[perl #60554] BUG: 'our' variables getting lost in NQP actions

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


In Pipp I encountered the problem that an our variables  seem to get 
lost in NQP actions.
This means that I had set an our variable in one action. When trying to 
look at the
variable in a subsequently called action, the variable was not defined.
However this was not reproducible. Using the variable in another action 
worked as expected.

In t/compilers/pct/complete_workflow.t:84 I added a TODO test case that 
illustrates this
behavior.



[perl #60566] Broken link to Debian packages

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


Howdy,

The link to the Debian packages on http://www.parrot.org/download is
broken, apparently because line preceding it is a partial copy.  The
attached patch may make the issue clearer.

-- 
Matt http://ftbfs.org/
--- download~   2008-11-15 23:35:15.0 -0800
+++ download2008-11-15 23:35:23.0 -0800
@@ -107,7 +107,6 @@
 !--
 lia href=http://ftp.debian.org/debian/pool/main/p/parrot/;Debian 
Packages/a/li
 p--/p
-lia href=http://alioth.debian.org/projects/pkg-parrot/
 lia href=http://alioth.debian.org/projects/pkg-parrot/;Debian 
Packages/a/li
 lia href=http://www.gentoo-portage.com/dev-lang/parrot;Gentoo/a/li
 lia 
href=http://www.freebsd.org/cgi/ports.cgi?query=parrot;Freebsd/a/li


[perl #60570] Wrong error message about passed args when signature with named argument

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


Hi!
example:

sub bar (@ar, :$a) { ... }
bar(); #too few arguments passed (0) - 4 params expected

If signature without named args, all right.

Ilya


[perl #60576] Out of memory

2008-11-16 Thread Andreas J. Koenig
# New Ticket Created by  (Andreas J. Koenig) 
# Please include the string:  [perl #60576]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60576 


---
osname= linux
osvers= 2.6.18-6-xen-amd64
arch=   x86_64-linux-gnu-thread-multi
cc= cc
---
Flags:
category=core
severity=critical
ack=no
---
cc -o miniparrot src/main.o src/null_config.o \
-Wl,-rpath=/home/src/perl/parrot/SVN.ro/blib/lib 
-L/home/src/perl/parrot/SVN.ro/blib/lib -lparrot  -ldl -lm -lpthread -lcrypt 
-lrt -lgmp -lreadline -lglut -lGLU -lGL -lcrypto  -L/usr/local/lib -Wl,-E  
Invoking Parrot to generate runtime/parrot/include/config.fpmc --cross your 
fingers
./miniparrot config_lib.pasm  runtime/parrot/include/config.fpmc
Parrot VM: PANIC: Out of mem!
C file src/gc/memory.c, line 107
Parrot file (not available), line (not available)

We highly suggest you notify the Parrot team if you have not been working on
Parrot.  Use parrotbug (located in parrot's root directory) or send an
e-mail to [EMAIL PROTECTED]
Include the entire text of this error message and the text of the script that
generated the error.  If you've made any modifications to Parrot, please
describe them as well.

Version : 0.8.0-devel
Configured  : Sun Nov 16 12:38:36 2008 GMT
Architecture: nojit
JIT Capable : No
Interp Flags: (no interpreter)
Exceptions  : (missing from core)

Dumping Core...
/bin/sh: line 1:  1484 Quit./miniparrot config_lib.pasm 
runtime/parrot/include/config.fpmc



---
Summary of my parrot 0.8.0 (r32705) configuration:
  configdate='Sun Nov 16 12:38:36 2008 GMT'
  Platform:
osname=linux, archname=x86_64-linux-gnu-thread-multi
jitcapable=0, jitarchname=nojit,
jitosname=linux, jitcpuarch=amd64
execcapable=0
perl=/usr/bin/perl
  Compiler:
cc='cc', ccflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN  -pipe 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-DHASATTRIBUTE_CONST  -DHASATTRIBUTE_DEPRECATED  -DHASATTRIBUTE_MALLOC  
-DHASATTRIBUTE_NONNULL  -DHASATTRIBUTE_NORETURN  -DHASATTRIBUTE_PURE  
-DHASATTRIBUTE_UNUSED  -DHASATTRIBUTE_WARN_UNUSED_RESULT  -falign-functions=16 
-fvisibility=hidden -maccumulate-outgoing-args -W -Wall -Waggregate-return 
-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wendif-labels -Wextra 
-Wformat -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k 
-Wimplicit -Wimport -Winit-self -Winline -Winvalid-pch -Wlogical-op 
-Wmissing-braces -Wmissing-field-initializers -Wno-missing-format-attribute 
-Wmissing-include-dirs -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 -Wvariadic-macros -Wwrite-stri!
 ngs -Wbad-function-cast -Wc++-compat -Wdeclaration-after-statement 
-Werror=declaration-after-statement -Wimplicit-function-declaration 
-Wimplicit-int -Wmain -Wmissing-declarations -Wmissing-prototypes 
-Wnested-externs -Wnonnull -DHAS_GETTEXT',
  Linker and Libraries:
ld='cc', ldflags=' -L/usr/local/lib',
cc_ldflags='',
libs='-ldl -lm -lpthread -lcrypt -lrt -lgmp -lreadline -lglut -lGLU -lGL 
-lcrypto '
  Dynamic Linking:
share_ext='.so', ld_share_flags='-shared -O2 -g -L/usr/local/lib -fPIC',
load_ext='.so', ld_load_flags='-shared -O2 -g -L/usr/local/lib -fPIC'
  Types:
iv=long, intvalsize=8, intsize=4, opcode_t=long, opcode_t_size=8,
ptrsize=8, ptr_alignment=1 byteorder=12345678, 
nv=double, numvalsize=8, doublesize=8

---
Environment:
HOME =/home/sand
LANG =en_US.UTF-8
LANGUAGE  (unset)
LD_LIBRARY_PATH  (unset)
LOGDIR  (unset)
PATH 
=/home/sand/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/perl/bin:/usr/X11/bin:/sbin:/usr/sbin
SHELL =/usr/bin/zsh


-- 
andreas


Re: [perl #60566] Broken link to Debian packages

2008-11-16 Thread jerry gay
On Sat, Nov 15, 2008 at 23:37, via RT Matt Kraai 
[EMAIL PROTECTED] wrote:

 # New Ticket Created by  Matt Kraai
 # Please include the string:  [perl #60566]
 # in the subject line of all future correspondence about this issue.
 # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60566 


 Howdy,

 The link to the Debian packages on http://www.parrot.org/download is
 broken, apparently because line preceding it is a partial copy.  The
 attached patch may make the issue clearer.

 --
 Matt http://ftbfs.org/

 --- download~   2008-11-15 23:35:15.0 -0800
 +++ download2008-11-15 23:35:23.0 -0800
 @@ -107,7 +107,6 @@
  !--
  lia href=http://ftp.debian.org/debian/pool/main/p/parrot/;Debian
 Packages/a/li
  p--/p
 -lia href=http://alioth.debian.org/projects/pkg-parrot/
  lia href=http://alioth.debian.org/projects/pkg-parrot/;Debian
 Packages/a/li
  lia href=http://www.gentoo-portage.com/dev-lang/parrot
 Gentoo/a/li
  lia href=http://www.freebsd.org/cgi/ports.cgi?query=parrot
 Freebsd/a/li

 fixed at http://www.parrot.org/download. thanks for reporting.
~jerry


[perl #60556] Exceptions from C-level MULTI functions break subs

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


If an exception handler catches an exception from a MULTI function implemented 
in C, passing that exception from the handler to a sub causes a segfault. 
Doing the same thing with a subclass of Integer with a PIR divide sub works as 
expected.
The attached code demonstrates this.  If p is an Integer, the parrot dies.  If 
it's a MyInteger, it doesn't.
#! parrot

.sub main :main

.local pmc p, q, int_class, myint_class

int_class   = get_class 'Integer'
myint_class = subclass int_class, 'MyInteger'

p = new 'Integer'
set p, 0

push_eh handler
#throw an exception from a C-level MULTI function
q = p / p
goto end
pop_eh
goto end

handler:
.local pmc exception
.local string message
.get_results (exception)

message = exception['message']
cause_sf(message)
end:
.end

.sub cause_sf 
.param string message
say message
end:
.end

.namespace ['MyInteger'] 

.sub divide :multi(MyInteger, MyInteger)
.param pmc self
.param pmc right
.param pmc dest

.local pmc ex

ex = new 'Exception'
ex['message'] = don't feel like dividing
throw ex
.end

# Local Variables:
#   mode: pir
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4 filetype=pir:


[perl #60568] Re: Broken link to Debian packages

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


On Sat, Nov 15, 2008 at 11:37:20PM -0800, Matt Kraai wrote:
 The link to the Debian packages on http://www.parrot.org/download is
 broken, apparently because line preceding it is a partial copy.  The
 attached patch may make the issue clearer.

I forgot to add that it would be nice if there was a link on each page
indicating how and where to report problems.  It took me a bit of
searching before I finally found instructions on the How to Get
Involved page.

-- 
Matt http://ftbfs.org/


[perl #60560] [META] lex bugs

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


Hello.

Single meta-ticket to follow lex-related bugs.

-- 
Bacek


[perl #60584] misc windows fixes

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


Since jimmy can't post to this email address, here's a recent patch from him:

---

this patch fixed some http address like: @echo http:/smoke.parrotcode.org\

fixed 'make vim-install' can't work on Windows NT series


-- 
Will Coke Coleda


jimmy.patch
Description: Binary data


[perl #60572] can`t set attribute-array for object in .new

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


Hi!
example:

class Foo {
has @.a;
}
my @b = 1,2,3;

my $f = Foo.new(a = @b);
$f.a.perl.say; # []

$f = Foo.new( :a(1,2,3) );
$f.a.perl.say; # []

$f = Foo.new( :a([1,2,3]) );
$f.a.perl.say; # []

Thank you!
Ilya


Re: [perl #60564] [TODO] Refactor contexts to be PMCs

2008-11-16 Thread Andrew Whitworth
Since I'm monkeying around in the relevant code anyway, this might be
a good task for the next calling_conventions branch. Or, if you
prefer, we could create a second branch for this conversion and do the
work there.

--Andrew Whitworth

On Sun, Nov 16, 2008 at 2:02 AM, via RT Allison Randal
[EMAIL PROTECTED] wrote:
 # New Ticket Created by  Allison Randal
 # Please include the string:  [perl #60564]
 # in the subject line of all future correspondence about this issue.
 # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60564 


 This ticket contains the partial conversion of contexts to PMCs that I
 did at YAPC::NA 2008. We found a quicker solution to the immediate
 problem, but this is still a change we'd like to make.

 - The patch probably won't apply cleanly (we've removed some code since
 then).
 - The patch itself includes merge conflicts in 3 files, should be easily
 resolved (I ran the diff on an old checkout of a branch that doesn't
 exist anymore).
 - The Context PMC is pretty far along, needs some more work.
 - The conversions from direct struct access to indirect access through a
 macro are right, but many more of these conversions need to be made.

 Allison

 /*
 Copyright (C) 2008, The Perl Foundation.
 $Id: parrotcontext.pmc 27598 2008-05-17 19:37:56Z allison $

 =head1 NAME

 src/pmc/parrotcontext.pmc - Context

 =head1 DESCRIPTION

 This class implements the Context PMC, a core PMC used to represent an
 execution context.


 =head2 Structure

 The Context PMC structure (CParrot_Context) consists of five items:

 =over 4

 =item Cone

 =back

 =cut

 */

 #include parrot/parrot.h

 /*

 =head2 Functions

 =over 4

 =cut

 */

 pmclass Context need_ext {

/* common header with Interp_Context */
ATTR PMC  *caller_ctx;/* caller context */
ATTR Regs_ni   bp;/* pointers to FLOATVAL  INTVAL */
ATTR Regs_ps   bp_ps; /* pointers to PMC  STR */
/* end common header */
ATTR INTVAL   *n_regs_used;   /* INSP in PBC points to Sub */
ATTR size_tregs_mem_size; /* memory occupied by registers */
ATTR void *regs_mem;  /* a pointer to the allocated register 
 memory */
ATTR int   ref_count; /* how often refered to [deprecated]*/

ATTR PMC  *lex_pad;   /* LexPad PMC */
ATTR PMC  *outer_ctx; /* outer context, if a closure */
ATTR UINTVAL   warns; /* Keeps track of what warnings
   * have been activated */
ATTR UINTVAL   errors;/* fatals that can be turned off */
ATTR UINTVAL   trace_flags;
ATTR UINTVAL   recursion_depth; /* Sub call recursion depth */
/*
 * new call scheme and introspective variables
 */
ATTR PMC  *current_sub; /* the Sub we are executing */
/*
 * for now use a return continuation PMC
 */
ATTR PMC  *current_cont;/* the return continuation PMC */
ATTR PMC  *current_object;  /* current object if a method call */
ATTR opcode_t *current_pc;  /* program counter of Sub invocation */
ATTR PMC  *current_namespace; /* The namespace we're currently in 
 */
ATTR INTVALcurrent_HLL; /* see also src/hll.c */
ATTR opcode_t *current_results; /* ptr into code with get_results 
 opcode */
ATTR PMC  *results_signature; /* results signature pmc if it is 
 non-const */
ATTR PMC  *handlers;/* local handlers for the context */
/* deref the constants - we need it all the time */
ATTR struct PackFile_Constant ** constants;
/* code-prederefed.code - code-base.data in opcodes
 * to simplify conversio between code ptrs in e.g. invoke
 */
ATTR size_t pred_offset;

 /*

 =item Cvoid init()

 Initializes a Context PMC.

 =cut

 */

VTABLE void init() {
Parrot_Context * const ctx_struct = 
 mem_allocate_zeroed_typed(Parrot_Context);

/* Set flags for custom DOD mark and destroy. */
PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);

/* Set up the context. */
PMC_data(SELF) = ctx_struct;
ctx_struct-ref_count = 0;
ctx_struct-current_HLL   = 0;
ctx_struct-current_results   = NULL;
ctx_struct-results_signature = NULL;
ctx_struct-regs_mem  = NULL;
ctx_struct-caller_ctx= PMCNULL;
ctx_struct-outer_ctx = PMCNULL;
ctx_struct-lex_pad   = PMCNULL;
ctx_struct-current_sub   = PMCNULL;
ctx_struct-current_cont  = PMCNULL;
ctx_struct-current_object= PMCNULL;
ctx_struct-current_namespace = PMCNULL;
ctx_struct-results_signature = PMCNULL;
ctx_struct-handlers  = PMCNULL;
}

 /*

 =item Cvoid set_pointer(void *value)

 Sets Cstruct_val to C*value.

 =cut

 */

VTABLE void set_pointer(void 

Re: [perl #60564] [TODO] Refactor contexts to be PMCs

2008-11-16 Thread Vasily Chekalkin

Andrew Whitworth wrote:

Since I'm monkeying around in the relevant code anyway, this might be
a good task for the next calling_conventions branch. Or, if you
prefer, we could create a second branch for this conversion and do the
work there.


Looks like it can be part of lex2 branch.

--
Bacek


Re: [perl #60564] [TODO] Refactor contexts to be PMCs

2008-11-16 Thread Allison Randal

Andrew Whitworth via RT wrote:

Since I'm monkeying around in the relevant code anyway, this might be
a good task for the next calling_conventions branch. Or, if you
prefer, we could create a second branch for this conversion and do the
work there.


The general consensus on this one is to wait until after the GC refactor 
(which is the next big branch after the I/O). Contexts are recycled so 
rapidly, that the current GC would be really slow.


Allison


[perl #58244] [BUG] inheritance of attributes

2008-11-16 Thread [EMAIL PROTECTED] via RT
On Tue Nov 04 14:55:43 2008, [EMAIL PROTECTED] wrote:
 After studying these, it appears that they are actually not inheritance
 issues (which may exist, but I don't think it's the problem here), but
 actually the same problem as you get in doing:
 
 my $x; $x -= 3;
 
 Namely, that x and y are undefined, and doing -= on them gives the MMD
 error. So once we fix that, this ticked should also be cleared up.
 
This was fixed, and the two files attached to this ticket now run;
closing ticket.

Thanks for reporting,

Jonathan


[perl #58396] Closure parameters do not work in if statements in Rakudo

2008-11-16 Thread [EMAIL PROTECTED] via RT
On Wed Aug 27 06:17:33 2008, masak wrote:
 r30590:
 $ ./perl6 -e 'sub testa { return 5 }; if testa() - $a { say $a }'
 Statement not terminated properly at line 1, near - $a { sa
 [...]
 
This now works (thanks to pmichaud++) - resolving ticket.

Jonathan


[svn:parrot-pdd] r32719 - trunk/docs/pdds

2008-11-16 Thread kjs
Author: kjs
Date: Sun Nov 16 10:04:44 2008
New Revision: 32719

Modified:
   trunk/docs/pdds/pdd19_pir.pod

Log:
[pdd19] add description of the new :nsentry subroutine flag.

Modified: trunk/docs/pdds/pdd19_pir.pod
==
--- trunk/docs/pdds/pdd19_pir.pod   (original)
+++ trunk/docs/pdds/pdd19_pir.pod   Sun Nov 16 10:04:44 2008
@@ -528,6 +528,13 @@
 work well with C:outer or existing PMC types such as CClosure,
 CCoroutine, etc.
 
+=item :nsentry( string_constant )
+
+Specify the name by which the subroutine is stored in the namespace. The 
default
+name by which a subroutine is stored in the namespace (if this flag is 
missing),
+is the subroutine's name as given after the C.sub directive. This flag allows
+to override this.
+
 =back
 
 


[svn:parrot-pdd] r32726 - trunk/docs/pdds

2008-11-16 Thread kjs
Author: kjs
Date: Sun Nov 16 11:05:31 2008
New Revision: 32726

Modified:
   trunk/docs/pdds/pdd19_pir.pod

Log:
[pdd19] :lexid will be changed into :subid.



Modified: trunk/docs/pdds/pdd19_pir.pod
==
--- trunk/docs/pdds/pdd19_pir.pod   (original)
+++ trunk/docs/pdds/pdd19_pir.pod   Sun Nov 16 11:05:31 2008
@@ -516,6 +516,10 @@
 
 =item :lexid( string_constant )
 
+Deprecated; see RT#60592. C:lexid will be renamed to C:subid.
+
+=item :subid( string_constant )
+
 Specifies a unique string identifier for the subroutine. This is useful for
 referring to a particular subroutine with C:outer, even though several
 subroutines in the file may have the same name (because they are multi, or in


Please Update NEWS, Status, PLATFORMS, etc

2008-11-16 Thread chromatic
Parrot 0.8.1 will come out on Tuesday, 18 November.  Please concentrate on bug 
fixes and closing tickets (low priority fixes are better) until further 
notice.

As well, please update NEWS and various status files, including PLATFORMS (and 
any deprecations) in preparation for the release.

Test reports are very welcome too.

-- c


[perl #60572] can`t set attribute-array for object in .new

2008-11-16 Thread [EMAIL PROTECTED] via RT
On Sun Nov 16 01:25:10 2008, ihrd wrote:
 example:
 
 class Foo {
 has @.a;
 }
 my @b = 1,2,3;
 
 my $f = Foo.new(a = @b);
 $f.a.perl.say; # []
 
Fixed in r32733.

Thanks,

Jonathan



[perl #60528] Rakudo wrongly permits mutation of readonly variables in some cases

2008-11-16 Thread [EMAIL PROTECTED] via RT
On Fri Nov 14 05:58:21 2008, pmichaud wrote:
 On Thu, Nov 13, 2008 at 03:21:45PM -0800, Carl Mäsak wrote:
  Rakudo r32629 sometimes dies when assigning a readonly variable to
  itself, and sometimes not.
  
  $ ./perl6 -e 'for a b c - $foo { $foo = $foo; say $foo }' # dies,
good
  Cannot assign to readonly variable.
  [...]
  
  $ ./perl6 -e 'for split(/sp/, a b c) - $foo { $foo = $foo; say
  $foo }' # bhd!
  a
  b
  c
 
 There's a bit more going on behind the scenes here -- the $foo = $foo
 line in the second case is also promoting Parrot String values into
 Rakudo Str objects.  I suspect that promotion is causing the
 readonly property on $foo to be lost.
 
 My guess is that we want to adjust Parrot's Ccopy opcode so that
 it doesn't modify the destination PMC's properties.
 
I've fixed it in a patch that's about to go in as soon as it smokes;
please can somebody make sure that a regression test goes in for this.

Thanks,

Jonathan



[perl #60578] parrot.org: add link for reporting problems to each page

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


matt kraai says:

 t would be nice if there was a link on each page indicating how and where
to report problems.  It took me a bit of searching before I finally found
instructions on the How to Get Involved page.

i agree.
~jerry


[perl #60586] nsentry

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


Code is in branch nsentry.
Deprecated notice is going in.
pmichaud has agreed to write tests


[perl #60588] Change lexid to subid

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





[perl #60592] [TODO] change :lexid into :subid.

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


On the PDS2008, it has been decided that :lexid is renamed into :subid.

kjs


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

2008-11-16 Thread chromatic
On Saturday 11 October 2008 14:53:53 Christoph Otto wrote:

 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.

I'd rather remove the hash seed from the key calculation.  Instead, let's use 
a global seed (#defined somewhere) as the initial seed, cache the calculated 
key value, then hash against any hash seed and the string's length if the 
hash has a non-zero seed.  That doesn't spread the hash seed's entropy 
througout the key as much, but it lets us cache calculated keys and should 
give us more entropy to reduce collisions.

Any mathematician is welcome to prove that this makes things worse, however.

-- c