Skip to content
Snippets Groups Projects
Commit e792fa6d authored by Xun Yang's avatar Xun Yang
Browse files

native write

parent 3cb4089f
No related branches found
No related tags found
2 merge requests!30New new string,!20Master
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment