Merge pull request #21 from trilis/1.10

Fix bytecode generation for .array
This commit is contained in:
Dmitry Boulytchev 2021-10-30 19:24:25 +03:00 committed by GitHub
commit 594fa7bf8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -209,7 +209,7 @@ void disassemble (FILE *f, bytefile *bf) {
break;
case 6:
fprintf (f, "CALL\t%0x%.8x ", INT);
fprintf (f, "CALL\t0x%.8x ", INT);
fprintf (f, "%d", INT);
break;
@ -259,7 +259,7 @@ void disassemble (FILE *f, bytefile *bf) {
break;
case 4:
fprintf (f, "CALL\tBarray");
fprintf (f, "CALL\tBarray\t%d", INT);
break;
default:

View file

@ -191,8 +191,8 @@ module ByteCode =
(* 0x70 *) | CALL ("Lread", _, _) -> add_bytes [7*16 + 0]
(* 0x71 *) | CALL ("Lwrite", _, _) -> add_bytes [7*16 + 1]
(* 0x72 *) | CALL ("Llength", _, _) -> add_bytes [7*16 + 2]
(* 0x72 *) | CALL ("Lstring", _, _) -> add_bytes [7*16 + 3]
(* 0x72 *) | CALL (".array", _, _) -> add_bytes [7*16 + 4]
(* 0x73 *) | CALL ("Lstring", _, _) -> add_bytes [7*16 + 3]
(* 0x74 *) | CALL (".array", n, _) -> add_bytes [7*16 + 4]; add_ints [n]
(* 0x52 n:32 n:32 *) | BEGIN (_, a, l, [], _, _) -> add_bytes [5*16 + 2]; add_ints [a; l] (* with no closure *)
(* 0x53 n:32 n:32 *) | BEGIN (_, a, l, _, _, _) -> add_bytes [5*16 + 3]; add_ints [a; l] (* with a closure *)