diff --git a/AstBuilding.py b/AstBuilding.py index 25a7d0491409385d80ac71e056d5c040af5f7cc3..74bec9250c16e55217bca3583a01fe1518129c73 100644 --- a/AstBuilding.py +++ b/AstBuilding.py @@ -83,14 +83,14 @@ def arrayClassMemory(types): code += "section .text\n" + \ "; Function to initialize class memory layout\n" + \ pLabel(name=t+"_arrayMemoryInitialize", type="helper") + \ - p(instruction="mov", arg1="eax", arg2="I_SIT_spot_"+t+ "_array") + \ + p(instruction="mov", arg1="eax", arg2="dword I_SIT_spot_"+t+ "_array") + \ p(instruction="extern", arg1="I_SIT_Object") + \ - p(instruction="mov", arg1="[eax]", arg2="I_SIT_Object", comment="Points to the SIT column of java.lang.Object") + p(instruction="mov", arg1="[eax]", arg2="dword I_SIT_Object", comment="Points to the SIT column of java.lang.Object") for m in methods: code += p(instruction="extern", arg1=m) + \ - p(instruction="mov", arg1="eax", arg2="V_"+t+"_"+m+"_array") + \ - p(instruction="mov", arg1="[eax]", arg2=m, comment="points to method implementation") + p(instruction="mov", arg1="eax", arg2="dword V_"+t+"_"+m+"_array") + \ + p(instruction="mov", arg1="[eax]", arg2="dword "+m, comment="points to method implementation") code += p(instruction="ret", arg1="") code += "; End of function to initialize class memory layout\n" @@ -128,7 +128,12 @@ def codeGenPrep(ASTs): def codeGen(ASTs, output="output"): - ASTs = ASTs[:1] # TOREMOVE: don't compile stdlib for now + # ASTs = ASTs[:1] # TOREMOVE: don't compile stdlib for now + rASTs = [] + for index,t in enumerate(ASTs): + if index == 0 or t[0] == "stdlib/5.0/java/lang/Object.java": + rASTs.append(t) + ASTs = rASTs arrayClassMemory = codeGenPrep(ASTs) for t in ASTs: t[1].codeGen() diff --git a/ExprPrimaryNodes.py b/ExprPrimaryNodes.py index 11e60a14358f53136253c264466655cc48e32fd3..eb7c71c6c8be2a74dac49077eaa3539df2528850 100644 --- a/ExprPrimaryNodes.py +++ b/ExprPrimaryNodes.py @@ -200,7 +200,7 @@ class ArrayAccessNode(ASTNode): if hasattr(self, "code"): return self.code = "; Array access\n" + \ - self.addr + \ + self.addr() + \ p(instruction="mov", arg1="eax", arg2="[eax]", comment="eax now contains a[i]") +\ "; End of array access\n"