-
-
Save MasterDuke17/42081552de97d6a953500b348cc66f73 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 src/6model/sc.c src/6model/sc.c | |
index b120c42dd..4b9e3c693 100644 | |
--- src/6model/sc.c | |
+++ src/6model/sc.c | |
@@ -519,3 +519,17 @@ void MVM_sc_wb_hit_st(MVMThreadContext *tc, MVMSTable *st) { | |
#endif | |
} | |
} | |
+ | |
+void MVM_scsetobj_impl(MVMThreadContext *tc, MVMObject *sc, MVMObject *obj, MVMint64 idx) { | |
+ if (REPR(sc)->ID != MVM_REPR_ID_SCRef) | |
+ MVM_exception_throw_adhoc(tc, | |
+ "Must provide an SCRef operand to scsetobj"); | |
+ MVM_sc_set_object(tc, (MVMSerializationContext *)sc, | |
+ idx, obj); | |
+ if (MVM_sc_get_stable_sc(tc, STABLE(obj)) == NULL) { | |
+ /* Need to claim the SC also; typical case for new type objects. */ | |
+ MVMSTable *st = STABLE(obj); | |
+ MVM_sc_set_stable_sc(tc, st, (MVMSerializationContext *)sc); | |
+ MVM_sc_push_stable(tc, (MVMSerializationContext *)sc, st); | |
+ } | |
+} | |
diff --git src/6model/sc.h src/6model/sc.h | |
index e7a8b276e..897c90285 100644 | |
--- src/6model/sc.h | |
+++ src/6model/sc.h | |
@@ -178,3 +178,4 @@ MVM_STATIC_INLINE void MVM_SC_WB_ST(MVMThreadContext *tc, MVMSTable *st) { | |
if (MVM_sc_get_idx_of_sc(&st->header) > 0) | |
MVM_sc_wb_hit_st(tc, st); | |
} | |
+void MVM_scsetobj_impl(MVMThreadContext *tc, MVMObject *sc, MVMObject *obj, MVMint64 idx); | |
diff --git src/core/interp.c src/core/interp.c | |
index f52aac320..1cfeb0810 100644 | |
--- src/core/interp.c | |
+++ src/core/interp.c | |
@@ -3130,19 +3130,7 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex | |
cur_op += 4; | |
goto NEXT; | |
OP(scsetobj): { | |
- MVMObject *sc = GET_REG(cur_op, 0).o; | |
- MVMObject *obj = GET_REG(cur_op, 4).o; | |
- if (REPR(sc)->ID != MVM_REPR_ID_SCRef) | |
- MVM_exception_throw_adhoc(tc, | |
- "Must provide an SCRef operand to scsetobj"); | |
- MVM_sc_set_object(tc, (MVMSerializationContext *)sc, | |
- GET_REG(cur_op, 2).i64, obj); | |
- if (MVM_sc_get_stable_sc(tc, STABLE(obj)) == NULL) { | |
- /* Need to claim the SC also; typical case for new type objects. */ | |
- MVMSTable *st = STABLE(obj); | |
- MVM_sc_set_stable_sc(tc, st, (MVMSerializationContext *)sc); | |
- MVM_sc_push_stable(tc, (MVMSerializationContext *)sc, st); | |
- } | |
+ MVM_scsetobj_impl(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 4).o, GET_REG(cur_op, 2).i64); | |
cur_op += 6; | |
goto NEXT; | |
} | |
diff --git src/jit/graph.c src/jit/graph.c | |
index 69f7179e4..8050bab3e 100644 | |
--- src/jit/graph.c | |
+++ src/jit/graph.c | |
@@ -166,6 +166,7 @@ static void * op_to_func(MVMThreadContext *tc, MVMint16 opcode) { | |
case MVM_OP_islist: case MVM_OP_ishash: return MVM_repr_compare_repr_id; | |
case MVM_OP_wval: case MVM_OP_wval_wide: return MVM_sc_get_sc_object; | |
case MVM_OP_scgetobjidx: return MVM_sc_find_object_idx_jit; | |
+ case MVM_OP_scsetobj: return MVM_scsetobj_impl; | |
case MVM_OP_getdynlex: return MVM_frame_getdynlex; | |
case MVM_OP_binddynlex: return MVM_frame_binddynlex; | |
case MVM_OP_getlexouter: return MVM_frame_find_lexical_by_name_outer; | |
@@ -1915,6 +1916,7 @@ start: | |
case MVM_OP_objprimunsigned: | |
case MVM_OP_takehandlerresult: | |
case MVM_OP_exception: | |
+ //case MVM_OP_scsetobj: | |
case MVM_OP_scgethandle: | |
case MVM_OP_scobjcount: | |
case MVM_OP_setobjsc: | |
@@ -3982,6 +3984,17 @@ start: | |
jg_append_call_c(tc, jg, op_to_func(tc, op), 2, args, MVM_JIT_RV_PTR, dst); | |
break; | |
} | |
+ case MVM_OP_scsetobj: { | |
+ MVMint32 sc = ins->operands[0].reg.orig; | |
+ MVMint64 idx = ins->operands[1].lit_i64; | |
+ MVMint32 obj = ins->operands[2].reg.orig; | |
+ MVMJitCallArg args[] = { { MVM_JIT_INTERP_VAR, MVM_JIT_INTERP_TC }, | |
+ { MVM_JIT_REG_VAL, sc }, | |
+ { MVM_JIT_REG_VAL, obj }, | |
+ { MVM_JIT_LITERAL, idx } }; | |
+ jg_append_call_c(tc, jg, op_to_func(tc, op), 4, args, MVM_JIT_RV_VOID, -1); | |
+ break; | |
+ } | |
default: { | |
/* Check if it's an extop. */ | |
MVMint32 emitted_extop = 0; | |
diff --git src/jit/x64/emit.dasc src/jit/x64/emit.dasc | |
index a98b350ac..f276a42f3 100644 | |
--- src/jit/x64/emit.dasc | |
+++ src/jit/x64/emit.dasc | |
@@ -1902,6 +1902,37 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJ | |
| mov WORK[dst], TMP2; | |
break; | |
} | |
+// case MVM_OP_scsetobj: { | |
+// MVMint16 sc = ins->operands[0].reg.orig; | |
+// MVMint16 obj = ins->operands[2].reg.orig; | |
+// | mov r12, aword WORK[sc]; | |
+// | cmp_repr_id r12, TMP6, MVM_REPR_ID_SCRef; | |
+// | je >1; | |
+// | throw_adhoc "Must provide an SCRef operand to scsetobj" | |
+// |1: | |
+// | mov r13, aword WORK[obj]; | |
+// | mov ARG1, TC; | |
+// | mov ARG2, SCREF:r12; | |
+// | mov64 ARG3, ins->operands[1].lit_i64; | |
+// | mov ARG4, r13; | |
+// | call &MVM_sc_set_object; | |
+// | get_stable r13, r13; | |
+// | mov ARG1, TC; | |
+// | mov ARG2, r13; | |
+// | call &MVM_sc_get_stable_sc; | |
+// | test RV, RV; | |
+// | jnz >2; | |
+// | mov ARG1, TC; | |
+// | mov ARG2, r13; | |
+// | mov ARG3, SCREF:r12; | |
+// | call &MVM_sc_set_stable_sc | |
+// | mov ARG1, TC; | |
+// | mov ARG2, SCREF:r12; | |
+// | mov ARG3, r13; | |
+// | call &MVM_sc_push_stable | |
+// |2: | |
+// break; | |
+// } | |
case MVM_OP_scgethandle: { | |
MVMint16 dst = ins->operands[0].reg.orig; | |
MVMint16 sc = ins->operands[1].reg.orig; |
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
(gdb) x/50i 0x00007ffff60a214b | |
=> 0x7ffff60a214b: mov 0x10(%r10),%r11 | |
0x7ffff60a214f: mov 0x10(%r11),%r11 | |
0x7ffff60a2153: cmpl $0x11,0x1c8(%r11) | |
0x7ffff60a215b: je 0x7ffff60a2170 | |
0x7ffff60a215d: mov %r14,%rdi | |
0x7ffff60a2160: movabs $0x7ffff79f3958,%rsi | |
0x7ffff60a216a: call *0xe2(%rip) # 0x7ffff60a2252 | |
0x7ffff60a2170: mov %r14,%rdi | |
0x7ffff60a2173: mov %r10,%rsi | |
0x7ffff60a2176: call *0xde(%rip) # 0x7ffff60a225a | |
0x7ffff60a217c: mov %rax,0x18(%rbx) | |
0x7ffff60a2180: mov 0x10(%rbx),%r10 | |
0x7ffff60a2184: mov 0x10(%r10),%r11 | |
0x7ffff60a2188: mov 0x10(%r11),%r11 | |
0x7ffff60a218c: cmpl $0x11,0x1c8(%r11) | |
0x7ffff60a2194: je 0x7ffff60a21a9 | |
0x7ffff60a2196: mov %r14,%rdi | |
0x7ffff60a2199: movabs $0x7ffff79f3838,%rsi | |
0x7ffff60a21a3: call *0xb9(%rip) # 0x7ffff60a2262 | |
0x7ffff60a21a9: mov 0x8(%rbx),%r11 | |
0x7ffff60a21ad: mov %r14,%rdi | |
0x7ffff60a21b0: mov %r10,%rsi | |
0x7ffff60a21b3: movabs $0x300000001,%rdx | |
0x7ffff60a21bd: mov %r11,%rcx | |
0x7ffff60a21c0: call 0x7ffff791ca90 <MVM_sc_set_object> | |
0x7ffff60a21c5: mov 0x10(%r11),%r11 | |
0x7ffff60a21c9: mov %r14,%rdi | |
0x7ffff60a21cc: mov %r11,%rsi | |
0x7ffff60a21cf: call 0x7ffff79bc1d0 <MVM_sc_get_stable_sc> | |
0x7ffff60a21d4: test %rax,%rax | |
0x7ffff60a21d7: jne 0x7ffff60a21f5 | |
0x7ffff60a21d9: mov %r14,%rdi | |
0x7ffff60a21dc: mov %r11,%rsi | |
0x7ffff60a21df: mov %r10,%rdx | |
0x7ffff60a21e2: call 0x7ffff79bc230 <MVM_sc_set_stable_sc> | |
0x7ffff60a21e7: mov %r14,%rdi | |
0x7ffff60a21ea: mov %r10,%rsi | |
0x7ffff60a21ed: mov %r11,%rdx | |
0x7ffff60a21f0: call 0x7ffff791cd10 <MVM_sc_push_stable> | |
0x7ffff60a21f5: mov %r14,%r11 | |
0x7ffff60a21f8: mov %r11,%rdi | |
0x7ffff60a21fb: mov 0x18(%rbx),%r11 | |
0x7ffff60a21ff: mov %r11,%rsi | |
0x7ffff60a2202: mov $0x0,%r11 | |
0x7ffff60a2209: mov %r11,%rdx | |
0x7ffff60a220c: call *0x58(%rip) # 0x7ffff60a226a | |
0x7ffff60a2212: mov %r14,%r11 | |
0x7ffff60a2215: mov %r11,%rdi | |
0x7ffff60a2218: call *0x54(%rip) # 0x7ffff60a2272 | |
0x7ffff60a221e: movq $0x0,0x1f0(%r14) | |
(gdb) info registers | |
rax 0xd 13 | |
rbx 0x555555810d40 93824995102016 | |
rcx 0x555555d86980 93825000827264 | |
rdx 0x555555d86980 93825000827264 | |
rsi 0x7ffff7130338 140737338606392 | |
rdi 0x555555559de0 93824992255456 | |
rbp 0x7fffffffdb50 0x7fffffffdb50 | |
rsp 0x7fffffffda50 0x7fffffffda50 | |
r8 0x555555d86980 93825000827264 | |
r9 0x7ffff7d73c90 140737351466128 | |
r10 0x0 0 | |
r11 0x7ffff7e878c0 140737352595648 | |
r12 0x7ffff7dc2260 140737351787104 | |
r13 0x5555555f6370 93824992895856 | |
r14 0x555555559de0 93824992255456 | |
r15 0x555555559de0 93824992255456 | |
rip 0x7ffff60a214b 0x7ffff60a214b | |
eflags 0x10246 [ PF ZF IF RF ] | |
cs 0x33 51 | |
ss 0x2b 43 | |
ds 0x0 0 | |
es 0x0 0 | |
fs 0x0 0 | |
gs 0x0 0 |
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
(gdb) bt | |
#0 0x00007ffff608d14b in ?? () | |
#1 0x0000000000000008 in ?? () | |
#2 0x00007fffffffdac0 in ?? () | |
#3 0x00007ffff7d73ca0 in CSWTCH.21 () from //home/dan/Source/perl6/install/lib/libmoar.so | |
#4 0x0000000000000010 in ?? () | |
#5 0x00005555562739b8 in ?? () | |
#6 0x00005555558513b8 in ?? () | |
#7 0x0000555555765410 in ?? () | |
#8 0x000055555583ed08 in ?? () | |
#9 0x00007ffff7661030 in ?? () | |
#10 0x00007ffff6dc82b0 in ?? () | |
#11 0x00005555555bca28 in ?? () | |
#12 0x00007ffff78e5733 in MVM_repr_at_key_o (tc=<optimized out>, obj=<optimized out>, key=<optimized out>) at src/6model/reprconv.c:518 | |
#13 0x8a13c64bb2951a00 in ?? () | |
#14 0x0000555555559de0 in ?? () | |
#15 0x00007fffffffdb40 in ?? () | |
#16 0x00007ffff7dc2260 in __do_global_dtors_aux_fini_array_entry () from //home/dan/Source/perl6/install/lib/libmoar.so | |
#17 0x0000555555db4de8 in ?? () | |
#18 0x0000555555db4d90 in ?? () | |
#19 0x0000555555559de0 in ?? () | |
#20 0x00007fffffffdef0 in ?? () | |
#21 0x00007ffff78f5960 in invoke_handler (tc=<optimized out>, invokee=<optimized out>, callsite=<optimized out>, args=<optimized out>) at src/6model/reprs/MVMCode.c:10 | |
#22 0x0000555555559de0 in ?? () | |
#23 0x0000555555db4de8 in ?? () | |
#24 0x0000555555db4d90 in ?? () | |
#25 0x00007fffffffdef0 in ?? () | |
#26 0x00007ffff788af86 in MVM_interp_run (tc=0x555555559de0, initial_invoke=0x7ffff700c540, invoke_data=0x7ffff700c540, outer_runloop=0x555555d86980) at src/core/interp.c:6449 | |
Backtrace stopped: previous frame inner to this frame (corrupt stack?) | |
(gdb) |
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
(gdb) set disassembly-flavor intel | |
(gdb) x/20i 0x00007ffff608d14b | |
0x7ffff608d14b: mov bl,0x10 | |
0x7ffff608d14d: add DWORD PTR [rax],eax | |
0x7ffff608d14f: add BYTE PTR [rcx+rcx*4-0x26],cl | |
0x7ffff608d153: mov rcx,0x0 | |
0x7ffff608d15a: call QWORD PTR [rip+0x5e13] # 0x7ffff6092f73 | |
0x7ffff608d160: mov rcx,QWORD PTR [rbx+0x40] | |
0x7ffff608d164: mov rdx,QWORD PTR [r14+0x1b0] | |
0x7ffff608d16b: mov rdx,QWORD PTR [rdx+0x78] | |
0x7ffff608d16f: mov rdx,QWORD PTR [rdx] | |
0x7ffff608d172: test rcx,rcx | |
0x7ffff608d175: je 0x7ffff608d187 | |
0x7ffff608d177: test WORD PTR [rcx+0xc],0x1 | |
0x7ffff608d17d: jne 0x7ffff608d187 | |
0x7ffff608d17f: cmp rdx,QWORD PTR [rcx+0x10] | |
0x7ffff608d183: jne 0x7ffff608d187 | |
0x7ffff608d185: jmp 0x7ffff608d19c | |
0x7ffff608d187: mov rdi,r14 | |
0x7ffff608d18a: mov rsi,0x1 | |
0x7ffff608d191: call QWORD PTR [rip+0x5de4] # 0x7ffff6092f7b | |
0x7ffff608d197: jmp 0x7ffff6092f57 | |
(gdb) |
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
+ 1905 case MVM_OP_scsetobj: { | |
+ 1906 MVMint16 sc = ins->operands[0].reg.orig; | |
+ 1907 MVMint16 obj = ins->operands[2].reg.orig; | |
+ 1908 | mov TMP1, aword WORK[sc]; | |
+ 1909 | cmp_repr_id TMP1, TMP2, MVM_REPR_ID_SCRef; | |
+ 1910 | je >1; | |
+ 1911 | throw_adhoc "Must provide an SCRef operand to scsetobj" | |
+ 1912 |1: | |
+ 1913 | mov TMP2, aword WORK[obj]; | |
+ 1914 | mov ARG1, TC; | |
+ 1915 | mov ARG2, SCREF:TMP1; | |
+ 1916 | mov64 ARG3, ins->operands[1].lit_i64; | |
+ 1917 | mov ARG4, TMP2; | |
+ 1918 | call &MVM_sc_set_object; | |
+ 1919 | get_stable TMP2, TMP2 | |
+ 1920 | mov ARG1, TC; | |
+ 1921 | mov ARG2, TMP2; | |
+ 1922 | call &MVM_sc_get_stable_sc; | |
+ 1923 | test RV, RV; | |
+ 1924 | jnz >2; | |
+ 1925 | mov ARG1, TC; | |
+ 1926 | mov ARG2, TMP2; | |
+ 1927 | mov ARG3, SCREF:TMP1; | |
+ 1928 | call &MVM_sc_set_stable_sc | |
+ 1929 | mov ARG1, TC; | |
+ 1930 | mov ARG2, SCREF:TMP1; | |
+ 1931 | mov ARG3, TMP2; | |
+ 1932 | call &MVM_sc_push_stable | |
+ 1933 |2: | |
+ 1934 break; | |
+ 1935 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment