Created
November 11, 2015 23:08
-
-
Save peschwa/34d7f556fa56580c3ddc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/6model/6model.c b/src/6model/6model.c | |
index 5a54cac..93fc7b7 100644 | |
--- a/src/6model/6model.c | |
+++ b/src/6model/6model.c | |
@@ -408,7 +408,7 @@ void MVM_6model_stable_gc_free(MVMThreadContext *tc, MVMSTable *st) { | |
/* Get the next type cache ID for a newly created STable. */ | |
MVMuint64 MVM_6model_next_type_cache_id(MVMThreadContext *tc) { | |
- return (MVMuint64)MVM_add(&tc->instance->cur_type_cache_id, 64) + 64; | |
+ return (MVMuint64)MVM_add(&tc->instance->cur_type_cache_id, MVM_TYPE_CACHE_ID_INCR) + MVM_TYPE_CACHE_ID_INCR; | |
} | |
void MVM_6model_never_repossess(MVMThreadContext *tc, MVMObject *obj) { | |
diff --git a/src/6model/reprs/MVMMultiCache.c b/src/6model/reprs/MVMMultiCache.c | |
index b043dc7..7d9c3d0 100644 | |
--- a/src/6model/reprs/MVMMultiCache.c | |
+++ b/src/6model/reprs/MVMMultiCache.c | |
@@ -163,6 +163,7 @@ MVMObject * MVM_multi_cache_add(MVMThreadContext *tc, MVMObject *cache_obj, MVMO | |
if (arg_type == MVM_CALLSITE_ARG_OBJ) { | |
MVMObject *arg = MVM_args_get_pos_obj(tc, apc, i, 1).arg.o; | |
if (arg) { | |
+ MVMuint8 rwness = 0; | |
MVMContainerSpec const *contspec = STABLE(arg)->container_spec; | |
if (contspec && IS_CONCRETE(arg)) { | |
if (contspec->fetch_never_invokes) { | |
@@ -176,14 +177,19 @@ MVMObject * MVM_multi_cache_add(MVMThreadContext *tc, MVMObject *cache_obj, MVMO | |
goto DONE; | |
} | |
} | |
- arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0); | |
+ if (MVM_6model_container_iscont_i(tc, arg) | |
+ || MVM_6model_container_iscont_n(tc, arg) | |
+ || MVM_6model_container_iscont_s(tc, arg) | |
+ || (contspec && contspec->can_store(tc, MVM_args_get_pos_obj(tc, apc,i ,1).arg.o))) | |
+ rwness = 2; | |
+ arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0) | rwness; | |
} | |
else { | |
goto DONE; | |
} | |
} | |
else { | |
- arg_tup[i] = (arg_type << 1) | 1; | |
+ arg_tup[i] = (arg_type << 2) | 1; | |
} | |
} | |
@@ -257,6 +263,7 @@ MVMObject * MVM_multi_cache_find(MVMThreadContext *tc, MVMObject *cache_obj, MVM | |
if (arg_type == MVM_CALLSITE_ARG_OBJ) { | |
MVMObject *arg = MVM_args_get_pos_obj(tc, apc, i, 1).arg.o; | |
if (arg) { | |
+ MVMuint8 rwness = 0; | |
MVMContainerSpec const *contspec = STABLE(arg)->container_spec; | |
if (contspec && IS_CONCRETE(arg)) { | |
if (contspec->fetch_never_invokes) { | |
@@ -270,14 +277,19 @@ MVMObject * MVM_multi_cache_find(MVMThreadContext *tc, MVMObject *cache_obj, MVM | |
return NULL; | |
} | |
} | |
- arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0); | |
+ if (MVM_6model_container_iscont_i(tc, arg) | |
+ || MVM_6model_container_iscont_n(tc, arg) | |
+ || MVM_6model_container_iscont_s(tc, arg) | |
+ || (contspec && contspec->can_store(tc, MVM_args_get_pos_obj(tc, apc,i ,1).arg.o))) | |
+ rwness = 2; | |
+ arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0) | rwness; | |
} | |
else { | |
return NULL; | |
} | |
} | |
else { | |
- arg_tup[i] = (arg_type << 1) | 1; | |
+ arg_tup[i] = (arg_type << 2) | 1; | |
} | |
} | |
@@ -337,6 +349,7 @@ MVMObject * MVM_multi_cache_find_callsite_args(MVMThreadContext *tc, MVMObject * | |
if (arg_type == MVM_CALLSITE_ARG_OBJ) { | |
MVMObject *arg = args[i].o; | |
if (arg) { | |
+ MVMuint8 rwness = 0; | |
MVMContainerSpec const *contspec = STABLE(arg)->container_spec; | |
if (contspec && IS_CONCRETE(arg)) { | |
if (contspec->fetch_never_invokes) { | |
@@ -350,14 +363,19 @@ MVMObject * MVM_multi_cache_find_callsite_args(MVMThreadContext *tc, MVMObject * | |
return NULL; | |
} | |
} | |
- arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0); | |
+ if (MVM_6model_container_iscont_i(tc, arg) | |
+ || MVM_6model_container_iscont_n(tc, arg) | |
+ || MVM_6model_container_iscont_s(tc, arg) | |
+ || (contspec && contspec->can_store(tc, args[i].o))) | |
+ rwness = 2; | |
+ arg_tup[i] = STABLE(arg)->type_cache_id | (IS_CONCRETE(arg) ? 1 : 0) | rwness; | |
} | |
else { | |
return NULL; | |
} | |
} | |
else { | |
- arg_tup[i] = (arg_type << 1) | 1; | |
+ arg_tup[i] = (arg_type << 2) | 1; | |
} | |
} | |
@@ -445,7 +463,7 @@ MVMObject * MVM_multi_cache_find_spesh(MVMThreadContext *tc, MVMObject *cache_ob | |
} | |
} | |
else { | |
- arg_tup[i] = (arg_type << 1) | 1; | |
+ arg_tup[i] = (arg_type << 2) | 1; | |
} | |
} | |
diff --git a/src/moar.h b/src/moar.h | |
index 2d94ab3..b9c4873 100644 | |
--- a/src/moar.h | |
+++ b/src/moar.h | |
@@ -213,3 +213,6 @@ MVM_PUBLIC void MVM_vm_set_lib_path(MVMInstance *instance, int count, const char | |
* which the other atomic operation macros are used... */ | |
#define MVM_store(addr, new) AO_store_full((volatile AO_t *)(addr), (AO_t)(new)) | |
#define MVM_load(addr) AO_load_full((volatile AO_t *)(addr)) | |
+ | |
+/* Constant for incrementing the type cache ID for new STables */ | |
+#define MVM_TYPE_CACHE_ID_INCR 128 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Metamodel/BOOTSTRAP.nqp b/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
index c854ccf..2a29b6c 100644 | |
--- a/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
+++ b/src/Perl6/Metamodel/BOOTSTRAP.nqp | |
@@ -2042,7 +2042,7 @@ BEGIN { | |
})); | |
Routine.HOW.add_method(Routine, 'sort_dispatchees', nqp::getstaticcode(sub ($self) { | |
my $dcself := nqp::decont($self); | |
- unless nqp::isnull(nqp::getattr($dcself, Routine, '$!dispatch_order')) { | |
+ if nqp::isnull(nqp::getattr($dcself, Routine, '$!dispatch_order')) { | |
nqp::bindattr($dcself, Routine, '$!dispatch_order', | |
$self.'!sort_dispatchees_internal'()); | |
} | |
@@ -2088,6 +2088,7 @@ BEGIN { | |
my int $done := 0; | |
my int $done_bind_check := 0; | |
my $Positional := nqp::gethllsym('perl6', 'MD_Pos'); | |
+ | |
until $done { | |
$cur_candidate := nqp::atpos(@candidates, $cur_idx); | |
@@ -2318,12 +2319,7 @@ BEGIN { | |
} | |
} | |
if nqp::elems(@possibles) == 1 && $pure_type_result { | |
- my $have_rwness := 0; | |
- my @rwness := nqp::atkey(@possibles[0], 'rwness'); | |
- for @rwness { | |
- $have_rwness := 1 if $_ == 1; | |
- } | |
- add_to_cache(nqp::atkey(nqp::atpos(@possibles, 0), 'sub')) unless $found_one_rw; | |
+ add_to_cache(nqp::atkey(nqp::atpos(@possibles, 0), 'sub')); | |
} | |
# Perhaps we found nothing but have junctional arguments? | |
@@ -2349,7 +2345,7 @@ BEGIN { | |
} | |
# Need a unique candidate. | |
- if nqp::elems(@possibles) == 1 && nqp::elems($rwness_mismatch) == 0 { | |
+ if nqp::elems(@possibles) == 1 { | |
nqp::atkey(nqp::atpos(@possibles, 0), 'sub') | |
} | |
elsif nqp::isconcrete($junctional_res) { | |
@@ -2487,10 +2483,6 @@ BEGIN { | |
my $type_obj := nqp::atpos(nqp::atkey($cur_candidate, 'types'), $i); | |
my $type_flags := nqp::atpos_i(nqp::atkey($cur_candidate, 'type_flags'), $i); | |
my int $got_prim := nqp::atpos(@flags, $i); | |
- if nqp::atpos_i(nqp::atkey($cur_candidate, 'rwness'), $i) { | |
- $type_mismatch := 1; | |
- last; | |
- } | |
if $type_flags +& $TYPE_NATIVE_MASK { | |
# Looking for a natively typed value. Did we get one? | |
if $got_prim == $BIND_VAL_OBJ { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test Summary Report | |
------------------- | |
# SEGVs at Scalar.WHICH | |
t/spec/S02-types/WHICH.t (Wstat: 11 Tests: 444 Failed: 0) | |
Non-zero wait status: 11 | |
Parse errors: Bad plan. You planned 1648 tests but ran 444. | |
# SEGVs at isa-ok($brode, Scalar) | |
t/spec/S02-types/declare.rakudo.moar (Wstat: 11 Tests: 10 Failed: 0) | |
Non-zero wait status: 11 | |
Parse errors: Bad plan. You planned 70 tests but ran 10. | |
# flap i guess..? | |
t/spec/S17-scheduler/at.rakudo.moar (Wstat: 256 Tests: 15 Failed: 0) | |
Non-zero exit status: 1 | |
# doesn't notice 42i correctly and thus doesn't throw | |
t/spec/S03-operators/range-basic.t (Wstat: 512 Tests: 110 Failed: 2) | |
Failed tests: 29-30 | |
Non-zero exit status: 2 | |
# SEGVs at isa-ok $a.VAR, Scalar | |
t/spec/S06-signature/unpack-array.t (Wstat: 11 Tests: 13 Failed: 0) | |
Non-zero wait status: 11 | |
Parse errors: Bad plan. You planned 15 tests but ran 13. | |
Files=1073, Tests=48899, 485 wallclock secs (11.56 usr 2.08 sys + 1675.92 cusr 57.84 csys = 1747.40 CPU) | |
Result: FAIL | |
The SEGV is line 34 of the moar diff of this gist. | |
No idea if what I'm doing there is maybe actually wrong, but except for Scalar | |
(which I understand to be somewhat of a magical type...) everything seems to work... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment