aboutsummaryrefslogtreecommitdiff
path: root/src/buildvm_x64.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildvm_x64.h')
-rw-r--r--src/buildvm_x64.h1109
1 files changed, 615 insertions, 494 deletions
diff --git a/src/buildvm_x64.h b/src/buildvm_x64.h
index bd4ab408..06d6b038 100644
--- a/src/buildvm_x64.h
+++ b/src/buildvm_x64.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 char build_actionlist[16164] = { 15static const unsigned char build_actionlist[16165] = {
16 254,1,248,10,252,247,195,237,15,132,244,11,131,227,252,248,41,218,72,141, 16 254,1,248,10,252,247,195,237,15,132,244,11,131,227,252,248,41,218,72,141,
17 76,25,252,248,139,90,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,4, 17 76,25,252,248,139,90,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,4,
18 252,247,195,237,15,132,244,13,248,14,129,252,243,239,252,247,195,237,15,133, 18 252,247,195,237,15,132,244,13,248,14,129,252,243,239,252,247,195,237,15,133,
@@ -489,75 +489,75 @@ static const unsigned char build_actionlist[16164] = {
489 223,224,252,246,196,1,15,132,244,248,217,201,248,2,221,216,195,248,1,221, 489 223,224,252,246,196,1,15,132,244,248,217,201,248,2,221,216,195,248,1,221,
490 225,223,224,252,246,196,1,15,133,244,248,217,201,248,2,221,216,195,255,248, 490 225,223,224,252,246,196,1,15,133,244,248,217,201,248,2,221,216,195,255,248,
491 163,137,252,248,83,15,162,137,6,137,94,4,137,78,8,137,86,12,91,195,248,164, 491 163,137,252,248,83,15,162,137,6,137,94,4,137,78,8,137,86,12,91,195,248,164,
492 255,85,72,137,229,83,72,137,252,251,139,131,233,72,41,196,255,15,182,139, 492 255,204,248,165,255,85,72,137,229,83,72,137,252,251,139,131,233,72,41,196,
493 233,131,252,233,1,15,136,244,248,248,1,72,139,132,253,203,233,72,137,132, 493 255,15,182,139,233,131,252,233,1,15,136,244,248,248,1,72,139,132,253,203,
494 253,204,233,131,252,233,1,15,137,244,1,248,2,15,182,131,233,72,139,187,233, 494 233,72,137,132,253,204,233,131,252,233,1,15,137,244,1,248,2,15,182,131,233,
495 72,139,179,233,72,139,147,233,72,139,139,233,76,139,131,233,76,139,139,233, 495 72,139,187,233,72,139,179,233,72,139,147,233,72,139,139,233,76,139,131,233,
496 133,192,15,132,244,251,15,40,131,233,15,40,139,233,255,15,40,147,233,15,40, 496 76,139,139,233,133,192,15,132,244,251,15,40,131,233,15,40,139,233,255,15,
497 155,233,131,252,248,4,15,134,244,251,15,40,163,233,15,40,171,233,15,40,179, 497 40,147,233,15,40,155,233,131,252,248,4,15,134,244,251,15,40,163,233,15,40,
498 233,15,40,187,233,248,5,252,255,147,233,72,137,131,233,15,41,131,233,72,137, 498 171,233,15,40,179,233,15,40,187,233,248,5,252,255,147,233,72,137,131,233,
499 147,233,15,41,139,233,255,72,139,93,252,248,201,195,255,248,165,255,249,255, 499 15,41,131,233,72,137,147,233,15,41,139,233,255,72,139,93,252,248,201,195,
500 129,124,253,202,4,239,15,133,244,253,129,124,253,194,4,239,15,133,244,254, 500 255,249,255,129,124,253,202,4,239,15,133,244,253,129,124,253,194,4,239,15,
501 139,44,202,131,195,4,59,44,194,255,15,141,244,255,255,15,140,244,255,255, 501 133,244,254,139,44,202,131,195,4,59,44,194,255,15,141,244,255,255,15,140,
502 15,143,244,255,255,15,142,244,255,255,248,6,15,183,67,252,254,141,156,253, 502 244,255,255,15,143,244,255,255,15,142,244,255,255,248,6,15,183,67,252,254,
503 131,233,248,9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255, 503 141,156,253,131,233,248,9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,
504 36,252,238,248,7,15,135,244,43,129,124,253,194,4,239,15,130,244,247,15,133, 504 65,252,255,36,252,238,248,7,15,135,244,43,129,124,253,194,4,239,15,130,244,
505 244,43,255,252,242,15,42,4,194,252,233,244,248,255,221,4,202,219,4,194,252, 505 247,15,133,244,43,255,252,242,15,42,4,194,252,233,244,248,255,221,4,202,219,
506 233,244,249,255,248,8,15,135,244,43,255,252,242,15,42,12,202,252,242,15,16, 506 4,194,252,233,244,249,255,248,8,15,135,244,43,255,252,242,15,42,12,202,252,
507 4,194,131,195,4,102,15,46,193,255,15,134,244,9,255,15,135,244,9,255,15,130, 507 242,15,16,4,194,131,195,4,102,15,46,193,255,15,134,244,9,255,15,135,244,9,
508 244,9,255,15,131,244,9,255,252,233,244,6,255,219,4,202,252,233,244,248,255, 508 255,15,130,244,9,255,15,131,244,9,255,252,233,244,6,255,219,4,202,252,233,
509 129,124,253,202,4,239,15,131,244,43,129,124,253,194,4,239,15,131,244,43,255, 509 244,248,255,129,124,253,202,4,239,15,131,244,43,129,124,253,194,4,239,15,
510 248,1,252,242,15,16,4,194,248,2,131,195,4,102,15,46,4,202,248,3,255,248,1, 510 131,244,43,255,248,1,252,242,15,16,4,194,248,2,131,195,4,102,15,46,4,202,
511 221,4,202,248,2,221,4,194,248,3,131,195,4,255,223,252,233,221,216,255,218, 511 248,3,255,248,1,221,4,202,248,2,221,4,194,248,3,131,195,4,255,223,252,233,
512 252,233,223,224,158,255,15,134,244,247,255,15,135,244,247,255,15,130,244, 512 221,216,255,218,252,233,223,224,158,255,15,134,244,247,255,15,135,244,247,
513 247,255,15,131,244,247,255,15,183,67,252,254,141,156,253,131,233,248,1,139, 513 255,15,130,244,247,255,15,131,244,247,255,15,183,67,252,254,141,156,253,131,
514 3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,255,139, 514 233,248,1,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,
515 108,194,4,131,195,4,255,129,252,253,239,15,133,244,253,129,124,253,202,4, 515 252,238,255,139,108,194,4,131,195,4,255,129,252,253,239,15,133,244,253,129,
516 239,15,133,244,254,139,44,194,59,44,202,255,15,133,244,255,255,15,132,244, 516 124,253,202,4,239,15,133,244,254,139,44,194,59,44,202,255,15,133,244,255,
517 255,255,15,183,67,252,254,141,156,253,131,233,248,9,139,3,15,182,204,15,182, 517 255,15,132,244,255,255,15,183,67,252,254,141,156,253,131,233,248,9,139,3,
518 232,131,195,4,193,232,16,65,252,255,36,252,238,248,7,15,135,244,251,129,124, 518 15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,7,15,
519 253,202,4,239,15,130,244,247,15,133,244,251,255,252,242,15,42,4,202,255,219, 519 135,244,251,129,124,253,202,4,239,15,130,244,247,15,133,244,251,255,252,242,
520 4,202,255,252,233,244,248,248,8,15,135,244,251,255,252,242,15,42,4,194,102, 520 15,42,4,202,255,219,4,202,255,252,233,244,248,248,8,15,135,244,251,255,252,
521 15,46,4,202,255,219,4,194,221,4,202,255,252,233,244,250,255,129,252,253,239, 521 242,15,42,4,194,102,15,46,4,202,255,219,4,194,221,4,202,255,252,233,244,250,
522 15,131,244,251,129,124,253,202,4,239,15,131,244,251,255,248,1,252,242,15, 522 255,129,252,253,239,15,131,244,251,129,124,253,202,4,239,15,131,244,251,255,
523 16,4,202,248,2,102,15,46,4,194,248,4,255,248,1,221,4,202,248,2,221,4,194, 523 248,1,252,242,15,16,4,202,248,2,102,15,46,4,194,248,4,255,248,1,221,4,202,
524 248,4,255,15,138,244,248,15,133,244,248,255,15,138,244,248,15,132,244,247, 524 248,2,221,4,194,248,4,255,15,138,244,248,15,133,244,248,255,15,138,244,248,
525 255,248,1,15,183,67,252,254,141,156,253,131,233,248,2,255,248,2,15,183,67, 525 15,132,244,247,255,248,1,15,183,67,252,254,141,156,253,131,233,248,2,255,
526 252,254,141,156,253,131,233,248,1,255,252,233,244,9,255,248,5,255,129,252, 526 248,2,15,183,67,252,254,141,156,253,131,233,248,1,255,252,233,244,9,255,248,
527 253,239,15,132,244,48,129,124,253,202,4,239,15,132,244,48,255,57,108,202, 527 5,255,129,252,253,239,15,132,244,48,129,124,253,202,4,239,15,132,244,48,255,
528 4,15,133,244,2,129,252,253,239,15,131,244,1,139,12,202,139,4,194,57,193,15, 528 57,108,202,4,15,133,244,2,129,252,253,239,15,131,244,1,139,12,202,139,4,194,
529 132,244,1,129,252,253,239,15,135,244,2,129,252,253,239,15,130,244,2,139,169, 529 57,193,15,132,244,1,129,252,253,239,15,135,244,2,129,252,253,239,15,130,244,
530 233,133,252,237,15,132,244,2,252,246,133,233,235,15,133,244,2,255,49,252, 530 2,139,169,233,133,252,237,15,132,244,2,252,246,133,233,235,15,133,244,2,255,
531 237,255,189,1,0,0,0,255,252,233,244,47,255,248,3,129,252,253,239,255,15,133, 531 49,252,237,255,189,1,0,0,0,255,252,233,244,47,255,248,3,129,252,253,239,255,
532 244,9,255,252,233,244,48,255,72,252,247,208,139,108,202,4,131,195,4,129,252, 532 15,133,244,9,255,252,233,244,48,255,72,252,247,208,139,108,202,4,131,195,
533 253,239,15,133,244,249,139,12,202,65,59,12,135,255,139,108,202,4,131,195, 533 4,129,252,253,239,15,133,244,249,139,12,202,65,59,12,135,255,139,108,202,
534 4,255,129,252,253,239,15,133,244,253,65,129,124,253,199,4,239,15,133,244, 534 4,131,195,4,255,129,252,253,239,15,133,244,253,65,129,124,253,199,4,239,15,
535 254,65,139,44,199,59,44,202,255,15,183,67,252,254,141,156,253,131,233,248, 535 133,244,254,65,139,44,199,59,44,202,255,15,183,67,252,254,141,156,253,131,
536 9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238, 536 233,248,9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,
537 248,7,15,135,244,249,65,129,124,253,199,4,239,15,130,244,247,255,252,242, 537 252,238,248,7,15,135,244,249,65,129,124,253,199,4,239,15,130,244,247,255,
538 65,15,42,4,199,255,65,219,4,199,255,252,233,244,248,248,8,255,252,242,15, 538 252,242,65,15,42,4,199,255,65,219,4,199,255,252,233,244,248,248,8,255,252,
539 42,4,202,102,65,15,46,4,199,255,219,4,202,65,221,4,199,255,129,252,253,239, 539 242,15,42,4,202,102,65,15,46,4,199,255,219,4,202,65,221,4,199,255,129,252,
540 15,131,244,249,255,248,1,252,242,65,15,16,4,199,248,2,102,15,46,4,202,248, 540 253,239,15,131,244,249,255,248,1,252,242,65,15,16,4,199,248,2,102,15,46,4,
541 4,255,248,1,65,221,4,199,248,2,221,4,202,248,4,255,72,252,247,208,139,108, 541 202,248,4,255,248,1,65,221,4,199,248,2,221,4,202,248,4,255,72,252,247,208,
542 202,4,131,195,4,57,197,255,15,133,244,249,15,183,67,252,254,141,156,253,131, 542 139,108,202,4,131,195,4,57,197,255,15,133,244,249,15,183,67,252,254,141,156,
543 233,248,2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36, 543 253,131,233,248,2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,
544 252,238,248,3,129,252,253,239,15,133,244,2,252,233,244,48,255,15,132,244, 544 255,36,252,238,248,3,129,252,253,239,15,133,244,2,252,233,244,48,255,15,132,
545 248,129,252,253,239,15,132,244,48,15,183,67,252,254,141,156,253,131,233,248, 545 244,248,129,252,253,239,15,132,244,48,15,183,67,252,254,141,156,253,131,233,
546 2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238, 546 248,2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,
547 255,139,108,194,4,131,195,4,129,252,253,239,255,137,108,202,4,139,44,194, 547 238,255,139,108,194,4,131,195,4,129,252,253,239,255,137,108,202,4,139,44,
548 137,44,202,255,72,139,44,194,72,137,44,202,139,3,15,182,204,15,182,232,131, 548 194,137,44,202,255,72,139,44,194,72,137,44,202,139,3,15,182,204,15,182,232,
549 195,4,193,232,16,65,252,255,36,252,238,255,49,252,237,129,124,253,194,4,239, 549 131,195,4,193,232,16,65,252,255,36,252,238,255,49,252,237,129,124,253,194,
550 129,213,239,137,108,202,4,139,3,15,182,204,15,182,232,131,195,4,193,232,16, 550 4,239,129,213,239,137,108,202,4,139,3,15,182,204,15,182,232,131,195,4,193,
551 65,252,255,36,252,238,255,129,124,253,194,4,239,15,133,244,251,139,44,194, 551 232,16,65,252,255,36,252,238,255,129,124,253,194,4,239,15,133,244,251,139,
552 252,247,221,15,128,244,250,199,68,202,4,237,137,44,202,248,9,139,3,15,182, 552 44,194,252,247,221,15,128,244,250,199,68,202,4,237,137,44,202,248,9,139,3,
553 204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,4,199,68,202, 553 15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,4,199,
554 4,0,0,224,65,199,4,202,0,0,0,0,252,233,244,9,248,5,15,135,244,53,255,129, 554 68,202,4,0,0,224,65,199,4,202,0,0,0,0,252,233,244,9,248,5,15,135,244,53,255,
555 124,253,194,4,239,15,131,244,53,255,252,242,15,16,4,194,72,184,237,237,102, 555 129,124,253,194,4,239,15,131,244,53,255,252,242,15,16,4,194,72,184,237,237,
556 72,15,110,200,15,87,193,252,242,15,17,4,202,255,221,4,194,217,224,221,28, 556 102,72,15,110,200,15,87,193,252,242,15,17,4,202,255,221,4,194,217,224,221,
557 202,255,129,124,253,194,4,239,15,133,244,248,139,4,194,255,139,128,233,248, 557 28,202,255,129,124,253,194,4,239,15,133,244,248,139,4,194,255,139,128,233,
558 1,199,68,202,4,237,137,4,202,255,15,87,192,252,242,15,42,128,233,248,1,252, 558 248,1,199,68,202,4,237,137,4,202,255,15,87,192,252,242,15,42,128,233,248,
559 242,15,17,4,202,255,219,128,233,248,1,221,28,202,255,139,3,15,182,204,15, 559 1,252,242,15,17,4,202,255,219,128,233,248,1,221,28,202,255,139,3,15,182,204,
560 182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,2,129,124,253,194, 560 15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,2,129,124,253,194,
561 4,239,15,133,244,56,139,60,194,255,139,175,233,131,252,253,0,15,133,244,255, 561 4,239,15,133,244,56,139,60,194,255,139,175,233,131,252,253,0,15,133,244,255,
562 248,3,255,248,57,137,213,232,251,1,21,255,252,242,15,42,192,255,137,252,234, 562 248,3,255,248,57,137,213,232,251,1,21,255,252,242,15,42,192,255,137,252,234,
563 15,182,75,252,253,252,233,244,1,255,248,9,252,246,133,233,235,15,133,244, 563 15,182,75,252,253,252,233,244,1,255,248,9,252,246,133,233,235,15,133,244,
@@ -754,8 +754,8 @@ static const unsigned char build_actionlist[16164] = {
754 255,1,252,233,255,137,221,209,252,237,129,229,239,102,65,129,172,253,46,233, 754 255,1,252,233,255,137,221,209,252,237,129,229,239,102,65,129,172,253,46,233,
755 238,15,130,244,148,255,141,12,202,255,129,121,253,4,239,15,133,244,255,255, 755 238,15,130,244,148,255,141,12,202,255,129,121,253,4,239,15,133,244,255,255,
756 129,121,253,12,239,15,133,244,60,129,121,253,20,239,15,133,244,60,139,41, 756 129,121,253,12,239,15,133,244,60,129,121,253,20,239,15,133,244,60,139,41,
757 131,121,16,0,15,140,244,251,255,129,121,253,12,239,15,133,244,165,129,121, 757 131,121,16,0,15,140,244,251,255,129,121,253,12,239,15,133,244,164,129,121,
758 253,20,239,15,133,244,165,255,139,105,16,133,252,237,15,136,244,251,3,41, 758 253,20,239,15,133,244,164,255,139,105,16,133,252,237,15,136,244,251,3,41,
759 15,128,244,247,137,41,255,59,105,8,199,65,28,237,137,105,24,255,15,142,244, 759 15,128,244,247,137,41,255,59,105,8,199,65,28,237,137,105,24,255,15,142,244,
760 253,248,1,248,6,141,156,253,131,233,255,141,156,253,131,233,15,183,67,252, 760 253,248,1,248,6,141,156,253,131,233,255,141,156,253,131,233,15,183,67,252,
761 254,15,142,245,248,1,248,6,255,15,143,244,253,248,6,141,156,253,131,233,248, 761 254,15,142,245,248,1,248,6,255,15,143,244,253,248,6,141,156,253,131,233,248,
@@ -763,7 +763,7 @@ static const unsigned char build_actionlist[16164] = {
763 252,238,248,5,255,3,41,15,128,244,1,137,41,255,15,141,244,7,255,141,156,253, 763 252,238,248,5,255,3,41,15,128,244,1,137,41,255,15,141,244,7,255,141,156,253,
764 131,233,15,183,67,252,254,15,141,245,255,15,140,244,7,255,252,233,244,6,248, 764 131,233,15,183,67,252,254,15,141,245,255,15,140,244,7,255,252,233,244,6,248,
765 9,255,129,121,253,4,239,255,15,131,244,60,129,121,253,12,239,15,131,244,60, 765 9,255,129,121,253,4,239,255,15,131,244,60,129,121,253,12,239,15,131,244,60,
766 255,129,121,253,12,239,15,131,244,165,129,121,253,20,239,15,131,244,165,255, 766 255,129,121,253,12,239,15,131,244,164,129,121,253,20,239,15,131,244,164,255,
767 139,105,20,255,129,252,253,239,15,131,244,60,255,252,242,15,16,1,252,242, 767 139,105,20,255,129,252,253,239,15,131,244,60,255,252,242,15,16,1,252,242,
768 15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244, 768 15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244,
769 249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221, 769 249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221,
@@ -950,8 +950,8 @@ enum {
950 GLOB_vm_foldfpm, 950 GLOB_vm_foldfpm,
951 GLOB_vm_foldarith, 951 GLOB_vm_foldarith,
952 GLOB_vm_cpuid, 952 GLOB_vm_cpuid,
953 GLOB_vm_ffi_call,
954 GLOB_assert_bad_for_arg_type, 953 GLOB_assert_bad_for_arg_type,
954 GLOB_vm_ffi_call,
955 GLOB_BC_MODVN_Z, 955 GLOB_BC_MODVN_Z,
956 GLOB_BC_TGETS_Z, 956 GLOB_BC_TGETS_Z,
957 GLOB_BC_TSETS_Z, 957 GLOB_BC_TSETS_Z,
@@ -1112,8 +1112,8 @@ static const char *const globnames[] = {
1112 "vm_foldfpm", 1112 "vm_foldfpm",
1113 "vm_foldarith", 1113 "vm_foldarith",
1114 "vm_cpuid", 1114 "vm_cpuid",
1115 "vm_ffi_call@4",
1116 "assert_bad_for_arg_type", 1115 "assert_bad_for_arg_type",
1116 "vm_ffi_call@4",
1117 "BC_MODVN_Z", 1117 "BC_MODVN_Z",
1118 "BC_TGETS_Z", 1118 "BC_TGETS_Z",
1119 "BC_TSETS_Z", 1119 "BC_TSETS_Z",
@@ -1834,29 +1834,28 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
1834 dasm_put(Dst, 9411); 1834 dasm_put(Dst, 9411);
1835 } 1835 }
1836 dasm_put(Dst, 9829); 1836 dasm_put(Dst, 9829);
1837#ifdef LUA_USE_ASSERT
1838 dasm_put(Dst, 9413);
1839#endif
1840 dasm_put(Dst, 9853);
1837#if LJ_HASFFI 1841#if LJ_HASFFI
1838#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) 1842#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
1839 dasm_put(Dst, 9853, DtE(->spadj)); 1843 dasm_put(Dst, 9857, DtE(->spadj));
1840#if LJ_TARGET_WINDOWS 1844#if LJ_TARGET_WINDOWS
1841#endif 1845#endif
1842 dasm_put(Dst, 9869, DtE(->nsp), offsetof(CCallState, stack), CCALL_SPS_EXTRA*8, DtE(->nfpr), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->gpr[2]), DtE(->gpr[3]), DtE(->gpr[4]), DtE(->gpr[5]), DtE(->fpr[0]), DtE(->fpr[1])); 1846 dasm_put(Dst, 9873, DtE(->nsp), offsetof(CCallState, stack), CCALL_SPS_EXTRA*8, DtE(->nfpr), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->gpr[2]), DtE(->gpr[3]), DtE(->gpr[4]), DtE(->gpr[5]), DtE(->fpr[0]), DtE(->fpr[1]));
1843 dasm_put(Dst, 9948, DtE(->fpr[2]), DtE(->fpr[3]), DtE(->fpr[4]), DtE(->fpr[5]), DtE(->fpr[6]), DtE(->fpr[7]), DtE(->func), DtE(->gpr[0]), DtE(->fpr[0]), DtE(->gpr[1]), DtE(->fpr[1])); 1847 dasm_put(Dst, 9952, DtE(->fpr[2]), DtE(->fpr[3]), DtE(->fpr[4]), DtE(->fpr[5]), DtE(->fpr[6]), DtE(->fpr[7]), DtE(->func), DtE(->gpr[0]), DtE(->fpr[0]), DtE(->gpr[1]), DtE(->fpr[1]));
1844#if LJ_TARGET_WINDOWS 1848#if LJ_TARGET_WINDOWS
1845#endif 1849#endif
1846 dasm_put(Dst, 10003); 1850 dasm_put(Dst, 10007);
1847#endif
1848 dasm_put(Dst, 10011);
1849#ifdef LUA_USE_ASSERT
1850 dasm_put(Dst, 9413);
1851#endif 1851#endif
1852 dasm_put(Dst, 9413);
1853} 1852}
1854 1853
1855/* Generate the code for a single instruction. */ 1854/* Generate the code for a single instruction. */
1856static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) 1855static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
1857{ 1856{
1858 int vk = 0; 1857 int vk = 0;
1859 dasm_put(Dst, 10014, defop); 1858 dasm_put(Dst, 10015, defop);
1860 1859
1861 switch (op) { 1860 switch (op) {
1862 1861
@@ -1867,145 +1866,145 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
1867 1866
1868 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: 1867 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
1869 if (LJ_DUALNUM) { 1868 if (LJ_DUALNUM) {
1870 dasm_put(Dst, 10016, LJ_TISNUM, LJ_TISNUM); 1869 dasm_put(Dst, 10017, LJ_TISNUM, LJ_TISNUM);
1871 switch (op) { 1870 switch (op) {
1872 case BC_ISLT: 1871 case BC_ISLT:
1873 dasm_put(Dst, 10046); 1872 dasm_put(Dst, 10047);
1874 break; 1873 break;
1875 case BC_ISGE: 1874 case BC_ISGE:
1876 dasm_put(Dst, 10051); 1875 dasm_put(Dst, 10052);
1877 break; 1876 break;
1878 case BC_ISLE: 1877 case BC_ISLE:
1879 dasm_put(Dst, 10056); 1878 dasm_put(Dst, 10057);
1880 break; 1879 break;
1881 case BC_ISGT: 1880 case BC_ISGT:
1882 dasm_put(Dst, 10061); 1881 dasm_put(Dst, 10062);
1883 break; 1882 break;
1884 default: break; /* Shut up GCC. */ 1883 default: break; /* Shut up GCC. */
1885 } 1884 }
1886 dasm_put(Dst, 10066, -BCBIAS_J*4, LJ_TISNUM); 1885 dasm_put(Dst, 10067, -BCBIAS_J*4, LJ_TISNUM);
1887 if (sse) { 1886 if (sse) {
1888 dasm_put(Dst, 10121); 1887 dasm_put(Dst, 10122);
1889 } else { 1888 } else {
1890 dasm_put(Dst, 10132); 1889 dasm_put(Dst, 10133);
1891 } 1890 }
1892 dasm_put(Dst, 10143); 1891 dasm_put(Dst, 10144);
1893 if (sse) { 1892 if (sse) {
1894 dasm_put(Dst, 10150); 1893 dasm_put(Dst, 10151);
1895 switch (op) { 1894 switch (op) {
1896 case BC_ISLT: 1895 case BC_ISLT:
1897 dasm_put(Dst, 10170); 1896 dasm_put(Dst, 10171);
1898 break; 1897 break;
1899 case BC_ISGE: 1898 case BC_ISGE:
1900 dasm_put(Dst, 10175); 1899 dasm_put(Dst, 10176);
1901 break; 1900 break;
1902 case BC_ISLE: 1901 case BC_ISLE:
1903 dasm_put(Dst, 10180); 1902 dasm_put(Dst, 10181);
1904 break; 1903 break;
1905 case BC_ISGT: 1904 case BC_ISGT:
1906 dasm_put(Dst, 10185); 1905 dasm_put(Dst, 10186);
1907 break; 1906 break;
1908 default: break; /* Shut up GCC. */ 1907 default: break; /* Shut up GCC. */
1909 } 1908 }
1910 dasm_put(Dst, 10190); 1909 dasm_put(Dst, 10191);
1911 } else { 1910 } else {
1912 dasm_put(Dst, 10195); 1911 dasm_put(Dst, 10196);
1913 } 1912 }
1914 } else { 1913 } else {
1915 dasm_put(Dst, 10203, LJ_TISNUM, LJ_TISNUM); 1914 dasm_put(Dst, 10204, LJ_TISNUM, LJ_TISNUM);
1916 } 1915 }
1917 if (sse) { 1916 if (sse) {
1918 dasm_put(Dst, 10224); 1917 dasm_put(Dst, 10225);
1919 } else { 1918 } else {
1920 dasm_put(Dst, 10245); 1919 dasm_put(Dst, 10246);
1921 if (cmov) { 1920 if (cmov) {
1922 dasm_put(Dst, 10261); 1921 dasm_put(Dst, 10262);
1923 } else { 1922 } else {
1924 dasm_put(Dst, 10267); 1923 dasm_put(Dst, 10268);
1925 } 1924 }
1926 } 1925 }
1927 if (LJ_DUALNUM) { 1926 if (LJ_DUALNUM) {
1928 switch (op) { 1927 switch (op) {
1929 case BC_ISLT: 1928 case BC_ISLT:
1930 dasm_put(Dst, 10170); 1929 dasm_put(Dst, 10171);
1931 break; 1930 break;
1932 case BC_ISGE: 1931 case BC_ISGE:
1933 dasm_put(Dst, 10175); 1932 dasm_put(Dst, 10176);
1934 break; 1933 break;
1935 case BC_ISLE: 1934 case BC_ISLE:
1936 dasm_put(Dst, 10180); 1935 dasm_put(Dst, 10181);
1937 break; 1936 break;
1938 case BC_ISGT: 1937 case BC_ISGT:
1939 dasm_put(Dst, 10185); 1938 dasm_put(Dst, 10186);
1940 break; 1939 break;
1941 default: break; /* Shut up GCC. */ 1940 default: break; /* Shut up GCC. */
1942 } 1941 }
1943 dasm_put(Dst, 10190); 1942 dasm_put(Dst, 10191);
1944 } else { 1943 } else {
1945 switch (op) { 1944 switch (op) {
1946 case BC_ISLT: 1945 case BC_ISLT:
1947 dasm_put(Dst, 10274); 1946 dasm_put(Dst, 10275);
1948 break; 1947 break;
1949 case BC_ISGE: 1948 case BC_ISGE:
1950 dasm_put(Dst, 10279); 1949 dasm_put(Dst, 10280);
1951 break; 1950 break;
1952 case BC_ISLE: 1951 case BC_ISLE:
1953 dasm_put(Dst, 10284); 1952 dasm_put(Dst, 10285);
1954 break; 1953 break;
1955 case BC_ISGT: 1954 case BC_ISGT:
1956 dasm_put(Dst, 10289); 1955 dasm_put(Dst, 10290);
1957 break; 1956 break;
1958 default: break; /* Shut up GCC. */ 1957 default: break; /* Shut up GCC. */
1959 } 1958 }
1960 dasm_put(Dst, 10294, -BCBIAS_J*4); 1959 dasm_put(Dst, 10295, -BCBIAS_J*4);
1961 } 1960 }
1962 break; 1961 break;
1963 1962
1964 case BC_ISEQV: case BC_ISNEV: 1963 case BC_ISEQV: case BC_ISNEV:
1965 vk = op == BC_ISEQV; 1964 vk = op == BC_ISEQV;
1966 dasm_put(Dst, 10327); 1965 dasm_put(Dst, 10328);
1967 if (LJ_DUALNUM) { 1966 if (LJ_DUALNUM) {
1968 dasm_put(Dst, 10335, LJ_TISNUM, LJ_TISNUM); 1967 dasm_put(Dst, 10336, LJ_TISNUM, LJ_TISNUM);
1969 if (vk) { 1968 if (vk) {
1970 dasm_put(Dst, 10360); 1969 dasm_put(Dst, 10361);
1971 } else { 1970 } else {
1972 dasm_put(Dst, 10365); 1971 dasm_put(Dst, 10366);
1973 } 1972 }
1974 dasm_put(Dst, 10370, -BCBIAS_J*4, LJ_TISNUM); 1973 dasm_put(Dst, 10371, -BCBIAS_J*4, LJ_TISNUM);
1975 if (sse) { 1974 if (sse) {
1976 dasm_put(Dst, 10423); 1975 dasm_put(Dst, 10424);
1977 } else { 1976 } else {
1978 dasm_put(Dst, 10430); 1977 dasm_put(Dst, 10431);
1979 } 1978 }
1980 dasm_put(Dst, 10434); 1979 dasm_put(Dst, 10435);
1981 if (sse) { 1980 if (sse) {
1982 dasm_put(Dst, 10445); 1981 dasm_put(Dst, 10446);
1983 } else { 1982 } else {
1984 dasm_put(Dst, 10457); 1983 dasm_put(Dst, 10458);
1985 } 1984 }
1986 dasm_put(Dst, 10464); 1985 dasm_put(Dst, 10465);
1987 } else { 1986 } else {
1988 dasm_put(Dst, 10469, LJ_TISNUM, LJ_TISNUM); 1987 dasm_put(Dst, 10470, LJ_TISNUM, LJ_TISNUM);
1989 } 1988 }
1990 if (sse) { 1989 if (sse) {
1991 dasm_put(Dst, 10488); 1990 dasm_put(Dst, 10489);
1992 } else { 1991 } else {
1993 dasm_put(Dst, 10506); 1992 dasm_put(Dst, 10507);
1994 if (cmov) { 1993 if (cmov) {
1995 dasm_put(Dst, 10261); 1994 dasm_put(Dst, 10262);
1996 } else { 1995 } else {
1997 dasm_put(Dst, 10267); 1996 dasm_put(Dst, 10268);
1998 } 1997 }
1999 } 1998 }
2000 iseqne_fp: 1999 iseqne_fp:
2001 if (vk) { 2000 if (vk) {
2002 dasm_put(Dst, 10519); 2001 dasm_put(Dst, 10520);
2003 } else { 2002 } else {
2004 dasm_put(Dst, 10528); 2003 dasm_put(Dst, 10529);
2005 } 2004 }
2006 iseqne_end: 2005 iseqne_end:
2007 if (vk) { 2006 if (vk) {
2008 dasm_put(Dst, 10537, -BCBIAS_J*4); 2007 dasm_put(Dst, 10538, -BCBIAS_J*4);
2009 if (!LJ_HASFFI) { 2008 if (!LJ_HASFFI) {
2010 dasm_put(Dst, 4675); 2009 dasm_put(Dst, 4675);
2011 } 2010 }
@@ -2013,156 +2012,156 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2013 if (!LJ_HASFFI) { 2012 if (!LJ_HASFFI) {
2014 dasm_put(Dst, 4675); 2013 dasm_put(Dst, 4675);
2015 } 2014 }
2016 dasm_put(Dst, 10552, -BCBIAS_J*4); 2015 dasm_put(Dst, 10553, -BCBIAS_J*4);
2017 } 2016 }
2018 if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV || 2017 if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV ||
2019 op == BC_ISEQN || op == BC_ISNEN)) { 2018 op == BC_ISEQN || op == BC_ISNEN)) {
2020 dasm_put(Dst, 10567); 2019 dasm_put(Dst, 10568);
2021 } else { 2020 } else {
2022 dasm_put(Dst, 10306); 2021 dasm_put(Dst, 10307);
2023 } 2022 }
2024 if (op == BC_ISEQV || op == BC_ISNEV) { 2023 if (op == BC_ISEQV || op == BC_ISNEV) {
2025 dasm_put(Dst, 10572); 2024 dasm_put(Dst, 10573);
2026 if (LJ_HASFFI) { 2025 if (LJ_HASFFI) {
2027 dasm_put(Dst, 10575, LJ_TCDATA, LJ_TCDATA); 2026 dasm_put(Dst, 10576, LJ_TCDATA, LJ_TCDATA);
2028 } 2027 }
2029 dasm_put(Dst, 10594, LJ_TISPRI, LJ_TISTABUD, LJ_TUDATA, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq); 2028 dasm_put(Dst, 10595, LJ_TISPRI, LJ_TISTABUD, LJ_TUDATA, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq);
2030 if (vk) { 2029 if (vk) {
2031 dasm_put(Dst, 10658); 2030 dasm_put(Dst, 10659);
2032 } else { 2031 } else {
2033 dasm_put(Dst, 10662); 2032 dasm_put(Dst, 10663);
2034 } 2033 }
2035 dasm_put(Dst, 10668); 2034 dasm_put(Dst, 10669);
2036 } else if (LJ_HASFFI) { 2035 } else if (LJ_HASFFI) {
2037 dasm_put(Dst, 10673, LJ_TCDATA); 2036 dasm_put(Dst, 10674, LJ_TCDATA);
2038 if (LJ_DUALNUM && vk) { 2037 if (LJ_DUALNUM && vk) {
2039 dasm_put(Dst, 10680); 2038 dasm_put(Dst, 10681);
2040 } else { 2039 } else {
2041 dasm_put(Dst, 10653); 2040 dasm_put(Dst, 10654);
2042 } 2041 }
2043 dasm_put(Dst, 10685); 2042 dasm_put(Dst, 10686);
2044 } 2043 }
2045 break; 2044 break;
2046 case BC_ISEQS: case BC_ISNES: 2045 case BC_ISEQS: case BC_ISNES:
2047 vk = op == BC_ISEQS; 2046 vk = op == BC_ISEQS;
2048 dasm_put(Dst, 10690, LJ_TSTR); 2047 dasm_put(Dst, 10691, LJ_TSTR);
2049 iseqne_test: 2048 iseqne_test:
2050 if (vk) { 2049 if (vk) {
2051 dasm_put(Dst, 10523); 2050 dasm_put(Dst, 10524);
2052 } else { 2051 } else {
2053 dasm_put(Dst, 814); 2052 dasm_put(Dst, 814);
2054 } 2053 }
2055 goto iseqne_end; 2054 goto iseqne_end;
2056 case BC_ISEQN: case BC_ISNEN: 2055 case BC_ISEQN: case BC_ISNEN:
2057 vk = op == BC_ISEQN; 2056 vk = op == BC_ISEQN;
2058 dasm_put(Dst, 10717); 2057 dasm_put(Dst, 10718);
2059 if (LJ_DUALNUM) { 2058 if (LJ_DUALNUM) {
2060 dasm_put(Dst, 10725, LJ_TISNUM, LJ_TISNUM); 2059 dasm_put(Dst, 10726, LJ_TISNUM, LJ_TISNUM);
2061 if (vk) { 2060 if (vk) {
2062 dasm_put(Dst, 10360); 2061 dasm_put(Dst, 10361);
2063 } else { 2062 } else {
2064 dasm_put(Dst, 10365); 2063 dasm_put(Dst, 10366);
2065 } 2064 }
2066 dasm_put(Dst, 10752, -BCBIAS_J*4, LJ_TISNUM); 2065 dasm_put(Dst, 10753, -BCBIAS_J*4, LJ_TISNUM);
2067 if (sse) { 2066 if (sse) {
2068 dasm_put(Dst, 10802); 2067 dasm_put(Dst, 10803);
2069 } else { 2068 } else {
2070 dasm_put(Dst, 10810); 2069 dasm_put(Dst, 10811);
2071 } 2070 }
2072 dasm_put(Dst, 10815); 2071 dasm_put(Dst, 10816);
2073 if (sse) { 2072 if (sse) {
2074 dasm_put(Dst, 10822); 2073 dasm_put(Dst, 10823);
2075 } else { 2074 } else {
2076 dasm_put(Dst, 10835); 2075 dasm_put(Dst, 10836);
2077 } 2076 }
2078 dasm_put(Dst, 10464); 2077 dasm_put(Dst, 10465);
2079 } else { 2078 } else {
2080 dasm_put(Dst, 10843, LJ_TISNUM); 2079 dasm_put(Dst, 10844, LJ_TISNUM);
2081 } 2080 }
2082 if (sse) { 2081 if (sse) {
2083 dasm_put(Dst, 10852); 2082 dasm_put(Dst, 10853);
2084 } else { 2083 } else {
2085 dasm_put(Dst, 10871); 2084 dasm_put(Dst, 10872);
2086 if (cmov) { 2085 if (cmov) {
2087 dasm_put(Dst, 10261); 2086 dasm_put(Dst, 10262);
2088 } else { 2087 } else {
2089 dasm_put(Dst, 10267); 2088 dasm_put(Dst, 10268);
2090 } 2089 }
2091 } 2090 }
2092 goto iseqne_fp; 2091 goto iseqne_fp;
2093 case BC_ISEQP: case BC_ISNEP: 2092 case BC_ISEQP: case BC_ISNEP:
2094 vk = op == BC_ISEQP; 2093 vk = op == BC_ISEQP;
2095 dasm_put(Dst, 10885); 2094 dasm_put(Dst, 10886);
2096 if (!LJ_HASFFI) goto iseqne_test; 2095 if (!LJ_HASFFI) goto iseqne_test;
2097 if (vk) { 2096 if (vk) {
2098 dasm_put(Dst, 10899, -BCBIAS_J*4, LJ_TCDATA); 2097 dasm_put(Dst, 10900, -BCBIAS_J*4, LJ_TCDATA);
2099 } else { 2098 } else {
2100 dasm_put(Dst, 10950, LJ_TCDATA, -BCBIAS_J*4); 2099 dasm_put(Dst, 10951, LJ_TCDATA, -BCBIAS_J*4);
2101 } 2100 }
2102 break; 2101 break;
2103 2102
2104 /* -- Unary test and copy ops ------------------------------------------- */ 2103 /* -- Unary test and copy ops ------------------------------------------- */
2105 2104
2106 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: 2105 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
2107 dasm_put(Dst, 10995, LJ_TISTRUECOND); 2106 dasm_put(Dst, 10996, LJ_TISTRUECOND);
2108 if (op == BC_IST || op == BC_ISTC) { 2107 if (op == BC_IST || op == BC_ISTC) {
2109 dasm_put(Dst, 10289); 2108 dasm_put(Dst, 10290);
2110 } else { 2109 } else {
2111 dasm_put(Dst, 10284); 2110 dasm_put(Dst, 10285);
2112 } 2111 }
2113 if (op == BC_ISTC || op == BC_ISFC) { 2112 if (op == BC_ISTC || op == BC_ISFC) {
2114 dasm_put(Dst, 11007); 2113 dasm_put(Dst, 11008);
2115 } 2114 }
2116 dasm_put(Dst, 10294, -BCBIAS_J*4); 2115 dasm_put(Dst, 10295, -BCBIAS_J*4);
2117 break; 2116 break;
2118 2117
2119 /* -- Unary ops --------------------------------------------------------- */ 2118 /* -- Unary ops --------------------------------------------------------- */
2120 2119
2121 case BC_MOV: 2120 case BC_MOV:
2122 dasm_put(Dst, 11018); 2121 dasm_put(Dst, 11019);
2123 break; 2122 break;
2124 case BC_NOT: 2123 case BC_NOT:
2125 dasm_put(Dst, 11047, LJ_TISTRUECOND, LJ_TTRUE); 2124 dasm_put(Dst, 11048, LJ_TISTRUECOND, LJ_TTRUE);
2126 break; 2125 break;
2127 case BC_UNM: 2126 case BC_UNM:
2128 if (LJ_DUALNUM) { 2127 if (LJ_DUALNUM) {
2129 dasm_put(Dst, 11084, LJ_TISNUM, LJ_TISNUM); 2128 dasm_put(Dst, 11085, LJ_TISNUM, LJ_TISNUM);
2130 } else { 2129 } else {
2131 dasm_put(Dst, 11162, LJ_TISNUM); 2130 dasm_put(Dst, 11163, LJ_TISNUM);
2132 } 2131 }
2133 if (sse) { 2132 if (sse) {
2134 dasm_put(Dst, 11173, (unsigned int)(U64x(80000000,00000000)), (unsigned int)((U64x(80000000,00000000))>>32)); 2133 dasm_put(Dst, 11174, (unsigned int)(U64x(80000000,00000000)), (unsigned int)((U64x(80000000,00000000))>>32));
2135 } else { 2134 } else {
2136 dasm_put(Dst, 11198); 2135 dasm_put(Dst, 11199);
2137 } 2136 }
2138 if (LJ_DUALNUM) { 2137 if (LJ_DUALNUM) {
2139 dasm_put(Dst, 10567); 2138 dasm_put(Dst, 10568);
2140 } else { 2139 } else {
2141 dasm_put(Dst, 10306); 2140 dasm_put(Dst, 10307);
2142 } 2141 }
2143 break; 2142 break;
2144 case BC_LEN: 2143 case BC_LEN:
2145 dasm_put(Dst, 11207, LJ_TSTR); 2144 dasm_put(Dst, 11208, LJ_TSTR);
2146 if (LJ_DUALNUM) { 2145 if (LJ_DUALNUM) {
2147 dasm_put(Dst, 11221, Dt5(->len), LJ_TISNUM); 2146 dasm_put(Dst, 11222, Dt5(->len), LJ_TISNUM);
2148 } else if (sse) { 2147 } else if (sse) {
2149 dasm_put(Dst, 11235, Dt5(->len)); 2148 dasm_put(Dst, 11236, Dt5(->len));
2150 } else { 2149 } else {
2151 dasm_put(Dst, 11253, Dt5(->len)); 2150 dasm_put(Dst, 11254, Dt5(->len));
2152 } 2151 }
2153 dasm_put(Dst, 11262, LJ_TTAB); 2152 dasm_put(Dst, 11263, LJ_TTAB);
2154#ifdef LUAJIT_ENABLE_LUA52COMPAT 2153#ifdef LUAJIT_ENABLE_LUA52COMPAT
2155 dasm_put(Dst, 11298, Dt6(->metatable)); 2154 dasm_put(Dst, 11299, Dt6(->metatable));
2156#endif 2155#endif
2157 dasm_put(Dst, 11312); 2156 dasm_put(Dst, 11313);
2158 if (LJ_DUALNUM) { 2157 if (LJ_DUALNUM) {
2159 } else if (sse) { 2158 } else if (sse) {
2160 dasm_put(Dst, 11321); 2159 dasm_put(Dst, 11322);
2161 } else { 2160 } else {
2162 } 2161 }
2163 dasm_put(Dst, 11327); 2162 dasm_put(Dst, 11328);
2164#ifdef LUAJIT_ENABLE_LUA52COMPAT 2163#ifdef LUAJIT_ENABLE_LUA52COMPAT
2165 dasm_put(Dst, 11340, Dt6(->nomm), 1<<MM_len); 2164 dasm_put(Dst, 11341, Dt6(->nomm), 1<<MM_len);
2166#endif 2165#endif
2167 break; 2166 break;
2168 2167
@@ -2171,603 +2170,603 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2171 2170
2172 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: 2171 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
2173 if (LJ_DUALNUM) { 2172 if (LJ_DUALNUM) {
2174 dasm_put(Dst, 11356); 2173 dasm_put(Dst, 11357);
2175 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2174 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2176 switch (vk) { 2175 switch (vk) {
2177 case 0: 2176 case 0:
2178 dasm_put(Dst, 11364, LJ_TISNUM, LJ_TISNUM); 2177 dasm_put(Dst, 11365, LJ_TISNUM, LJ_TISNUM);
2179 break; 2178 break;
2180 case 1: 2179 case 1:
2181 dasm_put(Dst, 11399, LJ_TISNUM, LJ_TISNUM); 2180 dasm_put(Dst, 11400, LJ_TISNUM, LJ_TISNUM);
2182 break; 2181 break;
2183 default: 2182 default:
2184 dasm_put(Dst, 11434, LJ_TISNUM, LJ_TISNUM); 2183 dasm_put(Dst, 11435, LJ_TISNUM, LJ_TISNUM);
2185 break; 2184 break;
2186 } 2185 }
2187 dasm_put(Dst, 11467, LJ_TISNUM); 2186 dasm_put(Dst, 11468, LJ_TISNUM);
2188 if (vk == 1) { 2187 if (vk == 1) {
2189 dasm_put(Dst, 11231); 2188 dasm_put(Dst, 11232);
2190 } else { 2189 } else {
2191 dasm_put(Dst, 11014); 2190 dasm_put(Dst, 11015);
2192 } 2191 }
2193 dasm_put(Dst, 10306); 2192 dasm_put(Dst, 10307);
2194 } else { 2193 } else {
2195 dasm_put(Dst, 11356); 2194 dasm_put(Dst, 11357);
2196 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2195 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2197 switch (vk) { 2196 switch (vk) {
2198 case 0: 2197 case 0:
2199 dasm_put(Dst, 11473, LJ_TISNUM); 2198 dasm_put(Dst, 11474, LJ_TISNUM);
2200 if (LJ_DUALNUM) { 2199 if (LJ_DUALNUM) {
2201 dasm_put(Dst, 11485, LJ_TISNUM); 2200 dasm_put(Dst, 11486, LJ_TISNUM);
2202 } 2201 }
2203 if (sse) { 2202 if (sse) {
2204 dasm_put(Dst, 11497); 2203 dasm_put(Dst, 11498);
2205 } else { 2204 } else {
2206 dasm_put(Dst, 11512); 2205 dasm_put(Dst, 11513);
2207 } 2206 }
2208 break; 2207 break;
2209 case 1: 2208 case 1:
2210 dasm_put(Dst, 11521, LJ_TISNUM); 2209 dasm_put(Dst, 11522, LJ_TISNUM);
2211 if (LJ_DUALNUM) { 2210 if (LJ_DUALNUM) {
2212 dasm_put(Dst, 11533, LJ_TISNUM); 2211 dasm_put(Dst, 11534, LJ_TISNUM);
2213 } 2212 }
2214 if (sse) { 2213 if (sse) {
2215 dasm_put(Dst, 11545); 2214 dasm_put(Dst, 11546);
2216 } else { 2215 } else {
2217 dasm_put(Dst, 11560); 2216 dasm_put(Dst, 11561);
2218 } 2217 }
2219 break; 2218 break;
2220 default: 2219 default:
2221 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2220 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2222 if (sse) { 2221 if (sse) {
2223 dasm_put(Dst, 11591); 2222 dasm_put(Dst, 11592);
2224 } else { 2223 } else {
2225 dasm_put(Dst, 11605); 2224 dasm_put(Dst, 11606);
2226 } 2225 }
2227 break; 2226 break;
2228 } 2227 }
2229 if (sse) { 2228 if (sse) {
2230 dasm_put(Dst, 11191); 2229 dasm_put(Dst, 11192);
2231 } else { 2230 } else {
2232 dasm_put(Dst, 11203); 2231 dasm_put(Dst, 11204);
2233 } 2232 }
2234 dasm_put(Dst, 10306); 2233 dasm_put(Dst, 10307);
2235 } 2234 }
2236 break; 2235 break;
2237 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 2236 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
2238 if (LJ_DUALNUM) { 2237 if (LJ_DUALNUM) {
2239 dasm_put(Dst, 11356); 2238 dasm_put(Dst, 11357);
2240 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2239 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2241 switch (vk) { 2240 switch (vk) {
2242 case 0: 2241 case 0:
2243 dasm_put(Dst, 11613, LJ_TISNUM, LJ_TISNUM); 2242 dasm_put(Dst, 11614, LJ_TISNUM, LJ_TISNUM);
2244 break; 2243 break;
2245 case 1: 2244 case 1:
2246 dasm_put(Dst, 11648, LJ_TISNUM, LJ_TISNUM); 2245 dasm_put(Dst, 11649, LJ_TISNUM, LJ_TISNUM);
2247 break; 2246 break;
2248 default: 2247 default:
2249 dasm_put(Dst, 11683, LJ_TISNUM, LJ_TISNUM); 2248 dasm_put(Dst, 11684, LJ_TISNUM, LJ_TISNUM);
2250 break; 2249 break;
2251 } 2250 }
2252 dasm_put(Dst, 11467, LJ_TISNUM); 2251 dasm_put(Dst, 11468, LJ_TISNUM);
2253 if (vk == 1) { 2252 if (vk == 1) {
2254 dasm_put(Dst, 11231); 2253 dasm_put(Dst, 11232);
2255 } else { 2254 } else {
2256 dasm_put(Dst, 11014); 2255 dasm_put(Dst, 11015);
2257 } 2256 }
2258 dasm_put(Dst, 10306); 2257 dasm_put(Dst, 10307);
2259 } else { 2258 } else {
2260 dasm_put(Dst, 11356); 2259 dasm_put(Dst, 11357);
2261 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2260 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2262 switch (vk) { 2261 switch (vk) {
2263 case 0: 2262 case 0:
2264 dasm_put(Dst, 11473, LJ_TISNUM); 2263 dasm_put(Dst, 11474, LJ_TISNUM);
2265 if (LJ_DUALNUM) { 2264 if (LJ_DUALNUM) {
2266 dasm_put(Dst, 11485, LJ_TISNUM); 2265 dasm_put(Dst, 11486, LJ_TISNUM);
2267 } 2266 }
2268 if (sse) { 2267 if (sse) {
2269 dasm_put(Dst, 11716); 2268 dasm_put(Dst, 11717);
2270 } else { 2269 } else {
2271 dasm_put(Dst, 11731); 2270 dasm_put(Dst, 11732);
2272 } 2271 }
2273 break; 2272 break;
2274 case 1: 2273 case 1:
2275 dasm_put(Dst, 11521, LJ_TISNUM); 2274 dasm_put(Dst, 11522, LJ_TISNUM);
2276 if (LJ_DUALNUM) { 2275 if (LJ_DUALNUM) {
2277 dasm_put(Dst, 11533, LJ_TISNUM); 2276 dasm_put(Dst, 11534, LJ_TISNUM);
2278 } 2277 }
2279 if (sse) { 2278 if (sse) {
2280 dasm_put(Dst, 11740); 2279 dasm_put(Dst, 11741);
2281 } else { 2280 } else {
2282 dasm_put(Dst, 11755); 2281 dasm_put(Dst, 11756);
2283 } 2282 }
2284 break; 2283 break;
2285 default: 2284 default:
2286 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2285 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2287 if (sse) { 2286 if (sse) {
2288 dasm_put(Dst, 11764); 2287 dasm_put(Dst, 11765);
2289 } else { 2288 } else {
2290 dasm_put(Dst, 11778); 2289 dasm_put(Dst, 11779);
2291 } 2290 }
2292 break; 2291 break;
2293 } 2292 }
2294 if (sse) { 2293 if (sse) {
2295 dasm_put(Dst, 11191); 2294 dasm_put(Dst, 11192);
2296 } else { 2295 } else {
2297 dasm_put(Dst, 11203); 2296 dasm_put(Dst, 11204);
2298 } 2297 }
2299 dasm_put(Dst, 10306); 2298 dasm_put(Dst, 10307);
2300 } 2299 }
2301 break; 2300 break;
2302 case BC_MULVN: case BC_MULNV: case BC_MULVV: 2301 case BC_MULVN: case BC_MULNV: case BC_MULVV:
2303 if (LJ_DUALNUM) { 2302 if (LJ_DUALNUM) {
2304 dasm_put(Dst, 11356); 2303 dasm_put(Dst, 11357);
2305 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2304 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2306 switch (vk) { 2305 switch (vk) {
2307 case 0: 2306 case 0:
2308 dasm_put(Dst, 11786, LJ_TISNUM, LJ_TISNUM); 2307 dasm_put(Dst, 11787, LJ_TISNUM, LJ_TISNUM);
2309 break; 2308 break;
2310 case 1: 2309 case 1:
2311 dasm_put(Dst, 11822, LJ_TISNUM, LJ_TISNUM); 2310 dasm_put(Dst, 11823, LJ_TISNUM, LJ_TISNUM);
2312 break; 2311 break;
2313 default: 2312 default:
2314 dasm_put(Dst, 11858, LJ_TISNUM, LJ_TISNUM); 2313 dasm_put(Dst, 11859, LJ_TISNUM, LJ_TISNUM);
2315 break; 2314 break;
2316 } 2315 }
2317 dasm_put(Dst, 11467, LJ_TISNUM); 2316 dasm_put(Dst, 11468, LJ_TISNUM);
2318 if (vk == 1) { 2317 if (vk == 1) {
2319 dasm_put(Dst, 11231); 2318 dasm_put(Dst, 11232);
2320 } else { 2319 } else {
2321 dasm_put(Dst, 11014); 2320 dasm_put(Dst, 11015);
2322 } 2321 }
2323 dasm_put(Dst, 10306); 2322 dasm_put(Dst, 10307);
2324 } else { 2323 } else {
2325 dasm_put(Dst, 11356); 2324 dasm_put(Dst, 11357);
2326 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2325 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2327 switch (vk) { 2326 switch (vk) {
2328 case 0: 2327 case 0:
2329 dasm_put(Dst, 11473, LJ_TISNUM); 2328 dasm_put(Dst, 11474, LJ_TISNUM);
2330 if (LJ_DUALNUM) { 2329 if (LJ_DUALNUM) {
2331 dasm_put(Dst, 11485, LJ_TISNUM); 2330 dasm_put(Dst, 11486, LJ_TISNUM);
2332 } 2331 }
2333 if (sse) { 2332 if (sse) {
2334 dasm_put(Dst, 11892); 2333 dasm_put(Dst, 11893);
2335 } else { 2334 } else {
2336 dasm_put(Dst, 11907); 2335 dasm_put(Dst, 11908);
2337 } 2336 }
2338 break; 2337 break;
2339 case 1: 2338 case 1:
2340 dasm_put(Dst, 11521, LJ_TISNUM); 2339 dasm_put(Dst, 11522, LJ_TISNUM);
2341 if (LJ_DUALNUM) { 2340 if (LJ_DUALNUM) {
2342 dasm_put(Dst, 11533, LJ_TISNUM); 2341 dasm_put(Dst, 11534, LJ_TISNUM);
2343 } 2342 }
2344 if (sse) { 2343 if (sse) {
2345 dasm_put(Dst, 11916); 2344 dasm_put(Dst, 11917);
2346 } else { 2345 } else {
2347 dasm_put(Dst, 11931); 2346 dasm_put(Dst, 11932);
2348 } 2347 }
2349 break; 2348 break;
2350 default: 2349 default:
2351 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2350 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2352 if (sse) { 2351 if (sse) {
2353 dasm_put(Dst, 11940); 2352 dasm_put(Dst, 11941);
2354 } else { 2353 } else {
2355 dasm_put(Dst, 11954); 2354 dasm_put(Dst, 11955);
2356 } 2355 }
2357 break; 2356 break;
2358 } 2357 }
2359 if (sse) { 2358 if (sse) {
2360 dasm_put(Dst, 11191); 2359 dasm_put(Dst, 11192);
2361 } else { 2360 } else {
2362 dasm_put(Dst, 11203); 2361 dasm_put(Dst, 11204);
2363 } 2362 }
2364 dasm_put(Dst, 10306); 2363 dasm_put(Dst, 10307);
2365 } 2364 }
2366 break; 2365 break;
2367 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 2366 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
2368 dasm_put(Dst, 11356); 2367 dasm_put(Dst, 11357);
2369 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2368 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2370 switch (vk) { 2369 switch (vk) {
2371 case 0: 2370 case 0:
2372 dasm_put(Dst, 11473, LJ_TISNUM); 2371 dasm_put(Dst, 11474, LJ_TISNUM);
2373 if (LJ_DUALNUM) { 2372 if (LJ_DUALNUM) {
2374 dasm_put(Dst, 11485, LJ_TISNUM); 2373 dasm_put(Dst, 11486, LJ_TISNUM);
2375 } 2374 }
2376 if (sse) { 2375 if (sse) {
2377 dasm_put(Dst, 11962); 2376 dasm_put(Dst, 11963);
2378 } else { 2377 } else {
2379 dasm_put(Dst, 11977); 2378 dasm_put(Dst, 11978);
2380 } 2379 }
2381 break; 2380 break;
2382 case 1: 2381 case 1:
2383 dasm_put(Dst, 11521, LJ_TISNUM); 2382 dasm_put(Dst, 11522, LJ_TISNUM);
2384 if (LJ_DUALNUM) { 2383 if (LJ_DUALNUM) {
2385 dasm_put(Dst, 11533, LJ_TISNUM); 2384 dasm_put(Dst, 11534, LJ_TISNUM);
2386 } 2385 }
2387 if (sse) { 2386 if (sse) {
2388 dasm_put(Dst, 11986); 2387 dasm_put(Dst, 11987);
2389 } else { 2388 } else {
2390 dasm_put(Dst, 12001); 2389 dasm_put(Dst, 12002);
2391 } 2390 }
2392 break; 2391 break;
2393 default: 2392 default:
2394 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2393 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2395 if (sse) { 2394 if (sse) {
2396 dasm_put(Dst, 12010); 2395 dasm_put(Dst, 12011);
2397 } else { 2396 } else {
2398 dasm_put(Dst, 12024); 2397 dasm_put(Dst, 12025);
2399 } 2398 }
2400 break; 2399 break;
2401 } 2400 }
2402 if (sse) { 2401 if (sse) {
2403 dasm_put(Dst, 11191); 2402 dasm_put(Dst, 11192);
2404 } else { 2403 } else {
2405 dasm_put(Dst, 11203); 2404 dasm_put(Dst, 11204);
2406 } 2405 }
2407 dasm_put(Dst, 10306); 2406 dasm_put(Dst, 10307);
2408 break; 2407 break;
2409 case BC_MODVN: 2408 case BC_MODVN:
2410 dasm_put(Dst, 11356); 2409 dasm_put(Dst, 11357);
2411 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2410 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2412 switch (vk) { 2411 switch (vk) {
2413 case 0: 2412 case 0:
2414 dasm_put(Dst, 11473, LJ_TISNUM); 2413 dasm_put(Dst, 11474, LJ_TISNUM);
2415 if (LJ_DUALNUM) { 2414 if (LJ_DUALNUM) {
2416 dasm_put(Dst, 11485, LJ_TISNUM); 2415 dasm_put(Dst, 11486, LJ_TISNUM);
2417 } 2416 }
2418 if (sse) { 2417 if (sse) {
2419 dasm_put(Dst, 12032); 2418 dasm_put(Dst, 12033);
2420 } else { 2419 } else {
2421 dasm_put(Dst, 12047); 2420 dasm_put(Dst, 12048);
2422 } 2421 }
2423 break; 2422 break;
2424 case 1: 2423 case 1:
2425 dasm_put(Dst, 11521, LJ_TISNUM); 2424 dasm_put(Dst, 11522, LJ_TISNUM);
2426 if (LJ_DUALNUM) { 2425 if (LJ_DUALNUM) {
2427 dasm_put(Dst, 11533, LJ_TISNUM); 2426 dasm_put(Dst, 11534, LJ_TISNUM);
2428 } 2427 }
2429 if (sse) { 2428 if (sse) {
2430 dasm_put(Dst, 12056); 2429 dasm_put(Dst, 12057);
2431 } else { 2430 } else {
2432 dasm_put(Dst, 12071); 2431 dasm_put(Dst, 12072);
2433 } 2432 }
2434 break; 2433 break;
2435 default: 2434 default:
2436 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2435 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2437 if (sse) { 2436 if (sse) {
2438 dasm_put(Dst, 12080); 2437 dasm_put(Dst, 12081);
2439 } else { 2438 } else {
2440 dasm_put(Dst, 12094); 2439 dasm_put(Dst, 12095);
2441 } 2440 }
2442 break; 2441 break;
2443 } 2442 }
2444 dasm_put(Dst, 12102); 2443 dasm_put(Dst, 12103);
2445 if (sse) { 2444 if (sse) {
2446 dasm_put(Dst, 11191); 2445 dasm_put(Dst, 11192);
2447 } else { 2446 } else {
2448 dasm_put(Dst, 11203); 2447 dasm_put(Dst, 11204);
2449 } 2448 }
2450 dasm_put(Dst, 10306); 2449 dasm_put(Dst, 10307);
2451 break; 2450 break;
2452 case BC_MODNV: case BC_MODVV: 2451 case BC_MODNV: case BC_MODVV:
2453 dasm_put(Dst, 11356); 2452 dasm_put(Dst, 11357);
2454 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2453 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2455 switch (vk) { 2454 switch (vk) {
2456 case 0: 2455 case 0:
2457 dasm_put(Dst, 11473, LJ_TISNUM); 2456 dasm_put(Dst, 11474, LJ_TISNUM);
2458 if (LJ_DUALNUM) { 2457 if (LJ_DUALNUM) {
2459 dasm_put(Dst, 11485, LJ_TISNUM); 2458 dasm_put(Dst, 11486, LJ_TISNUM);
2460 } 2459 }
2461 if (sse) { 2460 if (sse) {
2462 dasm_put(Dst, 12032); 2461 dasm_put(Dst, 12033);
2463 } else { 2462 } else {
2464 dasm_put(Dst, 12047); 2463 dasm_put(Dst, 12048);
2465 } 2464 }
2466 break; 2465 break;
2467 case 1: 2466 case 1:
2468 dasm_put(Dst, 11521, LJ_TISNUM); 2467 dasm_put(Dst, 11522, LJ_TISNUM);
2469 if (LJ_DUALNUM) { 2468 if (LJ_DUALNUM) {
2470 dasm_put(Dst, 11533, LJ_TISNUM); 2469 dasm_put(Dst, 11534, LJ_TISNUM);
2471 } 2470 }
2472 if (sse) { 2471 if (sse) {
2473 dasm_put(Dst, 12056); 2472 dasm_put(Dst, 12057);
2474 } else { 2473 } else {
2475 dasm_put(Dst, 12071); 2474 dasm_put(Dst, 12072);
2476 } 2475 }
2477 break; 2476 break;
2478 default: 2477 default:
2479 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2478 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2480 if (sse) { 2479 if (sse) {
2481 dasm_put(Dst, 12080); 2480 dasm_put(Dst, 12081);
2482 } else { 2481 } else {
2483 dasm_put(Dst, 12094); 2482 dasm_put(Dst, 12095);
2484 } 2483 }
2485 break; 2484 break;
2486 } 2485 }
2487 dasm_put(Dst, 12108); 2486 dasm_put(Dst, 12109);
2488 break; 2487 break;
2489 case BC_POW: 2488 case BC_POW:
2490 dasm_put(Dst, 11356); 2489 dasm_put(Dst, 11357);
2491 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2490 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2492 switch (vk) { 2491 switch (vk) {
2493 case 0: 2492 case 0:
2494 dasm_put(Dst, 11473, LJ_TISNUM); 2493 dasm_put(Dst, 11474, LJ_TISNUM);
2495 if (LJ_DUALNUM) { 2494 if (LJ_DUALNUM) {
2496 dasm_put(Dst, 11485, LJ_TISNUM); 2495 dasm_put(Dst, 11486, LJ_TISNUM);
2497 } 2496 }
2498 if (sse) { 2497 if (sse) {
2499 dasm_put(Dst, 12032); 2498 dasm_put(Dst, 12033);
2500 } else { 2499 } else {
2501 dasm_put(Dst, 12047); 2500 dasm_put(Dst, 12048);
2502 } 2501 }
2503 break; 2502 break;
2504 case 1: 2503 case 1:
2505 dasm_put(Dst, 11521, LJ_TISNUM); 2504 dasm_put(Dst, 11522, LJ_TISNUM);
2506 if (LJ_DUALNUM) { 2505 if (LJ_DUALNUM) {
2507 dasm_put(Dst, 11533, LJ_TISNUM); 2506 dasm_put(Dst, 11534, LJ_TISNUM);
2508 } 2507 }
2509 if (sse) { 2508 if (sse) {
2510 dasm_put(Dst, 12056); 2509 dasm_put(Dst, 12057);
2511 } else { 2510 } else {
2512 dasm_put(Dst, 12071); 2511 dasm_put(Dst, 12072);
2513 } 2512 }
2514 break; 2513 break;
2515 default: 2514 default:
2516 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2515 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2517 if (sse) { 2516 if (sse) {
2518 dasm_put(Dst, 12080); 2517 dasm_put(Dst, 12081);
2519 } else { 2518 } else {
2520 dasm_put(Dst, 12094); 2519 dasm_put(Dst, 12095);
2521 } 2520 }
2522 break; 2521 break;
2523 } 2522 }
2524 dasm_put(Dst, 12113); 2523 dasm_put(Dst, 12114);
2525 if (sse) { 2524 if (sse) {
2526 dasm_put(Dst, 11191); 2525 dasm_put(Dst, 11192);
2527 } else { 2526 } else {
2528 dasm_put(Dst, 11203); 2527 dasm_put(Dst, 11204);
2529 } 2528 }
2530 dasm_put(Dst, 10306); 2529 dasm_put(Dst, 10307);
2531 break; 2530 break;
2532 2531
2533 case BC_CAT: 2532 case BC_CAT:
2534 dasm_put(Dst, 12117, Dt1(->base), Dt1(->base)); 2533 dasm_put(Dst, 12118, Dt1(->base), Dt1(->base));
2535 break; 2534 break;
2536 2535
2537 /* -- Constant ops ------------------------------------------------------ */ 2536 /* -- Constant ops ------------------------------------------------------ */
2538 2537
2539 case BC_KSTR: 2538 case BC_KSTR:
2540 dasm_put(Dst, 12201, LJ_TSTR); 2539 dasm_put(Dst, 12202, LJ_TSTR);
2541 break; 2540 break;
2542 case BC_KCDATA: 2541 case BC_KCDATA:
2543#if LJ_HASFFI 2542#if LJ_HASFFI
2544 dasm_put(Dst, 12201, LJ_TCDATA); 2543 dasm_put(Dst, 12202, LJ_TCDATA);
2545#endif 2544#endif
2546 break; 2545 break;
2547 case BC_KSHORT: 2546 case BC_KSHORT:
2548 if (LJ_DUALNUM) { 2547 if (LJ_DUALNUM) {
2549 dasm_put(Dst, 12238, LJ_TISNUM); 2548 dasm_put(Dst, 12239, LJ_TISNUM);
2550 } else if (sse) { 2549 } else if (sse) {
2551 dasm_put(Dst, 12250); 2550 dasm_put(Dst, 12251);
2552 } else { 2551 } else {
2553 dasm_put(Dst, 12265); 2552 dasm_put(Dst, 12266);
2554 } 2553 }
2555 dasm_put(Dst, 10306); 2554 dasm_put(Dst, 10307);
2556 break; 2555 break;
2557 case BC_KNUM: 2556 case BC_KNUM:
2558 if (sse) { 2557 if (sse) {
2559 dasm_put(Dst, 12273); 2558 dasm_put(Dst, 12274);
2560 } else { 2559 } else {
2561 dasm_put(Dst, 12287); 2560 dasm_put(Dst, 12288);
2562 } 2561 }
2563 dasm_put(Dst, 10306); 2562 dasm_put(Dst, 10307);
2564 break; 2563 break;
2565 case BC_KPRI: 2564 case BC_KPRI:
2566 dasm_put(Dst, 12295); 2565 dasm_put(Dst, 12296);
2567 break; 2566 break;
2568 case BC_KNIL: 2567 case BC_KNIL:
2569 dasm_put(Dst, 12324, LJ_TNIL); 2568 dasm_put(Dst, 12325, LJ_TNIL);
2570 break; 2569 break;
2571 2570
2572 /* -- Upvalue and function ops ------------------------------------------ */ 2571 /* -- Upvalue and function ops ------------------------------------------ */
2573 2572
2574 case BC_UGET: 2573 case BC_UGET:
2575 dasm_put(Dst, 12372, offsetof(GCfuncL, uvptr), DtA(->v)); 2574 dasm_put(Dst, 12373, offsetof(GCfuncL, uvptr), DtA(->v));
2576 break; 2575 break;
2577 case BC_USETV: 2576 case BC_USETV:
2578#define TV2MARKOFS \ 2577#define TV2MARKOFS \
2579 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv)) 2578 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
2580 dasm_put(Dst, 12413, offsetof(GCfuncL, uvptr), DtA(->closed), DtA(->v), TV2MARKOFS, LJ_GC_BLACK, LJ_TISGCV, LJ_TISNUM - LJ_TISGCV, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); 2579 dasm_put(Dst, 12414, offsetof(GCfuncL, uvptr), DtA(->closed), DtA(->v), TV2MARKOFS, LJ_GC_BLACK, LJ_TISGCV, LJ_TISNUM - LJ_TISGCV, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G);
2581 dasm_put(Dst, 12509); 2580 dasm_put(Dst, 12510);
2582 break; 2581 break;
2583#undef TV2MARKOFS 2582#undef TV2MARKOFS
2584 case BC_USETS: 2583 case BC_USETS:
2585 dasm_put(Dst, 12521, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G); 2584 dasm_put(Dst, 12522, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G);
2586 break; 2585 break;
2587 case BC_USETN: 2586 case BC_USETN:
2588 dasm_put(Dst, 12617); 2587 dasm_put(Dst, 12618);
2589 if (sse) { 2588 if (sse) {
2590 dasm_put(Dst, 12622); 2589 dasm_put(Dst, 12623);
2591 } else { 2590 } else {
2592 dasm_put(Dst, 10838); 2591 dasm_put(Dst, 10839);
2593 } 2592 }
2594 dasm_put(Dst, 12630, offsetof(GCfuncL, uvptr), DtA(->v)); 2593 dasm_put(Dst, 12631, offsetof(GCfuncL, uvptr), DtA(->v));
2595 if (sse) { 2594 if (sse) {
2596 dasm_put(Dst, 12639); 2595 dasm_put(Dst, 12640);
2597 } else { 2596 } else {
2598 dasm_put(Dst, 12645); 2597 dasm_put(Dst, 12646);
2599 } 2598 }
2600 dasm_put(Dst, 10306); 2599 dasm_put(Dst, 10307);
2601 break; 2600 break;
2602 case BC_USETP: 2601 case BC_USETP:
2603 dasm_put(Dst, 12648, offsetof(GCfuncL, uvptr), DtA(->v)); 2602 dasm_put(Dst, 12649, offsetof(GCfuncL, uvptr), DtA(->v));
2604 break; 2603 break;
2605 case BC_UCLO: 2604 case BC_UCLO:
2606 dasm_put(Dst, 12688, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base)); 2605 dasm_put(Dst, 12689, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
2607 break; 2606 break;
2608 2607
2609 case BC_FNEW: 2608 case BC_FNEW:
2610 dasm_put(Dst, 12744, Dt1(->base), Dt1(->base), LJ_TFUNC); 2609 dasm_put(Dst, 12745, Dt1(->base), Dt1(->base), LJ_TFUNC);
2611 break; 2610 break;
2612 2611
2613 /* -- Table ops --------------------------------------------------------- */ 2612 /* -- Table ops --------------------------------------------------------- */
2614 2613
2615 case BC_TNEW: 2614 case BC_TNEW:
2616 dasm_put(Dst, 12811, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB); 2615 dasm_put(Dst, 12812, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
2617 break; 2616 break;
2618 case BC_TDUP: 2617 case BC_TDUP:
2619 dasm_put(Dst, 12935, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB); 2618 dasm_put(Dst, 12936, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
2620 break; 2619 break;
2621 2620
2622 case BC_GGET: 2621 case BC_GGET:
2623 dasm_put(Dst, 13034, Dt7(->env)); 2622 dasm_put(Dst, 13035, Dt7(->env));
2624 break; 2623 break;
2625 case BC_GSET: 2624 case BC_GSET:
2626 dasm_put(Dst, 13054, Dt7(->env)); 2625 dasm_put(Dst, 13055, Dt7(->env));
2627 break; 2626 break;
2628 2627
2629 case BC_TGETV: 2628 case BC_TGETV:
2630 dasm_put(Dst, 13074, LJ_TTAB); 2629 dasm_put(Dst, 13075, LJ_TTAB);
2631 if (LJ_DUALNUM) { 2630 if (LJ_DUALNUM) {
2632 dasm_put(Dst, 13097, LJ_TISNUM); 2631 dasm_put(Dst, 13098, LJ_TISNUM);
2633 } else { 2632 } else {
2634 dasm_put(Dst, 13111, LJ_TISNUM); 2633 dasm_put(Dst, 13112, LJ_TISNUM);
2635 if (sse) { 2634 if (sse) {
2636 dasm_put(Dst, 13122); 2635 dasm_put(Dst, 13123);
2637 } else { 2636 } else {
2638 } 2637 }
2639 dasm_put(Dst, 13143); 2638 dasm_put(Dst, 13144);
2640 } 2639 }
2641 dasm_put(Dst, 13148, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TNIL); 2640 dasm_put(Dst, 13149, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TNIL);
2642 dasm_put(Dst, 13240, LJ_TSTR); 2641 dasm_put(Dst, 13241, LJ_TSTR);
2643 break; 2642 break;
2644 case BC_TGETS: 2643 case BC_TGETS:
2645 dasm_put(Dst, 13258, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); 2644 dasm_put(Dst, 13259, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
2646 dasm_put(Dst, 13343, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 2645 dasm_put(Dst, 13344, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
2647 break; 2646 break;
2648 case BC_TGETB: 2647 case BC_TGETB:
2649 dasm_put(Dst, 13415, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 2648 dasm_put(Dst, 13416, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
2650 dasm_put(Dst, 13511, LJ_TNIL); 2649 dasm_put(Dst, 13512, LJ_TNIL);
2651 break; 2650 break;
2652 2651
2653 case BC_TSETV: 2652 case BC_TSETV:
2654 dasm_put(Dst, 13528, LJ_TTAB); 2653 dasm_put(Dst, 13529, LJ_TTAB);
2655 if (LJ_DUALNUM) { 2654 if (LJ_DUALNUM) {
2656 dasm_put(Dst, 13097, LJ_TISNUM); 2655 dasm_put(Dst, 13098, LJ_TISNUM);
2657 } else { 2656 } else {
2658 dasm_put(Dst, 13111, LJ_TISNUM); 2657 dasm_put(Dst, 13112, LJ_TISNUM);
2659 if (sse) { 2658 if (sse) {
2660 dasm_put(Dst, 13122); 2659 dasm_put(Dst, 13123);
2661 } else { 2660 } else {
2662 } 2661 }
2663 dasm_put(Dst, 13551); 2662 dasm_put(Dst, 13552);
2664 } 2663 }
2665 dasm_put(Dst, 13556, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); 2664 dasm_put(Dst, 13557, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex);
2666 dasm_put(Dst, 13637, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2665 dasm_put(Dst, 13638, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2667 break; 2666 break;
2668 case BC_TSETS: 2667 case BC_TSETS:
2669 dasm_put(Dst, 13696, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); 2668 dasm_put(Dst, 13697, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
2670 dasm_put(Dst, 13773, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); 2669 dasm_put(Dst, 13774, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next));
2671 dasm_put(Dst, 13860, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2670 dasm_put(Dst, 13861, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2672 break; 2671 break;
2673 case BC_TSETB: 2672 case BC_TSETB:
2674 dasm_put(Dst, 13952, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); 2673 dasm_put(Dst, 13953, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
2675 dasm_put(Dst, 14047, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2674 dasm_put(Dst, 14048, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2676 break; 2675 break;
2677 2676
2678 case BC_TSETM: 2677 case BC_TSETM:
2679 dasm_put(Dst, 14095, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); 2678 dasm_put(Dst, 14096, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
2680 dasm_put(Dst, 14245, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2679 dasm_put(Dst, 14246, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2681 break; 2680 break;
2682 2681
2683 /* -- Calls and vararg handling ----------------------------------------- */ 2682 /* -- Calls and vararg handling ----------------------------------------- */
2684 2683
2685 case BC_CALL: case BC_CALLM: 2684 case BC_CALL: case BC_CALLM:
2686 dasm_put(Dst, 11360); 2685 dasm_put(Dst, 11361);
2687 if (op == BC_CALLM) { 2686 if (op == BC_CALLM) {
2688 dasm_put(Dst, 14265); 2687 dasm_put(Dst, 14266);
2689 } 2688 }
2690 dasm_put(Dst, 14270, LJ_TFUNC, Dt7(->pc)); 2689 dasm_put(Dst, 14271, LJ_TFUNC, Dt7(->pc));
2691 break; 2690 break;
2692 2691
2693 case BC_CALLMT: 2692 case BC_CALLMT:
2694 dasm_put(Dst, 14265); 2693 dasm_put(Dst, 14266);
2695 break; 2694 break;
2696 case BC_CALLT: 2695 case BC_CALLT:
2697 dasm_put(Dst, 14313, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc)); 2696 dasm_put(Dst, 14314, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
2698 dasm_put(Dst, 14431, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG); 2697 dasm_put(Dst, 14432, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
2699 break; 2698 break;
2700 2699
2701 case BC_ITERC: 2700 case BC_ITERC:
2702 dasm_put(Dst, 14505, LJ_TFUNC, 2+1, Dt7(->pc)); 2701 dasm_put(Dst, 14506, LJ_TFUNC, 2+1, Dt7(->pc));
2703 break; 2702 break;
2704 2703
2705 case BC_ITERN: 2704 case BC_ITERN:
2706#if LJ_HASJIT 2705#if LJ_HASJIT
2707#endif 2706#endif
2708 dasm_put(Dst, 14577, Dt6(->asize), Dt6(->array), LJ_TNIL); 2707 dasm_put(Dst, 14578, Dt6(->asize), Dt6(->array), LJ_TNIL);
2709 if (LJ_DUALNUM) { 2708 if (LJ_DUALNUM) {
2710 dasm_put(Dst, 11226, LJ_TISNUM); 2709 dasm_put(Dst, 11227, LJ_TISNUM);
2711 } else if (sse) { 2710 } else if (sse) {
2712 dasm_put(Dst, 11321); 2711 dasm_put(Dst, 11322);
2713 } else { 2712 } else {
2714 dasm_put(Dst, 14629); 2713 dasm_put(Dst, 14630);
2715 } 2714 }
2716 dasm_put(Dst, 14635); 2715 dasm_put(Dst, 14636);
2717 if (LJ_DUALNUM) { 2716 if (LJ_DUALNUM) {
2718 } else if (sse) { 2717 } else if (sse) {
2719 dasm_put(Dst, 11191); 2718 dasm_put(Dst, 11192);
2720 } else { 2719 } else {
2721 dasm_put(Dst, 11203); 2720 dasm_put(Dst, 11204);
2722 } 2721 }
2723 dasm_put(Dst, 14648, -BCBIAS_J*4); 2722 dasm_put(Dst, 14649, -BCBIAS_J*4);
2724 if (!LJ_DUALNUM && !sse) { 2723 if (!LJ_DUALNUM && !sse) {
2725 dasm_put(Dst, 14702); 2724 dasm_put(Dst, 14703);
2726 } 2725 }
2727 dasm_put(Dst, 14708, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val)); 2726 dasm_put(Dst, 14709, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val));
2728 break; 2727 break;
2729 2728
2730 case BC_ISNEXT: 2729 case BC_ISNEXT:
2731 dasm_put(Dst, 14787, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, BC_JMP, -BCBIAS_J*4, BC_ITERC); 2730 dasm_put(Dst, 14788, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, BC_JMP, -BCBIAS_J*4, BC_ITERC);
2732 break; 2731 break;
2733 2732
2734 case BC_VARG: 2733 case BC_VARG:
2735 dasm_put(Dst, 14888, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack)); 2734 dasm_put(Dst, 14889, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
2736 dasm_put(Dst, 15055, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); 2735 dasm_put(Dst, 15056, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
2737 break; 2736 break;
2738 2737
2739 /* -- Returns ----------------------------------------------------------- */ 2738 /* -- Returns ----------------------------------------------------------- */
2740 2739
2741 case BC_RETM: 2740 case BC_RETM:
2742 dasm_put(Dst, 14265); 2741 dasm_put(Dst, 14266);
2743 break; 2742 break;
2744 2743
2745 case BC_RET: case BC_RET0: case BC_RET1: 2744 case BC_RET: case BC_RET0: case BC_RET1:
2746 if (op != BC_RET0) { 2745 if (op != BC_RET0) {
2747 dasm_put(Dst, 15125); 2746 dasm_put(Dst, 15126);
2748 } 2747 }
2749 dasm_put(Dst, 15129, FRAME_TYPE); 2748 dasm_put(Dst, 15130, FRAME_TYPE);
2750 switch (op) { 2749 switch (op) {
2751 case BC_RET: 2750 case BC_RET:
2752 dasm_put(Dst, 15148); 2751 dasm_put(Dst, 15149);
2753 break; 2752 break;
2754 case BC_RET1: 2753 case BC_RET1:
2755 dasm_put(Dst, 15202); 2754 dasm_put(Dst, 15203);
2756 /* fallthrough */ 2755 /* fallthrough */
2757 case BC_RET0: 2756 case BC_RET0:
2758 dasm_put(Dst, 15212); 2757 dasm_put(Dst, 15213);
2759 default: 2758 default:
2760 break; 2759 break;
2761 } 2760 }
2762 dasm_put(Dst, 15223, Dt7(->pc), PC2PROTO(k)); 2761 dasm_put(Dst, 15224, Dt7(->pc), PC2PROTO(k));
2763 if (op == BC_RET) { 2762 if (op == BC_RET) {
2764 dasm_put(Dst, 15271, LJ_TNIL); 2763 dasm_put(Dst, 15272, LJ_TNIL);
2765 } else { 2764 } else {
2766 dasm_put(Dst, 15282, LJ_TNIL); 2765 dasm_put(Dst, 15283, LJ_TNIL);
2767 } 2766 }
2768 dasm_put(Dst, 15289, -FRAME_VARG, FRAME_TYPEP); 2767 dasm_put(Dst, 15290, -FRAME_VARG, FRAME_TYPEP);
2769 if (op != BC_RET0) { 2768 if (op != BC_RET0) {
2770 dasm_put(Dst, 15313); 2769 dasm_put(Dst, 15314);
2771 } 2770 }
2772 dasm_put(Dst, 4752); 2771 dasm_put(Dst, 4752);
2773 break; 2772 break;
@@ -2777,7 +2776,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2777 2776
2778 case BC_FORL: 2777 case BC_FORL:
2779#if LJ_HASJIT 2778#if LJ_HASJIT
2780 dasm_put(Dst, 15317, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2779 dasm_put(Dst, 15318, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2781#endif 2780#endif
2782 break; 2781 break;
2783 2782
@@ -2789,111 +2788,111 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2789 case BC_FORI: 2788 case BC_FORI:
2790 case BC_IFORL: 2789 case BC_IFORL:
2791 vk = (op == BC_IFORL || op == BC_JFORL); 2790 vk = (op == BC_IFORL || op == BC_JFORL);
2792 dasm_put(Dst, 15338); 2791 dasm_put(Dst, 15339);
2793 if (LJ_DUALNUM) { 2792 if (LJ_DUALNUM) {
2794 dasm_put(Dst, 15342, LJ_TISNUM); 2793 dasm_put(Dst, 15343, LJ_TISNUM);
2795 if (!vk) { 2794 if (!vk) {
2796 dasm_put(Dst, 15352, LJ_TISNUM, LJ_TISNUM); 2795 dasm_put(Dst, 15353, LJ_TISNUM, LJ_TISNUM);
2797 } else { 2796 } else {
2798#ifdef LUA_USE_ASSERT 2797#ifdef LUA_USE_ASSERT
2799 dasm_put(Dst, 15381, LJ_TISNUM, LJ_TISNUM); 2798 dasm_put(Dst, 15382, LJ_TISNUM, LJ_TISNUM);
2800#endif 2799#endif
2801 dasm_put(Dst, 15400); 2800 dasm_put(Dst, 15401);
2802 } 2801 }
2803 dasm_put(Dst, 15419, LJ_TISNUM); 2802 dasm_put(Dst, 15420, LJ_TISNUM);
2804 if (op == BC_FORI) { 2803 if (op == BC_FORI) {
2805 dasm_put(Dst, 15430, -BCBIAS_J*4); 2804 dasm_put(Dst, 15431, -BCBIAS_J*4);
2806 } else if (op == BC_JFORI) { 2805 } else if (op == BC_JFORI) {
2807 dasm_put(Dst, 15444, -BCBIAS_J*4, BC_JLOOP); 2806 dasm_put(Dst, 15445, -BCBIAS_J*4, BC_JLOOP);
2808 } else if (op == BC_IFORL) { 2807 } else if (op == BC_IFORL) {
2809 dasm_put(Dst, 15462, -BCBIAS_J*4); 2808 dasm_put(Dst, 15463, -BCBIAS_J*4);
2810 } else { 2809 } else {
2811 dasm_put(Dst, 15454, BC_JLOOP); 2810 dasm_put(Dst, 15455, BC_JLOOP);
2812 } 2811 }
2813 dasm_put(Dst, 15476); 2812 dasm_put(Dst, 15477);
2814 if (vk) { 2813 if (vk) {
2815 dasm_put(Dst, 15501); 2814 dasm_put(Dst, 15502);
2816 } 2815 }
2817 dasm_put(Dst, 15419, LJ_TISNUM); 2816 dasm_put(Dst, 15420, LJ_TISNUM);
2818 if (op == BC_FORI) { 2817 if (op == BC_FORI) {
2819 dasm_put(Dst, 15510); 2818 dasm_put(Dst, 15511);
2820 } else if (op == BC_JFORI) { 2819 } else if (op == BC_JFORI) {
2821 dasm_put(Dst, 15515, -BCBIAS_J*4, BC_JLOOP); 2820 dasm_put(Dst, 15516, -BCBIAS_J*4, BC_JLOOP);
2822 } else if (op == BC_IFORL) { 2821 } else if (op == BC_IFORL) {
2823 dasm_put(Dst, 15529); 2822 dasm_put(Dst, 15530);
2824 } else { 2823 } else {
2825 dasm_put(Dst, 15525, BC_JLOOP); 2824 dasm_put(Dst, 15526, BC_JLOOP);
2826 } 2825 }
2827 dasm_put(Dst, 15534); 2826 dasm_put(Dst, 15535);
2828 } else if (!vk) { 2827 } else if (!vk) {
2829 dasm_put(Dst, 15541, LJ_TISNUM); 2828 dasm_put(Dst, 15542, LJ_TISNUM);
2830 } 2829 }
2831 if (!vk) { 2830 if (!vk) {
2832 dasm_put(Dst, 15547, LJ_TISNUM); 2831 dasm_put(Dst, 15548, LJ_TISNUM);
2833 } else { 2832 } else {
2834#ifdef LUA_USE_ASSERT 2833#ifdef LUA_USE_ASSERT
2835 dasm_put(Dst, 15561, LJ_TISNUM, LJ_TISNUM); 2834 dasm_put(Dst, 15562, LJ_TISNUM, LJ_TISNUM);
2836#endif 2835#endif
2837 } 2836 }
2838 dasm_put(Dst, 15580); 2837 dasm_put(Dst, 15581);
2839 if (!vk) { 2838 if (!vk) {
2840 dasm_put(Dst, 15584, LJ_TISNUM); 2839 dasm_put(Dst, 15585, LJ_TISNUM);
2841 } 2840 }
2842 if (sse) { 2841 if (sse) {
2843 dasm_put(Dst, 15593); 2842 dasm_put(Dst, 15594);
2844 if (vk) { 2843 if (vk) {
2845 dasm_put(Dst, 15605); 2844 dasm_put(Dst, 15606);
2846 } else { 2845 } else {
2847 dasm_put(Dst, 15624); 2846 dasm_put(Dst, 15625);
2848 } 2847 }
2849 dasm_put(Dst, 15629); 2848 dasm_put(Dst, 15630);
2850 } else { 2849 } else {
2851 dasm_put(Dst, 15642); 2850 dasm_put(Dst, 15643);
2852 if (vk) { 2851 if (vk) {
2853 dasm_put(Dst, 15648); 2852 dasm_put(Dst, 15649);
2854 } else { 2853 } else {
2855 dasm_put(Dst, 15664); 2854 dasm_put(Dst, 15665);
2856 } 2855 }
2857 dasm_put(Dst, 15672); 2856 dasm_put(Dst, 15673);
2858 if (cmov) { 2857 if (cmov) {
2859 dasm_put(Dst, 10261); 2858 dasm_put(Dst, 10262);
2860 } else { 2859 } else {
2861 dasm_put(Dst, 10267); 2860 dasm_put(Dst, 10268);
2862 } 2861 }
2863 if (!cmov) { 2862 if (!cmov) {
2864 dasm_put(Dst, 15677); 2863 dasm_put(Dst, 15678);
2865 } 2864 }
2866 } 2865 }
2867 if (op == BC_FORI) { 2866 if (op == BC_FORI) {
2868 if (LJ_DUALNUM) { 2867 if (LJ_DUALNUM) {
2869 dasm_put(Dst, 15683); 2868 dasm_put(Dst, 15684);
2870 } else { 2869 } else {
2871 dasm_put(Dst, 15688, -BCBIAS_J*4); 2870 dasm_put(Dst, 15689, -BCBIAS_J*4);
2872 } 2871 }
2873 } else if (op == BC_JFORI) { 2872 } else if (op == BC_JFORI) {
2874 dasm_put(Dst, 15698, -BCBIAS_J*4, BC_JLOOP); 2873 dasm_put(Dst, 15699, -BCBIAS_J*4, BC_JLOOP);
2875 } else if (op == BC_IFORL) { 2874 } else if (op == BC_IFORL) {
2876 if (LJ_DUALNUM) { 2875 if (LJ_DUALNUM) {
2877 dasm_put(Dst, 15712); 2876 dasm_put(Dst, 15713);
2878 } else { 2877 } else {
2879 dasm_put(Dst, 15717, -BCBIAS_J*4); 2878 dasm_put(Dst, 15718, -BCBIAS_J*4);
2880 } 2879 }
2881 } else { 2880 } else {
2882 dasm_put(Dst, 15708, BC_JLOOP); 2881 dasm_put(Dst, 15709, BC_JLOOP);
2883 } 2882 }
2884 if (LJ_DUALNUM) { 2883 if (LJ_DUALNUM) {
2885 dasm_put(Dst, 10190); 2884 dasm_put(Dst, 10191);
2886 } else { 2885 } else {
2887 dasm_put(Dst, 10972); 2886 dasm_put(Dst, 10973);
2888 } 2887 }
2889 if (sse) { 2888 if (sse) {
2890 dasm_put(Dst, 15727); 2889 dasm_put(Dst, 15728);
2891 } 2890 }
2892 break; 2891 break;
2893 2892
2894 case BC_ITERL: 2893 case BC_ITERL:
2895#if LJ_HASJIT 2894#if LJ_HASJIT
2896 dasm_put(Dst, 15317, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2895 dasm_put(Dst, 15318, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2897#endif 2896#endif
2898 break; 2897 break;
2899 2898
@@ -2902,33 +2901,33 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2902 break; 2901 break;
2903#endif 2902#endif
2904 case BC_IITERL: 2903 case BC_IITERL:
2905 dasm_put(Dst, 15738, LJ_TNIL); 2904 dasm_put(Dst, 15739, LJ_TNIL);
2906 if (op == BC_JITERL) { 2905 if (op == BC_JITERL) {
2907 dasm_put(Dst, 15753, BC_JLOOP); 2906 dasm_put(Dst, 15754, BC_JLOOP);
2908 } else { 2907 } else {
2909 dasm_put(Dst, 15767, -BCBIAS_J*4); 2908 dasm_put(Dst, 15768, -BCBIAS_J*4);
2910 } 2909 }
2911 dasm_put(Dst, 10304); 2910 dasm_put(Dst, 10305);
2912 break; 2911 break;
2913 2912
2914 case BC_LOOP: 2913 case BC_LOOP:
2915#if LJ_HASJIT 2914#if LJ_HASJIT
2916 dasm_put(Dst, 15317, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2915 dasm_put(Dst, 15318, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2917#endif 2916#endif
2918 break; 2917 break;
2919 2918
2920 case BC_ILOOP: 2919 case BC_ILOOP:
2921 dasm_put(Dst, 10306); 2920 dasm_put(Dst, 10307);
2922 break; 2921 break;
2923 2922
2924 case BC_JLOOP: 2923 case BC_JLOOP:
2925#if LJ_HASJIT 2924#if LJ_HASJIT
2926 dasm_put(Dst, 15783, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); 2925 dasm_put(Dst, 15784, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
2927#endif 2926#endif
2928 break; 2927 break;
2929 2928
2930 case BC_JMP: 2929 case BC_JMP:
2931 dasm_put(Dst, 15824, -BCBIAS_J*4); 2930 dasm_put(Dst, 15825, -BCBIAS_J*4);
2932 break; 2931 break;
2933 2932
2934 /* -- Function headers -------------------------------------------------- */ 2933 /* -- Function headers -------------------------------------------------- */
@@ -2942,7 +2941,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2942 2941
2943 case BC_FUNCF: 2942 case BC_FUNCF:
2944#if LJ_HASJIT 2943#if LJ_HASJIT
2945 dasm_put(Dst, 15850, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL); 2944 dasm_put(Dst, 15851, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
2946#endif 2945#endif
2947 case BC_FUNCV: /* NYI: compiled vararg functions. */ 2946 case BC_FUNCV: /* NYI: compiled vararg functions. */
2948 break; 2947 break;
@@ -2952,13 +2951,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2952 break; 2951 break;
2953#endif 2952#endif
2954 case BC_IFUNCF: 2953 case BC_IFUNCF:
2955 dasm_put(Dst, 15871, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); 2954 dasm_put(Dst, 15872, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
2956 if (op == BC_JFUNCF) { 2955 if (op == BC_JFUNCF) {
2957 dasm_put(Dst, 15902, BC_JLOOP); 2956 dasm_put(Dst, 15903, BC_JLOOP);
2958 } else { 2957 } else {
2959 dasm_put(Dst, 10306); 2958 dasm_put(Dst, 10307);
2960 } 2959 }
2961 dasm_put(Dst, 15911, LJ_TNIL); 2960 dasm_put(Dst, 15912, LJ_TNIL);
2962 break; 2961 break;
2963 2962
2964 case BC_JFUNCV: 2963 case BC_JFUNCV:
@@ -2969,30 +2968,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2969 break; /* NYI: compiled vararg functions. */ 2968 break; /* NYI: compiled vararg functions. */
2970 2969
2971 case BC_IFUNCV: 2970 case BC_IFUNCV:
2972 dasm_put(Dst, 15933, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); 2971 dasm_put(Dst, 15934, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
2973 if (op == BC_JFUNCV) { 2972 if (op == BC_JFUNCV) {
2974 dasm_put(Dst, 15902, BC_JLOOP); 2973 dasm_put(Dst, 15903, BC_JLOOP);
2975 } else { 2974 } else {
2976 dasm_put(Dst, 16030, -4+PC2PROTO(k)); 2975 dasm_put(Dst, 16031, -4+PC2PROTO(k));
2977 } 2976 }
2978 dasm_put(Dst, 16055, LJ_TNIL); 2977 dasm_put(Dst, 16056, LJ_TNIL);
2979 break; 2978 break;
2980 2979
2981 case BC_FUNCC: 2980 case BC_FUNCC:
2982 case BC_FUNCCW: 2981 case BC_FUNCCW:
2983 dasm_put(Dst, 16077, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); 2982 dasm_put(Dst, 16078, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
2984 if (op == BC_FUNCC) { 2983 if (op == BC_FUNCC) {
2985 dasm_put(Dst, 2424); 2984 dasm_put(Dst, 2424);
2986 } else { 2985 } else {
2987 dasm_put(Dst, 16107); 2986 dasm_put(Dst, 16108);
2988 } 2987 }
2989 dasm_put(Dst, 16115, DISPATCH_GL(vmstate), ~LJ_VMST_C); 2988 dasm_put(Dst, 16116, DISPATCH_GL(vmstate), ~LJ_VMST_C);
2990 if (op == BC_FUNCC) { 2989 if (op == BC_FUNCC) {
2991 dasm_put(Dst, 16125); 2990 dasm_put(Dst, 16126);
2992 } else { 2991 } else {
2993 dasm_put(Dst, 16130, DISPATCH_GL(wrapf)); 2992 dasm_put(Dst, 16131, DISPATCH_GL(wrapf));
2994 } 2993 }
2995 dasm_put(Dst, 16136, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); 2994 dasm_put(Dst, 16137, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
2996 break; 2995 break;
2997 2996
2998 /* ---------------------------------------------------------------------- */ 2997 /* ---------------------------------------------------------------------- */
@@ -3020,7 +3019,7 @@ static int build_backend(BuildCtx *ctx)
3020 3019
3021 build_subroutines(ctx, cmov, sse); 3020 build_subroutines(ctx, cmov, sse);
3022 3021
3023 dasm_put(Dst, 16162); 3022 dasm_put(Dst, 16163);
3024 for (op = 0; op < BC__MAX; op++) 3023 for (op = 0; op < BC__MAX; op++)
3025 build_ins(ctx, (BCOp)op, op, cmov, sse); 3024 build_ins(ctx, (BCOp)op, op, cmov, sse);
3026 3025
@@ -3030,6 +3029,7 @@ static int build_backend(BuildCtx *ctx)
3030/* Emit pseudo frame-info for all assembler functions. */ 3029/* Emit pseudo frame-info for all assembler functions. */
3031static void emit_asm_debug(BuildCtx *ctx) 3030static void emit_asm_debug(BuildCtx *ctx)
3032{ 3031{
3032 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
3033#if LJ_64 3033#if LJ_64
3034#define SZPTR "8" 3034#define SZPTR "8"
3035#define BSZPTR "3" 3035#define BSZPTR "3"
@@ -3063,22 +3063,49 @@ static void emit_asm_debug(BuildCtx *ctx)
3063 "\t.long .LEFDE0-.LASFDE0\n" 3063 "\t.long .LEFDE0-.LASFDE0\n"
3064 ".LASFDE0:\n" 3064 ".LASFDE0:\n"
3065 "\t.long .Lframe0\n" 3065 "\t.long .Lframe0\n"
3066 "\t.long .Lbegin\n"
3067 "\t.long %d\n"
3068 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3069#if LJ_64 3066#if LJ_64
3067 "\t.quad .Lbegin\n"
3068 "\t.quad %d\n"
3069 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3070 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ 3070 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3071 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 3071 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3072 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 3072 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
3073 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 3073 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
3074#else 3074#else
3075 "\t.long .Lbegin\n"
3076 "\t.long %d\n"
3077 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3075 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ 3078 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3076 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ 3079 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
3077 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ 3080 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
3078 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 3081 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
3079#endif 3082#endif
3080 "\t.align " SZPTR "\n" 3083 "\t.align " SZPTR "\n"
3081 ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE); 3084 ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
3085#if LJ_HASFFI
3086 fprintf(ctx->fp,
3087 ".LSFDE1:\n"
3088 "\t.long .LEFDE1-.LASFDE1\n"
3089 ".LASFDE1:\n"
3090 "\t.long .Lframe0\n"
3091#if LJ_64
3092 "\t.quad lj_vm_ffi_call\n"
3093 "\t.quad %d\n"
3094 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
3095 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3096 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3097 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3098#else
3099 "\t.long lj_vm_ffi_call\n"
3100 "\t.long %d\n"
3101 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
3102 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3103 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
3104 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
3105#endif
3106 "\t.align " SZPTR "\n"
3107 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
3108#endif
3082#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_) 3109#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
3083 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n"); 3110 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
3084#else 3111#else
@@ -3103,10 +3130,10 @@ static void emit_asm_debug(BuildCtx *ctx)
3103 "\t.align " SZPTR "\n" 3130 "\t.align " SZPTR "\n"
3104 ".LECIE1:\n\n"); 3131 ".LECIE1:\n\n");
3105 fprintf(ctx->fp, 3132 fprintf(ctx->fp,
3106 ".LSFDE1:\n" 3133 ".LSFDE2:\n"
3107 "\t.long .LEFDE1-.LASFDE1\n" 3134 "\t.long .LEFDE2-.LASFDE2\n"
3108 ".LASFDE1:\n" 3135 ".LASFDE2:\n"
3109 "\t.long .LASFDE1-.Lframe1\n" 3136 "\t.long .LASFDE2-.Lframe1\n"
3110 "\t.long .Lbegin-.\n" 3137 "\t.long .Lbegin-.\n"
3111 "\t.long %d\n" 3138 "\t.long %d\n"
3112 "\t.uleb128 0\n" /* augmentation length */ 3139 "\t.uleb128 0\n" /* augmentation length */
@@ -3123,7 +3150,46 @@ static void emit_asm_debug(BuildCtx *ctx)
3123 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 3150 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
3124#endif 3151#endif
3125 "\t.align " SZPTR "\n" 3152 "\t.align " SZPTR "\n"
3126 ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE); 3153 ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
3154#if LJ_HASFFI
3155 fprintf(ctx->fp,
3156 ".Lframe2:\n"
3157 "\t.long .LECIE2-.LSCIE2\n"
3158 ".LSCIE2:\n"
3159 "\t.long 0\n"
3160 "\t.byte 0x1\n"
3161 "\t.string \"zR\"\n"
3162 "\t.uleb128 0x1\n"
3163 "\t.sleb128 -" SZPTR "\n"
3164 "\t.byte " REG_RA "\n"
3165 "\t.uleb128 1\n" /* augmentation length */
3166 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3167 "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
3168 "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
3169 "\t.align " SZPTR "\n"
3170 ".LECIE2:\n\n");
3171 fprintf(ctx->fp,
3172 ".LSFDE3:\n"
3173 "\t.long .LEFDE3-.LASFDE3\n"
3174 ".LASFDE3:\n"
3175 "\t.long .LASFDE3-.Lframe2\n"
3176 "\t.long lj_vm_ffi_call-.\n"
3177 "\t.long %d\n"
3178 "\t.uleb128 0\n" /* augmentation length */
3179#if LJ_64
3180 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
3181 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3182 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3183 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3184#else
3185 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
3186 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3187 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
3188 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
3189#endif
3190 "\t.align " SZPTR "\n"
3191 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
3192#endif
3127 break; 3193 break;
3128 case BUILD_coffasm: 3194 case BUILD_coffasm:
3129 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n"); 3195 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n");
@@ -3174,6 +3240,9 @@ static void emit_asm_debug(BuildCtx *ctx)
3174 ** Or a linker. Or a plastic case. But I digress. 3240 ** Or a linker. Or a plastic case. But I digress.
3175 */ 3241 */
3176 case BUILD_machasm: { 3242 case BUILD_machasm: {
3243#if LJ_HASFFI
3244 int fcsize = 0;
3245#endif
3177 int i; 3246 int i;
3178 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); 3247 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
3179 fprintf(ctx->fp, 3248 fprintf(ctx->fp,
@@ -3205,6 +3274,9 @@ static void emit_asm_debug(BuildCtx *ctx)
3205 const char *name = ctx->sym[i].name; 3274 const char *name = ctx->sym[i].name;
3206 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs; 3275 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
3207 if (size == 0) continue; 3276 if (size == 0) continue;
3277#if LJ_HASFFI
3278 if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
3279#endif
3208 fprintf(ctx->fp, 3280 fprintf(ctx->fp,
3209 "%s.eh:\n" 3281 "%s.eh:\n"
3210 "LSFDE%d:\n" 3282 "LSFDE%d:\n"
@@ -3214,23 +3286,72 @@ static void emit_asm_debug(BuildCtx *ctx)
3214 "\t.long LASFDE%d-EH_frame1\n" 3286 "\t.long LASFDE%d-EH_frame1\n"
3215 "\t.long %s-.\n" 3287 "\t.long %s-.\n"
3216 "\t.long %d\n" 3288 "\t.long %d\n"
3217 "\t.byte 0\n" /* augmentation length */ 3289 "\t.byte 0\n" /* augmentation length */
3218 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ 3290 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
3219#if LJ_64 3291#if LJ_64
3220 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */ 3292 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
3221 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */ 3293 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
3222 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */ 3294 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
3223 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */ 3295 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
3224#else 3296#else
3225 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ 3297 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
3226 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ 3298 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
3227 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ 3299 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
3228 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ 3300 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
3229#endif 3301#endif
3230 "\t.align " BSZPTR "\n" 3302 "\t.align " BSZPTR "\n"
3231 "LEFDE%d:\n\n", 3303 "LEFDE%d:\n\n",
3232 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i); 3304 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
3233 } 3305 }
3306#if LJ_HASFFI
3307 if (fcsize) {
3308 fprintf(ctx->fp,
3309 "EH_frame2:\n"
3310 "\t.set L$set$y,LECIEY-LSCIEY\n"
3311 "\t.long L$set$y\n"
3312 "LSCIEY:\n"
3313 "\t.long 0\n"
3314 "\t.byte 0x1\n"
3315 "\t.ascii \"zR\\0\"\n"
3316 "\t.byte 0x1\n"
3317 "\t.byte 128-" SZPTR "\n"
3318 "\t.byte " REG_RA "\n"
3319 "\t.byte 1\n" /* augmentation length */
3320#if LJ_64
3321 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3322 "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
3323#else
3324 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3325 "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
3326#endif
3327 "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
3328 "\t.align " BSZPTR "\n"
3329 "LECIEY:\n\n");
3330 fprintf(ctx->fp,
3331 "_lj_vm_ffi_call.eh:\n"
3332 "LSFDEY:\n"
3333 "\t.set L$set$yy,LEFDEY-LASFDEY\n"
3334 "\t.long L$set$yy\n"
3335 "LASFDEY:\n"
3336 "\t.long LASFDEY-EH_frame2\n"
3337 "\t.long _lj_vm_ffi_call-.\n"
3338 "\t.long %d\n"
3339 "\t.byte 0\n" /* augmentation length */
3340#if LJ_64
3341 "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
3342 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
3343 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3344 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
3345#else
3346 "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
3347 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
3348 "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
3349 "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
3350#endif
3351 "\t.align " BSZPTR "\n"
3352 "LEFDEY:\n\n", fcsize);
3353 }
3354#endif
3234#if LJ_64 3355#if LJ_64
3235 fprintf(ctx->fp, "\t.subsections_via_symbols\n"); 3356 fprintf(ctx->fp, "\t.subsections_via_symbols\n");
3236#else 3357#else