From: Joel Brobecker <brobecker@adacore.com>
To: Ken Werner <ken@linux.vnet.ibm.com>
Cc: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [patch] initial OpenCL C language support
Date: Tue, 02 Nov 2010 19:23:00 -0000 [thread overview]
Message-ID: <20101102192311.GI2492@adacore.com> (raw)
In-Reply-To: <201010271535.05100.ken@linux.vnet.ibm.com>
> > Just to clarify a bit what I was trying to say: Most of the comments are
> > mostly cosmetic, and I don't think we need to verify that you followed
> > the comments correctly. If this was the only comments I had, I would be
> > comfortable with pre-approving the patch, particularly since Tom already
> > looked at it as well. But before the patch goes in, I'd like to understand
> > what the reason for the changes in c-exp.y...
>
> The reason for looking up the primitive types instead of referring to
> the builtins is that the builtin types may have a wrong type size. The
> OpenCL type long for example is expected to have a size of 8 byte
> while the size of the GDB builtin long is dependant on the current
> architecture and might be only 4 bytes.
But you have the gdbarch vector when building the OpenCL long, right?
(see opencl_language_arch_info). For instance, in Ada, we don't know
the size of type "Integer", so we ask the gdbarch what is the size of
int.
lai->primitive_type_vector [ada_primitive_type_int]
= arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
0, "integer");
That way, we can use the builtin types directly. Would that work in
your case?
> + /* Triple vectors have the size of a quad vector. */
^^^ missing second space
> +/* Returns non-zero if the array ARR contains duplicates within
> + the first N elements. */
non-zero should be spelled nonzero. I have known that for quite a while
because a friend of mine is really good at spelling, but never really
thought much until I saw this being explicitly mentioned in the GCC
Coding Conventions. Let's try to fix them one at a time...
> + for (i = offset; i < n; i++)
> + {
> + memcpy (value_contents_raw (v) + j++ * elsize,
> + value_contents (c->val) + c->indices[i] * elsize,
> + elsize);
> + }
The curly braces are unnecessary in this case.
> + for (i = start; i < end; i++)
> + {
> + int startoffset = (i == start) ? startrest : 0;
> + int length = (i == end) ? endrest : elsize;
> + if (!value_bits_valid (c->val, c->indices[i] * elsize + startoffset,
> + length))
Missing empty line after variable declarations...
> + for (i = 0; i < c->n; i++)
> + {
> + if (value_bits_valid (c->val, c->indices[i] * elsize, elsize))
> + return 1;
> + }
Unecessary curly braces...
> + for (i = 0; i < n; i++)
> + {
> + /* Copy src val contents into the destination value. */
> + memcpy (value_contents_writeable (ret)
> + + (i * TYPE_LENGTH (elm_type)),
> + value_contents (val)
> + + (indices[i] * TYPE_LENGTH (elm_type)),
> + TYPE_LENGTH (elm_type));
> + }
Likewise.
> +/* Perform a relational operation on two operands. */
> +static struct value *
> +opencl_relop (struct expression *exp, struct value *arg1, struct value *arg2,
> + enum exp_opcode op)
Missing empty line after the function description.
> + if (!t1_is_vec && !t2_is_vec)
> + {
> + int tmp = scalar_relop (arg1, arg2, op);
> + struct type *type =
> + language_bool_type (exp->language_defn, exp->gdbarch);
> + val = value_from_longest (type, tmp);
> + }
Missing empty line after variable declarations...
> +# Increase timeout
> +set timeout 60
> +verbose "Timeout set to $timeout seconds" 2
Have we determine why it is necessary to increase the timeout to 60?
--
Joel
next prev parent reply other threads:[~2010-11-02 19:23 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-22 17:21 Ken Werner
2010-10-25 22:41 ` Tom Tromey
2010-10-26 13:05 ` Ken Werner
2010-10-26 13:44 ` Tom Tromey
2010-10-26 16:02 ` Ken Werner
2010-10-26 17:49 ` Eli Zaretskii
2010-10-26 19:58 ` Joel Brobecker
2010-10-26 20:03 ` Joel Brobecker
2010-10-27 13:36 ` Ken Werner
2010-11-02 19:23 ` Joel Brobecker [this message]
2010-11-03 13:03 ` Ken Werner
2010-11-03 15:27 ` Joel Brobecker
2010-11-04 15:39 ` Ken Werner
2010-11-04 17:48 ` Eli Zaretskii
2010-11-05 14:21 ` Ken Werner
2010-11-05 14:39 ` Ken Werner
2010-10-27 19:04 ` Jan Kratochvil
2010-10-27 19:21 ` Pedro Alves
2010-10-27 21:01 ` Ken Werner
2010-11-02 16:52 ` [doc RFA] Switch to GCC coding style [Re: [patch] initial OpenCL C language support] Jan Kratochvil
2010-11-02 17:04 ` Doug Evans
2010-11-02 17:23 ` Jan Kratochvil
2010-11-02 17:29 ` Doug Evans
2010-11-02 19:21 ` Eli Zaretskii
2010-11-02 19:29 ` Joel Brobecker
2010-11-08 12:50 ` Jan Kratochvil
2010-11-08 16:11 ` Joel Brobecker
2010-11-08 16:38 ` Mark Kettenis
2010-11-08 16:43 ` Joel Brobecker
2010-11-08 16:54 ` Pedro Alves
2010-11-08 18:36 ` Joel Brobecker
2010-11-02 18:01 ` Joel Brobecker
2010-11-02 18:10 ` [doc RFA] Switch to GCC coding style Jan Kratochvil
2010-11-02 18:20 ` Doug Evans
2010-11-02 18:58 ` Joel Brobecker
2010-11-02 19:19 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101102192311.GI2492@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=ken@linux.vnet.ibm.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).