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

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

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

Name: VMMaker.oscog-eem.2969
Author: eem
Time: 18 June 2021, 8:27:39.266763 pm
UUID: e47dec6d-965d-4dc1-ad51-ad192f9f6181
Ancestors: VMMaker.oscog-eem.2968

Fix a bug in the assert in Fix a bug in the assert in cogMethodContaining: when supplied the mcpc of a block method at its stack check offset.

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

Item was changed:
  ----- Method: CogMethodZone>>cogMethodContaining: (in category 'jit - api') -----
  cogMethodContaining: mcpc
  "Answer the method containing mcpc for the purposes of code zone compaction,
  where mcpc is actually the value of instructionPointer at the time of a compaction."
  <var: 'mcpc' type: #usqInt>
  <api>
  | cogMethod prevMethod |
  mcpc > limitAddress ifTrue:
  [^nil].
  mcpc < baseAddress ifTrue:
  [cogit assertMcpcIsPrimReturn: mcpc.
  ^nil].
  self assert: mcpc < self freeStart.
  cogMethod := coInterpreter cCoerceSimple: baseAddress to: #'CogMethod *'.
  [cogMethod asUnsignedInteger < mcpc] whileTrue:
  [prevMethod := cogMethod.
  cogMethod := self methodAfter: cogMethod].
 
  "Since mcpc is actually instructionPointer we expect that it is either at the stack check
  (normal code zone reclamation invoked through checkForEventsMayContextSwitch:)
  or is in a primitive, immediately following the call of the C primitive routine."
  self assert: (prevMethod notNil
  and: [mcpc = (prevMethod asUnsignedInteger + prevMethod stackCheckOffset)
+ or: [(self mcpc: mcpc isAtStackCheckOfBlockMethodIn: prevMethod)
  or: [(cogit backEnd isCallPrecedingReturnPC: mcpc)
  and: [(coInterpreter
  primitiveIndexOfMethod: prevMethod methodObject
  header: prevMethod methodHeader) > 0
+ or: [(cogit backEnd callTargetFromReturnAddress: mcpc) = cogit ceCheckForInterruptTrampoline]]]]]).
- or: [(cogit backEnd callTargetFromReturnAddress: mcpc) = cogit ceCheckForInterruptTrampoline]]]]).
  ^prevMethod!

Item was added:
+ ----- Method: CogMethodZone>>mcpc:isAtStackCheckOfBlockMethodIn: (in category 'testing') -----
+ mcpc: mcpc isAtStackCheckOfBlockMethodIn: cogMethod
+ "For assert checking..."
+ <var: 'cogMethod' type: #'CogMethod *'>
+ cogMethod blockEntryOffset = 0 ifTrue:
+ [^false].
+ ^(cogit blockDispatchTargetsFor: cogMethod perform: #stackCheckOffsetOfBlockAt:isMcpc: arg: mcpc) ~= 0!

Item was added:
+ ----- Method: Cogit>>stackCheckOffsetOfBlockAt:isMcpc: (in category 'testing') -----
+ stackCheckOffsetOfBlockAt: blockEntryMcpc isMcpc: mcpc
+ <returnTypeC: #usqInt>
+ | cogBlockMethod |
+ <var: #cogBlockMethod type: #'CogBlockMethod *'>
+ cogBlockMethod := self cCoerceSimple: blockEntryMcpc - (self sizeof: CogBlockMethod)
+  to: #'CogBlockMethod *'.
+ cogBlockMethod asInteger + cogBlockMethod stackCheckOffset = mcpc ifTrue:
+ [^cogBlockMethod asUnsignedInteger].
+ ^0 "keep scanning..."!