VM Maker: VMMaker.oscog-eem.2635.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscog-eem.2635.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2635.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.2635
Author: eem
Time: 25 December 2019, 2:04:03.435778 pm
UUID: 4f981067-9b07-427b-b4e3-802f9cfdc451
Ancestors: VMMaker.oscog-eem.2634

Simulation:
Remove CogVMSimulator>>externalizeIPandSP and instead nil localFP in returnToExecutive:postContextSwitch: and slowPrimitiveResponse. externalizeIPandSP is used in too many places. Provide stackPointerForFramePointer:, extracted from printFrame:, for the benefit of opening frame inspectors.
Add a hack to CogVMSimulator>>close to close any attendant VMObjectInspectors (this should happen in the UI, e.g. in SystemWindow>>delete; see where it closes any extrantSketchEditor; a generic facility would help ;-) ).

=============== Diff against VMMaker.oscog-eem.2634 ===============

Item was changed:
  ----- Method: CogVMSimulator>>close (in category 'initialization') -----
  close  "close any files that ST may have opened, etc"
+ pluginList do: [:assoc| | plugin | plugin := assoc value. plugin ~~ self ifTrue: [plugin close]].
+ "Ugh; this code belongs in the UI"
+ World submorphs do:
+ [:submorph|
+ (submorph model isVMObjectInspector
+ and: [submorph model coInterpreter == self]) ifTrue:
+ [submorph delete]]!
- pluginList do: [:assoc| | plugin | plugin := assoc value. plugin ~~ self ifTrue: [plugin close]]!

Item was removed:
- ----- Method: CogVMSimulator>>externalizeIPandSP (in category 'utilities') -----
- externalizeIPandSP
- "Copy the local instruction, stack and frame pointers to global variables for use in primitives and other functions outside the interpret loop.
- Override to record the transition by nilling localFP."
-
- self assert: localIP asUnsignedInteger ~= cogit ceReturnToInterpreterPC.
- instructionPointer := self oopForPointer: localIP.
- stackPointer := localSP.
- framePointer := localFP.
- localFP := nil!

Item was added:
+ ----- Method: CogVMSimulator>>returnToExecutive:postContextSwitch: (in category 'enilopmarts') -----
+ returnToExecutive: inInterpreter postContextSwitch: switchedContext
+ "Return to the current frame, either by entering machine code, or longjmp-ing back to the
+ interpreter or simply returning, depending on where we are. To know whether to return or
+ enter machine code we have to know from whence we came.  We could have come from
+ the interpreter, either directly or via a machine code primitive.  We could have come from
+ machine code.  The instructionPointer tells us where from.  If it is above startOfMemory we're
+ in the interpreter.  If it is below, then we are in machine-code unless it is ceReturnToInterpreterPC,
+ in which case we're in a machine-code primitive called from the interpreter.
+
+ Override to nil localFP.  This mimics the production VM's housing of localFP (& localIP & localSP)
+ in a local (hopefully register) variable in interpret, and hence outside of interpret it is invalid.
+ In the simulator it is also used as the flag as to whether the head frame is to be derived from
+ localFP & localSP (when localFP notNl) or from framePointer & stackPointer (when localFP is nil)."
+ localFP := nil.
+ ^super returnToExecutive: inInterpreter postContextSwitch: switchedContext!

Item was added:
+ ----- Method: CogVMSimulator>>slowPrimitiveResponse (in category 'primitive support') -----
+ slowPrimitiveResponse
+ "Invoke a normal (non-quick) primitive.
+ Called under the assumption that primFunctionPointer has been preloaded.
+
+ Override to nil localFP.  This mimics the production VM's housing of localFP (& localIP & localSP)
+ in a local (hopefully register) variable in interpret, and hence outside of interpret it is invalid.
+ In the simulator it is also used as the flag as to whether the head frame is to be derived from
+ localFP & localSP (when localFP notNl) or from framePointer & stackPointer (when localFP is nil)."
+ localFP := nil.
+ ^super slowPrimitiveResponse!

Item was added:
+ ----- Method: StackInterpreter>>stackPointerForFramePointer: (in category 'frame access') -----
+ stackPointerForFramePointer: theFP
+ | thePage frameAbove |
+ "c.f. the code in printFrame:"
+ <doNotGenerate>
+ frameAbove := nil.
+ ^theFP = self headFramePointer
+ ifTrue: [self headStackPointer]
+ ifFalse:
+ [thePage := stackPages stackPageFor: theFP.
+ (stackPages isFree: thePage) ifTrue:
+ [self printHexPtr: theFP; print: ' is on a free page?!!'; cr.
+ ^nil].
+ (thePage ~= stackPage
+  and: [theFP = thePage headFP])
+ ifTrue: [thePage headSP]
+ ifFalse:
+ [frameAbove := self safeFindFrameAbove: theFP
+ on: thePage
+ startingFrom: ((thePage = stackPage
+ and: [self headFramePointer
+ between: thePage realStackLimit
+ and: thePage baseAddress])
+ ifTrue: [self headFramePointer]
+ ifFalse: [thePage headFP]).
+ frameAbove ifNotNil:
+ [self frameCallerSP: frameAbove]]]
+ !