diff options
author | Mike Pall <mike> | 2012-03-29 01:12:54 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-03-29 01:14:24 +0200 |
commit | 1980ee95b0d5343822d6c92abf9f8feb15ac9764 (patch) | |
tree | 9b0a85ee294d2b1004118a7edc1356a9dedbfbdf | |
parent | a53a5497742c5249a6cad7e3e25075b8e679ba85 (diff) | |
download | luajit-1980ee95b0d5343822d6c92abf9f8feb15ac9764.tar.gz luajit-1980ee95b0d5343822d6c92abf9f8feb15ac9764.tar.bz2 luajit-1980ee95b0d5343822d6c92abf9f8feb15ac9764.zip |
PPC: Use builtin D-Cache/I-Cache sync code.
-rw-r--r-- | src/buildvm_ppc.dasc | 25 | ||||
-rw-r--r-- | src/buildvm_ppc.h | 830 | ||||
-rw-r--r-- | src/lj_mcode.c | 20 | ||||
-rw-r--r-- | src/lj_vm.h | 3 |
4 files changed, 458 insertions, 420 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index 132242d8..027e75b0 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
@@ -2533,6 +2533,31 @@ static void build_subroutines(BuildCtx *ctx) | |||
2533 | |//-- Miscellaneous functions -------------------------------------------- | 2533 | |//-- Miscellaneous functions -------------------------------------------- |
2534 | |//----------------------------------------------------------------------- | 2534 | |//----------------------------------------------------------------------- |
2535 | | | 2535 | | |
2536 | |// void lj_vm_cachesync(void *start, void *end) | ||
2537 | |// Flush D-Cache and invalidate I-Cache. Assumes 32 byte cache line size. | ||
2538 | |// This is a good lower bound, except for very ancient PPC models. | ||
2539 | |->vm_cachesync: | ||
2540 | | // Compute start of first cache line and number of cache lines. | ||
2541 | | rlwinm CARG1, CARG1, 0, 0, 26 | ||
2542 | | sub CARG2, CARG2, CARG1 | ||
2543 | | addi CARG2, CARG2, 31 | ||
2544 | | rlwinm. CARG2, CARG2, 27, 5, 31 | ||
2545 | | beqlr | ||
2546 | | mtctr CARG2 | ||
2547 | | mr CARG3, CARG1 | ||
2548 | |1: // Flush D-Cache. | ||
2549 | | dcbst r0, CARG1 | ||
2550 | | addi CARG1, CARG1, 32 | ||
2551 | | bdnz <1 | ||
2552 | | sync | ||
2553 | | mtctr CARG2 | ||
2554 | |1: // Invalidate I-Cache. | ||
2555 | | icbi r0, CARG3 | ||
2556 | | addi CARG3, CARG3, 32 | ||
2557 | | bdnz <1 | ||
2558 | | isync | ||
2559 | | blr | ||
2560 | | | ||
2536 | |//----------------------------------------------------------------------- | 2561 | |//----------------------------------------------------------------------- |
2537 | |//-- FFI helper functions ----------------------------------------------- | 2562 | |//-- FFI helper functions ----------------------------------------------- |
2538 | |//----------------------------------------------------------------------- | 2563 | |//----------------------------------------------------------------------- |
diff --git a/src/buildvm_ppc.h b/src/buildvm_ppc.h index c8d76fda..81285d63 100644 --- a/src/buildvm_ppc.h +++ b/src/buildvm_ppc.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[7740] = { | 15 | static const unsigned int build_actionlist[7762] = { |
16 | 0x00010001, | 16 | 0x00010001, |
17 | 0x00060014, | 17 | 0x00060014, |
18 | 0x72000000, | 18 | 0x72000000, |
@@ -4103,6 +4103,28 @@ static const unsigned int build_actionlist[7740] = { | |||
4103 | 0x7c810808, | 4103 | 0x7c810808, |
4104 | 0x00000000, | 4104 | 0x00000000, |
4105 | 0x0006009e, | 4105 | 0x0006009e, |
4106 | 0x54630034, | ||
4107 | 0x7c832050, | ||
4108 | 0x3884001f, | ||
4109 | 0x5484d97f, | ||
4110 | 0x4d820020, | ||
4111 | 0x7c8903a6, | ||
4112 | 0x7c651b78, | ||
4113 | 0x0006000b, | ||
4114 | 0x7c00186c, | ||
4115 | 0x38630020, | ||
4116 | 0x42000000, | ||
4117 | 0x0005080b, | ||
4118 | 0x7c0004ac, | ||
4119 | 0x7c8903a6, | ||
4120 | 0x0006000b, | ||
4121 | 0x7c002fac, | ||
4122 | 0x38a50020, | ||
4123 | 0x42000000, | ||
4124 | 0x0005080b, | ||
4125 | 0x4c00012c, | ||
4126 | 0x4e800020, | ||
4127 | 0x0006009f, | ||
4106 | 0x00000000, | 4128 | 0x00000000, |
4107 | 0x9421fef0, | 4129 | 0x9421fef0, |
4108 | 0x91c10000, | 4130 | 0x91c10000, |
@@ -4286,7 +4308,7 @@ static const unsigned int build_actionlist[7740] = { | |||
4286 | 0x48000000, | 4308 | 0x48000000, |
4287 | 0x0005001a, | 4309 | 0x0005001a, |
4288 | 0x00000000, | 4310 | 0x00000000, |
4289 | 0x0006009f, | 4311 | 0x000600a0, |
4290 | 0x00000000, | 4312 | 0x00000000, |
4291 | 0x81030000, | 4313 | 0x81030000, |
4292 | 0x00098200, | 4314 | 0x00098200, |
@@ -4522,10 +4544,10 @@ static const unsigned int build_actionlist[7740] = { | |||
4522 | 0x00098200, | 4544 | 0x00098200, |
4523 | 0x00000000, | 4545 | 0x00000000, |
4524 | 0x409d0000, | 4546 | 0x409d0000, |
4525 | 0x000508a0, | 4547 | 0x000508a1, |
4526 | 0x00000000, | 4548 | 0x00000000, |
4527 | 0x409d0000, | 4549 | 0x409d0000, |
4528 | 0x000508a1, | 4550 | 0x000508a2, |
4529 | 0x00000000, | 4551 | 0x00000000, |
4530 | 0x7c14706e, | 4552 | 0x7c14706e, |
4531 | 0x81300000, | 4553 | 0x81300000, |
@@ -4696,10 +4718,10 @@ static const unsigned int build_actionlist[7740] = { | |||
4696 | 0x3d290000, | 4718 | 0x3d290000, |
4697 | 0x00098200, | 4719 | 0x00098200, |
4698 | 0x00000000, | 4720 | 0x00000000, |
4699 | 0x000600a0, | ||
4700 | 0x00000000, | ||
4701 | 0x000600a1, | 4721 | 0x000600a1, |
4702 | 0x00000000, | 4722 | 0x00000000, |
4723 | 0x000600a2, | ||
4724 | 0x00000000, | ||
4703 | 0x40820000, | 4725 | 0x40820000, |
4704 | 0x00050807, | 4726 | 0x00050807, |
4705 | 0x40860000, | 4727 | 0x40860000, |
@@ -4707,10 +4729,10 @@ static const unsigned int build_actionlist[7740] = { | |||
4707 | 0x7c042800, | 4729 | 0x7c042800, |
4708 | 0x0006000e, | 4730 | 0x0006000e, |
4709 | 0x00000000, | 4731 | 0x00000000, |
4710 | 0x000600a0, | ||
4711 | 0x00000000, | ||
4712 | 0x000600a1, | 4732 | 0x000600a1, |
4713 | 0x00000000, | 4733 | 0x00000000, |
4734 | 0x000600a2, | ||
4735 | 0x00000000, | ||
4714 | 0x7c0ea02e, | 4736 | 0x7c0ea02e, |
4715 | 0x3a100004, | 4737 | 0x3a100004, |
4716 | 0x7c0ea4ae, | 4738 | 0x7c0ea4ae, |
@@ -5550,7 +5572,7 @@ static const unsigned int build_actionlist[7740] = { | |||
5550 | 0x40800000, | 5572 | 0x40800000, |
5551 | 0x00050842, | 5573 | 0x00050842, |
5552 | 0x00000000, | 5574 | 0x00000000, |
5553 | 0x000600a2, | 5575 | 0x000600a3, |
5554 | 0xfc2e7824, | 5576 | 0xfc2e7824, |
5555 | 0x48000001, | 5577 | 0x48000001, |
5556 | 0x00030010, | 5578 | 0x00030010, |
@@ -5606,7 +5628,7 @@ static const unsigned int build_actionlist[7740] = { | |||
5606 | 0x40800000, | 5628 | 0x40800000, |
5607 | 0x00050840, | 5629 | 0x00050840, |
5608 | 0x00000000, | 5630 | 0x00000000, |
5609 | 0x000600a2, | 5631 | 0x000600a3, |
5610 | 0xfc2e7824, | 5632 | 0xfc2e7824, |
5611 | 0x48000001, | 5633 | 0x48000001, |
5612 | 0x00030010, | 5634 | 0x00030010, |
@@ -5699,7 +5721,7 @@ static const unsigned int build_actionlist[7740] = { | |||
5699 | 0x00050842, | 5721 | 0x00050842, |
5700 | 0x00000000, | 5722 | 0x00000000, |
5701 | 0x48000000, | 5723 | 0x48000000, |
5702 | 0x000500a2, | 5724 | 0x000500a3, |
5703 | 0x00000000, | 5725 | 0x00000000, |
5704 | 0x7d0e502e, | 5726 | 0x7d0e502e, |
5705 | 0x00000000, | 5727 | 0x00000000, |
@@ -5746,7 +5768,7 @@ static const unsigned int build_actionlist[7740] = { | |||
5746 | 0x00050840, | 5768 | 0x00050840, |
5747 | 0x00000000, | 5769 | 0x00000000, |
5748 | 0x48000000, | 5770 | 0x48000000, |
5749 | 0x000500a2, | 5771 | 0x000500a3, |
5750 | 0x00000000, | 5772 | 0x00000000, |
5751 | 0x7d0e502e, | 5773 | 0x7d0e502e, |
5752 | 0x7c2e54ae, | 5774 | 0x7c2e54ae, |
@@ -6226,10 +6248,10 @@ static const unsigned int build_actionlist[7740] = { | |||
6226 | 0x7d6f402e, | 6248 | 0x7d6f402e, |
6227 | 0x00000000, | 6249 | 0x00000000, |
6228 | 0x48000000, | 6250 | 0x48000000, |
6229 | 0x000500a3, | 6251 | 0x000500a4, |
6230 | 0x00000000, | 6252 | 0x00000000, |
6231 | 0x48000000, | 6253 | 0x48000000, |
6232 | 0x000500a4, | 6254 | 0x000500a5, |
6233 | 0x00000000, | 6255 | 0x00000000, |
6234 | 0x7c6a706e, | 6256 | 0x7c6a706e, |
6235 | 0x7c8b706e, | 6257 | 0x7c8b706e, |
@@ -6315,7 +6337,7 @@ static const unsigned int build_actionlist[7740] = { | |||
6315 | 0x816b0004, | 6337 | 0x816b0004, |
6316 | 0x00000000, | 6338 | 0x00000000, |
6317 | 0x48000000, | 6339 | 0x48000000, |
6318 | 0x000500a3, | 6340 | 0x000500a4, |
6319 | 0x00000000, | 6341 | 0x00000000, |
6320 | 0x7c6a706e, | 6342 | 0x7c6a706e, |
6321 | 0x5568007e, | 6343 | 0x5568007e, |
@@ -6327,7 +6349,7 @@ static const unsigned int build_actionlist[7740] = { | |||
6327 | 0x7d6f402e, | 6349 | 0x7d6f402e, |
6328 | 0x40820000, | 6350 | 0x40820000, |
6329 | 0x0005082d, | 6351 | 0x0005082d, |
6330 | 0x000600a3, | 6352 | 0x000600a4, |
6331 | 0x800a0000, | 6353 | 0x800a0000, |
6332 | 0x00098200, | 6354 | 0x00098200, |
6333 | 0x810b0000, | 6355 | 0x810b0000, |
@@ -6537,7 +6559,7 @@ static const unsigned int build_actionlist[7740] = { | |||
6537 | 0x816b0004, | 6559 | 0x816b0004, |
6538 | 0x00000000, | 6560 | 0x00000000, |
6539 | 0x48000000, | 6561 | 0x48000000, |
6540 | 0x000500a4, | 6562 | 0x000500a5, |
6541 | 0x00060011, | 6563 | 0x00060011, |
6542 | 0x80110000, | 6564 | 0x80110000, |
6543 | 0x00098200, | 6565 | 0x00098200, |
@@ -6561,7 +6583,7 @@ static const unsigned int build_actionlist[7740] = { | |||
6561 | 0x7d6f402e, | 6583 | 0x7d6f402e, |
6562 | 0x40820000, | 6584 | 0x40820000, |
6563 | 0x00050831, | 6585 | 0x00050831, |
6564 | 0x000600a4, | 6586 | 0x000600a5, |
6565 | 0x800a0000, | 6587 | 0x800a0000, |
6566 | 0x00098200, | 6588 | 0x00098200, |
6567 | 0x810b0000, | 6589 | 0x810b0000, |
@@ -7189,7 +7211,7 @@ static const unsigned int build_actionlist[7740] = { | |||
7189 | 0x6a080000, | 7211 | 0x6a080000, |
7190 | 0x00090200, | 7212 | 0x00090200, |
7191 | 0x40820000, | 7213 | 0x40820000, |
7192 | 0x000508a5, | 7214 | 0x000508a6, |
7193 | 0x00060017, | 7215 | 0x00060017, |
7194 | 0x80f0fffc, | 7216 | 0x80f0fffc, |
7195 | 0x2c0c0008, | 7217 | 0x2c0c0008, |
@@ -7240,7 +7262,7 @@ static const unsigned int build_actionlist[7740] = { | |||
7240 | 0x7ee9412e, | 7262 | 0x7ee9412e, |
7241 | 0x48000000, | 7263 | 0x48000000, |
7242 | 0x0005000f, | 7264 | 0x0005000f, |
7243 | 0x000600a5, | 7265 | 0x000600a6, |
7244 | 0x71090000, | 7266 | 0x71090000, |
7245 | 0x00090200, | 7267 | 0x00090200, |
7246 | 0x40820000, | 7268 | 0x40820000, |
@@ -7258,7 +7280,7 @@ static const unsigned int build_actionlist[7740] = { | |||
7258 | 0x6a080000, | 7280 | 0x6a080000, |
7259 | 0x00090200, | 7281 | 0x00090200, |
7260 | 0x40a20000, | 7282 | 0x40a20000, |
7261 | 0x000508a5, | 7283 | 0x000508a6, |
7262 | 0x80f0fffc, | 7284 | 0x80f0fffc, |
7263 | 0x392efff8, | 7285 | 0x392efff8, |
7264 | 0x54ea5d78, | 7286 | 0x54ea5d78, |
@@ -7894,6 +7916,7 @@ enum { | |||
7894 | GLOB_vm_trunc, | 7916 | GLOB_vm_trunc, |
7895 | GLOB_vm_modi, | 7917 | GLOB_vm_modi, |
7896 | GLOB_vm_foldarith, | 7918 | GLOB_vm_foldarith, |
7919 | GLOB_vm_cachesync, | ||
7897 | GLOB_vm_ffi_callback, | 7920 | GLOB_vm_ffi_callback, |
7898 | GLOB_vm_ffi_call, | 7921 | GLOB_vm_ffi_call, |
7899 | GLOB_BC_ISEQN_Z, | 7922 | GLOB_BC_ISEQN_Z, |
@@ -8043,6 +8066,7 @@ static const char *const globnames[] = { | |||
8043 | "vm_trunc", | 8066 | "vm_trunc", |
8044 | "vm_modi", | 8067 | "vm_modi", |
8045 | "vm_foldarith", | 8068 | "vm_foldarith", |
8069 | "vm_cachesync", | ||
8046 | "vm_ffi_callback", | 8070 | "vm_ffi_callback", |
8047 | "vm_ffi_call", | 8071 | "vm_ffi_call", |
8048 | "BC_ISEQN_Z", | 8072 | "BC_ISEQN_Z", |
@@ -8528,19 +8552,19 @@ static void build_subroutines(BuildCtx *ctx) | |||
8528 | dasm_put(Dst, 4089); | 8552 | dasm_put(Dst, 4089); |
8529 | #if LJ_HASFFI | 8553 | #if LJ_HASFFI |
8530 | #define DtE(_V) (int)(ptrdiff_t)&(((CTState *)0)_V) | 8554 | #define DtE(_V) (int)(ptrdiff_t)&(((CTState *)0)_V) |
8531 | dasm_put(Dst, 4091, 56+(14-14)*4, 128+(14-14)*8, 56+(15-14)*4, 128+(15-14)*8, 56+(16-14)*4, 128+(16-14)*8, 56+(17-14)*4, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8); | 8555 | dasm_put(Dst, 4113, 56+(14-14)*4, 128+(14-14)*8, 56+(15-14)*4, 128+(15-14)*8, 56+(16-14)*4, 128+(16-14)*8, 56+(17-14)*4, 128+(17-14)*8, 56+(18-14)*4, 128+(18-14)*8, 56+(19-14)*4, 128+(19-14)*8, 56+(20-14)*4, 128+(20-14)*8, 56+(21-14)*4, 128+(21-14)*8, 56+(22-14)*4, 128+(22-14)*8, 56+(23-14)*4, 128+(23-14)*8, 56+(24-14)*4, 128+(24-14)*8); |
8532 | dasm_put(Dst, 4139, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4, 128+(31-14)*8, Dt2(->ctype_state), GG_G2DISP, DtE(->cb.slot), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1]), DtE(->cb.fpr[1]), DtE(->cb.gpr[2])); | 8556 | dasm_put(Dst, 4161, 56+(25-14)*4, 128+(25-14)*8, 56+(26-14)*4, 128+(26-14)*8, 56+(27-14)*4, 128+(27-14)*8, 56+(28-14)*4, 128+(28-14)*8, 56+(29-14)*4, 128+(29-14)*8, 56+(30-14)*4, 128+(30-14)*8, 56+(31-14)*4, 128+(31-14)*8, Dt2(->ctype_state), GG_G2DISP, DtE(->cb.slot), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1]), DtE(->cb.fpr[1]), DtE(->cb.gpr[2])); |
8533 | dasm_put(Dst, 4186, DtE(->cb.fpr[2]), DtE(->cb.gpr[3]), DtE(->cb.fpr[3]), DtE(->cb.gpr[4]), DtE(->cb.fpr[4]), DtE(->cb.gpr[5]), DtE(->cb.fpr[5]), DtE(->cb.gpr[6]), DtE(->cb.fpr[6]), DtE(->cb.gpr[7]), DtE(->cb.fpr[7]), 272+8, DtE(->cb.stack), Dt1(->base), LJ_TISNUM, Dt1(->top), LJ_TNIL, ~LJ_VMST_INTERP, DISPATCH_GL(vmstate), Dt7(->pc)); | 8557 | dasm_put(Dst, 4208, DtE(->cb.fpr[2]), DtE(->cb.gpr[3]), DtE(->cb.fpr[3]), DtE(->cb.gpr[4]), DtE(->cb.fpr[4]), DtE(->cb.gpr[5]), DtE(->cb.fpr[5]), DtE(->cb.gpr[6]), DtE(->cb.fpr[6]), DtE(->cb.gpr[7]), DtE(->cb.fpr[7]), 272+8, DtE(->cb.stack), Dt1(->base), LJ_TISNUM, Dt1(->top), LJ_TNIL, ~LJ_VMST_INTERP, DISPATCH_GL(vmstate), Dt7(->pc)); |
8534 | #endif | 8558 | #endif |
8535 | dasm_put(Dst, 4250); | 8559 | dasm_put(Dst, 4272); |
8536 | #if LJ_HASFFI | 8560 | #if LJ_HASFFI |
8537 | dasm_put(Dst, 4252, DISPATCH_GL(ctype_state), Dt1(->base), Dt1(->top), DtE(->L), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1])); | 8561 | dasm_put(Dst, 4274, DISPATCH_GL(ctype_state), Dt1(->base), Dt1(->top), DtE(->L), DtE(->cb.gpr[0]), DtE(->cb.fpr[0]), DtE(->cb.gpr[1])); |
8538 | #endif | 8562 | #endif |
8539 | dasm_put(Dst, 4273); | 8563 | dasm_put(Dst, 4295); |
8540 | #if LJ_HASFFI | 8564 | #if LJ_HASFFI |
8541 | #define DtF(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) | 8565 | #define DtF(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) |
8542 | dasm_put(Dst, 4275, DtF(->spadj), DtF(->nsp), DtF(->nfpr), DtF(->stack), 31-2, DtF(->fpr[0]), DtF(->fpr[1]), DtF(->fpr[2]), DtF(->fpr[3]), DtF(->fpr[4]), DtF(->fpr[5]), DtF(->fpr[6]), DtF(->fpr[7]), DtF(->func), DtF(->gpr[1]), DtF(->gpr[2])); | 8566 | dasm_put(Dst, 4297, DtF(->spadj), DtF(->nsp), DtF(->nfpr), DtF(->stack), 31-2, DtF(->fpr[0]), DtF(->fpr[1]), DtF(->fpr[2]), DtF(->fpr[3]), DtF(->fpr[4]), DtF(->fpr[5]), DtF(->fpr[6]), DtF(->fpr[7]), DtF(->func), DtF(->gpr[1]), DtF(->gpr[2])); |
8543 | dasm_put(Dst, 4332, DtF(->gpr[3]), DtF(->gpr[4]), DtF(->gpr[5]), DtF(->gpr[6]), DtF(->gpr[7]), DtF(->gpr[0]), DtF(->gpr[0]), DtF(->fpr[0]), DtF(->gpr[1]), DtF(->gpr[2]), DtF(->gpr[3])); | 8567 | dasm_put(Dst, 4354, DtF(->gpr[3]), DtF(->gpr[4]), DtF(->gpr[5]), DtF(->gpr[6]), DtF(->gpr[7]), DtF(->gpr[0]), DtF(->gpr[0]), DtF(->fpr[0]), DtF(->gpr[1]), DtF(->gpr[2]), DtF(->gpr[3])); |
8544 | #endif | 8568 | #endif |
8545 | } | 8569 | } |
8546 | 8570 | ||
@@ -8548,7 +8572,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
8548 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) | 8572 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) |
8549 | { | 8573 | { |
8550 | int vk = 0; | 8574 | int vk = 0; |
8551 | dasm_put(Dst, 4364, defop); | 8575 | dasm_put(Dst, 4386, defop); |
8552 | 8576 | ||
8553 | switch (op) { | 8577 | switch (op) { |
8554 | 8578 | ||
@@ -8558,224 +8582,224 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
8558 | 8582 | ||
8559 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: | 8583 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: |
8560 | if (LJ_DUALNUM) { | 8584 | if (LJ_DUALNUM) { |
8561 | dasm_put(Dst, 4366, -(BCBIAS_J*4 >> 16)); | 8585 | dasm_put(Dst, 4388, -(BCBIAS_J*4 >> 16)); |
8562 | if (op == BC_ISLT) { | 8586 | if (op == BC_ISLT) { |
8563 | dasm_put(Dst, 4383); | 8587 | dasm_put(Dst, 4405); |
8564 | } else if (op == BC_ISGE) { | 8588 | } else if (op == BC_ISGE) { |
8565 | dasm_put(Dst, 4386); | 8589 | dasm_put(Dst, 4408); |
8566 | } else if (op == BC_ISLE) { | 8590 | } else if (op == BC_ISLE) { |
8567 | dasm_put(Dst, 4389); | 8591 | dasm_put(Dst, 4411); |
8568 | } else { | 8592 | } else { |
8569 | dasm_put(Dst, 4392); | 8593 | dasm_put(Dst, 4414); |
8570 | } | 8594 | } |
8571 | dasm_put(Dst, 4395); | 8595 | dasm_put(Dst, 4417); |
8572 | if (op == BC_ISLT) { | 8596 | if (op == BC_ISLT) { |
8573 | dasm_put(Dst, 4434); | 8597 | dasm_put(Dst, 4456); |
8574 | } else if (op == BC_ISGE) { | 8598 | } else if (op == BC_ISGE) { |
8575 | dasm_put(Dst, 4437); | 8599 | dasm_put(Dst, 4459); |
8576 | } else if (op == BC_ISLE) { | 8600 | } else if (op == BC_ISLE) { |
8577 | dasm_put(Dst, 4440); | 8601 | dasm_put(Dst, 4462); |
8578 | } else { | 8602 | } else { |
8579 | dasm_put(Dst, 4444); | 8603 | dasm_put(Dst, 4466); |
8580 | } | 8604 | } |
8581 | dasm_put(Dst, 4448); | 8605 | dasm_put(Dst, 4470); |
8582 | } else { | 8606 | } else { |
8583 | dasm_put(Dst, 4451, -(BCBIAS_J*4 >> 16)); | 8607 | dasm_put(Dst, 4473, -(BCBIAS_J*4 >> 16)); |
8584 | if (op == BC_ISLT) { | 8608 | if (op == BC_ISLT) { |
8585 | dasm_put(Dst, 4468); | 8609 | dasm_put(Dst, 4490); |
8586 | } else if (op == BC_ISGE) { | 8610 | } else if (op == BC_ISGE) { |
8587 | dasm_put(Dst, 4471); | 8611 | dasm_put(Dst, 4493); |
8588 | } else if (op == BC_ISLE) { | 8612 | } else if (op == BC_ISLE) { |
8589 | dasm_put(Dst, 4474); | 8613 | dasm_put(Dst, 4496); |
8590 | } else { | 8614 | } else { |
8591 | dasm_put(Dst, 4478); | 8615 | dasm_put(Dst, 4500); |
8592 | } | 8616 | } |
8593 | dasm_put(Dst, 4482); | 8617 | dasm_put(Dst, 4504); |
8594 | } | 8618 | } |
8595 | break; | 8619 | break; |
8596 | 8620 | ||
8597 | case BC_ISEQV: case BC_ISNEV: | 8621 | case BC_ISEQV: case BC_ISNEV: |
8598 | vk = op == BC_ISEQV; | 8622 | vk = op == BC_ISEQV; |
8599 | if (LJ_DUALNUM) { | 8623 | if (LJ_DUALNUM) { |
8600 | dasm_put(Dst, 4495, -(BCBIAS_J*4 >> 16)); | 8624 | dasm_put(Dst, 4517, -(BCBIAS_J*4 >> 16)); |
8601 | if (vk) { | 8625 | if (vk) { |
8602 | dasm_put(Dst, 4508); | 8626 | dasm_put(Dst, 4530); |
8603 | } else { | 8627 | } else { |
8604 | dasm_put(Dst, 4511); | 8628 | dasm_put(Dst, 4533); |
8605 | } | 8629 | } |
8606 | } else { | 8630 | } else { |
8607 | dasm_put(Dst, 4514, -(BCBIAS_J*4 >> 16)); | 8631 | dasm_put(Dst, 4536, -(BCBIAS_J*4 >> 16)); |
8608 | if (vk) { | 8632 | if (vk) { |
8609 | dasm_put(Dst, 4531); | 8633 | dasm_put(Dst, 4553); |
8610 | } else { | 8634 | } else { |
8611 | dasm_put(Dst, 4535); | 8635 | dasm_put(Dst, 4557); |
8612 | } | 8636 | } |
8613 | dasm_put(Dst, 4539); | 8637 | dasm_put(Dst, 4561); |
8614 | } | 8638 | } |
8615 | dasm_put(Dst, 4551); | 8639 | dasm_put(Dst, 4573); |
8616 | if (!LJ_DUALNUM) { | 8640 | if (!LJ_DUALNUM) { |
8617 | dasm_put(Dst, 4553); | 8641 | dasm_put(Dst, 4575); |
8618 | } | 8642 | } |
8619 | if (LJ_HASFFI) { | 8643 | if (LJ_HASFFI) { |
8620 | dasm_put(Dst, 4556, LJ_TCDATA, LJ_TCDATA); | 8644 | dasm_put(Dst, 4578, LJ_TCDATA, LJ_TCDATA); |
8621 | } | 8645 | } |
8622 | dasm_put(Dst, 4561, ~LJ_TISPRI); | 8646 | dasm_put(Dst, 4583, ~LJ_TISPRI); |
8623 | if (LJ_HASFFI) { | 8647 | if (LJ_HASFFI) { |
8624 | dasm_put(Dst, 4566); | 8648 | dasm_put(Dst, 4588); |
8625 | } | 8649 | } |
8626 | dasm_put(Dst, 4568, ~LJ_TISTABUD); | 8650 | dasm_put(Dst, 4590, ~LJ_TISTABUD); |
8627 | if (LJ_HASFFI) { | 8651 | if (LJ_HASFFI) { |
8628 | dasm_put(Dst, 4571); | 8652 | dasm_put(Dst, 4593); |
8629 | } | 8653 | } |
8630 | dasm_put(Dst, 4574); | 8654 | dasm_put(Dst, 4596); |
8631 | if (vk) { | 8655 | if (vk) { |
8632 | dasm_put(Dst, 4582); | 8656 | dasm_put(Dst, 4604); |
8633 | } else { | 8657 | } else { |
8634 | dasm_put(Dst, 4587); | 8658 | dasm_put(Dst, 4609); |
8635 | } | 8659 | } |
8636 | if (LJ_DUALNUM) { | 8660 | if (LJ_DUALNUM) { |
8637 | dasm_put(Dst, 4592); | 8661 | dasm_put(Dst, 4614); |
8638 | } else { | 8662 | } else { |
8639 | dasm_put(Dst, 4607); | 8663 | dasm_put(Dst, 4629); |
8640 | } | 8664 | } |
8641 | dasm_put(Dst, 4610, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); | 8665 | dasm_put(Dst, 4632, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); |
8642 | break; | 8666 | break; |
8643 | 8667 | ||
8644 | case BC_ISEQS: case BC_ISNES: | 8668 | case BC_ISEQS: case BC_ISNES: |
8645 | vk = op == BC_ISEQS; | 8669 | vk = op == BC_ISEQS; |
8646 | dasm_put(Dst, 4629, 32-1); | 8670 | dasm_put(Dst, 4651, 32-1); |
8647 | if (LJ_HASFFI) { | 8671 | if (LJ_HASFFI) { |
8648 | dasm_put(Dst, 4637, LJ_TCDATA); | 8672 | dasm_put(Dst, 4659, LJ_TCDATA); |
8649 | } | 8673 | } |
8650 | dasm_put(Dst, 4640, LJ_TSTR); | 8674 | dasm_put(Dst, 4662, LJ_TSTR); |
8651 | if (LJ_HASFFI) { | 8675 | if (LJ_HASFFI) { |
8652 | dasm_put(Dst, 4644); | 8676 | dasm_put(Dst, 4666); |
8653 | } | 8677 | } |
8654 | dasm_put(Dst, 4647, -(BCBIAS_J*4 >> 16)); | 8678 | dasm_put(Dst, 4669, -(BCBIAS_J*4 >> 16)); |
8655 | if (vk) { | 8679 | if (vk) { |
8656 | dasm_put(Dst, 4655); | 8680 | dasm_put(Dst, 4677); |
8657 | } else { | 8681 | } else { |
8658 | dasm_put(Dst, 4657); | 8682 | dasm_put(Dst, 4679); |
8659 | } | 8683 | } |
8660 | dasm_put(Dst, 4659); | 8684 | dasm_put(Dst, 4681); |
8661 | break; | 8685 | break; |
8662 | 8686 | ||
8663 | case BC_ISEQN: case BC_ISNEN: | 8687 | case BC_ISEQN: case BC_ISNEN: |
8664 | vk = op == BC_ISEQN; | 8688 | vk = op == BC_ISEQN; |
8665 | if (LJ_DUALNUM) { | 8689 | if (LJ_DUALNUM) { |
8666 | dasm_put(Dst, 4671, -(BCBIAS_J*4 >> 16)); | 8690 | dasm_put(Dst, 4693, -(BCBIAS_J*4 >> 16)); |
8667 | if (vk) { | 8691 | if (vk) { |
8668 | dasm_put(Dst, 4683); | 8692 | dasm_put(Dst, 4705); |
8669 | } else { | 8693 | } else { |
8670 | dasm_put(Dst, 4685); | 8694 | dasm_put(Dst, 4707); |
8671 | } | 8695 | } |
8672 | dasm_put(Dst, 4687); | 8696 | dasm_put(Dst, 4709); |
8673 | } else { | 8697 | } else { |
8674 | if (vk) { | 8698 | if (vk) { |
8675 | dasm_put(Dst, 4694); | 8699 | dasm_put(Dst, 4716); |
8676 | } else { | 8700 | } else { |
8677 | dasm_put(Dst, 4696); | 8701 | dasm_put(Dst, 4718); |
8678 | } | 8702 | } |
8679 | dasm_put(Dst, 4698, -(BCBIAS_J*4 >> 16)); | 8703 | dasm_put(Dst, 4720, -(BCBIAS_J*4 >> 16)); |
8680 | } | 8704 | } |
8681 | if (vk) { | 8705 | if (vk) { |
8682 | dasm_put(Dst, 4711); | 8706 | dasm_put(Dst, 4733); |
8683 | if (!LJ_HASFFI) { | 8707 | if (!LJ_HASFFI) { |
8684 | dasm_put(Dst, 4716); | 8708 | dasm_put(Dst, 4738); |
8685 | } | 8709 | } |
8686 | } else { | 8710 | } else { |
8687 | dasm_put(Dst, 4718); | 8711 | dasm_put(Dst, 4740); |
8688 | if (!LJ_HASFFI) { | 8712 | if (!LJ_HASFFI) { |
8689 | dasm_put(Dst, 4722); | 8713 | dasm_put(Dst, 4744); |
8690 | } | 8714 | } |
8691 | dasm_put(Dst, 4724); | 8715 | dasm_put(Dst, 4746); |
8692 | } | 8716 | } |
8693 | dasm_put(Dst, 4727); | 8717 | dasm_put(Dst, 4749); |
8694 | if (LJ_HASFFI) { | 8718 | if (LJ_HASFFI) { |
8695 | dasm_put(Dst, 4738, LJ_TCDATA); | 8719 | dasm_put(Dst, 4760, LJ_TCDATA); |
8696 | } | 8720 | } |
8697 | if (LJ_DUALNUM) { | 8721 | if (LJ_DUALNUM) { |
8698 | dasm_put(Dst, 4746); | 8722 | dasm_put(Dst, 4768); |
8699 | } | 8723 | } |
8700 | break; | 8724 | break; |
8701 | 8725 | ||
8702 | case BC_ISEQP: case BC_ISNEP: | 8726 | case BC_ISEQP: case BC_ISNEP: |
8703 | vk = op == BC_ISEQP; | 8727 | vk = op == BC_ISEQP; |
8704 | dasm_put(Dst, 4770, 32-3); | 8728 | dasm_put(Dst, 4792, 32-3); |
8705 | if (LJ_HASFFI) { | 8729 | if (LJ_HASFFI) { |
8706 | dasm_put(Dst, 4777, LJ_TCDATA); | 8730 | dasm_put(Dst, 4799, LJ_TCDATA); |
8707 | } | 8731 | } |
8708 | dasm_put(Dst, 4780); | 8732 | dasm_put(Dst, 4802); |
8709 | if (LJ_HASFFI) { | 8733 | if (LJ_HASFFI) { |
8710 | dasm_put(Dst, 4782); | 8734 | dasm_put(Dst, 4804); |
8711 | } | 8735 | } |
8712 | dasm_put(Dst, 4785, -(BCBIAS_J*4 >> 16)); | 8736 | dasm_put(Dst, 4807, -(BCBIAS_J*4 >> 16)); |
8713 | if (vk) { | 8737 | if (vk) { |
8714 | dasm_put(Dst, 4791); | 8738 | dasm_put(Dst, 4813); |
8715 | } else { | 8739 | } else { |
8716 | dasm_put(Dst, 4793); | 8740 | dasm_put(Dst, 4815); |
8717 | } | 8741 | } |
8718 | dasm_put(Dst, 4795); | 8742 | dasm_put(Dst, 4817); |
8719 | break; | 8743 | break; |
8720 | 8744 | ||
8721 | /* -- Unary test and copy ops ------------------------------------------- */ | 8745 | /* -- Unary test and copy ops ------------------------------------------- */ |
8722 | 8746 | ||
8723 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: | 8747 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: |
8724 | dasm_put(Dst, 4807); | 8748 | dasm_put(Dst, 4829); |
8725 | if (op == BC_IST || op == BC_ISF) { | 8749 | if (op == BC_IST || op == BC_ISF) { |
8726 | dasm_put(Dst, 4811, LJ_TTRUE, -(BCBIAS_J*4 >> 16)); | 8750 | dasm_put(Dst, 4833, LJ_TTRUE, -(BCBIAS_J*4 >> 16)); |
8727 | if (op == BC_IST) { | 8751 | if (op == BC_IST) { |
8728 | dasm_put(Dst, 4818); | 8752 | dasm_put(Dst, 4840); |
8729 | } else { | 8753 | } else { |
8730 | dasm_put(Dst, 4820); | 8754 | dasm_put(Dst, 4842); |
8731 | } | 8755 | } |
8732 | dasm_put(Dst, 4822); | 8756 | dasm_put(Dst, 4844); |
8733 | } else { | 8757 | } else { |
8734 | dasm_put(Dst, 4824, LJ_TFALSE); | 8758 | dasm_put(Dst, 4846, LJ_TFALSE); |
8735 | if (op == BC_ISTC) { | 8759 | if (op == BC_ISTC) { |
8736 | dasm_put(Dst, 4829); | 8760 | dasm_put(Dst, 4851); |
8737 | } else { | 8761 | } else { |
8738 | dasm_put(Dst, 4832); | 8762 | dasm_put(Dst, 4854); |
8739 | } | 8763 | } |
8740 | dasm_put(Dst, 4835, -(BCBIAS_J*4 >> 16)); | 8764 | dasm_put(Dst, 4857, -(BCBIAS_J*4 >> 16)); |
8741 | } | 8765 | } |
8742 | dasm_put(Dst, 4842); | 8766 | dasm_put(Dst, 4864); |
8743 | break; | 8767 | break; |
8744 | 8768 | ||
8745 | /* -- Unary ops --------------------------------------------------------- */ | 8769 | /* -- Unary ops --------------------------------------------------------- */ |
8746 | 8770 | ||
8747 | case BC_MOV: | 8771 | case BC_MOV: |
8748 | dasm_put(Dst, 4853); | 8772 | dasm_put(Dst, 4875); |
8749 | break; | 8773 | break; |
8750 | case BC_NOT: | 8774 | case BC_NOT: |
8751 | dasm_put(Dst, 4866, LJ_TTRUE); | 8775 | dasm_put(Dst, 4888, LJ_TTRUE); |
8752 | break; | 8776 | break; |
8753 | case BC_UNM: | 8777 | case BC_UNM: |
8754 | dasm_put(Dst, 4882); | 8778 | dasm_put(Dst, 4904); |
8755 | if (LJ_DUALNUM) { | 8779 | if (LJ_DUALNUM) { |
8756 | dasm_put(Dst, 4886); | 8780 | dasm_put(Dst, 4908); |
8757 | } | 8781 | } |
8758 | dasm_put(Dst, 4914); | 8782 | dasm_put(Dst, 4936); |
8759 | if (LJ_DUALNUM) { | 8783 | if (LJ_DUALNUM) { |
8760 | dasm_put(Dst, 4924); | 8784 | dasm_put(Dst, 4946); |
8761 | } else { | 8785 | } else { |
8762 | dasm_put(Dst, 4927); | 8786 | dasm_put(Dst, 4949); |
8763 | } | 8787 | } |
8764 | break; | 8788 | break; |
8765 | case BC_LEN: | 8789 | case BC_LEN: |
8766 | dasm_put(Dst, 4936, LJ_TSTR, Dt5(->len)); | 8790 | dasm_put(Dst, 4958, LJ_TSTR, Dt5(->len)); |
8767 | if (LJ_DUALNUM) { | 8791 | if (LJ_DUALNUM) { |
8768 | dasm_put(Dst, 4946); | 8792 | dasm_put(Dst, 4968); |
8769 | } else { | 8793 | } else { |
8770 | dasm_put(Dst, 4951); | 8794 | dasm_put(Dst, 4973); |
8771 | } | 8795 | } |
8772 | dasm_put(Dst, 4958, LJ_TTAB); | 8796 | dasm_put(Dst, 4980, LJ_TTAB); |
8773 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 8797 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
8774 | dasm_put(Dst, 4972, Dt6(->metatable)); | 8798 | dasm_put(Dst, 4994, Dt6(->metatable)); |
8775 | #endif | 8799 | #endif |
8776 | dasm_put(Dst, 4979); | 8800 | dasm_put(Dst, 5001); |
8777 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 8801 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
8778 | dasm_put(Dst, 4985, Dt6(->nomm), 1<<MM_len); | 8802 | dasm_put(Dst, 5007, Dt6(->nomm), 1<<MM_len); |
8779 | #endif | 8803 | #endif |
8780 | break; | 8804 | break; |
8781 | 8805 | ||
@@ -8787,77 +8811,77 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
8787 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 8811 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
8788 | switch (vk) { | 8812 | switch (vk) { |
8789 | case 0: | 8813 | case 0: |
8790 | dasm_put(Dst, 4995); | 8814 | dasm_put(Dst, 5017); |
8791 | break; | 8815 | break; |
8792 | case 1: | 8816 | case 1: |
8793 | dasm_put(Dst, 5001); | 8817 | dasm_put(Dst, 5023); |
8794 | break; | 8818 | break; |
8795 | default: | 8819 | default: |
8796 | dasm_put(Dst, 5007); | 8820 | dasm_put(Dst, 5029); |
8797 | break; | 8821 | break; |
8798 | } | 8822 | } |
8799 | dasm_put(Dst, 5013); | 8823 | dasm_put(Dst, 5035); |
8800 | switch (vk) { | 8824 | switch (vk) { |
8801 | case 0: | 8825 | case 0: |
8802 | dasm_put(Dst, 5040); | 8826 | dasm_put(Dst, 5062); |
8803 | break; | 8827 | break; |
8804 | case 1: | 8828 | case 1: |
8805 | dasm_put(Dst, 5043); | 8829 | dasm_put(Dst, 5065); |
8806 | break; | 8830 | break; |
8807 | default: | 8831 | default: |
8808 | dasm_put(Dst, 5046); | 8832 | dasm_put(Dst, 5068); |
8809 | break; | 8833 | break; |
8810 | } | 8834 | } |
8811 | dasm_put(Dst, 5049); | 8835 | dasm_put(Dst, 5071); |
8812 | if (vk == 1) { | 8836 | if (vk == 1) { |
8813 | dasm_put(Dst, 5051); | 8837 | dasm_put(Dst, 5073); |
8814 | } else { | 8838 | } else { |
8815 | dasm_put(Dst, 5055); | 8839 | dasm_put(Dst, 5077); |
8816 | } | 8840 | } |
8817 | switch (vk) { | 8841 | switch (vk) { |
8818 | case 0: | 8842 | case 0: |
8819 | dasm_put(Dst, 5059); | 8843 | dasm_put(Dst, 5081); |
8820 | break; | 8844 | break; |
8821 | case 1: | 8845 | case 1: |
8822 | dasm_put(Dst, 5062); | 8846 | dasm_put(Dst, 5084); |
8823 | break; | 8847 | break; |
8824 | default: | 8848 | default: |
8825 | dasm_put(Dst, 5065); | 8849 | dasm_put(Dst, 5087); |
8826 | break; | 8850 | break; |
8827 | } | 8851 | } |
8828 | dasm_put(Dst, 5068); | 8852 | dasm_put(Dst, 5090); |
8829 | } else { | 8853 | } else { |
8830 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 8854 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
8831 | switch (vk) { | 8855 | switch (vk) { |
8832 | case 0: | 8856 | case 0: |
8833 | dasm_put(Dst, 5075); | 8857 | dasm_put(Dst, 5097); |
8834 | if (LJ_DUALNUM) { | 8858 | if (LJ_DUALNUM) { |
8835 | dasm_put(Dst, 5077); | 8859 | dasm_put(Dst, 5099); |
8836 | } | 8860 | } |
8837 | dasm_put(Dst, 5079); | 8861 | dasm_put(Dst, 5101); |
8838 | if (LJ_DUALNUM) { | 8862 | if (LJ_DUALNUM) { |
8839 | dasm_put(Dst, 5082); | 8863 | dasm_put(Dst, 5104); |
8840 | } else { | 8864 | } else { |
8841 | dasm_put(Dst, 5088); | 8865 | dasm_put(Dst, 5110); |
8842 | } | 8866 | } |
8843 | break; | 8867 | break; |
8844 | case 1: | 8868 | case 1: |
8845 | dasm_put(Dst, 5092); | 8869 | dasm_put(Dst, 5114); |
8846 | if (LJ_DUALNUM) { | 8870 | if (LJ_DUALNUM) { |
8847 | dasm_put(Dst, 5094); | 8871 | dasm_put(Dst, 5116); |
8848 | } | 8872 | } |
8849 | dasm_put(Dst, 5096); | 8873 | dasm_put(Dst, 5118); |
8850 | if (LJ_DUALNUM) { | 8874 | if (LJ_DUALNUM) { |
8851 | dasm_put(Dst, 5099); | 8875 | dasm_put(Dst, 5121); |
8852 | } else { | 8876 | } else { |
8853 | dasm_put(Dst, 5105); | 8877 | dasm_put(Dst, 5127); |
8854 | } | 8878 | } |
8855 | break; | 8879 | break; |
8856 | default: | 8880 | default: |
8857 | dasm_put(Dst, 5109); | 8881 | dasm_put(Dst, 5131); |
8858 | break; | 8882 | break; |
8859 | } | 8883 | } |
8860 | dasm_put(Dst, 5119); | 8884 | dasm_put(Dst, 5141); |
8861 | } | 8885 | } |
8862 | break; | 8886 | break; |
8863 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: | 8887 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: |
@@ -8865,77 +8889,77 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
8865 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 8889 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
8866 | switch (vk) { | 8890 | switch (vk) { |
8867 | case 0: | 8891 | case 0: |
8868 | dasm_put(Dst, 5132); | 8892 | dasm_put(Dst, 5154); |
8869 | break; | 8893 | break; |
8870 | case 1: | 8894 | case 1: |
8871 | dasm_put(Dst, 5138); | 8895 | dasm_put(Dst, 5160); |
8872 | break; | 8896 | break; |
8873 | default: | 8897 | default: |
8874 | dasm_put(Dst, 5144); | 8898 | dasm_put(Dst, 5166); |
8875 | break; | 8899 | break; |
8876 | } | 8900 | } |
8877 | dasm_put(Dst, 5150); | 8901 | dasm_put(Dst, 5172); |
8878 | switch (vk) { | 8902 | switch (vk) { |
8879 | case 0: | 8903 | case 0: |
8880 | dasm_put(Dst, 5177); | 8904 | dasm_put(Dst, 5199); |
8881 | break; | 8905 | break; |
8882 | case 1: | 8906 | case 1: |
8883 | dasm_put(Dst, 5180); | 8907 | dasm_put(Dst, 5202); |
8884 | break; | 8908 | break; |
8885 | default: | 8909 | default: |
8886 | dasm_put(Dst, 5183); | 8910 | dasm_put(Dst, 5205); |
8887 | break; | 8911 | break; |
8888 | } | 8912 | } |
8889 | dasm_put(Dst, 5186); | 8913 | dasm_put(Dst, 5208); |
8890 | if (vk == 1) { | 8914 | if (vk == 1) { |
8891 | dasm_put(Dst, 5188); | 8915 | dasm_put(Dst, 5210); |
8892 | } else { | 8916 | } else { |
8893 | dasm_put(Dst, 5192); | 8917 | dasm_put(Dst, 5214); |
8894 | } | 8918 | } |
8895 | switch (vk) { | 8919 | switch (vk) { |
8896 | case 0: | 8920 | case 0: |
8897 | dasm_put(Dst, 5196); | 8921 | dasm_put(Dst, 5218); |
8898 | break; | 8922 | break; |
8899 | case 1: | 8923 | case 1: |
8900 | dasm_put(Dst, 5199); | 8924 | dasm_put(Dst, 5221); |
8901 | break; | 8925 | break; |
8902 | default: | 8926 | default: |
8903 | dasm_put(Dst, 5202); | 8927 | dasm_put(Dst, 5224); |
8904 | break; | 8928 | break; |
8905 | } | 8929 | } |
8906 | dasm_put(Dst, 5205); | 8930 | dasm_put(Dst, 5227); |
8907 | } else { | 8931 | } else { |
8908 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 8932 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
8909 | switch (vk) { | 8933 | switch (vk) { |
8910 | case 0: | 8934 | case 0: |
8911 | dasm_put(Dst, 5212); | 8935 | dasm_put(Dst, 5234); |
8912 | if (LJ_DUALNUM) { | 8936 | if (LJ_DUALNUM) { |
8913 | dasm_put(Dst, 5214); | 8937 | dasm_put(Dst, 5236); |
8914 | } | 8938 | } |
8915 | dasm_put(Dst, 5216); | 8939 | dasm_put(Dst, 5238); |
8916 | if (LJ_DUALNUM) { | 8940 | if (LJ_DUALNUM) { |
8917 | dasm_put(Dst, 5219); | 8941 | dasm_put(Dst, 5241); |
8918 | } else { | 8942 | } else { |
8919 | dasm_put(Dst, 5225); | 8943 | dasm_put(Dst, 5247); |
8920 | } | 8944 | } |
8921 | break; | 8945 | break; |
8922 | case 1: | 8946 | case 1: |
8923 | dasm_put(Dst, 5229); | 8947 | dasm_put(Dst, 5251); |
8924 | if (LJ_DUALNUM) { | 8948 | if (LJ_DUALNUM) { |
8925 | dasm_put(Dst, 5231); | 8949 | dasm_put(Dst, 5253); |
8926 | } | 8950 | } |
8927 | dasm_put(Dst, 5233); | 8951 | dasm_put(Dst, 5255); |
8928 | if (LJ_DUALNUM) { | 8952 | if (LJ_DUALNUM) { |
8929 | dasm_put(Dst, 5236); | 8953 | dasm_put(Dst, 5258); |
8930 | } else { | 8954 | } else { |
8931 | dasm_put(Dst, 5242); | 8955 | dasm_put(Dst, 5264); |
8932 | } | 8956 | } |
8933 | break; | 8957 | break; |
8934 | default: | 8958 | default: |
8935 | dasm_put(Dst, 5246); | 8959 | dasm_put(Dst, 5268); |
8936 | break; | 8960 | break; |
8937 | } | 8961 | } |
8938 | dasm_put(Dst, 5256); | 8962 | dasm_put(Dst, 5278); |
8939 | } | 8963 | } |
8940 | break; | 8964 | break; |
8941 | case BC_MULVN: case BC_MULNV: case BC_MULVV: | 8965 | case BC_MULVN: case BC_MULNV: case BC_MULVV: |
@@ -8943,188 +8967,188 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
8943 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 8967 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
8944 | switch (vk) { | 8968 | switch (vk) { |
8945 | case 0: | 8969 | case 0: |
8946 | dasm_put(Dst, 5269); | 8970 | dasm_put(Dst, 5291); |
8947 | break; | 8971 | break; |
8948 | case 1: | 8972 | case 1: |
8949 | dasm_put(Dst, 5275); | 8973 | dasm_put(Dst, 5297); |
8950 | break; | 8974 | break; |
8951 | default: | 8975 | default: |
8952 | dasm_put(Dst, 5281); | 8976 | dasm_put(Dst, 5303); |
8953 | break; | 8977 | break; |
8954 | } | 8978 | } |
8955 | dasm_put(Dst, 5287); | 8979 | dasm_put(Dst, 5309); |
8956 | switch (vk) { | 8980 | switch (vk) { |
8957 | case 0: | 8981 | case 0: |
8958 | dasm_put(Dst, 5314); | 8982 | dasm_put(Dst, 5336); |
8959 | break; | 8983 | break; |
8960 | case 1: | 8984 | case 1: |
8961 | dasm_put(Dst, 5317); | 8985 | dasm_put(Dst, 5339); |
8962 | break; | 8986 | break; |
8963 | default: | 8987 | default: |
8964 | dasm_put(Dst, 5320); | 8988 | dasm_put(Dst, 5342); |
8965 | break; | 8989 | break; |
8966 | } | 8990 | } |
8967 | dasm_put(Dst, 5323); | 8991 | dasm_put(Dst, 5345); |
8968 | if (vk == 1) { | 8992 | if (vk == 1) { |
8969 | dasm_put(Dst, 5325); | 8993 | dasm_put(Dst, 5347); |
8970 | } else { | 8994 | } else { |
8971 | dasm_put(Dst, 5329); | 8995 | dasm_put(Dst, 5351); |
8972 | } | 8996 | } |
8973 | switch (vk) { | 8997 | switch (vk) { |
8974 | case 0: | 8998 | case 0: |
8975 | dasm_put(Dst, 5333); | 8999 | dasm_put(Dst, 5355); |
8976 | break; | 9000 | break; |
8977 | case 1: | 9001 | case 1: |
8978 | dasm_put(Dst, 5336); | 9002 | dasm_put(Dst, 5358); |
8979 | break; | 9003 | break; |
8980 | default: | 9004 | default: |
8981 | dasm_put(Dst, 5339); | 9005 | dasm_put(Dst, 5361); |
8982 | break; | 9006 | break; |
8983 | } | 9007 | } |
8984 | dasm_put(Dst, 5342); | 9008 | dasm_put(Dst, 5364); |
8985 | } else { | 9009 | } else { |
8986 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 9010 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
8987 | switch (vk) { | 9011 | switch (vk) { |
8988 | case 0: | 9012 | case 0: |
8989 | dasm_put(Dst, 5349); | 9013 | dasm_put(Dst, 5371); |
8990 | if (LJ_DUALNUM) { | 9014 | if (LJ_DUALNUM) { |
8991 | dasm_put(Dst, 5351); | 9015 | dasm_put(Dst, 5373); |
8992 | } | 9016 | } |
8993 | dasm_put(Dst, 5353); | 9017 | dasm_put(Dst, 5375); |
8994 | if (LJ_DUALNUM) { | 9018 | if (LJ_DUALNUM) { |
8995 | dasm_put(Dst, 5356); | 9019 | dasm_put(Dst, 5378); |
8996 | } else { | 9020 | } else { |
8997 | dasm_put(Dst, 5362); | 9021 | dasm_put(Dst, 5384); |
8998 | } | 9022 | } |
8999 | break; | 9023 | break; |
9000 | case 1: | 9024 | case 1: |
9001 | dasm_put(Dst, 5366); | 9025 | dasm_put(Dst, 5388); |
9002 | if (LJ_DUALNUM) { | 9026 | if (LJ_DUALNUM) { |
9003 | dasm_put(Dst, 5368); | 9027 | dasm_put(Dst, 5390); |
9004 | } | 9028 | } |
9005 | dasm_put(Dst, 5370); | 9029 | dasm_put(Dst, 5392); |
9006 | if (LJ_DUALNUM) { | 9030 | if (LJ_DUALNUM) { |
9007 | dasm_put(Dst, 5373); | 9031 | dasm_put(Dst, 5395); |
9008 | } else { | 9032 | } else { |
9009 | dasm_put(Dst, 5379); | 9033 | dasm_put(Dst, 5401); |
9010 | } | 9034 | } |
9011 | break; | 9035 | break; |
9012 | default: | 9036 | default: |
9013 | dasm_put(Dst, 5383); | 9037 | dasm_put(Dst, 5405); |
9014 | break; | 9038 | break; |
9015 | } | 9039 | } |
9016 | dasm_put(Dst, 5393); | 9040 | dasm_put(Dst, 5415); |
9017 | } | 9041 | } |
9018 | break; | 9042 | break; |
9019 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: | 9043 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: |
9020 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 9044 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
9021 | switch (vk) { | 9045 | switch (vk) { |
9022 | case 0: | 9046 | case 0: |
9023 | dasm_put(Dst, 5406); | 9047 | dasm_put(Dst, 5428); |
9024 | if (LJ_DUALNUM) { | 9048 | if (LJ_DUALNUM) { |
9025 | dasm_put(Dst, 5408); | 9049 | dasm_put(Dst, 5430); |
9026 | } | 9050 | } |
9027 | dasm_put(Dst, 5410); | 9051 | dasm_put(Dst, 5432); |
9028 | if (LJ_DUALNUM) { | 9052 | if (LJ_DUALNUM) { |
9029 | dasm_put(Dst, 5413); | 9053 | dasm_put(Dst, 5435); |
9030 | } else { | 9054 | } else { |
9031 | dasm_put(Dst, 5419); | 9055 | dasm_put(Dst, 5441); |
9032 | } | 9056 | } |
9033 | break; | 9057 | break; |
9034 | case 1: | 9058 | case 1: |
9035 | dasm_put(Dst, 5423); | 9059 | dasm_put(Dst, 5445); |
9036 | if (LJ_DUALNUM) { | 9060 | if (LJ_DUALNUM) { |
9037 | dasm_put(Dst, 5425); | 9061 | dasm_put(Dst, 5447); |
9038 | } | 9062 | } |
9039 | dasm_put(Dst, 5427); | 9063 | dasm_put(Dst, 5449); |
9040 | if (LJ_DUALNUM) { | 9064 | if (LJ_DUALNUM) { |
9041 | dasm_put(Dst, 5430); | 9065 | dasm_put(Dst, 5452); |
9042 | } else { | 9066 | } else { |
9043 | dasm_put(Dst, 5436); | 9067 | dasm_put(Dst, 5458); |
9044 | } | 9068 | } |
9045 | break; | 9069 | break; |
9046 | default: | 9070 | default: |
9047 | dasm_put(Dst, 5440); | 9071 | dasm_put(Dst, 5462); |
9048 | break; | 9072 | break; |
9049 | } | 9073 | } |
9050 | dasm_put(Dst, 5450); | 9074 | dasm_put(Dst, 5472); |
9051 | break; | 9075 | break; |
9052 | case BC_MODVN: | 9076 | case BC_MODVN: |
9053 | if (LJ_DUALNUM) { | 9077 | if (LJ_DUALNUM) { |
9054 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 9078 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
9055 | switch (vk) { | 9079 | switch (vk) { |
9056 | case 0: | 9080 | case 0: |
9057 | dasm_put(Dst, 5463); | 9081 | dasm_put(Dst, 5485); |
9058 | break; | 9082 | break; |
9059 | case 1: | 9083 | case 1: |
9060 | dasm_put(Dst, 5469); | 9084 | dasm_put(Dst, 5491); |
9061 | break; | 9085 | break; |
9062 | default: | 9086 | default: |
9063 | dasm_put(Dst, 5475); | 9087 | dasm_put(Dst, 5497); |
9064 | break; | 9088 | break; |
9065 | } | 9089 | } |
9066 | dasm_put(Dst, 5481); | 9090 | dasm_put(Dst, 5503); |
9067 | switch (vk) { | 9091 | switch (vk) { |
9068 | case 0: | 9092 | case 0: |
9069 | dasm_put(Dst, 5509); | 9093 | dasm_put(Dst, 5531); |
9070 | break; | 9094 | break; |
9071 | case 1: | 9095 | case 1: |
9072 | dasm_put(Dst, 5512); | 9096 | dasm_put(Dst, 5534); |
9073 | break; | 9097 | break; |
9074 | default: | 9098 | default: |
9075 | dasm_put(Dst, 5515); | 9099 | dasm_put(Dst, 5537); |
9076 | break; | 9100 | break; |
9077 | } | 9101 | } |
9078 | dasm_put(Dst, 5518); | 9102 | dasm_put(Dst, 5540); |
9079 | if (vk == 1) { | 9103 | if (vk == 1) { |
9080 | dasm_put(Dst, 5520); | 9104 | dasm_put(Dst, 5542); |
9081 | } else { | 9105 | } else { |
9082 | dasm_put(Dst, 5524); | 9106 | dasm_put(Dst, 5546); |
9083 | } | 9107 | } |
9084 | switch (vk) { | 9108 | switch (vk) { |
9085 | case 0: | 9109 | case 0: |
9086 | dasm_put(Dst, 5528); | 9110 | dasm_put(Dst, 5550); |
9087 | break; | 9111 | break; |
9088 | case 1: | 9112 | case 1: |
9089 | dasm_put(Dst, 5531); | 9113 | dasm_put(Dst, 5553); |
9090 | break; | 9114 | break; |
9091 | default: | 9115 | default: |
9092 | dasm_put(Dst, 5534); | 9116 | dasm_put(Dst, 5556); |
9093 | break; | 9117 | break; |
9094 | } | 9118 | } |
9095 | dasm_put(Dst, 5537); | 9119 | dasm_put(Dst, 5559); |
9096 | } else { | 9120 | } else { |
9097 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 9121 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
9098 | switch (vk) { | 9122 | switch (vk) { |
9099 | case 0: | 9123 | case 0: |
9100 | dasm_put(Dst, 5549); | 9124 | dasm_put(Dst, 5571); |
9101 | if (LJ_DUALNUM) { | 9125 | if (LJ_DUALNUM) { |
9102 | dasm_put(Dst, 5551); | 9126 | dasm_put(Dst, 5573); |
9103 | } | 9127 | } |
9104 | dasm_put(Dst, 5553); | 9128 | dasm_put(Dst, 5575); |
9105 | if (LJ_DUALNUM) { | 9129 | if (LJ_DUALNUM) { |
9106 | dasm_put(Dst, 5556); | 9130 | dasm_put(Dst, 5578); |
9107 | } else { | 9131 | } else { |
9108 | dasm_put(Dst, 5562); | 9132 | dasm_put(Dst, 5584); |
9109 | } | 9133 | } |
9110 | break; | 9134 | break; |
9111 | case 1: | 9135 | case 1: |
9112 | dasm_put(Dst, 5566); | 9136 | dasm_put(Dst, 5588); |
9113 | if (LJ_DUALNUM) { | 9137 | if (LJ_DUALNUM) { |
9114 | dasm_put(Dst, 5568); | 9138 | dasm_put(Dst, 5590); |
9115 | } | 9139 | } |
9116 | dasm_put(Dst, 5570); | 9140 | dasm_put(Dst, 5592); |
9117 | if (LJ_DUALNUM) { | 9141 | if (LJ_DUALNUM) { |
9118 | dasm_put(Dst, 5573); | 9142 | dasm_put(Dst, 5595); |
9119 | } else { | 9143 | } else { |
9120 | dasm_put(Dst, 5579); | 9144 | dasm_put(Dst, 5601); |
9121 | } | 9145 | } |
9122 | break; | 9146 | break; |
9123 | default: | 9147 | default: |
9124 | dasm_put(Dst, 5583); | 9148 | dasm_put(Dst, 5605); |
9125 | break; | 9149 | break; |
9126 | } | 9150 | } |
9127 | dasm_put(Dst, 5593); | 9151 | dasm_put(Dst, 5615); |
9128 | } | 9152 | } |
9129 | break; | 9153 | break; |
9130 | case BC_MODNV: case BC_MODVV: | 9154 | case BC_MODNV: case BC_MODVV: |
@@ -9132,297 +9156,297 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
9132 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 9156 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
9133 | switch (vk) { | 9157 | switch (vk) { |
9134 | case 0: | 9158 | case 0: |
9135 | dasm_put(Dst, 5611); | 9159 | dasm_put(Dst, 5633); |
9136 | break; | 9160 | break; |
9137 | case 1: | 9161 | case 1: |
9138 | dasm_put(Dst, 5617); | 9162 | dasm_put(Dst, 5639); |
9139 | break; | 9163 | break; |
9140 | default: | 9164 | default: |
9141 | dasm_put(Dst, 5623); | 9165 | dasm_put(Dst, 5645); |
9142 | break; | 9166 | break; |
9143 | } | 9167 | } |
9144 | dasm_put(Dst, 5629); | 9168 | dasm_put(Dst, 5651); |
9145 | switch (vk) { | 9169 | switch (vk) { |
9146 | case 0: | 9170 | case 0: |
9147 | dasm_put(Dst, 5657); | 9171 | dasm_put(Dst, 5679); |
9148 | break; | 9172 | break; |
9149 | case 1: | 9173 | case 1: |
9150 | dasm_put(Dst, 5660); | 9174 | dasm_put(Dst, 5682); |
9151 | break; | 9175 | break; |
9152 | default: | 9176 | default: |
9153 | dasm_put(Dst, 5663); | 9177 | dasm_put(Dst, 5685); |
9154 | break; | 9178 | break; |
9155 | } | 9179 | } |
9156 | dasm_put(Dst, 5666); | 9180 | dasm_put(Dst, 5688); |
9157 | if (vk == 1) { | 9181 | if (vk == 1) { |
9158 | dasm_put(Dst, 5668); | 9182 | dasm_put(Dst, 5690); |
9159 | } else { | 9183 | } else { |
9160 | dasm_put(Dst, 5672); | 9184 | dasm_put(Dst, 5694); |
9161 | } | 9185 | } |
9162 | switch (vk) { | 9186 | switch (vk) { |
9163 | case 0: | 9187 | case 0: |
9164 | dasm_put(Dst, 5676); | 9188 | dasm_put(Dst, 5698); |
9165 | break; | 9189 | break; |
9166 | case 1: | 9190 | case 1: |
9167 | dasm_put(Dst, 5679); | 9191 | dasm_put(Dst, 5701); |
9168 | break; | 9192 | break; |
9169 | default: | 9193 | default: |
9170 | dasm_put(Dst, 5682); | 9194 | dasm_put(Dst, 5704); |
9171 | break; | 9195 | break; |
9172 | } | 9196 | } |
9173 | dasm_put(Dst, 5685); | 9197 | dasm_put(Dst, 5707); |
9174 | } else { | 9198 | } else { |
9175 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 9199 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
9176 | switch (vk) { | 9200 | switch (vk) { |
9177 | case 0: | 9201 | case 0: |
9178 | dasm_put(Dst, 5688); | 9202 | dasm_put(Dst, 5710); |
9179 | if (LJ_DUALNUM) { | 9203 | if (LJ_DUALNUM) { |
9180 | dasm_put(Dst, 5690); | 9204 | dasm_put(Dst, 5712); |
9181 | } | 9205 | } |
9182 | dasm_put(Dst, 5692); | 9206 | dasm_put(Dst, 5714); |
9183 | if (LJ_DUALNUM) { | 9207 | if (LJ_DUALNUM) { |
9184 | dasm_put(Dst, 5695); | 9208 | dasm_put(Dst, 5717); |
9185 | } else { | 9209 | } else { |
9186 | dasm_put(Dst, 5701); | 9210 | dasm_put(Dst, 5723); |
9187 | } | 9211 | } |
9188 | break; | 9212 | break; |
9189 | case 1: | 9213 | case 1: |
9190 | dasm_put(Dst, 5705); | 9214 | dasm_put(Dst, 5727); |
9191 | if (LJ_DUALNUM) { | 9215 | if (LJ_DUALNUM) { |
9192 | dasm_put(Dst, 5707); | 9216 | dasm_put(Dst, 5729); |
9193 | } | 9217 | } |
9194 | dasm_put(Dst, 5709); | 9218 | dasm_put(Dst, 5731); |
9195 | if (LJ_DUALNUM) { | 9219 | if (LJ_DUALNUM) { |
9196 | dasm_put(Dst, 5712); | 9220 | dasm_put(Dst, 5734); |
9197 | } else { | 9221 | } else { |
9198 | dasm_put(Dst, 5718); | 9222 | dasm_put(Dst, 5740); |
9199 | } | 9223 | } |
9200 | break; | 9224 | break; |
9201 | default: | 9225 | default: |
9202 | dasm_put(Dst, 5722); | 9226 | dasm_put(Dst, 5744); |
9203 | break; | 9227 | break; |
9204 | } | 9228 | } |
9205 | dasm_put(Dst, 5732); | 9229 | dasm_put(Dst, 5754); |
9206 | } | 9230 | } |
9207 | break; | 9231 | break; |
9208 | case BC_POW: | 9232 | case BC_POW: |
9209 | dasm_put(Dst, 5735); | 9233 | dasm_put(Dst, 5757); |
9210 | break; | 9234 | break; |
9211 | 9235 | ||
9212 | case BC_CAT: | 9236 | case BC_CAT: |
9213 | dasm_put(Dst, 5758, Dt1(->base), 32-3, Dt1(->base)); | 9237 | dasm_put(Dst, 5780, Dt1(->base), 32-3, Dt1(->base)); |
9214 | break; | 9238 | break; |
9215 | 9239 | ||
9216 | /* -- Constant ops ------------------------------------------------------ */ | 9240 | /* -- Constant ops ------------------------------------------------------ */ |
9217 | 9241 | ||
9218 | case BC_KSTR: | 9242 | case BC_KSTR: |
9219 | dasm_put(Dst, 5788, 32-1, LJ_TSTR); | 9243 | dasm_put(Dst, 5810, 32-1, LJ_TSTR); |
9220 | break; | 9244 | break; |
9221 | case BC_KCDATA: | 9245 | case BC_KCDATA: |
9222 | #if LJ_HASFFI | 9246 | #if LJ_HASFFI |
9223 | dasm_put(Dst, 5807, 32-1, LJ_TCDATA); | 9247 | dasm_put(Dst, 5829, 32-1, LJ_TCDATA); |
9224 | #endif | 9248 | #endif |
9225 | break; | 9249 | break; |
9226 | case BC_KSHORT: | 9250 | case BC_KSHORT: |
9227 | if (LJ_DUALNUM) { | 9251 | if (LJ_DUALNUM) { |
9228 | dasm_put(Dst, 5826, 31-13); | 9252 | dasm_put(Dst, 5848, 31-13); |
9229 | } else { | 9253 | } else { |
9230 | dasm_put(Dst, 5842, 31-13, 31-20); | 9254 | dasm_put(Dst, 5864, 31-13, 31-20); |
9231 | } | 9255 | } |
9232 | break; | 9256 | break; |
9233 | case BC_KNUM: | 9257 | case BC_KNUM: |
9234 | dasm_put(Dst, 5870); | 9258 | dasm_put(Dst, 5892); |
9235 | break; | 9259 | break; |
9236 | case BC_KPRI: | 9260 | case BC_KPRI: |
9237 | dasm_put(Dst, 5883, 32-3); | 9261 | dasm_put(Dst, 5905, 32-3); |
9238 | break; | 9262 | break; |
9239 | case BC_KNIL: | 9263 | case BC_KNIL: |
9240 | dasm_put(Dst, 5898); | 9264 | dasm_put(Dst, 5920); |
9241 | break; | 9265 | break; |
9242 | 9266 | ||
9243 | /* -- Upvalue and function ops ------------------------------------------ */ | 9267 | /* -- Upvalue and function ops ------------------------------------------ */ |
9244 | 9268 | ||
9245 | case BC_UGET: | 9269 | case BC_UGET: |
9246 | dasm_put(Dst, 5917, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); | 9270 | dasm_put(Dst, 5939, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); |
9247 | break; | 9271 | break; |
9248 | case BC_USETV: | 9272 | case BC_USETV: |
9249 | dasm_put(Dst, 5938, 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); | 9273 | dasm_put(Dst, 5960, 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); |
9250 | break; | 9274 | break; |
9251 | case BC_USETS: | 9275 | case BC_USETS: |
9252 | dasm_put(Dst, 5991, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_TSTR, LJ_GC_WHITES, GG_DISP2G); | 9276 | dasm_put(Dst, 6013, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_TSTR, LJ_GC_WHITES, GG_DISP2G); |
9253 | break; | 9277 | break; |
9254 | case BC_USETN: | 9278 | case BC_USETN: |
9255 | dasm_put(Dst, 6042, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); | 9279 | dasm_put(Dst, 6064, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); |
9256 | break; | 9280 | break; |
9257 | case BC_USETP: | 9281 | case BC_USETP: |
9258 | dasm_put(Dst, 6063, 32-1, 32-3, offsetof(GCfuncL, uvptr), DtA(->v)); | 9282 | dasm_put(Dst, 6085, 32-1, 32-3, offsetof(GCfuncL, uvptr), DtA(->v)); |
9259 | break; | 9283 | break; |
9260 | 9284 | ||
9261 | case BC_UCLO: | 9285 | case BC_UCLO: |
9262 | dasm_put(Dst, 6086, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); | 9286 | dasm_put(Dst, 6108, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); |
9263 | break; | 9287 | break; |
9264 | 9288 | ||
9265 | case BC_FNEW: | 9289 | case BC_FNEW: |
9266 | dasm_put(Dst, 6116, 32-1, Dt1(->base), Dt1(->base), LJ_TFUNC); | 9290 | dasm_put(Dst, 6138, 32-1, Dt1(->base), Dt1(->base), LJ_TFUNC); |
9267 | break; | 9291 | break; |
9268 | 9292 | ||
9269 | /* -- Table ops --------------------------------------------------------- */ | 9293 | /* -- Table ops --------------------------------------------------------- */ |
9270 | 9294 | ||
9271 | case BC_TNEW: | 9295 | case BC_TNEW: |
9272 | case BC_TDUP: | 9296 | case BC_TDUP: |
9273 | dasm_put(Dst, 6144, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); | 9297 | dasm_put(Dst, 6166, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); |
9274 | if (op == BC_TNEW) { | 9298 | if (op == BC_TNEW) { |
9275 | dasm_put(Dst, 6157); | 9299 | dasm_put(Dst, 6179); |
9276 | } else { | 9300 | } else { |
9277 | dasm_put(Dst, 6166, 32-1); | 9301 | dasm_put(Dst, 6188, 32-1); |
9278 | } | 9302 | } |
9279 | dasm_put(Dst, 6173, Dt1(->base), LJ_TTAB); | 9303 | dasm_put(Dst, 6195, Dt1(->base), LJ_TTAB); |
9280 | if (op == BC_TNEW) { | 9304 | if (op == BC_TNEW) { |
9281 | dasm_put(Dst, 6190); | 9305 | dasm_put(Dst, 6212); |
9282 | } | 9306 | } |
9283 | dasm_put(Dst, 6195); | 9307 | dasm_put(Dst, 6217); |
9284 | break; | 9308 | break; |
9285 | 9309 | ||
9286 | case BC_GGET: | 9310 | case BC_GGET: |
9287 | case BC_GSET: | 9311 | case BC_GSET: |
9288 | dasm_put(Dst, 6204, 32-1, Dt7(->env)); | 9312 | dasm_put(Dst, 6226, 32-1, Dt7(->env)); |
9289 | if (op == BC_GGET) { | 9313 | if (op == BC_GGET) { |
9290 | dasm_put(Dst, 6212); | 9314 | dasm_put(Dst, 6234); |
9291 | } else { | 9315 | } else { |
9292 | dasm_put(Dst, 6215); | 9316 | dasm_put(Dst, 6237); |
9293 | } | 9317 | } |
9294 | break; | 9318 | break; |
9295 | 9319 | ||
9296 | case BC_TGETV: | 9320 | case BC_TGETV: |
9297 | dasm_put(Dst, 6218); | 9321 | dasm_put(Dst, 6240); |
9298 | if (LJ_DUALNUM) { | 9322 | if (LJ_DUALNUM) { |
9299 | dasm_put(Dst, 6222); | 9323 | dasm_put(Dst, 6244); |
9300 | } else { | 9324 | } else { |
9301 | dasm_put(Dst, 6224); | 9325 | dasm_put(Dst, 6246); |
9302 | } | 9326 | } |
9303 | dasm_put(Dst, 6226, LJ_TTAB); | 9327 | dasm_put(Dst, 6248, LJ_TTAB); |
9304 | if (LJ_DUALNUM) { | 9328 | if (LJ_DUALNUM) { |
9305 | dasm_put(Dst, 6232, Dt6(->asize), Dt6(->array), 31-3); | 9329 | dasm_put(Dst, 6254, Dt6(->asize), Dt6(->array), 31-3); |
9306 | } else { | 9330 | } else { |
9307 | dasm_put(Dst, 6242, Dt6(->asize), Dt6(->array), 31-3); | 9331 | dasm_put(Dst, 6264, Dt6(->asize), Dt6(->array), 31-3); |
9308 | } | 9332 | } |
9309 | dasm_put(Dst, 6259, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TSTR); | 9333 | dasm_put(Dst, 6281, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TSTR); |
9310 | if (!LJ_DUALNUM) { | 9334 | if (!LJ_DUALNUM) { |
9311 | dasm_put(Dst, 6299); | 9335 | dasm_put(Dst, 6321); |
9312 | } | 9336 | } |
9313 | dasm_put(Dst, 6301); | 9337 | dasm_put(Dst, 6323); |
9314 | break; | 9338 | break; |
9315 | case BC_TGETS: | 9339 | case BC_TGETS: |
9316 | dasm_put(Dst, 6304, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), 4+offsetof(Node, key), DtB(->val), 4+offsetof(Node, val), LJ_TSTR, LJ_TNIL, DtB(->next)); | 9340 | dasm_put(Dst, 6326, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), 4+offsetof(Node, key), DtB(->val), 4+offsetof(Node, val), LJ_TSTR, LJ_TNIL, DtB(->next)); |
9317 | dasm_put(Dst, 6365, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 9341 | dasm_put(Dst, 6387, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
9318 | break; | 9342 | break; |
9319 | case BC_TGETB: | 9343 | case BC_TGETB: |
9320 | dasm_put(Dst, 6385, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 9344 | dasm_put(Dst, 6407, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
9321 | break; | 9345 | break; |
9322 | 9346 | ||
9323 | case BC_TSETV: | 9347 | case BC_TSETV: |
9324 | dasm_put(Dst, 6433); | 9348 | dasm_put(Dst, 6455); |
9325 | if (LJ_DUALNUM) { | 9349 | if (LJ_DUALNUM) { |
9326 | dasm_put(Dst, 6437); | 9350 | dasm_put(Dst, 6459); |
9327 | } else { | 9351 | } else { |
9328 | dasm_put(Dst, 6439); | 9352 | dasm_put(Dst, 6461); |
9329 | } | 9353 | } |
9330 | dasm_put(Dst, 6441, LJ_TTAB); | 9354 | dasm_put(Dst, 6463, LJ_TTAB); |
9331 | if (LJ_DUALNUM) { | 9355 | if (LJ_DUALNUM) { |
9332 | dasm_put(Dst, 6447, Dt6(->asize), Dt6(->array), 31-3); | 9356 | dasm_put(Dst, 6469, Dt6(->asize), Dt6(->array), 31-3); |
9333 | } else { | 9357 | } else { |
9334 | dasm_put(Dst, 6457, Dt6(->asize), Dt6(->array), 31-3); | 9358 | dasm_put(Dst, 6479, Dt6(->asize), Dt6(->array), 31-3); |
9335 | } | 9359 | } |
9336 | dasm_put(Dst, 6474, Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR); | 9360 | dasm_put(Dst, 6496, Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR); |
9337 | if (!LJ_DUALNUM) { | 9361 | if (!LJ_DUALNUM) { |
9338 | dasm_put(Dst, 6521); | 9362 | dasm_put(Dst, 6543); |
9339 | } | 9363 | } |
9340 | dasm_put(Dst, 6523, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 9364 | dasm_put(Dst, 6545, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
9341 | break; | 9365 | break; |
9342 | case BC_TSETS: | 9366 | case BC_TSETS: |
9343 | dasm_put(Dst, 6538, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), 4+offsetof(Node, key), DtB(->val), DtB(->next), LJ_TSTR, LJ_TNIL); | 9367 | dasm_put(Dst, 6560, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), 4+offsetof(Node, key), DtB(->val), DtB(->next), LJ_TSTR, LJ_TNIL); |
9344 | dasm_put(Dst, 6589, LJ_GC_BLACK, DtB(->val), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR); | 9368 | dasm_put(Dst, 6611, LJ_GC_BLACK, DtB(->val), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR); |
9345 | dasm_put(Dst, 6646, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 9369 | dasm_put(Dst, 6668, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
9346 | break; | 9370 | break; |
9347 | case BC_TSETB: | 9371 | case BC_TSETB: |
9348 | dasm_put(Dst, 6669, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain)); | 9372 | dasm_put(Dst, 6691, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain)); |
9349 | dasm_put(Dst, 6727, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 9373 | dasm_put(Dst, 6749, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
9350 | break; | 9374 | break; |
9351 | 9375 | ||
9352 | case BC_TSETM: | 9376 | case BC_TSETM: |
9353 | dasm_put(Dst, 6737, 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)); | 9377 | dasm_put(Dst, 6759, 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)); |
9354 | dasm_put(Dst, 6806); | 9378 | dasm_put(Dst, 6828); |
9355 | break; | 9379 | break; |
9356 | 9380 | ||
9357 | /* -- Calls and vararg handling ----------------------------------------- */ | 9381 | /* -- Calls and vararg handling ----------------------------------------- */ |
9358 | 9382 | ||
9359 | case BC_CALLM: | 9383 | case BC_CALLM: |
9360 | dasm_put(Dst, 6809); | 9384 | dasm_put(Dst, 6831); |
9361 | break; | 9385 | break; |
9362 | case BC_CALL: | 9386 | case BC_CALL: |
9363 | dasm_put(Dst, 6811, LJ_TFUNC, Dt7(->pc)); | 9387 | dasm_put(Dst, 6833, LJ_TFUNC, Dt7(->pc)); |
9364 | break; | 9388 | break; |
9365 | 9389 | ||
9366 | case BC_CALLMT: | 9390 | case BC_CALLMT: |
9367 | dasm_put(Dst, 6832); | 9391 | dasm_put(Dst, 6854); |
9368 | break; | 9392 | break; |
9369 | case BC_CALLT: | 9393 | case BC_CALLT: |
9370 | dasm_put(Dst, 6834, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); | 9394 | dasm_put(Dst, 6856, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); |
9371 | dasm_put(Dst, 6898, FRAME_TYPE); | 9395 | dasm_put(Dst, 6920, FRAME_TYPE); |
9372 | break; | 9396 | break; |
9373 | 9397 | ||
9374 | case BC_ITERC: | 9398 | case BC_ITERC: |
9375 | dasm_put(Dst, 6907, LJ_TFUNC, Dt7(->pc)); | 9399 | dasm_put(Dst, 6929, LJ_TFUNC, Dt7(->pc)); |
9376 | break; | 9400 | break; |
9377 | 9401 | ||
9378 | case BC_ITERN: | 9402 | case BC_ITERN: |
9379 | #if LJ_HASJIT | 9403 | #if LJ_HASJIT |
9380 | #endif | 9404 | #endif |
9381 | dasm_put(Dst, 6934, Dt6(->asize), Dt6(->array), 31-3, LJ_TNIL); | 9405 | dasm_put(Dst, 6956, Dt6(->asize), Dt6(->array), 31-3, LJ_TNIL); |
9382 | if (LJ_DUALNUM) { | 9406 | if (LJ_DUALNUM) { |
9383 | dasm_put(Dst, 6956); | 9407 | dasm_put(Dst, 6978); |
9384 | } else { | 9408 | } else { |
9385 | dasm_put(Dst, 6959); | 9409 | dasm_put(Dst, 6981); |
9386 | } | 9410 | } |
9387 | dasm_put(Dst, 6963, -(BCBIAS_J*4 >> 16)); | 9411 | dasm_put(Dst, 6985, -(BCBIAS_J*4 >> 16)); |
9388 | if (!LJ_DUALNUM) { | 9412 | if (!LJ_DUALNUM) { |
9389 | dasm_put(Dst, 6971); | 9413 | dasm_put(Dst, 6993); |
9390 | } | 9414 | } |
9391 | dasm_put(Dst, 6973, Dt6(->hmask), Dt6(->node), 31-5, 31-3, LJ_TNIL, DtB(->key), -(BCBIAS_J*4 >> 16)); | 9415 | dasm_put(Dst, 6995, Dt6(->hmask), Dt6(->node), 31-5, 31-3, LJ_TNIL, DtB(->key), -(BCBIAS_J*4 >> 16)); |
9392 | break; | 9416 | break; |
9393 | 9417 | ||
9394 | case BC_ISNEXT: | 9418 | case BC_ISNEXT: |
9395 | dasm_put(Dst, 7029, 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)); | 9419 | dasm_put(Dst, 7051, 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)); |
9396 | break; | 9420 | break; |
9397 | 9421 | ||
9398 | case BC_VARG: | 9422 | case BC_VARG: |
9399 | dasm_put(Dst, 7079, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); | 9423 | dasm_put(Dst, 7101, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); |
9400 | dasm_put(Dst, 7159); | 9424 | dasm_put(Dst, 7181); |
9401 | break; | 9425 | break; |
9402 | 9426 | ||
9403 | /* -- Returns ----------------------------------------------------------- */ | 9427 | /* -- Returns ----------------------------------------------------------- */ |
9404 | 9428 | ||
9405 | case BC_RETM: | 9429 | case BC_RETM: |
9406 | dasm_put(Dst, 7165); | 9430 | dasm_put(Dst, 7187); |
9407 | break; | 9431 | break; |
9408 | 9432 | ||
9409 | case BC_RET: | 9433 | case BC_RET: |
9410 | dasm_put(Dst, 7167, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); | 9434 | dasm_put(Dst, 7189, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); |
9411 | break; | 9435 | break; |
9412 | 9436 | ||
9413 | case BC_RET0: case BC_RET1: | 9437 | case BC_RET0: case BC_RET1: |
9414 | dasm_put(Dst, 7237, FRAME_TYPE, FRAME_VARG); | 9438 | dasm_put(Dst, 7259, FRAME_TYPE, FRAME_VARG); |
9415 | if (op == BC_RET1) { | 9439 | if (op == BC_RET1) { |
9416 | dasm_put(Dst, 7250); | 9440 | dasm_put(Dst, 7272); |
9417 | } | 9441 | } |
9418 | dasm_put(Dst, 7253, Dt7(->pc), PC2PROTO(k)); | 9442 | dasm_put(Dst, 7275, Dt7(->pc), PC2PROTO(k)); |
9419 | break; | 9443 | break; |
9420 | 9444 | ||
9421 | /* -- Loops and branches ------------------------------------------------ */ | 9445 | /* -- Loops and branches ------------------------------------------------ */ |
9422 | 9446 | ||
9423 | case BC_FORL: | 9447 | case BC_FORL: |
9424 | #if LJ_HASJIT | 9448 | #if LJ_HASJIT |
9425 | dasm_put(Dst, 7281, GG_DISP2HOT, -HOTCOUNT_LOOP); | 9449 | dasm_put(Dst, 7303, GG_DISP2HOT, -HOTCOUNT_LOOP); |
9426 | #endif | 9450 | #endif |
9427 | break; | 9451 | break; |
9428 | 9452 | ||
@@ -9435,100 +9459,100 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
9435 | case BC_IFORL: | 9459 | case BC_IFORL: |
9436 | vk = (op == BC_IFORL || op == BC_JFORL); | 9460 | vk = (op == BC_IFORL || op == BC_JFORL); |
9437 | if (LJ_DUALNUM) { | 9461 | if (LJ_DUALNUM) { |
9438 | dasm_put(Dst, 7291, FORL_IDX*8+4); | 9462 | dasm_put(Dst, 7313, FORL_IDX*8+4); |
9439 | if (vk) { | 9463 | if (vk) { |
9440 | dasm_put(Dst, 7296, FORL_STEP*8+4, FORL_STOP*8+4, FORL_IDX*8+4); | 9464 | dasm_put(Dst, 7318, FORL_STEP*8+4, FORL_STOP*8+4, FORL_IDX*8+4); |
9441 | } else { | 9465 | } else { |
9442 | dasm_put(Dst, 7310, FORL_STEP*8, FORL_STEP*8+4, FORL_STOP*8, FORL_STOP*8+4); | 9466 | dasm_put(Dst, 7332, FORL_STEP*8, FORL_STEP*8+4, FORL_STOP*8, FORL_STOP*8+4); |
9443 | } | 9467 | } |
9444 | dasm_put(Dst, 7326, FORL_EXT*8); | 9468 | dasm_put(Dst, 7348, FORL_EXT*8); |
9445 | if (op != BC_JFORL) { | 9469 | if (op != BC_JFORL) { |
9446 | dasm_put(Dst, 7333, 32-1); | 9470 | dasm_put(Dst, 7355, 32-1); |
9447 | } | 9471 | } |
9448 | dasm_put(Dst, 7336, FORL_EXT*8+4); | 9472 | dasm_put(Dst, 7358, FORL_EXT*8+4); |
9449 | if (op != BC_JFORL) { | 9473 | if (op != BC_JFORL) { |
9450 | dasm_put(Dst, 7339); | 9474 | dasm_put(Dst, 7361); |
9451 | } | 9475 | } |
9452 | if (op == BC_FORI) { | 9476 | if (op == BC_FORI) { |
9453 | dasm_put(Dst, 7341); | 9477 | dasm_put(Dst, 7363); |
9454 | } else if (op == BC_JFORI) { | 9478 | } else if (op == BC_JFORI) { |
9455 | dasm_put(Dst, 7344, -(BCBIAS_J*4 >> 16)); | 9479 | dasm_put(Dst, 7366, -(BCBIAS_J*4 >> 16)); |
9456 | } else if (op == BC_IFORL) { | 9480 | } else if (op == BC_IFORL) { |
9457 | dasm_put(Dst, 7349, -(BCBIAS_J*4 >> 16)); | 9481 | dasm_put(Dst, 7371, -(BCBIAS_J*4 >> 16)); |
9458 | } else { | 9482 | } else { |
9459 | dasm_put(Dst, 7354, BC_JLOOP); | 9483 | dasm_put(Dst, 7376, BC_JLOOP); |
9460 | } | 9484 | } |
9461 | dasm_put(Dst, 7357); | 9485 | dasm_put(Dst, 7379); |
9462 | if (vk) { | 9486 | if (vk) { |
9463 | dasm_put(Dst, 7373); | 9487 | dasm_put(Dst, 7395); |
9464 | } | 9488 | } |
9465 | } | 9489 | } |
9466 | if (vk) { | 9490 | if (vk) { |
9467 | if (LJ_DUALNUM) { | 9491 | if (LJ_DUALNUM) { |
9468 | dasm_put(Dst, 7380, FORL_IDX*8); | 9492 | dasm_put(Dst, 7402, FORL_IDX*8); |
9469 | } else { | 9493 | } else { |
9470 | dasm_put(Dst, 7384); | 9494 | dasm_put(Dst, 7406); |
9471 | } | 9495 | } |
9472 | dasm_put(Dst, 7386, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8, FORL_IDX*8); | 9496 | dasm_put(Dst, 7408, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8, FORL_IDX*8); |
9473 | } else { | 9497 | } else { |
9474 | if (LJ_DUALNUM) { | 9498 | if (LJ_DUALNUM) { |
9475 | dasm_put(Dst, 7396); | 9499 | dasm_put(Dst, 7418); |
9476 | } else { | 9500 | } else { |
9477 | dasm_put(Dst, 7398, FORL_STEP*8, FORL_STOP*8); | 9501 | dasm_put(Dst, 7420, FORL_STEP*8, FORL_STOP*8); |
9478 | } | 9502 | } |
9479 | dasm_put(Dst, 7407, FORL_IDX*8, FORL_STOP*8); | 9503 | dasm_put(Dst, 7429, FORL_IDX*8, FORL_STOP*8); |
9480 | } | 9504 | } |
9481 | dasm_put(Dst, 7416); | 9505 | dasm_put(Dst, 7438); |
9482 | if (op != BC_JFORL) { | 9506 | if (op != BC_JFORL) { |
9483 | dasm_put(Dst, 7418, 32-1); | 9507 | dasm_put(Dst, 7440, 32-1); |
9484 | } | 9508 | } |
9485 | dasm_put(Dst, 7421, FORL_EXT*8); | 9509 | dasm_put(Dst, 7443, FORL_EXT*8); |
9486 | if (op != BC_JFORL) { | 9510 | if (op != BC_JFORL) { |
9487 | dasm_put(Dst, 7424); | 9511 | dasm_put(Dst, 7446); |
9488 | } | 9512 | } |
9489 | dasm_put(Dst, 7426); | 9513 | dasm_put(Dst, 7448); |
9490 | if (op == BC_JFORI) { | 9514 | if (op == BC_JFORI) { |
9491 | dasm_put(Dst, 7428, -(BCBIAS_J*4 >> 16)); | 9515 | dasm_put(Dst, 7450, -(BCBIAS_J*4 >> 16)); |
9492 | } | 9516 | } |
9493 | dasm_put(Dst, 7431); | 9517 | dasm_put(Dst, 7453); |
9494 | if (op == BC_FORI) { | 9518 | if (op == BC_FORI) { |
9495 | dasm_put(Dst, 7434); | 9519 | dasm_put(Dst, 7456); |
9496 | } else if (op == BC_IFORL) { | 9520 | } else if (op == BC_IFORL) { |
9497 | if (LJ_DUALNUM) { | 9521 | if (LJ_DUALNUM) { |
9498 | dasm_put(Dst, 7437); | 9522 | dasm_put(Dst, 7459); |
9499 | } else { | 9523 | } else { |
9500 | dasm_put(Dst, 7440); | 9524 | dasm_put(Dst, 7462); |
9501 | } | 9525 | } |
9502 | dasm_put(Dst, 7443, -(BCBIAS_J*4 >> 16)); | 9526 | dasm_put(Dst, 7465, -(BCBIAS_J*4 >> 16)); |
9503 | } else if (op == BC_JFORI) { | 9527 | } else if (op == BC_JFORI) { |
9504 | dasm_put(Dst, 7447); | 9528 | dasm_put(Dst, 7469); |
9505 | } else { | 9529 | } else { |
9506 | dasm_put(Dst, 7450, BC_JLOOP); | 9530 | dasm_put(Dst, 7472, BC_JLOOP); |
9507 | } | 9531 | } |
9508 | if (LJ_DUALNUM) { | 9532 | if (LJ_DUALNUM) { |
9509 | dasm_put(Dst, 7453); | 9533 | dasm_put(Dst, 7475); |
9510 | } else { | 9534 | } else { |
9511 | dasm_put(Dst, 7456); | 9535 | dasm_put(Dst, 7478); |
9512 | } | 9536 | } |
9513 | dasm_put(Dst, 7468); | 9537 | dasm_put(Dst, 7490); |
9514 | if (op == BC_FORI) { | 9538 | if (op == BC_FORI) { |
9515 | dasm_put(Dst, 7470, -(BCBIAS_J*4 >> 16)); | 9539 | dasm_put(Dst, 7492, -(BCBIAS_J*4 >> 16)); |
9516 | } else if (op == BC_IFORL) { | 9540 | } else if (op == BC_IFORL) { |
9517 | dasm_put(Dst, 7476); | 9541 | dasm_put(Dst, 7498); |
9518 | } else if (op == BC_JFORI) { | 9542 | } else if (op == BC_JFORI) { |
9519 | dasm_put(Dst, 7479); | 9543 | dasm_put(Dst, 7501); |
9520 | } else { | 9544 | } else { |
9521 | dasm_put(Dst, 7482, BC_JLOOP); | 9545 | dasm_put(Dst, 7504, BC_JLOOP); |
9522 | } | 9546 | } |
9523 | dasm_put(Dst, 7485); | 9547 | dasm_put(Dst, 7507); |
9524 | if (op == BC_JFORI) { | 9548 | if (op == BC_JFORI) { |
9525 | dasm_put(Dst, 7488, BC_JLOOP); | 9549 | dasm_put(Dst, 7510, BC_JLOOP); |
9526 | } | 9550 | } |
9527 | break; | 9551 | break; |
9528 | 9552 | ||
9529 | case BC_ITERL: | 9553 | case BC_ITERL: |
9530 | #if LJ_HASJIT | 9554 | #if LJ_HASJIT |
9531 | dasm_put(Dst, 7494, GG_DISP2HOT, -HOTCOUNT_LOOP); | 9555 | dasm_put(Dst, 7516, GG_DISP2HOT, -HOTCOUNT_LOOP); |
9532 | #endif | 9556 | #endif |
9533 | break; | 9557 | break; |
9534 | 9558 | ||
@@ -9537,40 +9561,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
9537 | break; | 9561 | break; |
9538 | #endif | 9562 | #endif |
9539 | case BC_IITERL: | 9563 | case BC_IITERL: |
9540 | dasm_put(Dst, 7504, LJ_TNIL); | 9564 | dasm_put(Dst, 7526, LJ_TNIL); |
9541 | if (op == BC_JITERL) { | 9565 | if (op == BC_JITERL) { |
9542 | dasm_put(Dst, 7511, BC_JLOOP); | 9566 | dasm_put(Dst, 7533, BC_JLOOP); |
9543 | } else { | 9567 | } else { |
9544 | dasm_put(Dst, 7516, 32-1, -(BCBIAS_J*4 >> 16)); | 9568 | dasm_put(Dst, 7538, 32-1, -(BCBIAS_J*4 >> 16)); |
9545 | } | 9569 | } |
9546 | dasm_put(Dst, 7524); | 9570 | dasm_put(Dst, 7546); |
9547 | break; | 9571 | break; |
9548 | 9572 | ||
9549 | case BC_LOOP: | 9573 | case BC_LOOP: |
9550 | #if LJ_HASJIT | 9574 | #if LJ_HASJIT |
9551 | dasm_put(Dst, 7536, GG_DISP2HOT, -HOTCOUNT_LOOP); | 9575 | dasm_put(Dst, 7558, GG_DISP2HOT, -HOTCOUNT_LOOP); |
9552 | #endif | 9576 | #endif |
9553 | break; | 9577 | break; |
9554 | 9578 | ||
9555 | case BC_ILOOP: | 9579 | case BC_ILOOP: |
9556 | dasm_put(Dst, 7546); | 9580 | dasm_put(Dst, 7568); |
9557 | break; | 9581 | break; |
9558 | 9582 | ||
9559 | case BC_JLOOP: | 9583 | case BC_JLOOP: |
9560 | #if LJ_HASJIT | 9584 | #if LJ_HASJIT |
9561 | dasm_put(Dst, 7557, DISPATCH_J(trace), 32-1, DISPATCH_GL(vmstate), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), GG_DISP2G+32768); | 9585 | dasm_put(Dst, 7579, DISPATCH_J(trace), 32-1, DISPATCH_GL(vmstate), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), GG_DISP2G+32768); |
9562 | #endif | 9586 | #endif |
9563 | break; | 9587 | break; |
9564 | 9588 | ||
9565 | case BC_JMP: | 9589 | case BC_JMP: |
9566 | dasm_put(Dst, 7576, 32-1, -(BCBIAS_J*4 >> 16)); | 9590 | dasm_put(Dst, 7598, 32-1, -(BCBIAS_J*4 >> 16)); |
9567 | break; | 9591 | break; |
9568 | 9592 | ||
9569 | /* -- Function headers -------------------------------------------------- */ | 9593 | /* -- Function headers -------------------------------------------------- */ |
9570 | 9594 | ||
9571 | case BC_FUNCF: | 9595 | case BC_FUNCF: |
9572 | #if LJ_HASJIT | 9596 | #if LJ_HASJIT |
9573 | dasm_put(Dst, 7592, GG_DISP2HOT, -HOTCOUNT_CALL); | 9597 | dasm_put(Dst, 7614, GG_DISP2HOT, -HOTCOUNT_CALL); |
9574 | #endif | 9598 | #endif |
9575 | case BC_FUNCV: /* NYI: compiled vararg functions. */ | 9599 | case BC_FUNCV: /* NYI: compiled vararg functions. */ |
9576 | break; | 9600 | break; |
@@ -9580,42 +9604,42 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
9580 | break; | 9604 | break; |
9581 | #endif | 9605 | #endif |
9582 | case BC_IFUNCF: | 9606 | case BC_IFUNCF: |
9583 | dasm_put(Dst, 7602, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); | 9607 | dasm_put(Dst, 7624, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); |
9584 | if (op != BC_JFUNCF) { | 9608 | if (op != BC_JFUNCF) { |
9585 | dasm_put(Dst, 7614); | 9609 | dasm_put(Dst, 7636); |
9586 | } | 9610 | } |
9587 | dasm_put(Dst, 7617); | 9611 | dasm_put(Dst, 7639); |
9588 | if (op == BC_JFUNCF) { | 9612 | if (op == BC_JFUNCF) { |
9589 | dasm_put(Dst, 7622, BC_JLOOP); | 9613 | dasm_put(Dst, 7644, BC_JLOOP); |
9590 | } else { | 9614 | } else { |
9591 | dasm_put(Dst, 7626); | 9615 | dasm_put(Dst, 7648); |
9592 | } | 9616 | } |
9593 | dasm_put(Dst, 7635); | 9617 | dasm_put(Dst, 7657); |
9594 | break; | 9618 | break; |
9595 | 9619 | ||
9596 | case BC_JFUNCV: | 9620 | case BC_JFUNCV: |
9597 | #if !LJ_HASJIT | 9621 | #if !LJ_HASJIT |
9598 | break; | 9622 | break; |
9599 | #endif | 9623 | #endif |
9600 | dasm_put(Dst, 7641); | 9624 | dasm_put(Dst, 7663); |
9601 | break; /* NYI: compiled vararg functions. */ | 9625 | break; /* NYI: compiled vararg functions. */ |
9602 | 9626 | ||
9603 | case BC_IFUNCV: | 9627 | case BC_IFUNCV: |
9604 | dasm_put(Dst, 7643, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), LJ_TNIL); | 9628 | dasm_put(Dst, 7665, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), LJ_TNIL); |
9605 | break; | 9629 | break; |
9606 | 9630 | ||
9607 | case BC_FUNCC: | 9631 | case BC_FUNCC: |
9608 | case BC_FUNCCW: | 9632 | case BC_FUNCCW: |
9609 | if (op == BC_FUNCC) { | 9633 | if (op == BC_FUNCC) { |
9610 | dasm_put(Dst, 7696, Dt8(->f)); | 9634 | dasm_put(Dst, 7718, Dt8(->f)); |
9611 | } else { | 9635 | } else { |
9612 | dasm_put(Dst, 7699, DISPATCH_GL(wrapf)); | 9636 | dasm_put(Dst, 7721, DISPATCH_GL(wrapf)); |
9613 | } | 9637 | } |
9614 | dasm_put(Dst, 7702, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); | 9638 | dasm_put(Dst, 7724, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); |
9615 | if (op == BC_FUNCCW) { | 9639 | if (op == BC_FUNCCW) { |
9616 | dasm_put(Dst, 7715, Dt8(->f)); | 9640 | dasm_put(Dst, 7737, Dt8(->f)); |
9617 | } | 9641 | } |
9618 | dasm_put(Dst, 7718, DISPATCH_GL(vmstate), Dt1(->base), 31-3, Dt1(->top), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); | 9642 | dasm_put(Dst, 7740, DISPATCH_GL(vmstate), Dt1(->base), 31-3, Dt1(->top), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); |
9619 | break; | 9643 | break; |
9620 | 9644 | ||
9621 | /* ---------------------------------------------------------------------- */ | 9645 | /* ---------------------------------------------------------------------- */ |
@@ -9635,7 +9659,7 @@ static int build_backend(BuildCtx *ctx) | |||
9635 | 9659 | ||
9636 | build_subroutines(ctx); | 9660 | build_subroutines(ctx); |
9637 | 9661 | ||
9638 | dasm_put(Dst, 7739); | 9662 | dasm_put(Dst, 7761); |
9639 | for (op = 0; op < BC__MAX; op++) | 9663 | for (op = 0; op < BC__MAX; op++) |
9640 | build_ins(ctx, (BCOp)op, op); | 9664 | build_ins(ctx, (BCOp)op, op); |
9641 | 9665 | ||
diff --git a/src/lj_mcode.c b/src/lj_mcode.c index a48f9e55..7857ebc0 100644 --- a/src/lj_mcode.c +++ b/src/lj_mcode.c | |||
@@ -29,15 +29,6 @@ | |||
29 | void sys_icache_invalidate(void *start, size_t len); | 29 | void sys_icache_invalidate(void *start, size_t len); |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #if LJ_TARGET_LINUX && LJ_TARGET_PPC | ||
33 | #include <dlfcn.h> | ||
34 | static void (*mcode_sync_ppc)(void *start, void *end); | ||
35 | static void mcode_sync_dummy(void *start, void *end) | ||
36 | { | ||
37 | UNUSED(start); UNUSED(end); | ||
38 | } | ||
39 | #endif | ||
40 | |||
41 | /* Synchronize data/instruction cache. */ | 32 | /* Synchronize data/instruction cache. */ |
42 | void lj_mcode_sync(void *start, void *end) | 33 | void lj_mcode_sync(void *start, void *end) |
43 | { | 34 | { |
@@ -48,14 +39,9 @@ void lj_mcode_sync(void *start, void *end) | |||
48 | UNUSED(start); UNUSED(end); | 39 | UNUSED(start); UNUSED(end); |
49 | #elif LJ_TARGET_OSX | 40 | #elif LJ_TARGET_OSX |
50 | sys_icache_invalidate(start, (char *)end-(char *)start); | 41 | sys_icache_invalidate(start, (char *)end-(char *)start); |
51 | #elif LJ_TARGET_LINUX && LJ_TARGET_PPC | 42 | #elif LJ_TARGET_PPC |
52 | if (!mcode_sync_ppc) { | 43 | lj_vm_cachesync(start, end); |
53 | void *vdso = dlopen("linux-vdso32.so.1", RTLD_LAZY); | 44 | #elif defined(__GNUC__) |
54 | if (!vdso || !(mcode_sync_ppc = dlsym(vdso, "__kernel_sync_dicache"))) | ||
55 | mcode_sync_ppc = mcode_sync_dummy; | ||
56 | } | ||
57 | mcode_sync_ppc(start, end); | ||
58 | #elif defined(__GNUC__) && !LJ_TARGET_PPC | ||
59 | __clear_cache(start, end); | 45 | __clear_cache(start, end); |
60 | #else | 46 | #else |
61 | #error "Missing builtin to flush instruction cache" | 47 | #error "Missing builtin to flush instruction cache" |
diff --git a/src/lj_vm.h b/src/lj_vm.h index 77f119b4..2cf04184 100644 --- a/src/lj_vm.h +++ b/src/lj_vm.h | |||
@@ -27,6 +27,9 @@ LJ_ASMF void lj_vm_unwind_rethrow(void); | |||
27 | #if LJ_TARGET_X86ORX64 | 27 | #if LJ_TARGET_X86ORX64 |
28 | LJ_ASMF int lj_vm_cpuid(uint32_t f, uint32_t res[4]); | 28 | LJ_ASMF int lj_vm_cpuid(uint32_t f, uint32_t res[4]); |
29 | #endif | 29 | #endif |
30 | #if LJ_TARGET_PPC | ||
31 | void lj_vm_cachesync(void *start, void *end); | ||
32 | #endif | ||
30 | LJ_ASMF double lj_vm_foldarith(double x, double y, int op); | 33 | LJ_ASMF double lj_vm_foldarith(double x, double y, int op); |
31 | #if LJ_HASJIT | 34 | #if LJ_HASJIT |
32 | LJ_ASMF double lj_vm_foldfpm(double x, int op); | 35 | LJ_ASMF double lj_vm_foldfpm(double x, int op); |