Re: [perl #59658] Build failure in src/pmc/float.c -- non-constant intiializer

2008-10-11 Thread Allison Randal

jerry gay wrote:


  .\src\pmc\float.c(3340) : warning C4204: nonstandard extension used
: non-constant aggregate initializer

there are now hundreds of these warnings in that build. we do have
warnings ratcheted up pretty high, but i don't think it's worth
relaxing them for this construct unless it's very difficult to change
the code generator--i assume this is generated code, since it's in so
many pmc .c files. i may get a chance to investigate further this
evening, if somebody hasn't beaten me to it.


Yes, that's generated code, it's part of the initialization of MULTIs 
declared in a PMC. I was hoping to avoid all those C strings. But, try 
r31879.


Allison


[perl #59782] [PATCH] add pmc_cmp VTABLE function

2008-10-11 Thread via RT
# New Ticket Created by  Christoph Otto 
# Please include the string:  [perl #59782]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59782 


In response to a question about comparison operators in Pipp*, Allison 
suggested that I add a variant cmp VTABLE function which returns a PMC instead 
of an INTVAL.  This patch adds such a function, named pmc_cmp.  It's named 
pmc_cmp rather than cmp_pmc to try to avoid confusion with the other cmp_* 
functions, since the type name in this function name refers to the return type 
rather than the argument type.

The patch should be simple enough to be obviously correct and doesn't cause 
any new test failures.  Comments would be appreciated.

* http://irclog.perlgeek.de/parrotsketch/2008-10-07#i_609226
Index: src/vtable.tbl
===
--- src/vtable.tbl	(revision 31855)
+++ src/vtable.tbl	(working copy)
@@ -273,6 +273,7 @@
 INTVAL cmp(PMC* value)
 INTVAL cmp_num(PMC* value)
 INTVAL cmp_string(PMC* value)
+PMC* pmc_cmp(PMC* value)
 
 PMC* logical_or(PMC* value, PMC* dest)
 
Index: src/pmc/default.pmc
===
--- src/pmc/default.pmc	(revision 31855)
+++ src/pmc/default.pmc	(working copy)
@@ -2488,6 +2488,29 @@
 
 /*
 
+=item CPMC *pmc_cmp(PMC *value)
+
+Default fallback. Performs a multiple dispatch call for 'pmc_cmp'.
+
+=cut
+
+*/
+
+VTABLE PMC *pmc_cmp(PMC *value) {
+PMC *retval;
+
+/* Don't multidispatch if you've got two pointers to the same PMC. They
+ * are equal. */
+if (SELF == value)
+return 0;
+
+Parrot_mmd_multi_dispatch_from_c_args(interp,
+pmc_cmp, PP-P, SELF, value, retval);
+
+return retval;
+}
+/*
+
 =item CPMC *logical_or(PMC *value, PMC *dest)
 
 Default fallback. Performs a multiple dispatch call for 'logical_or'.
Index: tools/dev/vtablize.pl
===
--- tools/dev/vtablize.pl	(revision 31855)
+++ tools/dev/vtablize.pl	(working copy)
@@ -220,6 +220,7 @@
 s/^(\s*)(INTVAL\s+cmp\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
 s/^(\s*)(INTVAL\s+cmp_num\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
 s/^(\s*)(INTVAL\s+cmp_string\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
+s/^(\s*)(INTVAL\s+pmc_cmp\(PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
 s/^(\s*)(PMC\s+\*logical_or\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;
 s/^(\s*)(PMC\s+\*logical_xor\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$2VTABLE $2/;
 s/^(\s*)(PMC\s+\*logical_and\(PMC\s+\*\w*,\s+PMC\s+\*\w*\)\s+{)/$1VTABLE $2/;


[perl #59790] t/stm/basic_mt.t #4 hangs under cygwin since svn 31655-ish

2008-10-11 Thread [EMAIL PROTECTED] (via RT)
# New Ticket Created by  [EMAIL PROTECTED] 
# Please include the string:  [perl #59790]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59790 


perl t/stm/basic_mt.t hangs since about October 5 under cygwin.  This is
reproducible directly from the command line (perl t/stm/basic_mt.t).
It's
parrot that's hanging.  I looked around and it looks like the TAP
modules
can't mark a test as needing a timeout (so to speak), so it hangs the
smoke
tests until parrot.exe is killed manually.

I run the cygwin smoke tests nightly in the hopes that its useful, and
to
poke around with parrot as it evolves, so I think my estimation of the
svn rev
where it started hanging is accurate +/- 20 revs.

Krishna Sethuraman
[EMAIL PROTECTED]

Summary of my parrot 0.7.1 (r31839) configuration:
  configdate='Thu Oct  9 20:04:04 2008 GMT'
  Platform:
osname=cygwin, archname=i686-cygwin-thread-multi-64int
jitcapable=1, jitarchname=i386-cygwin,
jitosname=CYGWIN, jitcpuarch=i386
execcapable=1
perl=/usr/bin/perl.exe
  Compiler:
cc='ccache gcc', ccflags='-U__STRICT_ANSI__  -pipe
-I/usr/local/include -DHASATTRIBUTE_CONST  -DHASATTRIBUTE_DEPRECATED
-DHASATTRIBUTE_MALLOC  -DHASATTRIBUTE_NONNULL  -DHASATTRIBUTE_NORETURN
-DHASATTRIBUTE_PURE  -DHASATTRIBUTE_UNUSED
-DHASATTRIBUTE_WARN_UNUSED_RESULT  -falign-functions=16
-maccumulate-outgoing-args -W -Wall -Waggregate-return -Wcast-align
-Wcast-qual -Wchar-subscripts -Wcomment -Wdisabled-optimization
-Wendif-labels -Wextra -Wformat -Wformat-extra-args -Wformat-nonliteral
-Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline
-Winvalid-pch -Wmissing-braces -Wno-missing-format-attribute -Wpacked
-Wparentheses -Wpointer-arith -Wreturn-type -Wsequence-point -Wno-shadow
-Wsign-compare -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch
-Wswitch-default -Wtrigraphs -Wundef -Wunknown-pragmas -Wno-unused
-Wwrite-strings -Wbad-function-cast -Wdeclaration-after-statement
-Wimplicit-function-declaration -Wimplicit-int -Wmain
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wnonnull',
Linker and Libraries:
ld='gcc', ldflags=' -Wl,--enable-auto-import
-Wl,--export-all-symbols -Wl,--stack,8388608
-Wl,--enable-auto-image-base -L/usr/local/lib',
cc_ldflags='',
libs='-ldl -lcrypt -lgmp'
  Dynamic Linking:
share_ext='.dll', ld_share_flags='-shared',
load_ext='.dll', ld_load_flags='-shared'
  Types:
iv=long, intvalsize=4, intsize=4, opcode_t=long, opcode_t_size=4,
ptrsize=4, ptr_alignment=1 byteorder=1234,
nv=double, numvalsize=8, doublesize=8

---
Environment:
HOME =//sjcnetapp/home/ksethura
LANG  (unset)
LANGUAGE  (unset)
LD_LIBRARY_PATH  (unset)
LOGDIR  (unset)
PATH
=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/c/Perl/site/bin:/
cygdrive/c/Perl/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cy
gdrive/c/WINDOWS/system32/wbem:/cygdrive/c/program files/common
files/roxio shared/dllshared/:/cygdrive/c/program
files/perforce:/cygdrive/c/program
files/rational/common:/cygdrive/c/program files/rational/clearcase/bin
SHELL  (unset)


Re: [perl #59782] [PATCH] add pmc_cmp VTABLE function

2008-10-11 Thread Allison Randal

Christoph Otto (via RT) wrote:


In response to a question about comparison operators in Pipp*, Allison 
suggested that I add a variant cmp VTABLE function which returns a PMC instead 
of an INTVAL.  This patch adds such a function, named pmc_cmp.  It's named 
pmc_cmp rather than cmp_pmc to try to avoid confusion with the other cmp_* 
functions, since the type name in this function name refers to the return type 
rather than the argument type.


Hmmm... we don't use that convention anywhere else (putting the type 
first to indicate that it's a return type, rather than an argument 
type). The closest we come is the 'get' and 'set' vtable functions which 
are 'get_returntype_keyed_argumenttype'. The 'shift' and 'pop' 
vtable functions both use 'shift_pmc' and 'pop_pmc' to indicate that the 
return type is a PMC. So, let's stick with 'cmp_pmc' for this one.


Otherwise, thumbs up, looks great!

Allison


Re: [perl #59784] [PATCH] Enhancement : support for multiple optables in PGE

2008-10-11 Thread Andrew Whitworth
On Fri, Oct 10, 2008 at 7:43 AM, via RT Florian Hatat
[EMAIL PROTECTED] wrote:
 The diff on the code itself is actually quite small: it was mainly a
 matter of moving some code around, and adding the unique identifier
 instead of the $optable static name. It contains an update for
 docs/pct/pct_optable_guide.pod as well. It was made against the 0.7.1
 sources.

I'm not an expert on this area, but do we lose introspection on the
optable object if they are all uniquely named? That is, if we want to
modify one of the optables at runtime, are we going to be able to do
it?

Instead of simply giving all optables a unique identifier, maybe we
should add them to a hash with the name of the is optable rule being
the key for it. That way we could get to the various optables by name.
Languages like Perl6 that expect to only have one optable could simply
bind the preferred one to the $optable variable.

--Andrew Whitworth


[perl #59782] [PATCH] add pmc_cmp VTABLE function

2008-10-11 Thread Christoph Otto via RT
On Sat Oct 11 05:07:25 2008, [EMAIL PROTECTED] wrote:
 Christoph Otto (via RT) wrote:
 
  In response to a question about comparison operators in Pipp*,
 Allison
  suggested that I add a variant cmp VTABLE function which returns a
 PMC instead
  of an INTVAL.  This patch adds such a function, named pmc_cmp.  It's
 named
  pmc_cmp rather than cmp_pmc to try to avoid confusion with the other
 cmp_*
  functions, since the type name in this function name refers to the
 return type
  rather than the argument type.
 
 Hmmm... we don't use that convention anywhere else (putting the type
 first to indicate that it's a return type, rather than an argument
 type). The closest we come is the 'get' and 'set' vtable functions
 which
 are 'get_returntype_keyed_argumenttype'. The 'shift' and 'pop'
 vtable functions both use 'shift_pmc' and 'pop_pmc' to indicate that
 the
 return type is a PMC. So, let's stick with 'cmp_pmc' for this one.
 
 Otherwise, thumbs up, looks great!
 
 Allison
 

This was committed (with the recommended change) in r31892.  Thanks for
the feedback!


[perl #59810] [PATCH] store hash seed in parrot_string_t struct

2008-10-11 Thread via RT
# New Ticket Created by  Christoph Otto 
# Please include the string:  [perl #59810]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59810 


Calling string_hash with a seed value other than the one used in src/hash.c 
(3793) can cause strange and wonderful failures if the STRING is reused by imcc.

What happens is that after the STRING's hash is computed, it's cached in 
s-hashval.  This is works fine unless the first caller of string_hash on a 
given STRING uses a seed other than 3793 *and* the STRING is reused by imcc as 
a hash key.  When this happens, the second call to string_hash sees a cached 
hash which was computed with an unexpected seed.  When this STRING is used as 
a hash key, parrot_hash_get_bucket looks in the wrong bucket and fails to find 
the associated value.

This leads to various levels of badness.  In Pipp's case, it means that with 
the following PIR code, the lookup of the hypothetical do_stuff METHOD would 
fail because the STRING 'do_stuff' would be hashed by 
Parrot_PhpArray_get_string_keyed_str with an unexpected seed.

p = new 'PhpArray'
p['do_stuff'] = 'x' #caches an unexpected hash in s-hashval
p.'do_stuff'()  #method lookup fails with reused STRING 'do_stuff'

Because string_hash is marked PARROT_API and presumably intended for external 
use, a caller should be able to call it with an arbitrary seed without messing 
up the rest of Parrot.  The attached patch allows this by adding a seedval 
field to parrot_string_t and checking both the seedval and the hashval before 
returning the cached hashval of a STRING.

I'd appreciate comments on whether this is the right approach and if there is 
anything the patch misses.
Index: src/hash.c
===
--- src/hash.c	(revision 31889)
+++ src/hash.c	(working copy)
@@ -146,7 +146,7 @@
 static size_t
 key_hash_STRING(PARROT_INTERP, ARGMOD(STRING *s), size_t seed)
 {
-if (s-hashval) {
+if (s-hashval  s-seedval == seed) {
 return s-hashval;
 }
 
Index: src/string.c
===
--- src/string.c	(revision 31889)
+++ src/string.c	(working copy)
@@ -2245,6 +2245,7 @@
 
 h  = CHARSET_COMPUTE_HASH(interp, s, seed);
 s-hashval = h;
+s-seedval = seed;
 
 return h;
 }
Index: include/parrot/pobj.h
===
--- include/parrot/pobj.h	(revision 31889)
+++ include/parrot/pobj.h	(working copy)
@@ -124,6 +124,7 @@
 UINTVAL bufused;
 UINTVAL strlen;
 UINTVAL hashval; /* cached hash value computation */
+size_t  seedval; /* cached hash seed */
 
 /*parrot_string_representation_t representation;*/
 const struct _encoding *encoding;
Index: docs/pdds/pdd28_strings.pod
===
--- docs/pdds/pdd28_strings.pod	(revision 31889)
+++ docs/pdds/pdd28_strings.pod	(working copy)
@@ -265,6 +265,7 @@
   UINTVAL   bufused;
   UINTVAL   strlen;
   UINTVAL   hashval;
+  size_tseedval;
   const struct _encoding   *encoding;
   const struct _charset*charset;
   const struct _normalization  *normalization;
@@ -303,6 +304,12 @@
 A cache of the hash value of the string, for rapid lookups when the string is
 used as a hash key.
 
+=item seedval
+
+A cache of the seed used to compute the hash value of the string.  This value
+ensures that hashes computed with different seeds will not interfere with
+eachother.
+
 =item encoding
 
 How the data is encoded (e.g. fixed 8-bit characters, UTF-8, or UTF-32).  Note


[perl #59816] TGE fails in r31893

2008-10-11 Thread via RT
# New Ticket Created by  Will Coleda 
# Please include the string:  [perl #59816]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59816 


After building parrot, cd compilers/tge  make test;

Test Summary Report
---
../../t/compilers/tge/basic.t  (Wstat: 256 Tests: 3 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
../../t/compilers/tge/grammar.t (Wstat: 512 Tests: 3 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 2
Files=3, Tests=8,  0 wallclock secs ( 0.00 usr  0.01 sys +  0.36 cusr
0.12 csys =  0.49 CPU)
Result: FAIL
make: *** [test] Error 1


-- 
Will Coke Coleda