master
Sanjar Ahmadov 3 years ago
parent 82829cb601
commit 4d97a84bce

@ -363,6 +363,9 @@ public class CodeGenImpl extends CodeGenBase
int slotNum = argNum + 1; // We have extra slot for static link
Expr expr = args.get(i);
expr.dispatch(this);
// FIXME: Box primitives here
// All expressions should save their end result in A0
// So, once expr is evaluated add value inside A0 onto stack as an argument
backend.emitSW(A0, SP, -wordSize*slotNum, "Push argument " + argNum + " from left");
@ -689,13 +692,7 @@ public class CodeGenImpl extends CodeGenBase
public Register analyze(IntegerLiteral node) {
backend.emitLW(T6, FP, 0, "Inside IntegerLiteral: " + node.value);
backend.emitLI(A0, node.value, "Load integer literal " + node.value);
backend.emitJAL(makeIntLabel, "Box integer");
// System.out.println("+++ Inside IntegerLiteral");
// backend.emitLA(A0, new Label("$int$prototype"), "Load prototype");
// backend.emitJAL(new Label("ra, alloc"), "");
// backend.emitLI(T0, node.value, "Load integer " + node.value);
// backend.emitSW(T0, A0, "@.__int__", null);
backend.emitJAL(makeIntLabel, "Box integer");
return A0;
}

Loading…
Cancel
Save