VM Maker: VMMaker.oscog-eem.2641.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.2641.mcz

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

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

Name: VMMaker.oscog-eem.2641
Author: eem
Time: 28 December 2019, 9:20:09.625069 am
UUID: a9498159-b2c1-4915-9b3e-e55babbbf3b2
Ancestors: VMMaker.oscog-eem.2640

Simulator:
Fix bad bug in CogVMSimulator>>close that ended up trying to close all windows.

Add support for looking up 32-bit constants (class indices) for 64-bit out-of-line literals (ARMv8).

Ensure all of a closed PIC is disassembled.

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

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; at least some of this code belongs in the UI..."
  World submorphs do:
  [:submorph|
  (submorph model isVMObjectInspector
  and: [submorph model coInterpreter == self]) ifTrue:
  [submorph delete].
  (submorph model isDebugger
+ and: [(submorph model interruptedProcess suspendedContext findContextSuchThat:
- and: [submorph model interruptedProcess suspendedContext findContextSuchThat:
  [:ctxt|
  (ctxt receiver == cogit
  and: [ctxt selector == #simulateCogCodeAt:])
  or: [ctxt receiver == self
+ and: [ctxt selector == #interpret]]]) notNil]) ifTrue:
- and: [ctxt selector == #interpret]]]]) notNil ifTrue:
  [submorph model windowIsClosing.
  submorph delete]]!

Item was changed:
  ----- Method: Cogit>>codeRangesFor: (in category 'disassembly') -----
  codeRangesFor: cogMethod
  "Answer a sequence of ranges of code for the main method and all of the blocks in a CogMethod.
  N.B.  These are in order of block dispatch, _not_ necessarily address order in the method."
  <doNotGenerate>
  | pc end blockEntry starts |
  cogMethod cmType = CMClosedPIC ifTrue:
+ [end := false
+ ifTrue: [cogMethod asInteger + cPICEndOfCodeOffset - backEnd jumpLongByteSize]
+ ifFalse: [cogMethod asInteger + closedPICSize - 1].
- [end := cogMethod asInteger + cPICEndOfCodeOffset - backEnd jumpLongByteSize.
  ^{ CogCodeRange
  from: cogMethod asInteger + (self sizeof: CogMethod)
  to: end
  cogMethod: cogMethod
  startpc: nil }].
  end := (self mapEndFor: cogMethod) - 1.
  cogMethod blockEntryOffset = 0 ifTrue:
  [^{ CogCodeRange
  from: cogMethod asInteger + (self sizeof: CogMethod)
  to: end
  cogMethod: cogMethod
  startpc: (cogMethod cmType ~= CMOpenPIC ifTrue:
  [coInterpreter startPCOfMethodHeader: cogMethod methodHeader]) }].
  pc := blockEntry := cogMethod blockEntryOffset + cogMethod asInteger.
  starts := OrderedCollection with: cogMethod.
  [pc < end] whileTrue:
  [| targetpc |
  targetpc := blockEntry.
  (backEnd isJumpAt: pc) ifTrue:
  [targetpc := backEnd jumpTargetPCAt: pc.
  targetpc < blockEntry ifTrue:
  [starts add: (self cCoerceSimple: targetpc - (self sizeof: CogBlockMethod) to: #'CogBlockMethod *')]].
  pc := pc + (backEnd instructionSizeAt: pc)].
  starts := starts asSortedCollection.
  ^(1 to: starts size + 1) collect:
  [:i| | cogSubMethod nextpc |
  i <= starts size
  ifTrue:
  [cogSubMethod := starts at: i.
  nextpc := i < starts size ifTrue: [(starts at: i + 1) address] ifFalse: [blockEntry].
  CogCodeRange
  from: cogSubMethod address + (self sizeof: cogSubMethod)
  to: nextpc - 1
  cogMethod: cogSubMethod
  startpc: (i = 1
  ifTrue: [coInterpreter startPCOfMethodHeader: cogMethod methodHeader]
  ifFalse: [cogSubMethod startpc])]
  ifFalse:
  [CogCodeRange
  from: blockEntry
  to: end]]!

Item was added:
+ ----- Method: Cogit>>lookup32BitWordConstant: (in category 'disassembly') -----
+ lookup32BitWordConstant: word
+ <doNotGenerate>
+ ^objectMemory lookup32BitWordConstant: word!

Item was added:
+ ----- Method: NewObjectMemory>>lookup32BitWordConstant: (in category 'simulation') -----
+ lookup32BitWordConstant: word
+ <doNotGenerate>
+ "Compatibility with SpurMemoryManager"
+ ^nil!

Item was added:
+ ----- Method: SpurMemoryManager>>lookup32BitWordConstant: (in category 'simulation only') -----
+ lookup32BitWordConstant: word
+ "If word appears to be a class index answer the class name, otherwise answer nil.
+ For code disassembly"
+ <doNotGenerate>
+ | class classSize classNameIndex thisClassIndex |
+ class := self noCheckClassAtIndex: word.
+ (class isNil or: [class = nilObj]) ifTrue:
+ [^nil]. "address is either a class or a metaclass, or an instance of a class or invalid.  determine which."
+ classNameIndex := coInterpreter classNameIndex.
+ thisClassIndex := coInterpreter thisClassIndex.
+ ((classSize := self numSlotsOf: class) <= (classNameIndex max: thisClassIndex)
+ or: [classSize > 255]) ifTrue:
+ [^nil].
+ "Address could be a class or a metaclass"
+ (self lookupAddress: (self fetchPointer: classNameIndex ofObject: class)) ifNotNil:
+ [:maybeClassName| ^maybeClassName allButFirst].
+ (self lookupAddress: (self fetchPointer: thisClassIndex ofObject: class)) ifNotNil:
+ [:maybeClassName| ^maybeClassName allButFirst, ' class'].!