Skip to content
Snippets Groups Projects

Sit

Merged Pui Yan Chloe Sham requested to merge SIT into Array

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
58 58
59 59 ####################################################
60 60 # Preparation before code Gen:
61 # 1. Calculating the size of the object from each class
61 # 1. Calculating the size of the object from each class
62 62 # (also simultaneosly creating fieldOffset because fieldOffset table is required to generate size)
63 63 def codeGenPrep(ASTs):
64 interM = []
64 65 for t in ASTs:
65 66 classInterNode = t[1].typeDcl
66 67 if classInterNode and classInterNode.__class__.__name__ == "ClassNode":
67 68 classInterNode.populateSizeAndFieldOffset()
69 else: # interfaceNode, get their methods to prep for SIT
70 interM += classInterNode.method
  • Pui Yan Chloe Sham
    Pui Yan Chloe Sham @pycsham started a thread on commit 593233be
  • 355 359 self.methodOffset[(method.name, method.paramTypes)] = lastMethodOffset
    356 360 self.data += pLabel(name=self.name + "_" + method.name + "_" + method.paramTypes, type="vtable")
    357 361 self.data += p(instruction="dd", arg1=64) # just declaring a memory segment with a random number
    358
    359 # Adding inherited method to the methodDict
    362
    363 # Adding inherited method to the methodDict
    360 364 for i in self.inherits:
    361 365 if isinstance(i, MethodNode):
    362 366 key = (i.name, i.paramTypes)
    363 367 if not key in methodDict:
    364 368 methodDict[(i.name, i.paramTypes)] = i
    365 369
    366 # print(self.methodOffset)
    370 # Layout SIT
    371 self.code += pLabel("SIT_" + self.name, "local")
  • Pui Yan Chloe Sham
    Pui Yan Chloe Sham @pycsham started a thread on commit 593233be
  • 357 361 self.data += p(instruction="dd", arg1=64) # just declaring a memory segment with a random number
    358
    359 # Adding inherited method to the methodDict
    362
    363 # Adding inherited method to the methodDict
    360 364 for i in self.inherits:
    361 365 if isinstance(i, MethodNode):
    362 366 key = (i.name, i.paramTypes)
    363 367 if not key in methodDict:
    364 368 methodDict[(i.name, i.paramTypes)] = i
    365 369
    366 # print(self.methodOffset)
    370 # Layout SIT
    371 self.code += pLabel("SIT_" + self.name, "local")
    372 for i in range(self.SITsize):
    373 self.code += pLabel("SIT_" + i, "local")
  • mentioned in commit d68a4c92

  • Please register or sign in to reply
    Loading