Re: Review of current stm branch code
/LURK On 11 Aug 2006, at 06:11, Joshua Hoblitt wrote: This is a bad joke, right? How much of your life are you intending to spend on chasing down hard to find missing braces bugs? On 11 Aug 2006, at 06:52, Chip Salzenberg wrote: Seriously: I am serious. Many of the changes I have in mind for the Parrot source code are based on reducing the visual footprint of constructs without changing their meaning, and eliminating needless words^Wbraces is one way to do that. On 11 Aug 2006, at 06:28, Uri Guttman wrote: braces RULES!! Six years into the project the Parrot team, responsible for the Perl6 internals finaly get round to arguing about what style of C brackets and indenting they are going to use.. I can just see how that will run on Slashdot.. :sheesh!: ;-) Sam Phillips [EMAIL PROTECTED] LURK
Re: Review of current stm branch code
On Fri, Aug 11, 2006 at 11:46:37AM +0100, Sam Phillips wrote: Six years into the project the Parrot team, responsible for the Perl6 internals finaly get round to arguing about what style of C brackets and indenting they are going to use.. It's not an argument.[*] If people kept talking about it, and if I kept trying to persuade them, back forth... then, it'd be an argument. [*] It's abuse. Arguments are down the hall. -- Chip Salzenberg [EMAIL PROTECTED]
Re: Review of current stm branch code
On 8/10/06, Chip Salzenberg [EMAIL PROTECTED] wrote: I appreciate the quality of the stm code in general. You're being careful, you know what you're doing with C, and you're good at creating abstractions. I hope when STM is done[*] you'll keep hacking on Parrot. [*] As if it will ever be really done. No work of art is ever finished, only abandoned. Here are my comments. Once these issues and/or questions are addressed and/or diposed of, we can merge the state-of-stm onto the trunk. Please correct me wherever I've misunderstood what you're doing. POSSIBLE BUGS * START_WRITE_HLL params vs. usage +#define START_WRITE_HLL(interpreter, hll_info) \ +do { \ +if (PMC_sync(interpreter-HLL_info)) { \ +hll_info = interpreter-HLL_info = \ +Parrot_clone(interpreter, interpreter-HLL_info); \ +if (PMC_sync(interpreter-HLL_info)) { \ +mem_internal_free(PMC_sync(interpreter-HLL_info)); \ +} \ +} \ +} while (0) But then: +START_WRITE_HLL(interpreter, interpreter-HLL_info) That expansion, which is in part: interpreter-HLL_info = interpreter-HLL_info = Parrot_clone(interpreter, interpreter-HLL_info); mem_internal_free(PMC_sync(interpreter-HLL_info)); Looks odd or even broken, offhand. Am I missing something? I think it was just odd but violated what I had intended for that macro. I've changed the use of the macro. * enum trailing commas are not standard C89 doesn't allow enum lists to end with a comma. PITA, I know, but we can't require C99 yet. So e.g. 'thread_state_enum' needs a comma removed. Fixed. QUESTIONS/REQUESTS * You're defining a heck of a lot of macros. Is there any set of them that can be marked as private (to the STM implementation), e.g. with a leading single underscore? Say, if the ATOMIC_INT_CAS macro is only used by other macros and isn't part of the supported interface, then it could be renamed to _ATOMIC_INT_CAS. This will prevent the abstraction from leaking. * It's surely a mean trick on the poor user/programmer to have Parrot_atomic_int actually hold a long. :-, Any reason not to use int? Or do you want Parrot_atomic_long? I changed the name to Parrot_atomic_integer; I don't want to imply that it's going to be the same width as any particular built-in type or any particular Parrot-supplied type. I haven't changed ATOMIC_INT_* - ATOMIC_INTEGER_*, however, as I feel those macro names are long enough (especially with PARROT_ added, see below) and as I abbreviated 'pointer' too. (If you disagree, I'll change those, too.) * Is there any need/use for multiple integral atomic types, like an unsigned or a UINTVAL or something? (I expect the answer is no.) No. * Could *_{READ,WRITE}_HLL be named something like *_{READ,WRITE}_HLL_INFO, assuming they need to be macros at all? An HLL is an abstraction that currently doesn't have a single concrete representation. Done. * I see that Parrot_get_HLL_namespace() is now deferring namespace creation. That could perhaps be problematic. We've told users that get_root_namespace ['your_own_hll'; 'x'] and get_hll_namespace ['x'] have identical results. So, what's the payoff for this delayed creation? Mainly my coding convenience. I've undelayed the creation. * Does your ops.num renumber ops, or is diff just getting confused by whitespace? If the former, what's up? I apparently renumbered ops by mistake (I guess I shouldn't have assumed that dev/tools/ops_renum.mak would DTRT). Fixed by manually adding my new ops to the end of the file from trunk. CODING STANDARD^WWHIM ISSUES I do need to update pdd07. In the meantime, here are some coding standard issues I'd appreciate if you'd address. For some of them you're going to be setting the new standard for the rest of the code, but such is the fate of code reviewed the guy who's writing the new spec. :-, * Out of all the macros you're defining, will any of them be ever needed by users of the Parrot extension or embedding interfaces? If so, their full official names will have to start with PARROT_. But when compiling Parrot, it's OK to define non-PARROT_-prefix versions as aliases. Full names changed along with all usages (instead of defining aliases). [snip] * macro args protection Most of your code is really good careful with macro behaviors. Just a couple exceptions: +#define START_WRITE_HLL(interpreter, hll_info) \ +do { \ +if (PMC_sync(interpreter-HLL_info)) { \ +hll_info = interpreter-HLL_info = \ +Parrot_clone(interpreter, interpreter-HLL_info); \ +if (PMC_sync(interpreter-HLL_info)) { \ +mem_internal_free(PMC_sync(interpreter-HLL_info)); \ +} \ +} \ +} while (0) Macro
Re: Review of current stm branch code
On Thu, Aug 10, 2006 at 07:19:21PM -0700, Chip Salzenberg wrote: * enum trailing commas are not standard C89 doesn't allow enum lists to end with a comma. PITA, I know, but we can't require C99 yet. So e.g. 'thread_state_enum' needs a comma removed. Nor does C++ understand the trailing commas and I've run into this issue when trying to link C++ to C with C99 headers. -J -- pgpxHUM1uszSO.pgp Description: PGP signature
Re: Review of current stm branch code
On Thu, Aug 10, 2006 at 07:19:21PM -0700, Chip Salzenberg wrote: * useless curlies -if (PMC_IS_NULL(type_hash)) +if (PMC_IS_NULL(type_hash)) { return core_type; +} hash = PMC_struct_val(type_hash); -if (!hash-entries) +if (!hash-entries) { return core_type; +} Something I'm hoping to stamp out is the use of curlies for all if/else clauses, which makes code taller without making it substantially clearer. I'd appreciate if you'd use a no-curlies-when-possible style. OTOH, if you don't want to do this right away, I'd be OK with a merge first, and fixing the curlies later. OTGH, the project needs automated filters for more coding standards, including one that that notes (and optionally kills) the excess curlies. This is a bad joke, right? How much of your life are you intending to spend on chasing down hard to find missing braces bugs? -J -- pgpR245EXzCsy.pgp Description: PGP signature
Re: Review of current stm branch code
JH == Joshua Hoblitt [EMAIL PROTECTED] writes: JH On Thu, Aug 10, 2006 at 07:19:21PM -0700, Chip Salzenberg wrote: * useless curlies Something I'm hoping to stamp out is the use of curlies for all if/else clauses, which makes code taller without making it substantially clearer. I'd appreciate if you'd use a no-curlies-when-possible style. OTOH, if you don't want to do this right away, I'd be OK with a merge first, and fixing the curlies later. OTGH, the project needs automated filters for more coding standards, including one that that notes (and optionally kills) the excess curlies. JH This is a bad joke, right? How much of your life are you intending to JH spend on chasing down hard to find missing braces bugs? heh, this brings me back to my coding standards issues from when i did tons of c. i ALWAYS used braces so you could visually see the conditional or block of code. i was so glad when i switched to perl that braces were manditory. there are so many bug issues with dangling if/else clauses and unless you used pythonicly strict indenting, you were going to have them unless you used braces. the extra lines used are easily offset by better windowing editors, block hiding, and other things and also the reduction in bugs makes that minor sacrifice well worth it. but since i don't hack on parrot code i will just leave it at that. braces RULES!! back to lurking, uri -- Uri Guttman -- [EMAIL PROTECTED] http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs http://jobs.perl.org
Re: Review of current stm branch code
On Thu, Aug 10, 2006 at 07:11:15PM -1000, Joshua Hoblitt wrote: On Thu, Aug 10, 2006 at 07:19:21PM -0700, Chip Salzenberg wrote: * useless curlies OTGH, the project needs automated filters for more coding standards, including one that that notes (and optionally kills) the excess curlies. This is a bad joke, right? How much of your life are you intending to spend on chasing down hard to find missing braces bugs? If avoiding the possibility of hard-to-find bugs, were my priority, I wouldn't enjoy writing C and C++. Or Perl. Or PL/I. Seriously: I am serious. Many of the changes I have in mind for the Parrot source code are based on reducing the visual footprint of constructs without changing their meaning, and eliminating needless words^Wbraces is one way to do that. Anyone who needs braces to avoid/detect errors is probably just not acclimated to the C language, and/or failing to indent properly (that's what smart editors are for; no snide Python remarks please). And Parrot is written in the complete C language, not some intersection of C and Perl. I'd rather invest my extra vertical space into some well-chosen comments and blank lines between phrases, which can convey useful meaning, rather than braces around one-line if/else clauses, which are just noise. -- Chip Salzenberg [EMAIL PROTECTED]