This commit is contained in:
nora 2023-08-02 23:50:28 +02:00
parent 9ece18a48a
commit 9f3e728e79
4 changed files with 9 additions and 25 deletions

View file

@ -443,8 +443,6 @@ export const BUILTINS = [
"__i64_store",
"__i32_load",
"__i64_load",
"__string_ptr",
"__string_len",
"__memory_size",
"__memory_grow",
"__i32_extend_to_i64_u",

View file

@ -740,24 +740,6 @@ function lowerExpr(
instrs.push({ kind: "i64.store", imm: {} });
break exprKind;
}
case "__string_ptr": {
assertArgs(1);
lowerExpr(fcx, instrs, expr.args[0]);
// ptr, len
instrs.push({ kind: "drop" });
// ptr
break exprKind;
}
case "__string_len": {
assertArgs(1);
lowerExpr(fcx, instrs, expr.args[0]);
// ptr, len
instrs.push({ kind: "i32.const", imm: 0n });
// ptr, len, 0
instrs.push({ kind: "select" });
// len
break exprKind;
}
case "__memory_size": {
assertArgs(0);
instrs.push({ kind: "memory.size" });

View file

@ -28,7 +28,15 @@ function uwu() = (
/*-1*/
);
function eat(a: A) = ;
type B = {
a: (Int, Int, Int, Int, Int),
};
function test(b: B) = (
b.a;
);
function eat(a: A) =;
`;
function main() {

View file

@ -77,10 +77,6 @@ function typeOfBuiltinValue(name: BuiltinName, span: Span): Ty {
return mkTyFn([TY_I32], TY_I32);
case "__i64_load":
return mkTyFn([TY_I32], TY_INT);
case "__string_ptr":
return mkTyFn([TY_STRING], TY_I32);
case "__string_len":
return mkTyFn([TY_STRING], TY_I32);
case "__memory_size":
return mkTyFn([], TY_I32);
case "__memory_grow":