-
-
Save FROGGS/034a498fad1d55282f8b 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
run it as: | |
perl6-m -e 'my @a = <a b c>; my role IP { has $!ip }; @a does IP' | |
1) body(0x7fcb9e470230)->replaced = 0x49402a0 | |
elems 1: (0x1b86810, 0x1b9d8c8, 0x1b9d8e0) | |
form_space = 0x7fcb9df2f010, to_space = 0x7fcb9e330010 | |
real_data: 0x1b9d8e0 -> 0x18000900000000 | |
elems 2: 0x18000900000000 | |
Unhandled exception: This type does not support elems | |
at src/gen/m-CORE.setting:8231 (/home/froggs/dev/nqp/install/languages/perl6/runtime/CORE.setting.moarvm:REIFY:56) | |
from src/gen/m-CORE.setting:8569 (/home/froggs/dev/nqp/install/languages/perl6/runtime/CORE.setting.moarvm:REIFY:126) | |
from src/gen/m-CORE.setting:7443 (/home/froggs/dev/nqp/install/languages/perl6/runtime/CORE.setting.moarvm::507) | |
from src/gen/m-CORE.setting:7398 (/home/froggs/dev/nqp/install/languages/perl6/runtime/CORE.setting.moarvm:reify:74) | |
from src/gen/m-CORE.setting:7878 (/home/froggs/dev/nqp/install/languages/perl6/runtime/CORE.setting.moarvm:gimme:219) | |
from src/gen/m-CORE.setting:8281 (/home/froggs/dev/nqp/install/languages/perl6/runtime/CORE.setting.moarvm:sink:58) | |
from src/gen/m-main.nqp:47 (/home/froggs/dev/nqp/install/languages/perl6/runtime/perl6.moarvm:MAIN:39) | |
from src/gen/m-main.nqp:41 (/home/froggs/dev/nqp/install/languages/perl6/runtime/perl6.moarvm::207) | |
from <unknown>:1 (/home/froggs/dev/nqp/install/languages/perl6/runtime/perl6.moarvm::8) | |
from <unknown>:1 (/home/froggs/dev/nqp/install/languages/perl6/runtime/perl6.moarvm::9) |
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/reprs/P6opaque.c b/src/6model/reprs/P6opaque.c | |
index b72658d..217902f 100644 | |
--- a/src/6model/reprs/P6opaque.c | |
+++ b/src/6model/reprs/P6opaque.c | |
@@ -10,10 +10,14 @@ static const MVMREPROps this_repr; | |
* uninitialized slot that should trigger auto-viv. */ | |
static MVMObject *ass_null = NULL; | |
-/* If an object gets mixed in to, we need to be sure we look at is real body, | |
+/* If an object gets mixed in to, we need to be sure we look at its real body, | |
* which may have been moved to hang off the specified pointer. */ | |
static void * real_data(void *data) { | |
MVMP6opaqueBody *body = (MVMP6opaqueBody *)data; | |
+ if (body->replaced && !((unsigned long long)body->replaced & 0xFFFFFFFF)) { | |
+ //~ body->replaced = NULL; | |
+ printf("real_data: %p -> %p\n", data, body->replaced ? body->replaced : data); | |
+ } | |
return body->replaced ? body->replaced : data; | |
} | |
@@ -1128,10 +1132,12 @@ void change_type(MVMThreadContext *tc, MVMObject *obj, MVMObject *new_type) { | |
/* Pointer switch, taking care of existing body issues. */ | |
if (body->replaced) { | |
+ printf("1) body(%p)->replaced = %p\n", body, new); | |
body->replaced = new; | |
free(old); | |
} | |
else { | |
+ printf("1) body(%p)->replaced = %p\n", body, new); | |
body->replaced = new; | |
} | |
} | |
@@ -1270,7 +1276,11 @@ static void delete_key(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, voi | |
static MVMuint64 elems(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *data) { | |
MVMP6opaqueREPRData *repr_data = (MVMP6opaqueREPRData *)st->REPR_data; | |
+ printf("elems 1: (%p, %p, %p)\n", st, root, data); | |
+ printf("form_space = %p, to_space = %p\n", tc->nursery_fromspace, tc->nursery_tospace); | |
+ //~ printf("replaced: %p\n", ((MVMP6opaqueBody *)data)->replaced); | |
data = real_data(data); | |
+ printf("elems 2: %p\n", data); | |
if (repr_data->pos_del_slot >= 0) { | |
MVMObject *del = get_obj_at_offset(data, repr_data->attribute_offsets[repr_data->pos_del_slot]); | |
return REPR(del)->elems(tc, STABLE(del), del, OBJECT_BODY(del)); | |
diff --git a/src/6model/reprs/P6opaque.h b/src/6model/reprs/P6opaque.h | |
index e74b9e2..6ef5278 100644 | |
--- a/src/6model/reprs/P6opaque.h | |
+++ b/src/6model/reprs/P6opaque.h | |
@@ -99,3 +99,7 @@ struct MVMP6opaqueREPRData { | |
/* Function for REPR setup. */ | |
const MVMREPROps * MVMP6opaque_initialize(MVMThreadContext *tc); | |
+ | |
+/* If an object gets mixed in to, we need to be sure we look at its real body, | |
+ * which may have been moved to hang off the specified pointer. */ | |
+MVM_PUBLIC void * MVMP6opaque_real_data(MVMThreadContext *tc, void *data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment