Index: include/parrot/string_funcs.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/string_funcs.h,v
retrieving revision 1.38
diff -u -b -r1.38 string_funcs.h
--- include/parrot/string_funcs.h	18 Apr 2004 15:10:12 -0000	1.38
+++ include/parrot/string_funcs.h	19 Apr 2004 07:46:30 -0000
@@ -84,7 +84,7 @@
 /*void string_iterator_init(struct string_iterator_t *i, const STRING *s);*/
 UINTVAL string_decode_and_advance(struct string_iterator_t *i);
 
-size_t string_hash(Interp *interpreter, Hash *hash, STRING *s);
+size_t string_hash(Interp *interpreter, STRING *s);
 STRING * string_unescape_cstring(struct Parrot_Interp *, char *cstring,
 									char delimiter);
 
Index: src/hash.c
===================================================================
RCS file: /cvs/public/parrot/src/hash.c,v
retrieving revision 1.79
diff -u -b -r1.79 hash.c
--- src/hash.c	17 Apr 2004 06:22:55 -0000	1.79
+++ src/hash.c	19 Apr 2004 07:46:35 -0000
@@ -147,18 +147,13 @@
 */
 
 /* see also string.c */
-#define  USE_HASH_VAL 1
 
 static size_t
 key_hash_STRING(Interp *interpreter, Hash *hash, void *value)
 {
     STRING *s = value;
-#if USE_HASH_VAL
-    if (PObj_constant_TEST(s) && s->hashval) {
-        return s->hashval ^ hash->seed;
-    }
-#endif
-    return string_hash(interpreter, hash, s);
+
+    return string_hash(interpreter, s) ^ hash->seed;
 }
 
 /*
Index: src/string.c
===================================================================
RCS file: /cvs/public/parrot/src/string.c,v
retrieving revision 1.194
diff -u -b -r1.194 string.c
--- src/string.c	18 Apr 2004 15:10:56 -0000	1.194
+++ src/string.c	19 Apr 2004 07:46:41 -0000
@@ -27,8 +27,6 @@
 #include "parrot/parrot.h"
 #include <assert.h>
 
-#define USE_HASH_VAL 1
-
 /*
  * this extra size is in the hope, that some concat ops might
  * follow in a sequence.
@@ -106,6 +104,8 @@
         /* COW_FLAG | external_FLAG | bufstart_external_FLAG immobile_FLAG */
         PObj_is_external_CLEARALL(s);
     }
+    
+	s->hashval = 0;
 }
 
 /*
@@ -753,13 +753,7 @@
                 PObj_bufstart(s) = s->strstart = const_cast(buffer);
                 PObj_buflen(s)   = s->strlen = s->bufused = len;
                 PObj_bufstart_external_SET(s);
-#if USE_HASH_VAL
-                if (flags & PObj_constant_FLAG) {
-                    Hash hash;
-                    hash.seed = 0;
-                    s->hashval = string_hash(interpreter, &hash, s);
-                }
-#endif
+
                 return s;
             }
         }
@@ -784,13 +778,6 @@
             else {
                 s->strlen = s->bufused = 0;
             }
-#if USE_HASH_VAL
-                if (flags & PObj_constant_FLAG) {
-                    Hash hash;
-                    hash.seed = 0;
-                    s->hashval = string_hash(interpreter, &hash, s);
-                }
-#endif
         }
         else {
             string_fill_from_buffer(interpreter, buffer, len, encoding_name, s);
@@ -2838,29 +2825,27 @@
 =item C<size_t
 string_hash(struct Parrot_Interp * interpreter, Hash *hash, STRING *s)>
 
-Returns a hash value for the specified Parrot string.
-
-TODO - Cache this value in C<s->hashval>? Make the seed global, but
-random at start time?
+Returns the hash value for the specified Parrot string, caching it in
+C<s->hashval>.
 
 =cut
 
 */
 
 size_t
-string_hash(struct Parrot_Interp * interpreter, Hash *hash, STRING *s)
+string_hash(struct Parrot_Interp * interpreter, STRING *s)
 {
-#if USE_HASH_VAL
     register size_t h = 0;
-#else
-    register size_t h = hash->seed;
-#endif
 
     UNUSED(interpreter);
 
     if (!s)
         return 0;
 
+    if (s->hashval) {
+        return s->hashval;
+    }
+
     switch (s->representation) {
         case enum_stringrep_one:
             HASH_STRING(Parrot_UInt1, s, h);
@@ -2876,11 +2861,9 @@
             break;
     }
 
-#if USE_HASH_VAL
-    return h ^ hash->seed;
-#else
+	s->hashval = h;
+
     return h;
-#endif
 }
 
 
@@ -3035,13 +3018,7 @@
     }
     result->strlen = d;
     result->bufused = string_max_bytes(interpreter, result, d);
-#if USE_HASH_VAL
-    {
-        Hash hash;
-        hash.seed = 0;
-        result->hashval = string_hash(interpreter, &hash, result);
-    }
-#endif
+
     return result;
 }
 
Index: t/pmc/perlhash.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/perlhash.t,v
retrieving revision 1.43
diff -u -b -r1.43 perlhash.t
--- t/pmc/perlhash.t	9 Apr 2004 20:32:54 -0000	1.43
+++ t/pmc/perlhash.t	19 Apr 2004 07:46:43 -0000
@@ -19,7 +19,7 @@
 
 =cut
 
-use Parrot::Test tests => 33;
+use Parrot::Test tests => 34;
 use Test::More;
 
 output_is(<<CODE, <<OUTPUT, "Initial PerlHash tests");
@@ -1142,6 +1142,34 @@
 -134.134000
 135.135000
 -135.135000
+OUTPUT
+
+output_is(<< 'CODE', << 'OUTPUT', "mutating the lookup string");
+    new P0, .PerlHash
+    set P0["a"], "one"
+    set P0["ab"], "two"
+    set P0["abc"], "three"
+
+	set S0, "a"
+    set S1, P0[S0]
+	print S1
+	print "\n"
+
+	concat S0, "b"
+    set S1, P0[S0]
+	print S1
+	print "\n"
+
+	concat S0, "c"
+    set S1, P0[S0]
+	print S1
+	print "\n"
+
+	end
+CODE
+one
+two
+three
 OUTPUT
 
 1;
