mirror of
https://github.com/Noratrieb/riverdelta.git
synced 2026-01-14 16:35:03 +01:00
inline assembly :3
This commit is contained in:
parent
3ab116d7f0
commit
ba5d41674c
17 changed files with 448 additions and 45 deletions
10
ui-tests/asm/drop.nil
Normal file
10
ui-tests/asm/drop.nil
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
//@check-pass
|
||||
|
||||
function dropping(a: I32) =
|
||||
___asm(
|
||||
__locals(),
|
||||
"local.get 0",
|
||||
"drop",
|
||||
);
|
||||
|
||||
function main() = ;
|
||||
7
ui-tests/asm/instr_not_string.nil
Normal file
7
ui-tests/asm/instr_not_string.nil
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
function a(a: I32) =
|
||||
___asm(
|
||||
__locals(),
|
||||
0,
|
||||
);
|
||||
|
||||
function main() = ;
|
||||
4
ui-tests/asm/instr_not_string.stderr
Normal file
4
ui-tests/asm/instr_not_string.stderr
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
error: inline assembly instruction must be string literal with instruction
|
||||
--> $DIR/instr_not_string.nil:4
|
||||
4 | 0,
|
||||
^
|
||||
9
ui-tests/asm/invalid_instr.nil
Normal file
9
ui-tests/asm/invalid_instr.nil
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
//@check-pass
|
||||
|
||||
function dropping(a: I32) =
|
||||
___asm(
|
||||
__locals(),
|
||||
"meow meow",
|
||||
);
|
||||
|
||||
function main() = ;
|
||||
4
ui-tests/asm/invalid_instr.stderr
Normal file
4
ui-tests/asm/invalid_instr.stderr
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
error: unknown instruction: meow
|
||||
--> $DIR/invalid_instr.nil:6
|
||||
6 | "meow meow",
|
||||
^^^^^^^^^^^
|
||||
9
ui-tests/asm/missing_locals.nil
Normal file
9
ui-tests/asm/missing_locals.nil
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
//@check-pass
|
||||
|
||||
function dropping(a: I32) =
|
||||
___asm(
|
||||
"local.get 0",
|
||||
"drop",
|
||||
);
|
||||
|
||||
function main() = ;
|
||||
4
ui-tests/asm/missing_locals.stderr
Normal file
4
ui-tests/asm/missing_locals.stderr
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
error: inline assembly must have __locals() as first argument
|
||||
--> $DIR/missing_locals.nil:4
|
||||
4 | ___asm(
|
||||
^
|
||||
6
ui-tests/asm/not_toplevel.nil
Normal file
6
ui-tests/asm/not_toplevel.nil
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
function dropping(a: I32) = (
|
||||
1;
|
||||
___asm(__locals(), "drop");
|
||||
);
|
||||
|
||||
function main() = ;
|
||||
16
ui-tests/asm/not_toplevel.stderr
Normal file
16
ui-tests/asm/not_toplevel.stderr
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
error: `___asm` cannot be used as a value
|
||||
--> $DIR/not_toplevel.nil:3
|
||||
3 | ___asm(__locals(), "drop");
|
||||
^^^^^^
|
||||
error: `__locals` cannot be used as a value
|
||||
--> $DIR/not_toplevel.nil:3
|
||||
3 | ___asm(__locals(), "drop");
|
||||
^^^^^^^^
|
||||
error: expression of type <ERROR> is not callable
|
||||
--> $DIR/not_toplevel.nil:3
|
||||
3 | ___asm(__locals(), "drop");
|
||||
^^^^^^^^
|
||||
error: expression of type <ERROR> is not callable
|
||||
--> $DIR/not_toplevel.nil:3
|
||||
3 | ___asm(__locals(), "drop");
|
||||
^^^^^^
|
||||
17
ui-tests/asm/wrong_imm.nil
Normal file
17
ui-tests/asm/wrong_imm.nil
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//@check-pass
|
||||
|
||||
function a(a: I32) =
|
||||
___asm(
|
||||
__locals(),
|
||||
"local.get 0 0",
|
||||
"drop",
|
||||
);
|
||||
|
||||
function b(a: I32) =
|
||||
___asm(
|
||||
__locals(),
|
||||
"local.get",
|
||||
"drop",
|
||||
);
|
||||
|
||||
function main() = ;
|
||||
8
ui-tests/asm/wrong_imm.stderr
Normal file
8
ui-tests/asm/wrong_imm.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
error: mismatched immediate lengths, expected 1, got 2
|
||||
--> $DIR/wrong_imm.nil:6
|
||||
6 | "local.get 0 0",
|
||||
^^^^^^^^^^^^^^^
|
||||
error: mismatched immediate lengths, expected 1, got 0
|
||||
--> $DIR/wrong_imm.nil:13
|
||||
13 | "local.get",
|
||||
^^^^^^^^^^^
|
||||
17
ui-tests/type/generics/generics_structs_in_args.stderr
Normal file
17
ui-tests/type/generics/generics_structs_in_args.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/home/nils/projects/riverdelta/target/ast.js:110
|
||||
throw new Error(`substitution out of range, param index ${ty.idx} of param ${ty.name} out of range for length ${genericArgs.length}`);
|
||||
^
|
||||
|
||||
Error: substitution out of range, param index 0 of param T out of range for length 0
|
||||
at substituteTy (/home/nils/projects/riverdelta/target/ast.js:110:23)
|
||||
at subst (/home/nils/projects/riverdelta/target/ast.js:106:27)
|
||||
at Array.map (<anonymous>)
|
||||
at substituteTy (/home/nils/projects/riverdelta/target/ast.js:125:45)
|
||||
at typeOfItem (/home/nils/projects/riverdelta/target/typeck/item.js:193:33)
|
||||
at Object.itemInner (/home/nils/projects/riverdelta/target/typeck/index.js:63:54)
|
||||
at Object.item (/home/nils/projects/riverdelta/target/ast.js:146:34)
|
||||
at /home/nils/projects/riverdelta/target/ast.js:164:55
|
||||
at Array.map (<anonymous>)
|
||||
at foldAst (/home/nils/projects/riverdelta/target/ast.js:164:34)
|
||||
|
||||
Node.js v18.18.2
|
||||
Loading…
Add table
Add a link
Reference in a new issue