Skip to content

Instantly share code, notes, and snippets.

@timo
Last active November 16, 2021 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timo/ff98e2f4cbcd40e7223fc9e8dacd4984 to your computer and use it in GitHub Desktop.
Save timo/ff98e2f4cbcd40e7223fc9e8dacd4984 to your computer and use it in GitHub Desktop.
261: 49 8b 8e b0 01 00 00 mov rcx,QWORD PTR [r14+0x1b0]
268: 48 8b 49 68 mov rcx,QWORD PTR [rcx+0x68]
26c: 48 8b 49 58 mov rcx,QWORD PTR [rcx+0x58]
270: 48 89 4b 58 mov QWORD PTR [rbx+0x58],rcx
274: 49 8b 8e b0 01 00 00 mov rcx,QWORD PTR [r14+0x1b0]
27b: 48 8b 49 68 mov rcx,QWORD PTR [rcx+0x68]
27f: 48 8b 49 60 mov rcx,QWORD PTR [rcx+0x60]
283: 48 89 4b 60 mov QWORD PTR [rbx+0x60],rcx
287: 48 8b 4b 50 mov rcx,QWORD PTR [rbx+0x50]
28b: 48 8b 51 18 mov rdx,QWORD PTR [rcx+0x18]
28f: 48 89 53 68 mov QWORD PTR [rbx+0x68],rdx
293: 48 b9 00 00 00 00 00 movabs rcx,0x0
29a: 00 00 00
29d: 48 89 4b 70 mov QWORD PTR [rbx+0x70],rcx
2a1: 48 b9 00 00 00 00 00 movabs rcx,0x0
2a8: 00 00 00
2ab: 48 89 4b 78 mov QWORD PTR [rbx+0x78],rcx
2af: 48 b9 00 00 00 00 00 movabs rcx,0x0
2b6: 00 00 00
2b9: 48 89 8b 80 00 00 00 mov QWORD PTR [rbx+0x80],rcx
2c0: 48 b9 ff 00 00 00 00 movabs rcx,0xff
2c7: 00 00 00
2ca: 48 89 8b 88 00 00 00 mov QWORD PTR [rbx+0x88],rcx
2d1: 49 8b 96 c8 00 00 00 mov rdx,QWORD PTR [r14+0xc8]
2d8: 48 8b 12 mov rdx,QWORD PTR [rdx]
2db: 4d 8b 96 b0 01 00 00 mov r10,QWORD PTR [r14+0x1b0]
2e2: 49 89 52 78 mov QWORD PTR [r10+0x78],rdx
2e6: 41 c6 82 88 00 00 00 mov BYTE PTR [r10+0x88],0x2
2ed: 02
2ee: 48 8d 93 90 00 00 00 lea rdx,[rbx+0x90]
2f5: 49 89 92 80 00 00 00 mov QWORD PTR [r10+0x80],rdx
2fc: 4c 8b 5b 68 mov r11,QWORD PTR [rbx+0x68]
300: 4c 89 df mov rdi,r11
303: 4c 8b 5b 70 mov r11,QWORD PTR [rbx+0x70]
307: 4c 89 de mov rsi,r11
30a: 4c 8b 5b 78 mov r11,QWORD PTR [rbx+0x78]
30e: 4c 89 da mov rdx,r11
311: 4c 8b 9b 80 00 00 00 mov r11,QWORD PTR [rbx+0x80]
318: 4c 89 d9 mov rcx,r11
31b: 4c 8b 9b 88 00 00 00 mov r11,QWORD PTR [rbx+0x88]
322: 4d 89 d8 mov r8,r11
325: 49 ba 10 71 3f ba d3 movabs r10,0x7fd3ba3f7110
32c: 7f 00 00
32f: 41 ff d2 call r10
261: 49 8b 8e b0 01 00 00 mov rcx,QWORD PTR [r14+0x1b0]
268: 48 8b 49 68 mov rcx,QWORD PTR [rcx+0x68]
26c: 48 8b 49 58 mov rcx,QWORD PTR [rcx+0x58]
270: 48 89 4b 58 mov QWORD PTR [rbx+0x58],rcx
274: 49 8b 8e b0 01 00 00 mov rcx,QWORD PTR [r14+0x1b0]
27b: 48 8b 49 68 mov rcx,QWORD PTR [rcx+0x68]
27f: 48 8b 49 60 mov rcx,QWORD PTR [rcx+0x60]
283: 48 89 4b 60 mov QWORD PTR [rbx+0x60],rcx
287: 4d 89 f3 mov r11,r14
28a: 4c 89 df mov rdi,r11
28d: 4c 8b 5b 50 mov r11,QWORD PTR [rbx+0x50]
291: 4c 89 de mov rsi,r11
294: ff 15 08 10 00 00 call QWORD PTR [rip+0x1008] # 0x12a2
29a: 48 89 43 68 mov QWORD PTR [rbx+0x68],rax
29e: 48 b9 00 00 00 00 00 movabs rcx,0x0
2a5: 00 00 00
2a8: 48 89 4b 70 mov QWORD PTR [rbx+0x70],rcx
2ac: 48 b9 00 00 00 00 00 movabs rcx,0x0
2b3: 00 00 00
2b6: 48 89 4b 78 mov QWORD PTR [rbx+0x78],rcx
2ba: 48 b9 00 00 00 00 00 movabs rcx,0x0
2c1: 00 00 00
2c4: 48 89 8b 80 00 00 00 mov QWORD PTR [rbx+0x80],rcx
2cb: 48 b9 ff 00 00 00 00 movabs rcx,0xff
2d2: 00 00 00
2d5: 48 89 8b 88 00 00 00 mov QWORD PTR [rbx+0x88],rcx
2dc: 49 8b 96 c8 00 00 00 mov rdx,QWORD PTR [r14+0xc8]
2e3: 48 8b 12 mov rdx,QWORD PTR [rdx]
2e6: 4d 8b 96 b0 01 00 00 mov r10,QWORD PTR [r14+0x1b0]
2ed: 49 89 52 78 mov QWORD PTR [r10+0x78],rdx
2f1: 41 c6 82 88 00 00 00 mov BYTE PTR [r10+0x88],0x2
2f8: 02
2f9: 48 8d 93 90 00 00 00 lea rdx,[rbx+0x90]
300: 49 89 92 80 00 00 00 mov QWORD PTR [r10+0x80],rdx
307: 4c 8b 5b 68 mov r11,QWORD PTR [rbx+0x68]
30b: 4c 89 df mov rdi,r11
30e: 4c 8b 5b 70 mov r11,QWORD PTR [rbx+0x70]
312: 4c 89 de mov rsi,r11
315: 4c 8b 5b 78 mov r11,QWORD PTR [rbx+0x78]
319: 4c 89 da mov rdx,r11
31c: 4c 8b 9b 80 00 00 00 mov r11,QWORD PTR [rbx+0x80]
323: 4c 89 d9 mov rcx,r11
326: 4c 8b 9b 88 00 00 00 mov r11,QWORD PTR [rbx+0x88]
32d: 4d 89 d8 mov r8,r11
330: 49 ba 10 c1 14 b0 a6 movabs r10,0x7fa6b014c110
337: 7f 00 00
33a: 41 ff d2 call r10
diff --git a/src/jit/graph.c b/src/jit/graph.c
index aa7dfbfc3..d6671e581 100644
--- a/src/jit/graph.c
+++ b/src/jit/graph.c
@@ -3808,9 +3808,13 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
args[i - 1].type = MVM_JIT_PARAM_VMARRAY;
args[i - 1].v.lit_i64 = ins->operands[start + 2 + i].reg.orig;
}
+ else if (callsite->arg_flags[i] & MVM_CALLSITE_ARG_OBJ && body->arg_types[i - 1] == MVM_NATIVECALL_ARG_CARRAY) {
+ args[i - 1].type = MVM_JIT_PARAM_CARRAY;
+ args[i - 1].v.lit_i64 = ins->operands[start + 2 + i].reg.orig;
+ }
else {
MVM_spesh_graph_add_comment(tc, iter->graph, iter->ins,
- "BAIL: op <%s> (type of arg %d (%d) NYI)", ins->info->name, i, callsite->arg_flags[i]);
+ "BAIL: op <%s> (type of arg %d (%d, function's %d) NYI)", ins->info->name, i, callsite->arg_flags[i], body->arg_types[i - 1]);
return 0;
}
}
diff --git a/src/jit/graph.h b/src/jit/graph.h
index 37a9a49be..b027de085 100644
--- a/src/jit/graph.h
+++ b/src/jit/graph.h
@@ -123,6 +123,7 @@ typedef enum {
MVM_JIT_PARAM_DOUBLE,
MVM_JIT_PARAM_PTR,
MVM_JIT_PARAM_VMARRAY,
+ MVM_JIT_PARAM_CARRAY,
/* spesh slot value */
MVM_JIT_SPESH_SLOT_VALUE,
/* stack relative address */
diff --git a/src/jit/x64/emit.dasc b/src/jit/x64/emit.dasc
index 35ac128fd..9e23315d1 100644
--- a/src/jit/x64/emit.dasc
+++ b/src/jit/x64/emit.dasc
@@ -101,6 +101,7 @@
|.type OBJECT, MVMObject
|.type STOOGE, MVMObjectStooge
|.type VMARRAY, MVMArray
+|.type CARRAY, MVMCArray
|.type COLLECTABLE, MVMCollectable
|.type STABLE, MVMSTable
|.type REPR, MVMREPROps
@@ -2578,6 +2579,10 @@ static void load_call_arg(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJit
| mov TMP6, aword WORK[arg.v.lit_i64];
| mov TMP6, aword VMARRAY:TMP6->body.slots;
break;
+ case MVM_JIT_PARAM_CARRAY:
+ | mov TMP6, aword WORK[arg.v.lit_i64];
+ | mov TMP6, aword CARRAY:TMP6->body.storage;
+ break;
case MVM_JIT_SPESH_SLOT_VALUE:
| get_spesh_slot TMP6, arg.v.lit_i64;
break;
@@ -2708,6 +2713,7 @@ static void emit_posix_callargs(MVMThreadContext *tc, MVMJitCompiler *compiler,
case MVM_JIT_PARAM_I64_RW:
case MVM_JIT_PARAM_PTR:
case MVM_JIT_PARAM_VMARRAY:
+ case MVM_JIT_PARAM_CARRAY:
case MVM_JIT_SPESH_SLOT_VALUE:
case MVM_JIT_STACK_VALUE:
if (num_gpr < 6) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment