@@ -32,7 +32,11 @@ knowhow NQPClassHOW {
32
32
has @ ! done ;
33
33
34
34
# Cached values, which are thrown away if the class changes.
35
- has % ! cache ;
35
+ # XXX Should be an attribute later, but we get into some trouble with
36
+ # the bootstrap for now since we end up with SC references back to the
37
+ # previous build due to a parse altering the cache, and the SC WB getting
38
+ # hit.
39
+ my % caches ;
36
40
37
41
# Parrot-specific vtable mapping hash. Maps vtable name to method.
38
42
has % ! parrot_vtable_mapping ;
@@ -79,7 +83,7 @@ knowhow NQPClassHOW {
79
83
pir::die(" Cannot add a null method '$ name ' to class '$ ! name '" );
80
84
}
81
85
pir::set_method_cache_authoritativeness__vPi($ obj , 0 );
82
- % ! cache := {};
86
+ % caches { nqp ::where( self )} := {};
83
87
% ! methods {$ name } := $ code_obj ;
84
88
}
85
89
@@ -538,10 +542,10 @@ knowhow NQPClassHOW {
538
542
# # Cache-related
539
543
# #
540
544
method cache ($ obj , $ key , $ value_generator ) {
541
- % ! cache || (% ! cache := {});
542
- pir:: exists (% ! cache , $ key ) ??
543
- % ! cache {$ key } !!
544
- (% ! cache {$ key } := $ value_generator ())
545
+ nqp ::existskey( % caches , nqp ::where( self )) || (% caches { nqp ::where( self )} := {});
546
+ pir:: exists (% caches { nqp ::where( self )} , $ key ) ??
547
+ % caches { nqp ::where( self )} {$ key } !!
548
+ (% caches { nqp ::where( self )} {$ key } := $ value_generator ())
545
549
}
546
550
547
551
# #
0 commit comments