From e792fa6d165f319d878f9c00d56fd8f3d9505de5 Mon Sep 17 00:00:00 2001 From: Xun Yang <x299yang@uwaterloo.ca> Date: Mon, 13 Apr 2020 13:20:41 -0400 Subject: [PATCH] native write --- TypeNodes.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/TypeNodes.py b/TypeNodes.py index 28b222c..57ff04b 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" -- GitLab