summaryrefslogtreecommitdiff
path: root/src/buildvm_ppcspe.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildvm_ppcspe.h')
-rw-r--r--src/buildvm_ppcspe.h332
1 files changed, 170 insertions, 162 deletions
diff --git a/src/buildvm_ppcspe.h b/src/buildvm_ppcspe.h
index 8a10c24a..96f7e55b 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
15static const unsigned int build_actionlist[4947] = { 15static const unsigned int build_actionlist[4950] = {
160x00010001, 160x00010001,
170x00060014, 170x00060014,
180x72000000, 180x72000000,
@@ -2804,6 +2804,9 @@ static const unsigned int build_actionlist[4947] = {
28040x4e800020, 28040x4e800020,
28050x0006000c, 28050x0006000c,
28060x7c810808, 28060x7c810808,
28070x00060098,
28080x00000000,
28090x7c810808,
28070x00000000, 28100x00000000,
28080x00080000, 28110x00080000,
28090x00000000, 28120x00000000,
@@ -3263,7 +3266,7 @@ static const unsigned int build_actionlist[4947] = {
32630x40830000, 32660x40830000,
32640x0005083c, 32670x0005083c,
32650x00000000, 32680x00000000,
32660x00060098, 32690x00060099,
32670x108caae9, 32700x108caae9,
32680x48000001, 32710x48000001,
32690x00050091, 32720x00050091,
@@ -3301,7 +3304,7 @@ static const unsigned int build_actionlist[4947] = {
33010x0005083c, 33040x0005083c,
33020x00000000, 33050x00000000,
33030x48000000, 33060x48000000,
33040x00050098, 33070x00050099,
33050x00000000, 33080x00000000,
33060x108e5300, 33090x108e5300,
33070x10ce5b00, 33100x10ce5b00,
@@ -3736,10 +3739,10 @@ static const unsigned int build_actionlist[4947] = {
37360x7d6f402e, 37390x7d6f402e,
37370x00000000, 37400x00000000,
37380x48000000, 37410x48000000,
37390x00050099, 37420x0005009a,
37400x00000000, 37430x00000000,
37410x48000000, 37440x48000000,
37420x0005009a, 37450x0005009b,
37430x00000000, 37460x00000000,
37440x114e5300, 37470x114e5300,
37450x116e5b00, 37480x116e5b00,
@@ -3795,7 +3798,7 @@ static const unsigned int build_actionlist[4947] = {
37950x0006000f, 37980x0006000f,
37960x100bba34, 37990x100bba34,
37970x41800000, 38000x41800000,
37980x00050899, 38010x0005089a,
37990x48000000, 38020x48000000,
38000x0005002e, 38030x0005002e,
38010x00000000, 38040x00000000,
@@ -3807,7 +3810,7 @@ static const unsigned int build_actionlist[4947] = {
38070x7d6f402e, 38100x7d6f402e,
38080x40800000, 38110x40800000,
38090x0005082b, 38120x0005082b,
38100x00060099, 38130x0006009a,
38110x800a0000, 38140x800a0000,
38120x00098200, 38150x00098200,
38130x810b0000, 38160x810b0000,
@@ -3974,7 +3977,7 @@ static const unsigned int build_actionlist[4947] = {
39740x0006000f, 39770x0006000f,
39750x100bba34, 39780x100bba34,
39760x41800000, 39790x41800000,
39770x0005089a, 39800x0005089b,
39780x48000000, 39810x48000000,
39790x00050032, 39820x00050032,
39800x00060011, 39830x00060011,
@@ -3999,7 +4002,7 @@ static const unsigned int build_actionlist[4947] = {
39990x7d6f402e, 40020x7d6f402e,
40000x40800000, 40030x40800000,
40010x0005082f, 40040x0005082f,
40020x0006009a, 40050x0006009b,
40030x800a0000, 40060x800a0000,
40040x00098200, 40070x00098200,
40050x810b0000, 40080x810b0000,
@@ -4600,7 +4603,7 @@ static const unsigned int build_actionlist[4947] = {
46000x6a080000, 46030x6a080000,
46010x00090200, 46040x00090200,
46020x40820000, 46050x40820000,
46030x0005089b, 46060x0005089c,
46040x00060017, 46070x00060017,
46050x80f0fffc, 46080x80f0fffc,
46060x2c0c0008, 46090x2c0c0008,
@@ -4651,7 +4654,7 @@ static const unsigned int build_actionlist[4947] = {
46510x13494320, 46540x13494320,
46520x48000000, 46550x48000000,
46530x0005000f, 46560x0005000f,
46540x0006009b, 46570x0006009c,
46550x71090000, 46580x71090000,
46560x00090200, 46590x00090200,
46570x40820000, 46600x40820000,
@@ -4669,7 +4672,7 @@ static const unsigned int build_actionlist[4947] = {
46690x6a080000, 46720x6a080000,
46700x00090200, 46730x00090200,
46710x40820000, 46740x40820000,
46720x0005089b, 46750x0005089c,
46730x80f0fffc, 46760x80f0fffc,
46740x392efff8, 46770x392efff8,
46750x54ea5d78, 46780x54ea5d78,
@@ -5095,6 +5098,7 @@ enum {
5095 GLOB_vm_powi, 5098 GLOB_vm_powi,
5096 GLOB_vm_foldfpm, 5099 GLOB_vm_foldfpm,
5097 GLOB_vm_foldarith, 5100 GLOB_vm_foldarith,
5101 GLOB_vm_ffi_call,
5098 GLOB_BC_MODVN_Z, 5102 GLOB_BC_MODVN_Z,
5099 GLOB_BC_TGETS_Z, 5103 GLOB_BC_TGETS_Z,
5100 GLOB_BC_TSETS_Z, 5104 GLOB_BC_TSETS_Z,
@@ -5234,6 +5238,7 @@ static const char *const globnames[] = {
5234 "vm_powi", 5238 "vm_powi",
5235 "vm_foldfpm", 5239 "vm_foldfpm",
5236 "vm_foldarith", 5240 "vm_foldarith",
5241 "vm_ffi_call",
5237 "BC_MODVN_Z", 5242 "BC_MODVN_Z",
5238 "BC_TGETS_Z", 5243 "BC_TGETS_Z",
5239 "BC_TSETS_Z", 5244 "BC_TSETS_Z",
@@ -5409,13 +5414,16 @@ static void build_subroutines(BuildCtx *ctx)
5409 dasm_put(Dst, 2728); 5414 dasm_put(Dst, 2728);
5410#endif 5415#endif
5411 dasm_put(Dst, 2730); 5416 dasm_put(Dst, 2730);
5417#if LJ_HASFFI
5418 dasm_put(Dst, 2793);
5419#endif
5412} 5420}
5413 5421
5414/* Generate the code for a single instruction. */ 5422/* Generate the code for a single instruction. */
5415static void build_ins(BuildCtx *ctx, BCOp op, int defop) 5423static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5416{ 5424{
5417 int vk = 0; 5425 int vk = 0;
5418 dasm_put(Dst, 2792, defop); 5426 dasm_put(Dst, 2795, defop);
5419 5427
5420 switch (op) { 5428 switch (op) {
5421 5429
@@ -5424,112 +5432,112 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5424 /* Remember: all ops branch for a true comparison, fall through otherwise. */ 5432 /* Remember: all ops branch for a true comparison, fall through otherwise. */
5425 5433
5426 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: 5434 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
5427 dasm_put(Dst, 2794, -(BCBIAS_J*4 >> 16)); 5435 dasm_put(Dst, 2797, -(BCBIAS_J*4 >> 16));
5428 if (op == BC_ISLE || op == BC_ISGT) { 5436 if (op == BC_ISLE || op == BC_ISGT) {
5429 dasm_put(Dst, 2808); 5437 dasm_put(Dst, 2811);
5430 } 5438 }
5431 if (op == BC_ISLT || op == BC_ISLE) { 5439 if (op == BC_ISLT || op == BC_ISLE) {
5432 dasm_put(Dst, 2811); 5440 dasm_put(Dst, 2814);
5433 } else { 5441 } else {
5434 dasm_put(Dst, 2813); 5442 dasm_put(Dst, 2816);
5435 } 5443 }
5436 dasm_put(Dst, 2815); 5444 dasm_put(Dst, 2818);
5437 break; 5445 break;
5438 5446
5439 case BC_ISEQV: case BC_ISNEV: 5447 case BC_ISEQV: case BC_ISNEV:
5440 vk = op == BC_ISEQV; 5448 vk = op == BC_ISEQV;
5441 dasm_put(Dst, 2826, -(BCBIAS_J*4 >> 16)); 5449 dasm_put(Dst, 2829, -(BCBIAS_J*4 >> 16));
5442 if (vk) { 5450 if (vk) {
5443 dasm_put(Dst, 2840); 5451 dasm_put(Dst, 2843);
5444 } else { 5452 } else {
5445 dasm_put(Dst, 2842); 5453 dasm_put(Dst, 2845);
5446 } 5454 }
5447 dasm_put(Dst, 2844, ~LJ_TISPRI, ~LJ_TISTABUD); 5455 dasm_put(Dst, 2847, ~LJ_TISPRI, ~LJ_TISTABUD);
5448 if (vk) { 5456 if (vk) {
5449 dasm_put(Dst, 2866); 5457 dasm_put(Dst, 2869);
5450 } else { 5458 } else {
5451 dasm_put(Dst, 2868); 5459 dasm_put(Dst, 2871);
5452 } 5460 }
5453 dasm_put(Dst, 2870); 5461 dasm_put(Dst, 2873);
5454 if (vk) { 5462 if (vk) {
5455 dasm_put(Dst, 2872); 5463 dasm_put(Dst, 2875);
5456 } else { 5464 } else {
5457 dasm_put(Dst, 2874); 5465 dasm_put(Dst, 2877);
5458 } 5466 }
5459 dasm_put(Dst, 2876, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); 5467 dasm_put(Dst, 2879, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq);
5460 break; 5468 break;
5461 5469
5462 case BC_ISEQS: case BC_ISNES: 5470 case BC_ISEQS: case BC_ISNES:
5463 vk = op == BC_ISEQS; 5471 vk = op == BC_ISEQS;
5464 dasm_put(Dst, 2897, 32-1, -(BCBIAS_J*4 >> 16)); 5472 dasm_put(Dst, 2900, 32-1, -(BCBIAS_J*4 >> 16));
5465 if (vk) { 5473 if (vk) {
5466 dasm_put(Dst, 2911); 5474 dasm_put(Dst, 2914);
5467 } else { 5475 } else {
5468 dasm_put(Dst, 2913); 5476 dasm_put(Dst, 2916);
5469 } 5477 }
5470 dasm_put(Dst, 2915); 5478 dasm_put(Dst, 2918);
5471 break; 5479 break;
5472 5480
5473 case BC_ISEQN: case BC_ISNEN: 5481 case BC_ISEQN: case BC_ISNEN:
5474 vk = op == BC_ISEQN; 5482 vk = op == BC_ISEQN;
5475 dasm_put(Dst, 2926, -(BCBIAS_J*4 >> 16)); 5483 dasm_put(Dst, 2929, -(BCBIAS_J*4 >> 16));
5476 if (vk) { 5484 if (vk) {
5477 dasm_put(Dst, 2940);
5478 } else {
5479 dasm_put(Dst, 2943); 5485 dasm_put(Dst, 2943);
5486 } else {
5487 dasm_put(Dst, 2946);
5480 } 5488 }
5481 dasm_put(Dst, 2945); 5489 dasm_put(Dst, 2948);
5482 if (!vk) { 5490 if (!vk) {
5483 dasm_put(Dst, 2957); 5491 dasm_put(Dst, 2960);
5484 } 5492 }
5485 break; 5493 break;
5486 5494
5487 case BC_ISEQP: case BC_ISNEP: 5495 case BC_ISEQP: case BC_ISNEP:
5488 vk = op == BC_ISEQP; 5496 vk = op == BC_ISEQP;
5489 dasm_put(Dst, 2963, 32-3, -(BCBIAS_J*4 >> 16)); 5497 dasm_put(Dst, 2966, 32-3, -(BCBIAS_J*4 >> 16));
5490 if (vk) { 5498 if (vk) {
5491 dasm_put(Dst, 2975); 5499 dasm_put(Dst, 2978);
5492 } else { 5500 } else {
5493 dasm_put(Dst, 2977); 5501 dasm_put(Dst, 2980);
5494 } 5502 }
5495 dasm_put(Dst, 2979); 5503 dasm_put(Dst, 2982);
5496 break; 5504 break;
5497 5505
5498 /* -- Unary test and copy ops ------------------------------------------- */ 5506 /* -- Unary test and copy ops ------------------------------------------- */
5499 5507
5500 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: 5508 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
5501 dasm_put(Dst, 2990); 5509 dasm_put(Dst, 2993);
5502 if (op == BC_IST || op == BC_ISF) { 5510 if (op == BC_IST || op == BC_ISF) {
5503 dasm_put(Dst, 2996, -(BCBIAS_J*4 >> 16)); 5511 dasm_put(Dst, 2999, -(BCBIAS_J*4 >> 16));
5504 if (op == BC_IST) { 5512 if (op == BC_IST) {
5505 dasm_put(Dst, 3001); 5513 dasm_put(Dst, 3004);
5506 } else { 5514 } else {
5507 dasm_put(Dst, 3003); 5515 dasm_put(Dst, 3006);
5508 } 5516 }
5509 } else { 5517 } else {
5510 if (op == BC_ISTC) { 5518 if (op == BC_ISTC) {
5511 dasm_put(Dst, 3005);
5512 } else {
5513 dasm_put(Dst, 3008); 5519 dasm_put(Dst, 3008);
5520 } else {
5521 dasm_put(Dst, 3011);
5514 } 5522 }
5515 dasm_put(Dst, 3011, -(BCBIAS_J*4 >> 16)); 5523 dasm_put(Dst, 3014, -(BCBIAS_J*4 >> 16));
5516 } 5524 }
5517 dasm_put(Dst, 3018); 5525 dasm_put(Dst, 3021);
5518 break; 5526 break;
5519 5527
5520 /* -- Unary ops --------------------------------------------------------- */ 5528 /* -- Unary ops --------------------------------------------------------- */
5521 5529
5522 case BC_MOV: 5530 case BC_MOV:
5523 dasm_put(Dst, 3029); 5531 dasm_put(Dst, 3032);
5524 break; 5532 break;
5525 case BC_NOT: 5533 case BC_NOT:
5526 dasm_put(Dst, 3042, LJ_TTRUE); 5534 dasm_put(Dst, 3045, LJ_TTRUE);
5527 break; 5535 break;
5528 case BC_UNM: 5536 case BC_UNM:
5529 dasm_put(Dst, 3058); 5537 dasm_put(Dst, 3061);
5530 break; 5538 break;
5531 case BC_LEN: 5539 case BC_LEN:
5532 dasm_put(Dst, 3075, Dt5(->len)); 5540 dasm_put(Dst, 3078, Dt5(->len));
5533 break; 5541 break;
5534 5542
5535 /* -- Binary ops -------------------------------------------------------- */ 5543 /* -- Binary ops -------------------------------------------------------- */
@@ -5539,262 +5547,262 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5539 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5547 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5540 switch (vk) { 5548 switch (vk) {
5541 case 0: 5549 case 0:
5542 dasm_put(Dst, 3103); 5550 dasm_put(Dst, 3106);
5543 break; 5551 break;
5544 case 1: 5552 case 1:
5545 dasm_put(Dst, 3109); 5553 dasm_put(Dst, 3112);
5546 break; 5554 break;
5547 default: 5555 default:
5548 dasm_put(Dst, 3115); 5556 dasm_put(Dst, 3118);
5549 break; 5557 break;
5550 } 5558 }
5551 dasm_put(Dst, 3122); 5559 dasm_put(Dst, 3125);
5552 break; 5560 break;
5553 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 5561 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
5554 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5562 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5555 switch (vk) { 5563 switch (vk) {
5556 case 0: 5564 case 0:
5557 dasm_put(Dst, 3135); 5565 dasm_put(Dst, 3138);
5558 break; 5566 break;
5559 case 1: 5567 case 1:
5560 dasm_put(Dst, 3141); 5568 dasm_put(Dst, 3144);
5561 break; 5569 break;
5562 default: 5570 default:
5563 dasm_put(Dst, 3147); 5571 dasm_put(Dst, 3150);
5564 break; 5572 break;
5565 } 5573 }
5566 dasm_put(Dst, 3154); 5574 dasm_put(Dst, 3157);
5567 break; 5575 break;
5568 case BC_MULVN: case BC_MULNV: case BC_MULVV: 5576 case BC_MULVN: case BC_MULNV: case BC_MULVV:
5569 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5577 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5570 switch (vk) { 5578 switch (vk) {
5571 case 0: 5579 case 0:
5572 dasm_put(Dst, 3167); 5580 dasm_put(Dst, 3170);
5573 break; 5581 break;
5574 case 1: 5582 case 1:
5575 dasm_put(Dst, 3173); 5583 dasm_put(Dst, 3176);
5576 break; 5584 break;
5577 default: 5585 default:
5578 dasm_put(Dst, 3179); 5586 dasm_put(Dst, 3182);
5579 break; 5587 break;
5580 } 5588 }
5581 dasm_put(Dst, 3186); 5589 dasm_put(Dst, 3189);
5582 break; 5590 break;
5583 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 5591 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
5584 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5592 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5585 switch (vk) { 5593 switch (vk) {
5586 case 0: 5594 case 0:
5587 dasm_put(Dst, 3199); 5595 dasm_put(Dst, 3202);
5588 break; 5596 break;
5589 case 1: 5597 case 1:
5590 dasm_put(Dst, 3205); 5598 dasm_put(Dst, 3208);
5591 break; 5599 break;
5592 default: 5600 default:
5593 dasm_put(Dst, 3211); 5601 dasm_put(Dst, 3214);
5594 break; 5602 break;
5595 } 5603 }
5596 dasm_put(Dst, 3218); 5604 dasm_put(Dst, 3221);
5597 break; 5605 break;
5598 case BC_MODVN: 5606 case BC_MODVN:
5599 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5607 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5600 switch (vk) { 5608 switch (vk) {
5601 case 0: 5609 case 0:
5602 dasm_put(Dst, 3231); 5610 dasm_put(Dst, 3234);
5603 break; 5611 break;
5604 case 1: 5612 case 1:
5605 dasm_put(Dst, 3237); 5613 dasm_put(Dst, 3240);
5606 break; 5614 break;
5607 default: 5615 default:
5608 dasm_put(Dst, 3243); 5616 dasm_put(Dst, 3246);
5609 break; 5617 break;
5610 } 5618 }
5611 dasm_put(Dst, 3250); 5619 dasm_put(Dst, 3253);
5612 break; 5620 break;
5613 case BC_MODNV: case BC_MODVV: 5621 case BC_MODNV: case BC_MODVV:
5614 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 5622 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
5615 switch (vk) { 5623 switch (vk) {
5616 case 0: 5624 case 0:
5617 dasm_put(Dst, 3268); 5625 dasm_put(Dst, 3271);
5618 break; 5626 break;
5619 case 1: 5627 case 1:
5620 dasm_put(Dst, 3274); 5628 dasm_put(Dst, 3277);
5621 break; 5629 break;
5622 default: 5630 default:
5623 dasm_put(Dst, 3280); 5631 dasm_put(Dst, 3283);
5624 break; 5632 break;
5625 } 5633 }
5626 dasm_put(Dst, 3287); 5634 dasm_put(Dst, 3290);
5627 break; 5635 break;
5628 case BC_POW: 5636 case BC_POW:
5629 dasm_put(Dst, 3290); 5637 dasm_put(Dst, 3293);
5630 break; 5638 break;
5631 5639
5632 case BC_CAT: 5640 case BC_CAT:
5633 dasm_put(Dst, 3312, Dt1(->base), 32-3, Dt1(->base)); 5641 dasm_put(Dst, 3315, Dt1(->base), 32-3, Dt1(->base));
5634 break; 5642 break;
5635 5643
5636 /* -- Constant ops ------------------------------------------------------ */ 5644 /* -- Constant ops ------------------------------------------------------ */
5637 5645
5638 case BC_KSTR: 5646 case BC_KSTR:
5639 dasm_put(Dst, 3342, 32-1); 5647 dasm_put(Dst, 3345, 32-1);
5640 break; 5648 break;
5641 case BC_KCDATA: 5649 case BC_KCDATA:
5642#if LJ_HASFFI 5650#if LJ_HASFFI
5643 dasm_put(Dst, 3359, 32-1, LJ_TCDATA); 5651 dasm_put(Dst, 3362, 32-1, LJ_TCDATA);
5644#endif 5652#endif
5645 break; 5653 break;
5646 case BC_KSHORT: 5654 case BC_KSHORT:
5647 dasm_put(Dst, 3378, 32-3); 5655 dasm_put(Dst, 3381, 32-3);
5648 break; 5656 break;
5649 case BC_KNUM: 5657 case BC_KNUM:
5650 dasm_put(Dst, 3394); 5658 dasm_put(Dst, 3397);
5651 break; 5659 break;
5652 case BC_KPRI: 5660 case BC_KPRI:
5653 dasm_put(Dst, 3407, 32-3); 5661 dasm_put(Dst, 3410, 32-3);
5654 break; 5662 break;
5655 case BC_KNIL: 5663 case BC_KNIL:
5656 dasm_put(Dst, 3422); 5664 dasm_put(Dst, 3425);
5657 break; 5665 break;
5658 5666
5659 /* -- Upvalue and function ops ------------------------------------------ */ 5667 /* -- Upvalue and function ops ------------------------------------------ */
5660 5668
5661 case BC_UGET: 5669 case BC_UGET:
5662 dasm_put(Dst, 3441, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); 5670 dasm_put(Dst, 3444, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
5663 break; 5671 break;
5664 case BC_USETV: 5672 case BC_USETV:
5665 dasm_put(Dst, 3462, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -LJ_TISNUM, LJ_TISGCV - LJ_TISNUM, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); 5673 dasm_put(Dst, 3465, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -LJ_TISNUM, LJ_TISGCV - LJ_TISNUM, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G);
5666 break; 5674 break;
5667 case BC_USETS: 5675 case BC_USETS:
5668 dasm_put(Dst, 3514, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); 5676 dasm_put(Dst, 3517, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G);
5669 break; 5677 break;
5670 case BC_USETN: 5678 case BC_USETN:
5671 dasm_put(Dst, 3563, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); 5679 dasm_put(Dst, 3566, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
5672 break; 5680 break;
5673 case BC_USETP: 5681 case BC_USETP:
5674 dasm_put(Dst, 3584, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); 5682 dasm_put(Dst, 3587, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v));
5675 break; 5683 break;
5676 5684
5677 case BC_UCLO: 5685 case BC_UCLO:
5678 dasm_put(Dst, 3607, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); 5686 dasm_put(Dst, 3610, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base));
5679 break; 5687 break;
5680 5688
5681 case BC_FNEW: 5689 case BC_FNEW:
5682 dasm_put(Dst, 3637, 32-1, Dt1(->base), Dt1(->base)); 5690 dasm_put(Dst, 3640, 32-1, Dt1(->base), Dt1(->base));
5683 break; 5691 break;
5684 5692
5685 /* -- Table ops --------------------------------------------------------- */ 5693 /* -- Table ops --------------------------------------------------------- */
5686 5694
5687 case BC_TNEW: 5695 case BC_TNEW:
5688 case BC_TDUP: 5696 case BC_TDUP:
5689 dasm_put(Dst, 3663, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); 5697 dasm_put(Dst, 3666, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base));
5690 if (op == BC_TNEW) { 5698 if (op == BC_TNEW) {
5691 dasm_put(Dst, 3676); 5699 dasm_put(Dst, 3679);
5692 } else { 5700 } else {
5693 dasm_put(Dst, 3684, 32-1); 5701 dasm_put(Dst, 3687, 32-1);
5694 } 5702 }
5695 dasm_put(Dst, 3691, Dt1(->base)); 5703 dasm_put(Dst, 3694, Dt1(->base));
5696 break; 5704 break;
5697 5705
5698 case BC_GGET: 5706 case BC_GGET:
5699 case BC_GSET: 5707 case BC_GSET:
5700 dasm_put(Dst, 3714, 32-1, Dt7(->env)); 5708 dasm_put(Dst, 3717, 32-1, Dt7(->env));
5701 if (op == BC_GGET) { 5709 if (op == BC_GGET) {
5702 dasm_put(Dst, 3722);
5703 } else {
5704 dasm_put(Dst, 3725); 5710 dasm_put(Dst, 3725);
5711 } else {
5712 dasm_put(Dst, 3728);
5705 } 5713 }
5706 break; 5714 break;
5707 5715
5708 case BC_TGETV: 5716 case BC_TGETV:
5709 dasm_put(Dst, 3728, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 5717 dasm_put(Dst, 3731, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
5710 break; 5718 break;
5711 case BC_TGETS: 5719 case BC_TGETS:
5712 dasm_put(Dst, 3786, 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); 5720 dasm_put(Dst, 3789, 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);
5713 dasm_put(Dst, 3850); 5721 dasm_put(Dst, 3853);
5714 break; 5722 break;
5715 case BC_TGETB: 5723 case BC_TGETB:
5716 dasm_put(Dst, 3855, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 5724 dasm_put(Dst, 3858, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
5717 break; 5725 break;
5718 5726
5719 case BC_TSETV: 5727 case BC_TSETV:
5720 dasm_put(Dst, 3899, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); 5728 dasm_put(Dst, 3902, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex);
5721 dasm_put(Dst, 3966, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); 5729 dasm_put(Dst, 3969, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
5722 break; 5730 break;
5723 case BC_TSETS: 5731 case BC_TSETS:
5724 dasm_put(Dst, 3978, 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)); 5732 dasm_put(Dst, 3981, 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));
5725 dasm_put(Dst, 4039, 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)); 5733 dasm_put(Dst, 4042, 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));
5726 dasm_put(Dst, 4090, Dt6(->marked), Dt6(->gclist)); 5734 dasm_put(Dst, 4093, Dt6(->marked), Dt6(->gclist));
5727 break; 5735 break;
5728 case BC_TSETB: 5736 case BC_TSETB:
5729 dasm_put(Dst, 4097, 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)); 5737 dasm_put(Dst, 4100, 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));
5730 dasm_put(Dst, 4157, Dt6(->gclist)); 5738 dasm_put(Dst, 4160, Dt6(->gclist));
5731 break; 5739 break;
5732 5740
5733 case BC_TSETM: 5741 case BC_TSETM:
5734 dasm_put(Dst, 4162, 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)); 5742 dasm_put(Dst, 4165, 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));
5735 dasm_put(Dst, 4231); 5743 dasm_put(Dst, 4234);
5736 break; 5744 break;
5737 5745
5738 /* -- Calls and vararg handling ----------------------------------------- */ 5746 /* -- Calls and vararg handling ----------------------------------------- */
5739 5747
5740 case BC_CALLM: 5748 case BC_CALLM:
5741 dasm_put(Dst, 4234); 5749 dasm_put(Dst, 4237);
5742 break; 5750 break;
5743 case BC_CALL: 5751 case BC_CALL:
5744 dasm_put(Dst, 4236, Dt7(->pc)); 5752 dasm_put(Dst, 4239, Dt7(->pc));
5745 break; 5753 break;
5746 5754
5747 case BC_CALLMT: 5755 case BC_CALLMT:
5748 dasm_put(Dst, 4256); 5756 dasm_put(Dst, 4259);
5749 break; 5757 break;
5750 case BC_CALLT: 5758 case BC_CALLT:
5751 dasm_put(Dst, 4258, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); 5759 dasm_put(Dst, 4261, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
5752 dasm_put(Dst, 4323, FRAME_TYPE); 5760 dasm_put(Dst, 4326, FRAME_TYPE);
5753 break; 5761 break;
5754 5762
5755 case BC_ITERC: 5763 case BC_ITERC:
5756 dasm_put(Dst, 4330, Dt7(->pc)); 5764 dasm_put(Dst, 4333, Dt7(->pc));
5757 break; 5765 break;
5758 5766
5759 case BC_ITERN: 5767 case BC_ITERN:
5760#if LJ_HASJIT 5768#if LJ_HASJIT
5761#endif 5769#endif
5762 dasm_put(Dst, 4356, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); 5770 dasm_put(Dst, 4359, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16));
5763 dasm_put(Dst, 4435); 5771 dasm_put(Dst, 4438);
5764 break; 5772 break;
5765 5773
5766 case BC_ISNEXT: 5774 case BC_ISNEXT:
5767 dasm_put(Dst, 4439, 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)); 5775 dasm_put(Dst, 4442, 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));
5768 break; 5776 break;
5769 5777
5770 case BC_VARG: 5778 case BC_VARG:
5771 dasm_put(Dst, 4490, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); 5779 dasm_put(Dst, 4493, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base));
5772 dasm_put(Dst, 4570); 5780 dasm_put(Dst, 4573);
5773 break; 5781 break;
5774 5782
5775 /* -- Returns ----------------------------------------------------------- */ 5783 /* -- Returns ----------------------------------------------------------- */
5776 5784
5777 case BC_RETM: 5785 case BC_RETM:
5778 dasm_put(Dst, 4576); 5786 dasm_put(Dst, 4579);
5779 break; 5787 break;
5780 5788
5781 case BC_RET: 5789 case BC_RET:
5782 dasm_put(Dst, 4578, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); 5790 dasm_put(Dst, 4581, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
5783 break; 5791 break;
5784 5792
5785 case BC_RET0: case BC_RET1: 5793 case BC_RET0: case BC_RET1:
5786 dasm_put(Dst, 4648, FRAME_TYPE, FRAME_VARG); 5794 dasm_put(Dst, 4651, FRAME_TYPE, FRAME_VARG);
5787 if (op == BC_RET1) { 5795 if (op == BC_RET1) {
5788 dasm_put(Dst, 4661); 5796 dasm_put(Dst, 4664);
5789 } 5797 }
5790 dasm_put(Dst, 4664, Dt7(->pc), PC2PROTO(k)); 5798 dasm_put(Dst, 4667, Dt7(->pc), PC2PROTO(k));
5791 break; 5799 break;
5792 5800
5793 /* -- Loops and branches ------------------------------------------------ */ 5801 /* -- Loops and branches ------------------------------------------------ */
5794 5802
5795 case BC_FORL: 5803 case BC_FORL:
5796#if LJ_HASJIT 5804#if LJ_HASJIT
5797 dasm_put(Dst, 4692); 5805 dasm_put(Dst, 4695);
5798#endif 5806#endif
5799 break; 5807 break;
5800 5808
@@ -5806,35 +5814,35 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5806 case BC_FORI: 5814 case BC_FORI:
5807 case BC_IFORL: 5815 case BC_IFORL:
5808 vk = (op == BC_IFORL || op == BC_JFORL); 5816 vk = (op == BC_IFORL || op == BC_JFORL);
5809 dasm_put(Dst, 4694, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); 5817 dasm_put(Dst, 4697, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8);
5810 if (!vk) { 5818 if (!vk) {
5811 dasm_put(Dst, 4702); 5819 dasm_put(Dst, 4705);
5812 } 5820 }
5813 if (vk) { 5821 if (vk) {
5814 dasm_put(Dst, 4710, FORL_IDX*8); 5822 dasm_put(Dst, 4713, FORL_IDX*8);
5815 } 5823 }
5816 dasm_put(Dst, 4714, FORL_EXT*8); 5824 dasm_put(Dst, 4717, FORL_EXT*8);
5817 if (op != BC_JFORL) { 5825 if (op != BC_JFORL) {
5818 dasm_put(Dst, 4722, 32-1); 5826 dasm_put(Dst, 4725, 32-1);
5819 if (op == BC_JFORI) { 5827 if (op == BC_JFORI) {
5820 dasm_put(Dst, 4726, -(BCBIAS_J*4 >> 16));
5821 } else {
5822 dasm_put(Dst, 4729, -(BCBIAS_J*4 >> 16)); 5828 dasm_put(Dst, 4729, -(BCBIAS_J*4 >> 16));
5829 } else {
5830 dasm_put(Dst, 4732, -(BCBIAS_J*4 >> 16));
5823 } 5831 }
5824 } 5832 }
5825 if (op == BC_FORI) { 5833 if (op == BC_FORI) {
5826 dasm_put(Dst, 4732); 5834 dasm_put(Dst, 4735);
5827 } else if (op == BC_IFORL) { 5835 } else if (op == BC_IFORL) {
5828 dasm_put(Dst, 4734); 5836 dasm_put(Dst, 4737);
5829 } else { 5837 } else {
5830 dasm_put(Dst, 4736, BC_JLOOP); 5838 dasm_put(Dst, 4739, BC_JLOOP);
5831 } 5839 }
5832 dasm_put(Dst, 4739); 5840 dasm_put(Dst, 4742);
5833 break; 5841 break;
5834 5842
5835 case BC_ITERL: 5843 case BC_ITERL:
5836#if LJ_HASJIT 5844#if LJ_HASJIT
5837 dasm_put(Dst, 4754); 5845 dasm_put(Dst, 4757);
5838#endif 5846#endif
5839 break; 5847 break;
5840 5848
@@ -5843,40 +5851,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5843 break; 5851 break;
5844#endif 5852#endif
5845 case BC_IITERL: 5853 case BC_IITERL:
5846 dasm_put(Dst, 4756); 5854 dasm_put(Dst, 4759);
5847 if (op == BC_JITERL) { 5855 if (op == BC_JITERL) {
5848 dasm_put(Dst, 4762); 5856 dasm_put(Dst, 4765);
5849 } else { 5857 } else {
5850 dasm_put(Dst, 4764, 32-1, -(BCBIAS_J*4 >> 16)); 5858 dasm_put(Dst, 4767, 32-1, -(BCBIAS_J*4 >> 16));
5851 } 5859 }
5852 dasm_put(Dst, 4771); 5860 dasm_put(Dst, 4774);
5853 break; 5861 break;
5854 5862
5855 case BC_LOOP: 5863 case BC_LOOP:
5856#if LJ_HASJIT 5864#if LJ_HASJIT
5857 dasm_put(Dst, 4783); 5865 dasm_put(Dst, 4786);
5858#endif 5866#endif
5859 break; 5867 break;
5860 5868
5861 case BC_ILOOP: 5869 case BC_ILOOP:
5862 dasm_put(Dst, 4785); 5870 dasm_put(Dst, 4788);
5863 break; 5871 break;
5864 5872
5865 case BC_JLOOP: 5873 case BC_JLOOP:
5866#if LJ_HASJIT 5874#if LJ_HASJIT
5867 dasm_put(Dst, 4796); 5875 dasm_put(Dst, 4799);
5868#endif 5876#endif
5869 break; 5877 break;
5870 5878
5871 case BC_JMP: 5879 case BC_JMP:
5872 dasm_put(Dst, 4798, 32-1, -(BCBIAS_J*4 >> 16)); 5880 dasm_put(Dst, 4801, 32-1, -(BCBIAS_J*4 >> 16));
5873 break; 5881 break;
5874 5882
5875 /* -- Function headers -------------------------------------------------- */ 5883 /* -- Function headers -------------------------------------------------- */
5876 5884
5877 case BC_FUNCF: 5885 case BC_FUNCF:
5878#if LJ_HASJIT 5886#if LJ_HASJIT
5879 dasm_put(Dst, 4814); 5887 dasm_put(Dst, 4817);
5880#endif 5888#endif
5881 case BC_FUNCV: /* NYI: compiled vararg functions. */ 5889 case BC_FUNCV: /* NYI: compiled vararg functions. */
5882 break; 5890 break;
@@ -5886,38 +5894,38 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
5886 break; 5894 break;
5887#endif 5895#endif
5888 case BC_IFUNCF: 5896 case BC_IFUNCF:
5889 dasm_put(Dst, 4816, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); 5897 dasm_put(Dst, 4819, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3);
5890 if (op == BC_JFUNCF) { 5898 if (op == BC_JFUNCF) {
5891 dasm_put(Dst, 4834); 5899 dasm_put(Dst, 4837);
5892 } else { 5900 } else {
5893 dasm_put(Dst, 4836); 5901 dasm_put(Dst, 4839);
5894 } 5902 }
5895 dasm_put(Dst, 4845); 5903 dasm_put(Dst, 4848);
5896 break; 5904 break;
5897 5905
5898 case BC_JFUNCV: 5906 case BC_JFUNCV:
5899#if !LJ_HASJIT 5907#if !LJ_HASJIT
5900 break; 5908 break;
5901#endif 5909#endif
5902 dasm_put(Dst, 4851); 5910 dasm_put(Dst, 4854);
5903 break; /* NYI: compiled vararg functions. */ 5911 break; /* NYI: compiled vararg functions. */
5904 5912
5905 case BC_IFUNCV: 5913 case BC_IFUNCV:
5906 dasm_put(Dst, 4853, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); 5914 dasm_put(Dst, 4856, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams));
5907 break; 5915 break;
5908 5916
5909 case BC_FUNCC: 5917 case BC_FUNCC:
5910 case BC_FUNCCW: 5918 case BC_FUNCCW:
5911 if (op == BC_FUNCC) { 5919 if (op == BC_FUNCC) {
5912 dasm_put(Dst, 4903, Dt8(->f)); 5920 dasm_put(Dst, 4906, Dt8(->f));
5913 } else { 5921 } else {
5914 dasm_put(Dst, 4906, DISPATCH_GL(wrapf)); 5922 dasm_put(Dst, 4909, DISPATCH_GL(wrapf));
5915 } 5923 }
5916 dasm_put(Dst, 4909, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); 5924 dasm_put(Dst, 4912, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C);
5917 if (op == BC_FUNCCW) { 5925 if (op == BC_FUNCCW) {
5918 dasm_put(Dst, 4922, Dt8(->f)); 5926 dasm_put(Dst, 4925, Dt8(->f));
5919 } 5927 }
5920 dasm_put(Dst, 4925, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); 5928 dasm_put(Dst, 4928, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate));
5921 break; 5929 break;
5922 5930
5923 /* ---------------------------------------------------------------------- */ 5931 /* ---------------------------------------------------------------------- */
@@ -5937,7 +5945,7 @@ static int build_backend(BuildCtx *ctx)
5937 5945
5938 build_subroutines(ctx); 5946 build_subroutines(ctx);
5939 5947
5940 dasm_put(Dst, 4946); 5948 dasm_put(Dst, 4949);
5941 for (op = 0; op < BC__MAX; op++) 5949 for (op = 0; op < BC__MAX; op++)
5942 build_ins(ctx, (BCOp)op, op); 5950 build_ins(ctx, (BCOp)op, op);
5943 5951