diff --git a/TypeNodes.py b/TypeNodes.py index 28b222c58dec73c4435f72bad8c0cc78a404ce47..57ff04b96876eeffa31397d0c1ebda79a60954be 100644 --- a/TypeNodes.py +++ b/TypeNodes.py @@ -19,7 +19,7 @@ class ClassInterNode(ASTNode): self.SITsize = 0 self.subTypeSize = 0 self.subTypeOffset = 0 - + # sets self.inherits = [] self.super = [] @@ -414,11 +414,18 @@ class ClassNode(ClassInterNode): className = key[0] mLabel = "M_" + className + "_" + key[0] + "_" + key[1] # method implementation - # First need to import method implementation labels - if className != self.name: + # native write: (badly hardcoded here) + if vLabel == "V_OutputStream_nativeWrite_int": + mLabel = "NATIVEjava.io.OutputStream.nativeWrite" self.code += p(instruction="extern", arg1=mLabel, comment="importing method implementation label") - self.code += p(instruction="mov", arg1="eax", arg2=vLabel, comment="Filling in class memory segment for method " + mLabel) - self.code += p(instruction="mov", arg1="[eax]", arg2="dword " + mLabel) + self.code += p(instruction="mov", arg1="eax", arg2=vLabel, comment="Filling in class memory segment for method " + mLabel) + self.code += p(instruction="mov", arg1="[eax]", arg2="dword " + mLabel) + else: + # First need to import method implementation labels + if className != self.name: + self.code += p(instruction="extern", arg1=mLabel, comment="importing method implementation label") + self.code += p(instruction="mov", arg1="eax", arg2=vLabel, comment="Filling in class memory segment for method " + mLabel) + self.code += p(instruction="mov", arg1="[eax]", arg2="dword " + mLabel) self.code += "; End of function for filling in methods in class memory layout\n"