optimize frames; remove trampoline

This commit is contained in:
2026-02-18 22:37:48 -06:00
parent 27ca008f18
commit e004b2c472
14 changed files with 318 additions and 91 deletions

View File

@@ -4,7 +4,7 @@ var mcode = function(ast) {
// Translation tables
var binop_map = {
"+": "add", "-": "subtract", "*": "multiply", "/": "divide",
"%": "modulo", "&": "bitand", "|": "bitor", "^": "bitxor",
"%": "remainder", "&": "bitand", "|": "bitor", "^": "bitxor",
"<<": "shl", ">>": "shr", ">>>": "ushr",
"==": "eq", "===": "eq", "!=": "ne", "!==": "ne",
"<": "lt", "<=": "le", ">": "gt", ">=": "ge",
@@ -24,13 +24,13 @@ var mcode = function(ast) {
var binop_sym = {
add: "+", subtract: "-", multiply: "*", divide: "/",
modulo: "%", pow: "**",
remainder: "%", pow: "**",
lt: "<", le: "<=", gt: ">", ge: ">="
}
var compound_map = {
"+=": "add", "-=": "subtract", "*=": "multiply", "/=": "divide",
"%=": "modulo", "&=": "bitand", "|=": "bitor", "^=": "bitxor",
"%=": "remainder", "&=": "bitand", "|=": "bitor", "^=": "bitxor",
"<<=": "shl", ">>=": "shr", ">>>=": "ushr"
}
@@ -673,7 +673,8 @@ var mcode = function(ast) {
if (rel != null) {
emit_relational(rel[0], rel[1], rel[2])
} else if (op_str == "subtract" || op_str == "multiply" ||
op_str == "divide" || op_str == "modulo" || op_str == "pow") {
op_str == "divide" || op_str == "modulo" || op_str == "remainder" ||
op_str == "pow") {
emit_numeric_binop(op_str)
} else {
// Passthrough for bitwise, in, etc.