Skip to content

Commit d559989

Browse files
committed
Temporarily change the way we do NFA caching so we don't end up with SC refs between levels of the bootstrap.
1 parent 127134a commit d559989

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/how/NQPClassHOW.pm

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ knowhow NQPClassHOW {
3232
has @!done;
3333

3434
# 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;
3640

3741
# Parrot-specific vtable mapping hash. Maps vtable name to method.
3842
has %!parrot_vtable_mapping;
@@ -79,7 +83,7 @@ knowhow NQPClassHOW {
7983
pir::die("Cannot add a null method '$name' to class '$!name'");
8084
}
8185
pir::set_method_cache_authoritativeness__vPi($obj, 0);
82-
%!cache := {};
86+
%caches{nqp::where(self)} := {};
8387
%!methods{$name} := $code_obj;
8488
}
8589

@@ -538,10 +542,10 @@ knowhow NQPClassHOW {
538542
## Cache-related
539543
##
540544
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())
545549
}
546550

547551
##

0 commit comments

Comments
 (0)