develooper Front page | perl.perl5.porters | Postings from November 2003

Re: 5.8.2-RC1 and mp2

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
November 1, 2003 09:30
Subject:
Re: 5.8.2-RC1 and mp2
Message ID:
20031101173013.GL6287@plum.flirble.org
On Thu, Oct 30, 2003 at 01:37:27AM -0800, Stas Bekman wrote:

> It calls PERL_HASH() to precache hash values. The problem is that we have 
> to use that function, because we pre-hash the GVs before perl is even 
> started.
> 
> It calls:
> 
>   HE *he = hv_fetch_he(stash, mgv->name, mgv->len, mgv->hash);
> 
> to get the HE, and then the corresponding GV.
> 
> See src/modules/perl/modperl_mgv.c
> http://cvs.apache.org/viewcvs.cgi/*checkout*/modperl-2.0/src/modules/perl/modperl_mgv.c?rev=HEAD&content-type=text/plain
> 
> find hv_fetch_he.

  "You keep using that word. I do not think it means what you think it means."
  :-)


http://cvs.apache.org/viewcvs.cgi/*checkout*/modperl-2.0/src/modules/perl/modperl_util.h?rev=HEAD&content-type=text/plain

#define hv_fetch_he(hv,k,l,h) \
    modperl_perl_hv_fetch_he(aTHX_ hv, k, l, h)


I'm not sure how to make modperl run the test you sent to p5p so I've not
been able to test it.
(I can't edit httpd.conf to add it as the auto-generation blows it away,
 I can't work out where httpd.conf is auto-generated,
 and I can't spot how to re-run mod_perl from the shell prompt)

However,

export PERL_HASH_SEED=123456789

seems to make the the server fail to start as is. With the appended patch
everything works. You'll need to sync maint to (at least) 21608:

@@ -89,7 +89,7 @@
   (hash) = (hash_PeRlHaSh + (hash_PeRlHaSh << 15)); \
     } STMT_END
 
-#ifdef PERL_IN_HV_C
+#if defined (PERL_IN_HV_C) || defined (MOD_PERL)
 #define PERL_HASH_INTERNAL(hash,str,len) \
      STMT_START { \
   register const char *s_PeRlHaSh_tmp = str; \


Also 21605 gives Internals::HvREHASH which can be used to check the
rehashing flag, and a t/op/hash.t which uses it.

(See http://public.activestate.com/cgi-bin/perlbrowse?recent=1
for what's been changed recently)

I hope that this (with the per-thread initialisation of PL_new_hash_seed) 
is the fix. I'm going to be out for about the next 24 hours.

Nicholas Clark

--- src/modules/perl/modperl_util.c.orig	2003-10-10 05:17:22.000000000 +0100
+++ src/modules/perl/modperl_util.c	2003-11-01 16:18:10.000000000 +0000
@@ -473,6 +473,11 @@ HE *modperl_perl_hv_fetch_he(pTHX_ HV *h
         return 0;
     }
 
+#ifdef HvREHASH
+    if (HvREHASH(hv)) {
+	PERL_HASH_INTERNAL(hash, key, klen);
+    } else
+#endif
     if (!hash) {
 	PERL_HASH(hash, key, klen);
     }

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About