diff options
author | Mike Pall <mike> | 2011-08-10 22:09:14 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-08-10 22:33:52 +0200 |
commit | e8fa76feace720c8348f08fd0e0c9f0656277987 (patch) | |
tree | 67b7cb0b9ef18d217dbcc0204a6808f05af39458 /src | |
parent | d84207b8b6b906f9ec6eb1861a9319fb574dd1f8 (diff) | |
download | luajit-e8fa76feace720c8348f08fd0e0c9f0656277987.tar.gz luajit-e8fa76feace720c8348f08fd0e0c9f0656277987.tar.bz2 luajit-e8fa76feace720c8348f08fd0e0c9f0656277987.zip |
PPCSPE: Save/restore cr2, cr3 and cr4 when entering/leaving VM.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildvm_ppcspe.dasc | 58 | ||||
-rw-r--r-- | src/buildvm_ppcspe.h | 664 | ||||
-rw-r--r-- | src/lj_ccall.c | 2 | ||||
-rw-r--r-- | src/lj_ccall.h | 2 | ||||
-rw-r--r-- | src/lj_frame.h | 2 |
5 files changed, 372 insertions, 356 deletions
diff --git a/src/buildvm_ppcspe.dasc b/src/buildvm_ppcspe.dasc index 5d85961b..92914f98 100644 --- a/src/buildvm_ppcspe.dasc +++ b/src/buildvm_ppcspe.dasc | |||
@@ -61,27 +61,29 @@ | |||
61 | |.define CRET2, r4 | 61 | |.define CRET2, r4 |
62 | | | 62 | | |
63 | |// Stack layout while in interpreter. Must match with lj_frame.h. | 63 | |// Stack layout while in interpreter. Must match with lj_frame.h. |
64 | |.define SAVE_LR, 180(sp) | 64 | |.define SAVE_LR, 188(sp) |
65 | |.define CFRAME_SPACE, 176 // Delta for sp. | 65 | |.define CFRAME_SPACE, 184 // Delta for sp. |
66 | |// Back chain for sp: 176(sp) <-- sp entering interpreter | 66 | |// Back chain for sp: 184(sp) <-- sp entering interpreter |
67 | |.define SAVE_r31, 168(sp) // 64 bit register saves. | 67 | |.define SAVE_r31, 176(sp) // 64 bit register saves. |
68 | |.define SAVE_r30, 160(sp) | 68 | |.define SAVE_r30, 168(sp) |
69 | |.define SAVE_r29, 152(sp) | 69 | |.define SAVE_r29, 160(sp) |
70 | |.define SAVE_r28, 144(sp) | 70 | |.define SAVE_r28, 152(sp) |
71 | |.define SAVE_r27, 136(sp) | 71 | |.define SAVE_r27, 144(sp) |
72 | |.define SAVE_r26, 128(sp) | 72 | |.define SAVE_r26, 136(sp) |
73 | |.define SAVE_r25, 120(sp) | 73 | |.define SAVE_r25, 128(sp) |
74 | |.define SAVE_r24, 112(sp) | 74 | |.define SAVE_r24, 120(sp) |
75 | |.define SAVE_r23, 104(sp) | 75 | |.define SAVE_r23, 112(sp) |
76 | |.define SAVE_r22, 96(sp) | 76 | |.define SAVE_r22, 104(sp) |
77 | |.define SAVE_r21, 88(sp) | 77 | |.define SAVE_r21, 96(sp) |
78 | |.define SAVE_r20, 80(sp) | 78 | |.define SAVE_r20, 88(sp) |
79 | |.define SAVE_r19, 72(sp) | 79 | |.define SAVE_r19, 80(sp) |
80 | |.define SAVE_r18, 64(sp) | 80 | |.define SAVE_r18, 72(sp) |
81 | |.define SAVE_r17, 56(sp) | 81 | |.define SAVE_r17, 64(sp) |
82 | |.define SAVE_r16, 48(sp) | 82 | |.define SAVE_r16, 56(sp) |
83 | |.define SAVE_r15, 40(sp) | 83 | |.define SAVE_r15, 48(sp) |
84 | |.define SAVE_r14, 32(sp) | 84 | |.define SAVE_r14, 40(sp) |
85 | |.define SAVE_CR, 36(sp) | ||
86 | |.define UNUSED1, 32(sp) | ||
85 | |.define SAVE_ERRF, 28(sp) // 32 bit C frame info. | 87 | |.define SAVE_ERRF, 28(sp) // 32 bit C frame info. |
86 | |.define SAVE_NRES, 24(sp) | 88 | |.define SAVE_NRES, 24(sp) |
87 | |.define SAVE_CFRAME, 20(sp) | 89 | |.define SAVE_CFRAME, 20(sp) |
@@ -97,16 +99,16 @@ | |||
97 | |.macro saveregs | 99 | |.macro saveregs |
98 | | stwu sp, -CFRAME_SPACE(sp) | 100 | | stwu sp, -CFRAME_SPACE(sp) |
99 | | save_ r14; save_ r15; save_ r16; save_ r17; save_ r18; save_ r19 | 101 | | save_ r14; save_ r15; save_ r16; save_ r17; save_ r18; save_ r19 |
100 | | mflr r0 | 102 | | mflr r0; mfcr r12 |
101 | | save_ r20; save_ r21; save_ r22; save_ r23; save_ r24; save_ r25 | 103 | | save_ r20; save_ r21; save_ r22; save_ r23; save_ r24; save_ r25 |
102 | | stw r0, SAVE_LR | 104 | | stw r0, SAVE_LR; stw r12, SAVE_CR |
103 | | save_ r26; save_ r27; save_ r28; save_ r29; save_ r30; save_ r31 | 105 | | save_ r26; save_ r27; save_ r28; save_ r29; save_ r30; save_ r31 |
104 | |.endmacro | 106 | |.endmacro |
105 | | | 107 | | |
106 | |.macro restoreregs | 108 | |.macro restoreregs |
107 | | lwz r0, SAVE_LR | 109 | | lwz r0, SAVE_LR; lwz r12, SAVE_CR |
108 | | rest_ r14; rest_ r15; rest_ r16; rest_ r17; rest_ r18; rest_ r19 | 110 | | rest_ r14; rest_ r15; rest_ r16; rest_ r17; rest_ r18; rest_ r19 |
109 | | mtlr r0 | 111 | | mtlr r0; mtcrf 0x38, r12 |
110 | | rest_ r20; rest_ r21; rest_ r22; rest_ r23; rest_ r24; rest_ r25 | 112 | | rest_ r20; rest_ r21; rest_ r22; rest_ r23; rest_ r24; rest_ r25 |
111 | | rest_ r26; rest_ r27; rest_ r28; rest_ r29; rest_ r30; rest_ r31 | 113 | | rest_ r26; rest_ r27; rest_ r28; rest_ r29; rest_ r30; rest_ r31 |
112 | | addi sp, sp, CFRAME_SPACE | 114 | | addi sp, sp, CFRAME_SPACE |
@@ -3656,7 +3658,8 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
3656 | "\t.long .Lbegin\n" | 3658 | "\t.long .Lbegin\n" |
3657 | "\t.long %d\n" | 3659 | "\t.long %d\n" |
3658 | "\t.byte 0xe\n\t.uleb128 %d\n" | 3660 | "\t.byte 0xe\n\t.uleb128 %d\n" |
3659 | "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n", | 3661 | "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n" |
3662 | "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n", | ||
3660 | (int)ctx->codesz, CFRAME_SIZE); | 3663 | (int)ctx->codesz, CFRAME_SIZE); |
3661 | for (i = 14; i <= 31; i++) | 3664 | for (i = 14; i <= 31; i++) |
3662 | fprintf(ctx->fp, | 3665 | fprintf(ctx->fp, |
@@ -3693,7 +3696,8 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
3693 | "\t.long %d\n" | 3696 | "\t.long %d\n" |
3694 | "\t.uleb128 0\n" /* augmentation length */ | 3697 | "\t.uleb128 0\n" /* augmentation length */ |
3695 | "\t.byte 0xe\n\t.uleb128 %d\n" | 3698 | "\t.byte 0xe\n\t.uleb128 %d\n" |
3696 | "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n", | 3699 | "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n" |
3700 | "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n", | ||
3697 | (int)ctx->codesz, CFRAME_SIZE); | 3701 | (int)ctx->codesz, CFRAME_SIZE); |
3698 | for (i = 14; i <= 31; i++) | 3702 | for (i = 14; i <= 31; i++) |
3699 | fprintf(ctx->fp, | 3703 | fprintf(ctx->fp, |
diff --git a/src/buildvm_ppcspe.h b/src/buildvm_ppcspe.h index cf3c226e..a3eedd6e 100644 --- a/src/buildvm_ppcspe.h +++ b/src/buildvm_ppcspe.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #define DASM_SECTION_CODE_OP 0 | 12 | #define DASM_SECTION_CODE_OP 0 |
13 | #define DASM_SECTION_CODE_SUB 1 | 13 | #define DASM_SECTION_CODE_SUB 1 |
14 | #define DASM_MAXSECTION 2 | 14 | #define DASM_MAXSECTION 2 |
15 | static const unsigned int build_actionlist[4993] = { | 15 | static const unsigned int build_actionlist[5003] = { |
16 | 0x00010001, | 16 | 0x00010001, |
17 | 0x00060014, | 17 | 0x00060014, |
18 | 0x72000000, | 18 | 0x72000000, |
@@ -73,27 +73,29 @@ static const unsigned int build_actionlist[4993] = { | |||
73 | 0x90120000, | 73 | 0x90120000, |
74 | 0x00098200, | 74 | 0x00098200, |
75 | 0x0006001a, | 75 | 0x0006001a, |
76 | 0x800100b4, | 76 | 0x800100bc, |
77 | 0x11c12301, | 77 | 0x81810024, |
78 | 0x11e12b01, | 78 | 0x11c12b01, |
79 | 0x12013301, | 79 | 0x11e13301, |
80 | 0x12213b01, | 80 | 0x12013b01, |
81 | 0x12414301, | 81 | 0x12214301, |
82 | 0x12614b01, | 82 | 0x12414b01, |
83 | 0x12615301, | ||
83 | 0x7c0803a6, | 84 | 0x7c0803a6, |
84 | 0x12815301, | 85 | 0x7d838120, |
85 | 0x12a15b01, | 86 | 0x12815b01, |
86 | 0x12c16301, | 87 | 0x12a16301, |
87 | 0x12e16b01, | 88 | 0x12c16b01, |
88 | 0x13017301, | 89 | 0x12e17301, |
89 | 0x13217b01, | 90 | 0x13017b01, |
90 | 0x13418301, | 91 | 0x13218301, |
91 | 0x13618b01, | 92 | 0x13418b01, |
92 | 0x13819301, | 93 | 0x13619301, |
93 | 0x13a19b01, | 94 | 0x13819b01, |
94 | 0x13c1a301, | 95 | 0x13a1a301, |
95 | 0x13e1ab01, | 96 | 0x13c1ab01, |
96 | 0x382100b0, | 97 | 0x13e1b301, |
98 | 0x382100b8, | ||
97 | 0x4e800020, | 99 | 0x4e800020, |
98 | 0x00060010, | 100 | 0x00060010, |
99 | 0x40810000, | 101 | 0x40810000, |
@@ -218,27 +220,29 @@ static const unsigned int build_actionlist[4993] = { | |||
218 | 0x7c0903a6, | 220 | 0x7c0903a6, |
219 | 0x4e800420, | 221 | 0x4e800420, |
220 | 0x00060021, | 222 | 0x00060021, |
221 | 0x9421ff50, | 223 | 0x9421ff48, |
222 | 0x11c12321, | 224 | 0x11c12b21, |
223 | 0x11e12b21, | 225 | 0x11e13321, |
224 | 0x12013321, | 226 | 0x12013b21, |
225 | 0x12213b21, | 227 | 0x12214321, |
226 | 0x12414321, | 228 | 0x12414b21, |
227 | 0x12614b21, | 229 | 0x12615321, |
228 | 0x7c0802a6, | 230 | 0x7c0802a6, |
229 | 0x12815321, | 231 | 0x7d800026, |
230 | 0x12a15b21, | 232 | 0x12815b21, |
231 | 0x12c16321, | 233 | 0x12a16321, |
232 | 0x12e16b21, | 234 | 0x12c16b21, |
233 | 0x13017321, | 235 | 0x12e17321, |
234 | 0x13217b21, | 236 | 0x13017b21, |
235 | 0x900100b4, | 237 | 0x13218321, |
236 | 0x13418321, | 238 | 0x900100bc, |
237 | 0x13618b21, | 239 | 0x91810024, |
238 | 0x13819321, | 240 | 0x13418b21, |
239 | 0x13a19b21, | 241 | 0x13619321, |
240 | 0x13c1a321, | 242 | 0x13819b21, |
241 | 0x13e1ab21, | 243 | 0x13a1a321, |
244 | 0x13c1ab21, | ||
245 | 0x13e1b321, | ||
242 | 0x7c721b78, | 246 | 0x7c721b78, |
243 | 0x82320000, | 247 | 0x82320000, |
244 | 0x00098200, | 248 | 0x00098200, |
@@ -297,54 +301,58 @@ static const unsigned int build_actionlist[4993] = { | |||
297 | 0x48000000, | 301 | 0x48000000, |
298 | 0x00050018, | 302 | 0x00050018, |
299 | 0x00060022, | 303 | 0x00060022, |
300 | 0x9421ff50, | 304 | 0x9421ff48, |
301 | 0x11c12321, | 305 | 0x11c12b21, |
302 | 0x11e12b21, | 306 | 0x11e13321, |
303 | 0x12013321, | 307 | 0x12013b21, |
304 | 0x12213b21, | 308 | 0x12214321, |
305 | 0x12414321, | 309 | 0x12414b21, |
306 | 0x12614b21, | 310 | 0x12615321, |
307 | 0x7c0802a6, | 311 | 0x7c0802a6, |
308 | 0x12815321, | 312 | 0x7d800026, |
309 | 0x12a15b21, | 313 | 0x12815b21, |
310 | 0x12c16321, | 314 | 0x12a16321, |
311 | 0x12e16b21, | 315 | 0x12c16b21, |
312 | 0x13017321, | 316 | 0x12e17321, |
313 | 0x13217b21, | 317 | 0x13017b21, |
314 | 0x900100b4, | 318 | 0x13218321, |
315 | 0x13418321, | 319 | 0x900100bc, |
316 | 0x13618b21, | 320 | 0x91810024, |
317 | 0x13819321, | 321 | 0x13418b21, |
318 | 0x13a19b21, | 322 | 0x13619321, |
319 | 0x13c1a321, | 323 | 0x13819b21, |
320 | 0x13e1ab21, | 324 | 0x13a1a321, |
325 | 0x13c1ab21, | ||
326 | 0x13e1b321, | ||
321 | 0x3a000000, | 327 | 0x3a000000, |
322 | 0x00098200, | 328 | 0x00098200, |
323 | 0x90c1001c, | 329 | 0x90c1001c, |
324 | 0x48000000, | 330 | 0x48000000, |
325 | 0x00050001, | 331 | 0x00050001, |
326 | 0x00060023, | 332 | 0x00060023, |
327 | 0x9421ff50, | 333 | 0x9421ff48, |
328 | 0x11c12321, | 334 | 0x11c12b21, |
329 | 0x11e12b21, | 335 | 0x11e13321, |
330 | 0x12013321, | 336 | 0x12013b21, |
331 | 0x12213b21, | 337 | 0x12214321, |
332 | 0x12414321, | 338 | 0x12414b21, |
333 | 0x12614b21, | 339 | 0x12615321, |
334 | 0x7c0802a6, | 340 | 0x7c0802a6, |
335 | 0x12815321, | 341 | 0x7d800026, |
336 | 0x12a15b21, | 342 | 0x12815b21, |
337 | 0x12c16321, | 343 | 0x12a16321, |
338 | 0x12e16b21, | 344 | 0x12c16b21, |
339 | 0x13017321, | 345 | 0x12e17321, |
340 | 0x13217b21, | 346 | 0x13017b21, |
341 | 0x900100b4, | 347 | 0x13218321, |
342 | 0x13418321, | 348 | 0x900100bc, |
343 | 0x13618b21, | 349 | 0x91810024, |
344 | 0x13819321, | 350 | 0x13418b21, |
345 | 0x13a19b21, | 351 | 0x13619321, |
346 | 0x13c1a321, | 352 | 0x13819b21, |
347 | 0x13e1ab21, | 353 | 0x13a1a321, |
354 | 0x13c1ab21, | ||
355 | 0x13e1b321, | ||
348 | 0x3a000000, | 356 | 0x3a000000, |
349 | 0x00098200, | 357 | 0x00098200, |
350 | 0x0006000b, | 358 | 0x0006000b, |
@@ -407,27 +415,29 @@ static const unsigned int build_actionlist[4993] = { | |||
407 | 0x7c0903a6, | 415 | 0x7c0903a6, |
408 | 0x4e800420, | 416 | 0x4e800420, |
409 | 0x00060027, | 417 | 0x00060027, |
410 | 0x9421ff50, | 418 | 0x9421ff48, |
411 | 0x11c12321, | 419 | 0x11c12b21, |
412 | 0x11e12b21, | 420 | 0x11e13321, |
413 | 0x12013321, | 421 | 0x12013b21, |
414 | 0x12213b21, | 422 | 0x12214321, |
415 | 0x12414321, | 423 | 0x12414b21, |
416 | 0x12614b21, | 424 | 0x12615321, |
417 | 0x7c0802a6, | 425 | 0x7c0802a6, |
418 | 0x12815321, | 426 | 0x7d800026, |
419 | 0x12a15b21, | 427 | 0x12815b21, |
420 | 0x12c16321, | 428 | 0x12a16321, |
421 | 0x12e16b21, | 429 | 0x12c16b21, |
422 | 0x13017321, | 430 | 0x12e17321, |
423 | 0x13217b21, | 431 | 0x13017b21, |
424 | 0x900100b4, | 432 | 0x13218321, |
425 | 0x13418321, | 433 | 0x900100bc, |
426 | 0x13618b21, | 434 | 0x91810024, |
427 | 0x13819321, | 435 | 0x13418b21, |
428 | 0x13a19b21, | 436 | 0x13619321, |
429 | 0x13c1a321, | 437 | 0x13819b21, |
430 | 0x13e1ab21, | 438 | 0x13a1a321, |
439 | 0x13c1ab21, | ||
440 | 0x13e1b321, | ||
431 | 0x7c721b78, | 441 | 0x7c721b78, |
432 | 0x80030000, | 442 | 0x80030000, |
433 | 0x00098200, | 443 | 0x00098200, |
@@ -5368,113 +5378,113 @@ static void build_subroutines(BuildCtx *ctx) | |||
5368 | dasm_put(Dst, 0); | 5378 | dasm_put(Dst, 0); |
5369 | dasm_put(Dst, 1, FRAME_P, LJ_TTRUE, FRAME_TYPE, FRAME_C, ~LJ_VMST_C, Dt1(->base), DISPATCH_GL(vmstate), 31-3, Dt1(->top)); | 5379 | dasm_put(Dst, 1, FRAME_P, LJ_TTRUE, FRAME_TYPE, FRAME_C, ~LJ_VMST_C, Dt1(->base), DISPATCH_GL(vmstate), 31-3, Dt1(->top)); |
5370 | dasm_put(Dst, 55, Dt1(->cframe), Dt1(->maxstack), Dt1(->top), 31-3, Dt1(->top), ~LJ_VMST_C, Dt1(->glref), Dt2(->vmstate)); | 5380 | dasm_put(Dst, 55, Dt1(->cframe), Dt1(->maxstack), Dt1(->top), 31-3, Dt1(->top), ~LJ_VMST_C, Dt1(->glref), Dt2(->vmstate)); |
5371 | dasm_put(Dst, 133, LJ_TISNUM+1, LJ_TFUNC, LJ_TTAB, Dt1(->base), Dt1(->glref), LJ_TSTR, LJ_TFALSE, LJ_TNIL, ~LJ_VMST_INTERP, GG_G2DISP, DISPATCH_GL(vmstate), LUA_MINSTACK, Dt1(->base), Dt1(->top), 32-3); | 5381 | dasm_put(Dst, 135, LJ_TISNUM+1, LJ_TFUNC, LJ_TTAB, Dt1(->base), Dt1(->glref), LJ_TSTR, LJ_TFALSE, LJ_TNIL, ~LJ_VMST_INTERP, GG_G2DISP, DISPATCH_GL(vmstate), LUA_MINSTACK, Dt1(->base), Dt1(->top), 32-3); |
5372 | dasm_put(Dst, 188, Dt1(->base), Dt1(->top), Dt7(->pc), Dt1(->glref), Dt1(->status), FRAME_CP, CFRAME_RESUME, GG_G2DISP, Dt1(->cframe), Dt1(->base), LJ_TISNUM+1, Dt1(->top), LJ_TFUNC, LJ_TTAB, LJ_TSTR, Dt1(->status), FRAME_TYPE, ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate)); | 5382 | dasm_put(Dst, 190, Dt1(->base), Dt1(->top), Dt7(->pc), Dt1(->glref), Dt1(->status), FRAME_CP, CFRAME_RESUME, GG_G2DISP, Dt1(->cframe), Dt1(->base), LJ_TISNUM+1, Dt1(->top), LJ_TFUNC, LJ_TTAB, LJ_TSTR, Dt1(->status), FRAME_TYPE, ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate)); |
5373 | dasm_put(Dst, 279, FRAME_CP, FRAME_C, Dt1(->cframe), Dt1(->cframe), Dt1(->glref), GG_G2DISP, Dt1(->base), LJ_TISNUM+1, Dt1(->top), LJ_TFUNC, LJ_TTAB, LJ_TSTR, ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate)); | 5383 | dasm_put(Dst, 283, FRAME_CP, FRAME_C, Dt1(->cframe), Dt1(->cframe), Dt1(->glref), GG_G2DISP, Dt1(->base), LJ_TISNUM+1, Dt1(->top), LJ_TFUNC, LJ_TTAB, LJ_TSTR, ~LJ_VMST_INTERP, LJ_TNIL, DISPATCH_GL(vmstate)); |
5374 | dasm_put(Dst, 376, Dt7(->pc), Dt1(->stack), Dt1(->top), Dt1(->cframe), Dt1(->cframe), Dt1(->glref), FRAME_CP, GG_G2DISP, Dt7(->pc), PC2PROTO(k), Dt1(->base)); | 5384 | dasm_put(Dst, 384, Dt7(->pc), Dt1(->stack), Dt1(->top), Dt1(->cframe), Dt1(->cframe), Dt1(->glref), FRAME_CP, GG_G2DISP, Dt7(->pc), PC2PROTO(k), Dt1(->base)); |
5375 | dasm_put(Dst, 481, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), DISPATCH_GL(tmptv)); | 5385 | dasm_put(Dst, 491, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), DISPATCH_GL(tmptv)); |
5376 | dasm_put(Dst, 556, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), Dt1(->base)); | 5386 | dasm_put(Dst, 566, DISPATCH_GL(tmptv), DISPATCH_GL(tmptv2), DISPATCH_GL(tmptv), Dt1(->base), FRAME_CONT, Dt1(->top), Dt1(->base)); |
5377 | dasm_put(Dst, 637, -(BCBIAS_J*4 >> 16), LJ_TTRUE, LJ_TFALSE, Dt1(->base)); | 5387 | dasm_put(Dst, 647, -(BCBIAS_J*4 >> 16), LJ_TTRUE, LJ_TFALSE, Dt1(->base)); |
5378 | dasm_put(Dst, 706, Dt1(->base), FRAME_CONT); | 5388 | dasm_put(Dst, 716, Dt1(->base), FRAME_CONT); |
5379 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 5389 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
5380 | dasm_put(Dst, 729); | 5390 | dasm_put(Dst, 739); |
5381 | #endif | 5391 | #endif |
5382 | dasm_put(Dst, 731, Dt1(->base)); | 5392 | dasm_put(Dst, 741, Dt1(->base)); |
5383 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 5393 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
5384 | dasm_put(Dst, 739); | 5394 | dasm_put(Dst, 749); |
5385 | #else | 5395 | #else |
5386 | dasm_put(Dst, 746); | 5396 | dasm_put(Dst, 756); |
5387 | #endif | 5397 | #endif |
5388 | dasm_put(Dst, 749, Dt1(->base), Dt7(->pc), Dt1(->base), Dt1(->base)); | 5398 | dasm_put(Dst, 759, Dt1(->base), Dt7(->pc), Dt1(->base), Dt1(->base)); |
5389 | #if LJ_HASJIT | 5399 | #if LJ_HASJIT |
5390 | dasm_put(Dst, 797); | 5400 | dasm_put(Dst, 807); |
5391 | #endif | 5401 | #endif |
5392 | dasm_put(Dst, 799); | 5402 | dasm_put(Dst, 809); |
5393 | #if LJ_HASJIT | 5403 | #if LJ_HASJIT |
5394 | dasm_put(Dst, 801, BC_JFORI); | 5404 | dasm_put(Dst, 811, BC_JFORI); |
5395 | #endif | 5405 | #endif |
5396 | dasm_put(Dst, 804); | 5406 | dasm_put(Dst, 814); |
5397 | #if LJ_HASJIT | 5407 | #if LJ_HASJIT |
5398 | dasm_put(Dst, 806, BC_JFORI); | 5408 | dasm_put(Dst, 816, BC_JFORI); |
5399 | #endif | 5409 | #endif |
5400 | dasm_put(Dst, 809, BC_FORI, ~LJ_TNUMX, 31-3, Dt8(->upvalue), Dt6(->metatable), DISPATCH_GL(gcroot[GCROOT_MMNAME+MM_metatable])); | 5410 | dasm_put(Dst, 819, BC_FORI, ~LJ_TNUMX, 31-3, Dt8(->upvalue), Dt6(->metatable), DISPATCH_GL(gcroot[GCROOT_MMNAME+MM_metatable])); |
5401 | dasm_put(Dst, 874, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), LJ_TUDATA, 31-2, 4*~LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT])); | 5411 | dasm_put(Dst, 884, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), LJ_TUDATA, 31-2, 4*~LJ_TNUMX, DISPATCH_GL(gcroot[GCROOT_BASEMT])); |
5402 | dasm_put(Dst, 930, Dt6(->metatable), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 5412 | dasm_put(Dst, 940, Dt6(->metatable), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
5403 | dasm_put(Dst, 990, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM]), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->top), (2+1)*8); | 5413 | dasm_put(Dst, 1000, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM]), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->top), (2+1)*8); |
5404 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 5414 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
5405 | dasm_put(Dst, 1063, Dt6(->metatable), Dt8(->upvalue[0])); | 5415 | dasm_put(Dst, 1073, Dt6(->metatable), Dt8(->upvalue[0])); |
5406 | #else | 5416 | #else |
5407 | dasm_put(Dst, 1072, Dt8(->upvalue[0])); | 5417 | dasm_put(Dst, 1082, Dt8(->upvalue[0])); |
5408 | #endif | 5418 | #endif |
5409 | dasm_put(Dst, 1076, (3+1)*8, Dt6(->asize), Dt6(->array), 31-3, (0+1)*8, (2+1)*8, Dt6(->hmask), (0+1)*8, (0+1)*8); | 5419 | dasm_put(Dst, 1086, (3+1)*8, Dt6(->asize), Dt6(->array), 31-3, (0+1)*8, (2+1)*8, Dt6(->hmask), (0+1)*8, (0+1)*8); |
5410 | dasm_put(Dst, 1140); | 5420 | dasm_put(Dst, 1150); |
5411 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 5421 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
5412 | dasm_put(Dst, 1153, Dt6(->metatable), Dt8(->upvalue[0])); | 5422 | dasm_put(Dst, 1163, Dt6(->metatable), Dt8(->upvalue[0])); |
5413 | #else | 5423 | #else |
5414 | dasm_put(Dst, 1162, Dt8(->upvalue[0])); | 5424 | dasm_put(Dst, 1172, Dt8(->upvalue[0])); |
5415 | #endif | 5425 | #endif |
5416 | dasm_put(Dst, 1166, (3+1)*8, DISPATCH_GL(hookmask), 32-HOOK_ACTIVE_SHIFT, 8+FRAME_PCALL, DISPATCH_GL(hookmask), 32-HOOK_ACTIVE_SHIFT, 16+FRAME_PCALL, LJ_TTHREAD, Dt1(->status), Dt1(->cframe), Dt1(->top)); | 5426 | dasm_put(Dst, 1176, (3+1)*8, DISPATCH_GL(hookmask), 32-HOOK_ACTIVE_SHIFT, 8+FRAME_PCALL, DISPATCH_GL(hookmask), 32-HOOK_ACTIVE_SHIFT, 16+FRAME_PCALL, LJ_TTHREAD, Dt1(->status), Dt1(->cframe), Dt1(->top)); |
5417 | dasm_put(Dst, 1227, LUA_YIELD, Dt1(->base), Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->base), LUA_YIELD, Dt1(->top), ~LJ_VMST_INTERP, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack)); | 5427 | dasm_put(Dst, 1237, LUA_YIELD, Dt1(->base), Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->base), LUA_YIELD, Dt1(->top), ~LJ_VMST_INTERP, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack)); |
5418 | dasm_put(Dst, 1290, Dt1(->top), FRAME_TYPE, LJ_TTRUE, FRAME_TYPE, LJ_TFALSE, Dt1(->top), (2+1)*8, 32-3); | 5428 | dasm_put(Dst, 1300, Dt1(->top), FRAME_TYPE, LJ_TTRUE, FRAME_TYPE, LJ_TFALSE, Dt1(->top), (2+1)*8, 32-3); |
5419 | dasm_put(Dst, 1350, Dt8(->upvalue[0].gcr), Dt1(->status), Dt1(->cframe), Dt1(->top), LUA_YIELD, Dt1(->base), Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->base), LUA_YIELD, Dt1(->top), ~LJ_VMST_INTERP); | 5429 | dasm_put(Dst, 1360, Dt8(->upvalue[0].gcr), Dt1(->status), Dt1(->cframe), Dt1(->top), LUA_YIELD, Dt1(->base), Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->top), Dt1(->base), LUA_YIELD, Dt1(->top), ~LJ_VMST_INTERP); |
5420 | dasm_put(Dst, 1409, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack), Dt1(->top), FRAME_TYPE, 32-3, Dt1(->cframe)); | 5430 | dasm_put(Dst, 1419, Dt1(->base), DISPATCH_GL(vmstate), Dt1(->maxstack), Dt1(->top), FRAME_TYPE, 32-3, Dt1(->cframe)); |
5421 | dasm_put(Dst, 1466, Dt1(->base), CFRAME_RESUME, Dt1(->top), LUA_YIELD, Dt1(->cframe), Dt1(->status), (1+1)*8, FRAME_TYPE); | 5431 | dasm_put(Dst, 1476, Dt1(->base), CFRAME_RESUME, Dt1(->top), LUA_YIELD, Dt1(->cframe), Dt1(->status), (1+1)*8, FRAME_TYPE); |
5422 | dasm_put(Dst, 1531); | 5432 | dasm_put(Dst, 1541); |
5423 | dasm_put(Dst, 1600); | 5433 | dasm_put(Dst, 1610); |
5424 | dasm_put(Dst, 1663); | 5434 | dasm_put(Dst, 1673); |
5425 | dasm_put(Dst, 1728); | 5435 | dasm_put(Dst, 1738); |
5426 | dasm_put(Dst, 1798, Dt8(->upvalue[0]), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), (2+1)*8, (2+1)*8); | 5436 | dasm_put(Dst, 1808, Dt8(->upvalue[0]), DISPATCH_GL(tmptv), DISPATCH_GL(tmptv), (2+1)*8, (2+1)*8); |
5427 | dasm_put(Dst, 1870, Dt5(->len)); | 5437 | dasm_put(Dst, 1880, Dt5(->len)); |
5428 | dasm_put(Dst, 1937, Dt5(->len), (0+1)*8, Dt5([1]), (1+1)*8, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmptv), Dt1(->base), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); | 5438 | dasm_put(Dst, 1947, Dt5(->len), (0+1)*8, Dt5([1]), (1+1)*8, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmptv), Dt1(->base), Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); |
5429 | dasm_put(Dst, 1997, Dt5(->len), sizeof(GCstr)-1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); | 5439 | dasm_put(Dst, 2007, Dt5(->len), sizeof(GCstr)-1, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); |
5430 | dasm_put(Dst, 2063, Dt5(->len), DISPATCH_GL(tmpbuf.sz), Dt5([1]), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(strempty), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); | 5440 | dasm_put(Dst, 2073, Dt5(->len), DISPATCH_GL(tmpbuf.sz), Dt5([1]), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(strempty), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold)); |
5431 | dasm_put(Dst, 2122, DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf)); | 5441 | dasm_put(Dst, 2132, DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf)); |
5432 | dasm_put(Dst, 2181, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf)); | 5442 | dasm_put(Dst, 2191, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), DISPATCH_GL(tmpbuf.sz), Dt5(->len), sizeof(GCstr), DISPATCH_GL(tmpbuf.buf)); |
5433 | dasm_put(Dst, 2248); | 5443 | dasm_put(Dst, 2258); |
5434 | dasm_put(Dst, 2319); | 5444 | dasm_put(Dst, 2329); |
5435 | dasm_put(Dst, 2407, Dt8(->f), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc)); | 5445 | dasm_put(Dst, 2417, Dt8(->f), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), 31-3, Dt1(->top), Dt7(->pc)); |
5436 | dasm_put(Dst, 2486, FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); | 5446 | dasm_put(Dst, 2496, FRAME_TYPE, LUA_MINSTACK, Dt1(->base), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); |
5437 | #if LJ_HASJIT | 5447 | #if LJ_HASJIT |
5438 | dasm_put(Dst, 2528); | 5448 | dasm_put(Dst, 2538); |
5439 | #endif | 5449 | #endif |
5440 | dasm_put(Dst, 2530, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, 31-LUA_HOOKLINE, DISPATCH_GL(hookcount), Dt1(->base), Dt1(->base)); | 5450 | dasm_put(Dst, 2540, DISPATCH_GL(hookmask), HOOK_ACTIVE, GG_DISP2STATIC, DISPATCH_GL(hookmask), DISPATCH_GL(hookcount), HOOK_ACTIVE, 31-LUA_HOOKLINE, DISPATCH_GL(hookcount), Dt1(->base), Dt1(->base)); |
5441 | dasm_put(Dst, 2577, GG_DISP2STATIC); | 5451 | dasm_put(Dst, 2587, GG_DISP2STATIC); |
5442 | #if LJ_HASJIT | 5452 | #if LJ_HASJIT |
5443 | dasm_put(Dst, 2595); | 5453 | dasm_put(Dst, 2605); |
5444 | #endif | 5454 | #endif |
5445 | dasm_put(Dst, 2597); | 5455 | dasm_put(Dst, 2607); |
5446 | #if LJ_HASJIT | 5456 | #if LJ_HASJIT |
5447 | dasm_put(Dst, 2600); | 5457 | dasm_put(Dst, 2610); |
5448 | #endif | 5458 | #endif |
5449 | dasm_put(Dst, 2603); | 5459 | dasm_put(Dst, 2613); |
5450 | #if LJ_HASJIT | 5460 | #if LJ_HASJIT |
5451 | dasm_put(Dst, 2605); | 5461 | dasm_put(Dst, 2615); |
5452 | #endif | 5462 | #endif |
5453 | dasm_put(Dst, 2608, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); | 5463 | dasm_put(Dst, 2618, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); |
5454 | #if LJ_HASJIT | 5464 | #if LJ_HASJIT |
5455 | dasm_put(Dst, 2630); | 5465 | dasm_put(Dst, 2640); |
5456 | #endif | 5466 | #endif |
5457 | dasm_put(Dst, 2632); | 5467 | dasm_put(Dst, 2642); |
5458 | #if LJ_HASJIT | 5468 | #if LJ_HASJIT |
5459 | dasm_put(Dst, 2634); | 5469 | dasm_put(Dst, 2644); |
5460 | #endif | 5470 | #endif |
5461 | dasm_put(Dst, 2636); | 5471 | dasm_put(Dst, 2646); |
5462 | #if LJ_HASJIT | 5472 | #if LJ_HASJIT |
5463 | dasm_put(Dst, 2720); | 5473 | dasm_put(Dst, 2730); |
5464 | #else | 5474 | #else |
5465 | dasm_put(Dst, 2743); | 5475 | dasm_put(Dst, 2753); |
5466 | #endif | 5476 | #endif |
5467 | dasm_put(Dst, 2746); | 5477 | dasm_put(Dst, 2756); |
5468 | #if LJ_HASJIT | 5478 | #if LJ_HASJIT |
5469 | dasm_put(Dst, 2748); | 5479 | dasm_put(Dst, 2758); |
5470 | #endif | 5480 | #endif |
5471 | dasm_put(Dst, 2750); | 5481 | dasm_put(Dst, 2760); |
5472 | #if LJ_HASJIT | 5482 | #if LJ_HASJIT |
5473 | dasm_put(Dst, 2752); | 5483 | dasm_put(Dst, 2762); |
5474 | #endif | 5484 | #endif |
5475 | dasm_put(Dst, 2754); | 5485 | dasm_put(Dst, 2764); |
5476 | #if LJ_HASFFI | 5486 | #if LJ_HASFFI |
5477 | dasm_put(Dst, 2817); | 5487 | dasm_put(Dst, 2827); |
5478 | #endif | 5488 | #endif |
5479 | } | 5489 | } |
5480 | 5490 | ||
@@ -5482,7 +5492,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
5482 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) | 5492 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) |
5483 | { | 5493 | { |
5484 | int vk = 0; | 5494 | int vk = 0; |
5485 | dasm_put(Dst, 2819, defop); | 5495 | dasm_put(Dst, 2829, defop); |
5486 | 5496 | ||
5487 | switch (op) { | 5497 | switch (op) { |
5488 | 5498 | ||
@@ -5491,118 +5501,118 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5491 | /* Remember: all ops branch for a true comparison, fall through otherwise. */ | 5501 | /* Remember: all ops branch for a true comparison, fall through otherwise. */ |
5492 | 5502 | ||
5493 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: | 5503 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: |
5494 | dasm_put(Dst, 2821, -(BCBIAS_J*4 >> 16)); | 5504 | dasm_put(Dst, 2831, -(BCBIAS_J*4 >> 16)); |
5495 | if (op == BC_ISLE || op == BC_ISGT) { | 5505 | if (op == BC_ISLE || op == BC_ISGT) { |
5496 | dasm_put(Dst, 2835); | 5506 | dasm_put(Dst, 2845); |
5497 | } | 5507 | } |
5498 | if (op == BC_ISLT || op == BC_ISLE) { | 5508 | if (op == BC_ISLT || op == BC_ISLE) { |
5499 | dasm_put(Dst, 2838); | 5509 | dasm_put(Dst, 2848); |
5500 | } else { | 5510 | } else { |
5501 | dasm_put(Dst, 2840); | 5511 | dasm_put(Dst, 2850); |
5502 | } | 5512 | } |
5503 | dasm_put(Dst, 2842); | 5513 | dasm_put(Dst, 2852); |
5504 | break; | 5514 | break; |
5505 | 5515 | ||
5506 | case BC_ISEQV: case BC_ISNEV: | 5516 | case BC_ISEQV: case BC_ISNEV: |
5507 | vk = op == BC_ISEQV; | 5517 | vk = op == BC_ISEQV; |
5508 | dasm_put(Dst, 2853, -(BCBIAS_J*4 >> 16)); | 5518 | dasm_put(Dst, 2863, -(BCBIAS_J*4 >> 16)); |
5509 | if (vk) { | 5519 | if (vk) { |
5510 | dasm_put(Dst, 2867); | 5520 | dasm_put(Dst, 2877); |
5511 | } else { | 5521 | } else { |
5512 | dasm_put(Dst, 2869); | 5522 | dasm_put(Dst, 2879); |
5513 | } | 5523 | } |
5514 | dasm_put(Dst, 2871, ~LJ_TISPRI, ~LJ_TISTABUD); | 5524 | dasm_put(Dst, 2881, ~LJ_TISPRI, ~LJ_TISTABUD); |
5515 | if (vk) { | 5525 | if (vk) { |
5516 | dasm_put(Dst, 2893); | 5526 | dasm_put(Dst, 2903); |
5517 | } else { | 5527 | } else { |
5518 | dasm_put(Dst, 2895); | 5528 | dasm_put(Dst, 2905); |
5519 | } | 5529 | } |
5520 | dasm_put(Dst, 2897); | 5530 | dasm_put(Dst, 2907); |
5521 | if (vk) { | 5531 | if (vk) { |
5522 | dasm_put(Dst, 2899); | 5532 | dasm_put(Dst, 2909); |
5523 | } else { | 5533 | } else { |
5524 | dasm_put(Dst, 2901); | 5534 | dasm_put(Dst, 2911); |
5525 | } | 5535 | } |
5526 | dasm_put(Dst, 2903, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); | 5536 | dasm_put(Dst, 2913, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); |
5527 | break; | 5537 | break; |
5528 | 5538 | ||
5529 | case BC_ISEQS: case BC_ISNES: | 5539 | case BC_ISEQS: case BC_ISNES: |
5530 | vk = op == BC_ISEQS; | 5540 | vk = op == BC_ISEQS; |
5531 | dasm_put(Dst, 2924, 32-1, -(BCBIAS_J*4 >> 16)); | 5541 | dasm_put(Dst, 2934, 32-1, -(BCBIAS_J*4 >> 16)); |
5532 | if (vk) { | 5542 | if (vk) { |
5533 | dasm_put(Dst, 2938); | 5543 | dasm_put(Dst, 2948); |
5534 | } else { | 5544 | } else { |
5535 | dasm_put(Dst, 2940); | 5545 | dasm_put(Dst, 2950); |
5536 | } | 5546 | } |
5537 | dasm_put(Dst, 2942); | 5547 | dasm_put(Dst, 2952); |
5538 | break; | 5548 | break; |
5539 | 5549 | ||
5540 | case BC_ISEQN: case BC_ISNEN: | 5550 | case BC_ISEQN: case BC_ISNEN: |
5541 | vk = op == BC_ISEQN; | 5551 | vk = op == BC_ISEQN; |
5542 | dasm_put(Dst, 2953, -(BCBIAS_J*4 >> 16)); | 5552 | dasm_put(Dst, 2963, -(BCBIAS_J*4 >> 16)); |
5543 | if (vk) { | 5553 | if (vk) { |
5544 | dasm_put(Dst, 2967); | 5554 | dasm_put(Dst, 2977); |
5545 | } else { | 5555 | } else { |
5546 | dasm_put(Dst, 2970); | 5556 | dasm_put(Dst, 2980); |
5547 | } | 5557 | } |
5548 | dasm_put(Dst, 2972); | 5558 | dasm_put(Dst, 2982); |
5549 | if (!vk) { | 5559 | if (!vk) { |
5550 | dasm_put(Dst, 2984); | 5560 | dasm_put(Dst, 2994); |
5551 | } | 5561 | } |
5552 | break; | 5562 | break; |
5553 | 5563 | ||
5554 | case BC_ISEQP: case BC_ISNEP: | 5564 | case BC_ISEQP: case BC_ISNEP: |
5555 | vk = op == BC_ISEQP; | 5565 | vk = op == BC_ISEQP; |
5556 | dasm_put(Dst, 2990, 32-3, -(BCBIAS_J*4 >> 16)); | 5566 | dasm_put(Dst, 3000, 32-3, -(BCBIAS_J*4 >> 16)); |
5557 | if (vk) { | 5567 | if (vk) { |
5558 | dasm_put(Dst, 3002); | 5568 | dasm_put(Dst, 3012); |
5559 | } else { | 5569 | } else { |
5560 | dasm_put(Dst, 3004); | 5570 | dasm_put(Dst, 3014); |
5561 | } | 5571 | } |
5562 | dasm_put(Dst, 3006); | 5572 | dasm_put(Dst, 3016); |
5563 | break; | 5573 | break; |
5564 | 5574 | ||
5565 | /* -- Unary test and copy ops ------------------------------------------- */ | 5575 | /* -- Unary test and copy ops ------------------------------------------- */ |
5566 | 5576 | ||
5567 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: | 5577 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: |
5568 | dasm_put(Dst, 3017); | 5578 | dasm_put(Dst, 3027); |
5569 | if (op == BC_IST || op == BC_ISF) { | 5579 | if (op == BC_IST || op == BC_ISF) { |
5570 | dasm_put(Dst, 3023, -(BCBIAS_J*4 >> 16)); | 5580 | dasm_put(Dst, 3033, -(BCBIAS_J*4 >> 16)); |
5571 | if (op == BC_IST) { | 5581 | if (op == BC_IST) { |
5572 | dasm_put(Dst, 3028); | 5582 | dasm_put(Dst, 3038); |
5573 | } else { | 5583 | } else { |
5574 | dasm_put(Dst, 3030); | 5584 | dasm_put(Dst, 3040); |
5575 | } | 5585 | } |
5576 | } else { | 5586 | } else { |
5577 | if (op == BC_ISTC) { | 5587 | if (op == BC_ISTC) { |
5578 | dasm_put(Dst, 3032); | 5588 | dasm_put(Dst, 3042); |
5579 | } else { | 5589 | } else { |
5580 | dasm_put(Dst, 3035); | 5590 | dasm_put(Dst, 3045); |
5581 | } | 5591 | } |
5582 | dasm_put(Dst, 3038, -(BCBIAS_J*4 >> 16)); | 5592 | dasm_put(Dst, 3048, -(BCBIAS_J*4 >> 16)); |
5583 | } | 5593 | } |
5584 | dasm_put(Dst, 3045); | 5594 | dasm_put(Dst, 3055); |
5585 | break; | 5595 | break; |
5586 | 5596 | ||
5587 | /* -- Unary ops --------------------------------------------------------- */ | 5597 | /* -- Unary ops --------------------------------------------------------- */ |
5588 | 5598 | ||
5589 | case BC_MOV: | 5599 | case BC_MOV: |
5590 | dasm_put(Dst, 3056); | 5600 | dasm_put(Dst, 3066); |
5591 | break; | 5601 | break; |
5592 | case BC_NOT: | 5602 | case BC_NOT: |
5593 | dasm_put(Dst, 3069, LJ_TTRUE); | 5603 | dasm_put(Dst, 3079, LJ_TTRUE); |
5594 | break; | 5604 | break; |
5595 | case BC_UNM: | 5605 | case BC_UNM: |
5596 | dasm_put(Dst, 3085); | 5606 | dasm_put(Dst, 3095); |
5597 | break; | 5607 | break; |
5598 | case BC_LEN: | 5608 | case BC_LEN: |
5599 | dasm_put(Dst, 3102, Dt5(->len)); | 5609 | dasm_put(Dst, 3112, Dt5(->len)); |
5600 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 5610 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
5601 | dasm_put(Dst, 3126, Dt6(->metatable)); | 5611 | dasm_put(Dst, 3136, Dt6(->metatable)); |
5602 | #endif | 5612 | #endif |
5603 | dasm_put(Dst, 3133); | 5613 | dasm_put(Dst, 3143); |
5604 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 5614 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
5605 | dasm_put(Dst, 3139, Dt6(->nomm), 1<<MM_len); | 5615 | dasm_put(Dst, 3149, Dt6(->nomm), 1<<MM_len); |
5606 | #endif | 5616 | #endif |
5607 | break; | 5617 | break; |
5608 | 5618 | ||
@@ -5613,262 +5623,262 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5613 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5623 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5614 | switch (vk) { | 5624 | switch (vk) { |
5615 | case 0: | 5625 | case 0: |
5616 | dasm_put(Dst, 3149); | 5626 | dasm_put(Dst, 3159); |
5617 | break; | 5627 | break; |
5618 | case 1: | 5628 | case 1: |
5619 | dasm_put(Dst, 3155); | 5629 | dasm_put(Dst, 3165); |
5620 | break; | 5630 | break; |
5621 | default: | 5631 | default: |
5622 | dasm_put(Dst, 3161); | 5632 | dasm_put(Dst, 3171); |
5623 | break; | 5633 | break; |
5624 | } | 5634 | } |
5625 | dasm_put(Dst, 3168); | 5635 | dasm_put(Dst, 3178); |
5626 | break; | 5636 | break; |
5627 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: | 5637 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: |
5628 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5638 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5629 | switch (vk) { | 5639 | switch (vk) { |
5630 | case 0: | 5640 | case 0: |
5631 | dasm_put(Dst, 3181); | 5641 | dasm_put(Dst, 3191); |
5632 | break; | 5642 | break; |
5633 | case 1: | 5643 | case 1: |
5634 | dasm_put(Dst, 3187); | 5644 | dasm_put(Dst, 3197); |
5635 | break; | 5645 | break; |
5636 | default: | 5646 | default: |
5637 | dasm_put(Dst, 3193); | 5647 | dasm_put(Dst, 3203); |
5638 | break; | 5648 | break; |
5639 | } | 5649 | } |
5640 | dasm_put(Dst, 3200); | 5650 | dasm_put(Dst, 3210); |
5641 | break; | 5651 | break; |
5642 | case BC_MULVN: case BC_MULNV: case BC_MULVV: | 5652 | case BC_MULVN: case BC_MULNV: case BC_MULVV: |
5643 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5653 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5644 | switch (vk) { | 5654 | switch (vk) { |
5645 | case 0: | 5655 | case 0: |
5646 | dasm_put(Dst, 3213); | 5656 | dasm_put(Dst, 3223); |
5647 | break; | 5657 | break; |
5648 | case 1: | 5658 | case 1: |
5649 | dasm_put(Dst, 3219); | 5659 | dasm_put(Dst, 3229); |
5650 | break; | 5660 | break; |
5651 | default: | 5661 | default: |
5652 | dasm_put(Dst, 3225); | 5662 | dasm_put(Dst, 3235); |
5653 | break; | 5663 | break; |
5654 | } | 5664 | } |
5655 | dasm_put(Dst, 3232); | 5665 | dasm_put(Dst, 3242); |
5656 | break; | 5666 | break; |
5657 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: | 5667 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: |
5658 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5668 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5659 | switch (vk) { | 5669 | switch (vk) { |
5660 | case 0: | 5670 | case 0: |
5661 | dasm_put(Dst, 3245); | 5671 | dasm_put(Dst, 3255); |
5662 | break; | 5672 | break; |
5663 | case 1: | 5673 | case 1: |
5664 | dasm_put(Dst, 3251); | 5674 | dasm_put(Dst, 3261); |
5665 | break; | 5675 | break; |
5666 | default: | 5676 | default: |
5667 | dasm_put(Dst, 3257); | 5677 | dasm_put(Dst, 3267); |
5668 | break; | 5678 | break; |
5669 | } | 5679 | } |
5670 | dasm_put(Dst, 3264); | 5680 | dasm_put(Dst, 3274); |
5671 | break; | 5681 | break; |
5672 | case BC_MODVN: | 5682 | case BC_MODVN: |
5673 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5683 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5674 | switch (vk) { | 5684 | switch (vk) { |
5675 | case 0: | 5685 | case 0: |
5676 | dasm_put(Dst, 3277); | 5686 | dasm_put(Dst, 3287); |
5677 | break; | 5687 | break; |
5678 | case 1: | 5688 | case 1: |
5679 | dasm_put(Dst, 3283); | 5689 | dasm_put(Dst, 3293); |
5680 | break; | 5690 | break; |
5681 | default: | 5691 | default: |
5682 | dasm_put(Dst, 3289); | 5692 | dasm_put(Dst, 3299); |
5683 | break; | 5693 | break; |
5684 | } | 5694 | } |
5685 | dasm_put(Dst, 3296); | 5695 | dasm_put(Dst, 3306); |
5686 | break; | 5696 | break; |
5687 | case BC_MODNV: case BC_MODVV: | 5697 | case BC_MODNV: case BC_MODVV: |
5688 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5698 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5689 | switch (vk) { | 5699 | switch (vk) { |
5690 | case 0: | 5700 | case 0: |
5691 | dasm_put(Dst, 3314); | 5701 | dasm_put(Dst, 3324); |
5692 | break; | 5702 | break; |
5693 | case 1: | 5703 | case 1: |
5694 | dasm_put(Dst, 3320); | 5704 | dasm_put(Dst, 3330); |
5695 | break; | 5705 | break; |
5696 | default: | 5706 | default: |
5697 | dasm_put(Dst, 3326); | 5707 | dasm_put(Dst, 3336); |
5698 | break; | 5708 | break; |
5699 | } | 5709 | } |
5700 | dasm_put(Dst, 3333); | 5710 | dasm_put(Dst, 3343); |
5701 | break; | 5711 | break; |
5702 | case BC_POW: | 5712 | case BC_POW: |
5703 | dasm_put(Dst, 3336); | 5713 | dasm_put(Dst, 3346); |
5704 | break; | 5714 | break; |
5705 | 5715 | ||
5706 | case BC_CAT: | 5716 | case BC_CAT: |
5707 | dasm_put(Dst, 3358, Dt1(->base), 32-3, Dt1(->base)); | 5717 | dasm_put(Dst, 3368, Dt1(->base), 32-3, Dt1(->base)); |
5708 | break; | 5718 | break; |
5709 | 5719 | ||
5710 | /* -- Constant ops ------------------------------------------------------ */ | 5720 | /* -- Constant ops ------------------------------------------------------ */ |
5711 | 5721 | ||
5712 | case BC_KSTR: | 5722 | case BC_KSTR: |
5713 | dasm_put(Dst, 3388, 32-1); | 5723 | dasm_put(Dst, 3398, 32-1); |
5714 | break; | 5724 | break; |
5715 | case BC_KCDATA: | 5725 | case BC_KCDATA: |
5716 | #if LJ_HASFFI | 5726 | #if LJ_HASFFI |
5717 | dasm_put(Dst, 3405, 32-1, LJ_TCDATA); | 5727 | dasm_put(Dst, 3415, 32-1, LJ_TCDATA); |
5718 | #endif | 5728 | #endif |
5719 | break; | 5729 | break; |
5720 | case BC_KSHORT: | 5730 | case BC_KSHORT: |
5721 | dasm_put(Dst, 3424, 32-3); | 5731 | dasm_put(Dst, 3434, 32-3); |
5722 | break; | 5732 | break; |
5723 | case BC_KNUM: | 5733 | case BC_KNUM: |
5724 | dasm_put(Dst, 3440); | 5734 | dasm_put(Dst, 3450); |
5725 | break; | 5735 | break; |
5726 | case BC_KPRI: | 5736 | case BC_KPRI: |
5727 | dasm_put(Dst, 3453, 32-3); | 5737 | dasm_put(Dst, 3463, 32-3); |
5728 | break; | 5738 | break; |
5729 | case BC_KNIL: | 5739 | case BC_KNIL: |
5730 | dasm_put(Dst, 3468); | 5740 | dasm_put(Dst, 3478); |
5731 | break; | 5741 | break; |
5732 | 5742 | ||
5733 | /* -- Upvalue and function ops ------------------------------------------ */ | 5743 | /* -- Upvalue and function ops ------------------------------------------ */ |
5734 | 5744 | ||
5735 | case BC_UGET: | 5745 | case BC_UGET: |
5736 | dasm_put(Dst, 3487, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); | 5746 | dasm_put(Dst, 3497, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); |
5737 | break; | 5747 | break; |
5738 | case BC_USETV: | 5748 | case BC_USETV: |
5739 | dasm_put(Dst, 3508, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); | 5749 | dasm_put(Dst, 3518, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); |
5740 | break; | 5750 | break; |
5741 | case BC_USETS: | 5751 | case BC_USETS: |
5742 | dasm_put(Dst, 3560, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); | 5752 | dasm_put(Dst, 3570, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); |
5743 | break; | 5753 | break; |
5744 | case BC_USETN: | 5754 | case BC_USETN: |
5745 | dasm_put(Dst, 3609, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); | 5755 | dasm_put(Dst, 3619, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); |
5746 | break; | 5756 | break; |
5747 | case BC_USETP: | 5757 | case BC_USETP: |
5748 | dasm_put(Dst, 3630, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); | 5758 | dasm_put(Dst, 3640, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); |
5749 | break; | 5759 | break; |
5750 | 5760 | ||
5751 | case BC_UCLO: | 5761 | case BC_UCLO: |
5752 | dasm_put(Dst, 3653, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); | 5762 | dasm_put(Dst, 3663, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); |
5753 | break; | 5763 | break; |
5754 | 5764 | ||
5755 | case BC_FNEW: | 5765 | case BC_FNEW: |
5756 | dasm_put(Dst, 3683, 32-1, Dt1(->base), Dt1(->base)); | 5766 | dasm_put(Dst, 3693, 32-1, Dt1(->base), Dt1(->base)); |
5757 | break; | 5767 | break; |
5758 | 5768 | ||
5759 | /* -- Table ops --------------------------------------------------------- */ | 5769 | /* -- Table ops --------------------------------------------------------- */ |
5760 | 5770 | ||
5761 | case BC_TNEW: | 5771 | case BC_TNEW: |
5762 | case BC_TDUP: | 5772 | case BC_TDUP: |
5763 | dasm_put(Dst, 3709, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); | 5773 | dasm_put(Dst, 3719, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); |
5764 | if (op == BC_TNEW) { | 5774 | if (op == BC_TNEW) { |
5765 | dasm_put(Dst, 3722); | 5775 | dasm_put(Dst, 3732); |
5766 | } else { | 5776 | } else { |
5767 | dasm_put(Dst, 3730, 32-1); | 5777 | dasm_put(Dst, 3740, 32-1); |
5768 | } | 5778 | } |
5769 | dasm_put(Dst, 3737, Dt1(->base)); | 5779 | dasm_put(Dst, 3747, Dt1(->base)); |
5770 | break; | 5780 | break; |
5771 | 5781 | ||
5772 | case BC_GGET: | 5782 | case BC_GGET: |
5773 | case BC_GSET: | 5783 | case BC_GSET: |
5774 | dasm_put(Dst, 3760, 32-1, Dt7(->env)); | 5784 | dasm_put(Dst, 3770, 32-1, Dt7(->env)); |
5775 | if (op == BC_GGET) { | 5785 | if (op == BC_GGET) { |
5776 | dasm_put(Dst, 3768); | 5786 | dasm_put(Dst, 3778); |
5777 | } else { | 5787 | } else { |
5778 | dasm_put(Dst, 3771); | 5788 | dasm_put(Dst, 3781); |
5779 | } | 5789 | } |
5780 | break; | 5790 | break; |
5781 | 5791 | ||
5782 | case BC_TGETV: | 5792 | case BC_TGETV: |
5783 | dasm_put(Dst, 3774, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 5793 | dasm_put(Dst, 3784, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
5784 | break; | 5794 | break; |
5785 | case BC_TGETS: | 5795 | case BC_TGETS: |
5786 | dasm_put(Dst, 3832, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 5796 | dasm_put(Dst, 3842, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
5787 | dasm_put(Dst, 3896); | 5797 | dasm_put(Dst, 3906); |
5788 | break; | 5798 | break; |
5789 | case BC_TGETB: | 5799 | case BC_TGETB: |
5790 | dasm_put(Dst, 3901, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 5800 | dasm_put(Dst, 3911, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
5791 | break; | 5801 | break; |
5792 | 5802 | ||
5793 | case BC_TSETV: | 5803 | case BC_TSETV: |
5794 | dasm_put(Dst, 3945, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); | 5804 | dasm_put(Dst, 3955, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); |
5795 | dasm_put(Dst, 4012, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 5805 | dasm_put(Dst, 4022, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
5796 | break; | 5806 | break; |
5797 | case BC_TSETS: | 5807 | case BC_TSETS: |
5798 | dasm_put(Dst, 4024, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), DtB(->val), LJ_GC_BLACK, DtB(->val), Dt6(->metatable)); | 5808 | dasm_put(Dst, 4034, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), DtB(->val), LJ_GC_BLACK, DtB(->val), Dt6(->metatable)); |
5799 | dasm_put(Dst, 4085, Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain)); | 5809 | dasm_put(Dst, 4095, Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain)); |
5800 | dasm_put(Dst, 4136, Dt6(->marked), Dt6(->gclist)); | 5810 | dasm_put(Dst, 4146, Dt6(->marked), Dt6(->gclist)); |
5801 | break; | 5811 | break; |
5802 | case BC_TSETB: | 5812 | case BC_TSETB: |
5803 | dasm_put(Dst, 4143, 32-3, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked)); | 5813 | dasm_put(Dst, 4153, 32-3, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked)); |
5804 | dasm_put(Dst, 4203, Dt6(->gclist)); | 5814 | dasm_put(Dst, 4213, Dt6(->gclist)); |
5805 | break; | 5815 | break; |
5806 | 5816 | ||
5807 | case BC_TSETM: | 5817 | case BC_TSETM: |
5808 | dasm_put(Dst, 4208, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 5818 | dasm_put(Dst, 4218, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
5809 | dasm_put(Dst, 4277); | 5819 | dasm_put(Dst, 4287); |
5810 | break; | 5820 | break; |
5811 | 5821 | ||
5812 | /* -- Calls and vararg handling ----------------------------------------- */ | 5822 | /* -- Calls and vararg handling ----------------------------------------- */ |
5813 | 5823 | ||
5814 | case BC_CALLM: | 5824 | case BC_CALLM: |
5815 | dasm_put(Dst, 4280); | 5825 | dasm_put(Dst, 4290); |
5816 | break; | 5826 | break; |
5817 | case BC_CALL: | 5827 | case BC_CALL: |
5818 | dasm_put(Dst, 4282, Dt7(->pc)); | 5828 | dasm_put(Dst, 4292, Dt7(->pc)); |
5819 | break; | 5829 | break; |
5820 | 5830 | ||
5821 | case BC_CALLMT: | 5831 | case BC_CALLMT: |
5822 | dasm_put(Dst, 4302); | 5832 | dasm_put(Dst, 4312); |
5823 | break; | 5833 | break; |
5824 | case BC_CALLT: | 5834 | case BC_CALLT: |
5825 | dasm_put(Dst, 4304, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); | 5835 | dasm_put(Dst, 4314, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); |
5826 | dasm_put(Dst, 4369, FRAME_TYPE); | 5836 | dasm_put(Dst, 4379, FRAME_TYPE); |
5827 | break; | 5837 | break; |
5828 | 5838 | ||
5829 | case BC_ITERC: | 5839 | case BC_ITERC: |
5830 | dasm_put(Dst, 4376, Dt7(->pc)); | 5840 | dasm_put(Dst, 4386, Dt7(->pc)); |
5831 | break; | 5841 | break; |
5832 | 5842 | ||
5833 | case BC_ITERN: | 5843 | case BC_ITERN: |
5834 | #if LJ_HASJIT | 5844 | #if LJ_HASJIT |
5835 | #endif | 5845 | #endif |
5836 | dasm_put(Dst, 4402, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); | 5846 | dasm_put(Dst, 4412, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); |
5837 | dasm_put(Dst, 4481); | 5847 | dasm_put(Dst, 4491); |
5838 | break; | 5848 | break; |
5839 | 5849 | ||
5840 | case BC_ISNEXT: | 5850 | case BC_ISNEXT: |
5841 | dasm_put(Dst, 4485, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); | 5851 | dasm_put(Dst, 4495, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); |
5842 | break; | 5852 | break; |
5843 | 5853 | ||
5844 | case BC_VARG: | 5854 | case BC_VARG: |
5845 | dasm_put(Dst, 4536, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); | 5855 | dasm_put(Dst, 4546, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); |
5846 | dasm_put(Dst, 4616); | 5856 | dasm_put(Dst, 4626); |
5847 | break; | 5857 | break; |
5848 | 5858 | ||
5849 | /* -- Returns ----------------------------------------------------------- */ | 5859 | /* -- Returns ----------------------------------------------------------- */ |
5850 | 5860 | ||
5851 | case BC_RETM: | 5861 | case BC_RETM: |
5852 | dasm_put(Dst, 4622); | 5862 | dasm_put(Dst, 4632); |
5853 | break; | 5863 | break; |
5854 | 5864 | ||
5855 | case BC_RET: | 5865 | case BC_RET: |
5856 | dasm_put(Dst, 4624, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); | 5866 | dasm_put(Dst, 4634, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); |
5857 | break; | 5867 | break; |
5858 | 5868 | ||
5859 | case BC_RET0: case BC_RET1: | 5869 | case BC_RET0: case BC_RET1: |
5860 | dasm_put(Dst, 4694, FRAME_TYPE, FRAME_VARG); | 5870 | dasm_put(Dst, 4704, FRAME_TYPE, FRAME_VARG); |
5861 | if (op == BC_RET1) { | 5871 | if (op == BC_RET1) { |
5862 | dasm_put(Dst, 4707); | 5872 | dasm_put(Dst, 4717); |
5863 | } | 5873 | } |
5864 | dasm_put(Dst, 4710, Dt7(->pc), PC2PROTO(k)); | 5874 | dasm_put(Dst, 4720, Dt7(->pc), PC2PROTO(k)); |
5865 | break; | 5875 | break; |
5866 | 5876 | ||
5867 | /* -- Loops and branches ------------------------------------------------ */ | 5877 | /* -- Loops and branches ------------------------------------------------ */ |
5868 | 5878 | ||
5869 | case BC_FORL: | 5879 | case BC_FORL: |
5870 | #if LJ_HASJIT | 5880 | #if LJ_HASJIT |
5871 | dasm_put(Dst, 4738); | 5881 | dasm_put(Dst, 4748); |
5872 | #endif | 5882 | #endif |
5873 | break; | 5883 | break; |
5874 | 5884 | ||
@@ -5880,35 +5890,35 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5880 | case BC_FORI: | 5890 | case BC_FORI: |
5881 | case BC_IFORL: | 5891 | case BC_IFORL: |
5882 | vk = (op == BC_IFORL || op == BC_JFORL); | 5892 | vk = (op == BC_IFORL || op == BC_JFORL); |
5883 | dasm_put(Dst, 4740, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); | 5893 | dasm_put(Dst, 4750, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); |
5884 | if (!vk) { | 5894 | if (!vk) { |
5885 | dasm_put(Dst, 4748); | 5895 | dasm_put(Dst, 4758); |
5886 | } | 5896 | } |
5887 | if (vk) { | 5897 | if (vk) { |
5888 | dasm_put(Dst, 4756, FORL_IDX*8); | 5898 | dasm_put(Dst, 4766, FORL_IDX*8); |
5889 | } | 5899 | } |
5890 | dasm_put(Dst, 4760, FORL_EXT*8); | 5900 | dasm_put(Dst, 4770, FORL_EXT*8); |
5891 | if (op != BC_JFORL) { | 5901 | if (op != BC_JFORL) { |
5892 | dasm_put(Dst, 4768, 32-1); | 5902 | dasm_put(Dst, 4778, 32-1); |
5893 | if (op == BC_JFORI) { | 5903 | if (op == BC_JFORI) { |
5894 | dasm_put(Dst, 4772, -(BCBIAS_J*4 >> 16)); | 5904 | dasm_put(Dst, 4782, -(BCBIAS_J*4 >> 16)); |
5895 | } else { | 5905 | } else { |
5896 | dasm_put(Dst, 4775, -(BCBIAS_J*4 >> 16)); | 5906 | dasm_put(Dst, 4785, -(BCBIAS_J*4 >> 16)); |
5897 | } | 5907 | } |
5898 | } | 5908 | } |
5899 | if (op == BC_FORI) { | 5909 | if (op == BC_FORI) { |
5900 | dasm_put(Dst, 4778); | 5910 | dasm_put(Dst, 4788); |
5901 | } else if (op == BC_IFORL) { | 5911 | } else if (op == BC_IFORL) { |
5902 | dasm_put(Dst, 4780); | 5912 | dasm_put(Dst, 4790); |
5903 | } else { | 5913 | } else { |
5904 | dasm_put(Dst, 4782, BC_JLOOP); | 5914 | dasm_put(Dst, 4792, BC_JLOOP); |
5905 | } | 5915 | } |
5906 | dasm_put(Dst, 4785); | 5916 | dasm_put(Dst, 4795); |
5907 | break; | 5917 | break; |
5908 | 5918 | ||
5909 | case BC_ITERL: | 5919 | case BC_ITERL: |
5910 | #if LJ_HASJIT | 5920 | #if LJ_HASJIT |
5911 | dasm_put(Dst, 4800); | 5921 | dasm_put(Dst, 4810); |
5912 | #endif | 5922 | #endif |
5913 | break; | 5923 | break; |
5914 | 5924 | ||
@@ -5917,40 +5927,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5917 | break; | 5927 | break; |
5918 | #endif | 5928 | #endif |
5919 | case BC_IITERL: | 5929 | case BC_IITERL: |
5920 | dasm_put(Dst, 4802); | 5930 | dasm_put(Dst, 4812); |
5921 | if (op == BC_JITERL) { | 5931 | if (op == BC_JITERL) { |
5922 | dasm_put(Dst, 4808); | 5932 | dasm_put(Dst, 4818); |
5923 | } else { | 5933 | } else { |
5924 | dasm_put(Dst, 4810, 32-1, -(BCBIAS_J*4 >> 16)); | 5934 | dasm_put(Dst, 4820, 32-1, -(BCBIAS_J*4 >> 16)); |
5925 | } | 5935 | } |
5926 | dasm_put(Dst, 4817); | 5936 | dasm_put(Dst, 4827); |
5927 | break; | 5937 | break; |
5928 | 5938 | ||
5929 | case BC_LOOP: | 5939 | case BC_LOOP: |
5930 | #if LJ_HASJIT | 5940 | #if LJ_HASJIT |
5931 | dasm_put(Dst, 4829); | 5941 | dasm_put(Dst, 4839); |
5932 | #endif | 5942 | #endif |
5933 | break; | 5943 | break; |
5934 | 5944 | ||
5935 | case BC_ILOOP: | 5945 | case BC_ILOOP: |
5936 | dasm_put(Dst, 4831); | 5946 | dasm_put(Dst, 4841); |
5937 | break; | 5947 | break; |
5938 | 5948 | ||
5939 | case BC_JLOOP: | 5949 | case BC_JLOOP: |
5940 | #if LJ_HASJIT | 5950 | #if LJ_HASJIT |
5941 | dasm_put(Dst, 4842); | 5951 | dasm_put(Dst, 4852); |
5942 | #endif | 5952 | #endif |
5943 | break; | 5953 | break; |
5944 | 5954 | ||
5945 | case BC_JMP: | 5955 | case BC_JMP: |
5946 | dasm_put(Dst, 4844, 32-1, -(BCBIAS_J*4 >> 16)); | 5956 | dasm_put(Dst, 4854, 32-1, -(BCBIAS_J*4 >> 16)); |
5947 | break; | 5957 | break; |
5948 | 5958 | ||
5949 | /* -- Function headers -------------------------------------------------- */ | 5959 | /* -- Function headers -------------------------------------------------- */ |
5950 | 5960 | ||
5951 | case BC_FUNCF: | 5961 | case BC_FUNCF: |
5952 | #if LJ_HASJIT | 5962 | #if LJ_HASJIT |
5953 | dasm_put(Dst, 4860); | 5963 | dasm_put(Dst, 4870); |
5954 | #endif | 5964 | #endif |
5955 | case BC_FUNCV: /* NYI: compiled vararg functions. */ | 5965 | case BC_FUNCV: /* NYI: compiled vararg functions. */ |
5956 | break; | 5966 | break; |
@@ -5960,38 +5970,38 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5960 | break; | 5970 | break; |
5961 | #endif | 5971 | #endif |
5962 | case BC_IFUNCF: | 5972 | case BC_IFUNCF: |
5963 | dasm_put(Dst, 4862, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); | 5973 | dasm_put(Dst, 4872, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); |
5964 | if (op == BC_JFUNCF) { | 5974 | if (op == BC_JFUNCF) { |
5965 | dasm_put(Dst, 4880); | 5975 | dasm_put(Dst, 4890); |
5966 | } else { | 5976 | } else { |
5967 | dasm_put(Dst, 4882); | 5977 | dasm_put(Dst, 4892); |
5968 | } | 5978 | } |
5969 | dasm_put(Dst, 4891); | 5979 | dasm_put(Dst, 4901); |
5970 | break; | 5980 | break; |
5971 | 5981 | ||
5972 | case BC_JFUNCV: | 5982 | case BC_JFUNCV: |
5973 | #if !LJ_HASJIT | 5983 | #if !LJ_HASJIT |
5974 | break; | 5984 | break; |
5975 | #endif | 5985 | #endif |
5976 | dasm_put(Dst, 4897); | 5986 | dasm_put(Dst, 4907); |
5977 | break; /* NYI: compiled vararg functions. */ | 5987 | break; /* NYI: compiled vararg functions. */ |
5978 | 5988 | ||
5979 | case BC_IFUNCV: | 5989 | case BC_IFUNCV: |
5980 | dasm_put(Dst, 4899, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); | 5990 | dasm_put(Dst, 4909, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); |
5981 | break; | 5991 | break; |
5982 | 5992 | ||
5983 | case BC_FUNCC: | 5993 | case BC_FUNCC: |
5984 | case BC_FUNCCW: | 5994 | case BC_FUNCCW: |
5985 | if (op == BC_FUNCC) { | 5995 | if (op == BC_FUNCC) { |
5986 | dasm_put(Dst, 4949, Dt8(->f)); | 5996 | dasm_put(Dst, 4959, Dt8(->f)); |
5987 | } else { | 5997 | } else { |
5988 | dasm_put(Dst, 4952, DISPATCH_GL(wrapf)); | 5998 | dasm_put(Dst, 4962, DISPATCH_GL(wrapf)); |
5989 | } | 5999 | } |
5990 | dasm_put(Dst, 4955, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); | 6000 | dasm_put(Dst, 4965, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); |
5991 | if (op == BC_FUNCCW) { | 6001 | if (op == BC_FUNCCW) { |
5992 | dasm_put(Dst, 4968, Dt8(->f)); | 6002 | dasm_put(Dst, 4978, Dt8(->f)); |
5993 | } | 6003 | } |
5994 | dasm_put(Dst, 4971, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); | 6004 | dasm_put(Dst, 4981, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); |
5995 | break; | 6005 | break; |
5996 | 6006 | ||
5997 | /* ---------------------------------------------------------------------- */ | 6007 | /* ---------------------------------------------------------------------- */ |
@@ -6011,7 +6021,7 @@ static int build_backend(BuildCtx *ctx) | |||
6011 | 6021 | ||
6012 | build_subroutines(ctx); | 6022 | build_subroutines(ctx); |
6013 | 6023 | ||
6014 | dasm_put(Dst, 4992); | 6024 | dasm_put(Dst, 5002); |
6015 | for (op = 0; op < BC__MAX; op++) | 6025 | for (op = 0; op < BC__MAX; op++) |
6016 | build_ins(ctx, (BCOp)op, op); | 6026 | build_ins(ctx, (BCOp)op, op); |
6017 | 6027 | ||
@@ -6046,7 +6056,8 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
6046 | "\t.long .Lbegin\n" | 6056 | "\t.long .Lbegin\n" |
6047 | "\t.long %d\n" | 6057 | "\t.long %d\n" |
6048 | "\t.byte 0xe\n\t.uleb128 %d\n" | 6058 | "\t.byte 0xe\n\t.uleb128 %d\n" |
6049 | "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n", | 6059 | "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n" |
6060 | "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n", | ||
6050 | (int)ctx->codesz, CFRAME_SIZE); | 6061 | (int)ctx->codesz, CFRAME_SIZE); |
6051 | for (i = 14; i <= 31; i++) | 6062 | for (i = 14; i <= 31; i++) |
6052 | fprintf(ctx->fp, | 6063 | fprintf(ctx->fp, |
@@ -6083,7 +6094,8 @@ static void emit_asm_debug(BuildCtx *ctx) | |||
6083 | "\t.long %d\n" | 6094 | "\t.long %d\n" |
6084 | "\t.uleb128 0\n" /* augmentation length */ | 6095 | "\t.uleb128 0\n" /* augmentation length */ |
6085 | "\t.byte 0xe\n\t.uleb128 %d\n" | 6096 | "\t.byte 0xe\n\t.uleb128 %d\n" |
6086 | "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n", | 6097 | "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n" |
6098 | "\t.byte 0x5\n\t.uleb128 70\n\t.sleb128 37\n", | ||
6087 | (int)ctx->codesz, CFRAME_SIZE); | 6099 | (int)ctx->codesz, CFRAME_SIZE); |
6088 | for (i = 14; i <= 31; i++) | 6100 | for (i = 14; i <= 31; i++) |
6089 | fprintf(ctx->fp, | 6101 | fprintf(ctx->fp, |
diff --git a/src/lj_ccall.c b/src/lj_ccall.c index 183e471c..3ec5b1cc 100644 --- a/src/lj_ccall.c +++ b/src/lj_ccall.c | |||
@@ -578,7 +578,7 @@ static int ccall_set_args(lua_State *L, CTState *cts, CType *ct, | |||
578 | } | 578 | } |
579 | if (fid) lj_err_caller(L, LJ_ERR_FFI_NUMARG); /* Too few arguments. */ | 579 | if (fid) lj_err_caller(L, LJ_ERR_FFI_NUMARG); /* Too few arguments. */ |
580 | 580 | ||
581 | #if LJ_TARGET_X64 || LJ_TARGET_PPC || LJ_TARGET_PPCSPE | 581 | #if LJ_TARGET_X64 || LJ_TARGET_PPC |
582 | cc->nfpr = nfpr; /* Required for vararg functions. */ | 582 | cc->nfpr = nfpr; /* Required for vararg functions. */ |
583 | #endif | 583 | #endif |
584 | cc->nsp = nsp; | 584 | cc->nsp = nsp; |
diff --git a/src/lj_ccall.h b/src/lj_ccall.h index 9a927745..d9b1e42c 100644 --- a/src/lj_ccall.h +++ b/src/lj_ccall.h | |||
@@ -112,7 +112,7 @@ typedef struct CCallState { | |||
112 | uint8_t nfpr; /* Number of arguments in FPRs. */ | 112 | uint8_t nfpr; /* Number of arguments in FPRs. */ |
113 | #elif LJ_TARGET_X86 | 113 | #elif LJ_TARGET_X86 |
114 | uint8_t resx87; /* Result on x87 stack: 1:float, 2:double. */ | 114 | uint8_t resx87; /* Result on x87 stack: 1:float, 2:double. */ |
115 | #elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE | 115 | #elif LJ_TARGET_PPC |
116 | uint8_t nfpr; /* Number of arguments in FPRs. */ | 116 | uint8_t nfpr; /* Number of arguments in FPRs. */ |
117 | #endif | 117 | #endif |
118 | #if CCALL_NUM_FPR | 118 | #if CCALL_NUM_FPR |
diff --git a/src/lj_frame.h b/src/lj_frame.h index b8b7a727..89484565 100644 --- a/src/lj_frame.h +++ b/src/lj_frame.h | |||
@@ -115,7 +115,7 @@ enum { | |||
115 | #define CFRAME_OFS_L 16 | 115 | #define CFRAME_OFS_L 16 |
116 | #define CFRAME_OFS_PC 12 | 116 | #define CFRAME_OFS_PC 12 |
117 | #define CFRAME_OFS_MULTRES 8 | 117 | #define CFRAME_OFS_MULTRES 8 |
118 | #define CFRAME_SIZE 176 | 118 | #define CFRAME_SIZE 184 |
119 | #define CFRAME_SHIFT_MULTRES 3 | 119 | #define CFRAME_SHIFT_MULTRES 3 |
120 | #else | 120 | #else |
121 | #error "Missing CFRAME_* definitions for this architecture" | 121 | #error "Missing CFRAME_* definitions for this architecture" |