Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2655.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.2655 Author: eem Time: 9 January 2020, 4:31:10.631731 pm UUID: 1f8135c4-169e-41b6-8ab2-19e8f4f38f56 Ancestors: VMMaker.oscog-eem.2654 StackInterpreter: Fix awful bug in Context printing (wot I wrote) where the sanitised sp is printed rather than the awful truth. Have the CoInterpreter's interpret use the Cogit;s breakBlock if it has none and the Cogit has one. =============== Diff against VMMaker.oscog-eem.2654 =============== Item was added: + ----- Method: CogVMSimulator>>fetchStackPointerOf: (in category 'internal interpreter access') ----- + fetchStackPointerOf: aContext + "Return the stackPointer of a Context or BlockContext. + Does not deal with married contexts. Use only for debug + printing or object tracing functions. To obtain an accurate + stack pointer use stackPointerForMaybeMarriedContext:" + | sp | + sp := super fetchStackPointerOf: aContext. + self assert: sp >= 0. + ^sp! Item was changed: ----- Method: CogVMSimulator>>interpret (in category 'interpreter shell') ----- interpret "This is the main interpreter loop. It normally loops forever, fetching and executing bytecodes. When running in the context of a web browser plugin VM, however, it must return control to the web browser periodically. This should done only when the state of the currently running Squeak thread is safely stored in the object heap. Since this is the case at the moment that a check for interrupts is performed, that is when we return to the browser if it is time to do so. Interrupt checks happen quite frequently. Override for simulation to insert bytecode breakpoint support." - <inline: false> "If stacklimit is zero then the stack pages have not been initialized." stackLimit = 0 ifTrue: [^self initStackPagesAndInterpret]. + self useCogitBreakBlockIfNone. "record entry time when running as a browser plug-in" self browserPluginInitialiseIfNeeded. self internalizeIPandSP. self initExtensions. self fetchNextBytecode. [true] whileTrue: [self assertValidExecutionPointers. atEachStepBlock value. "N.B. may be nil" self dispatchOn: currentBytecode in: BytecodeTable. self incrementByteCount]. localIP := localIP - 1. "undo the pre-increment of IP before returning" self externalizeIPandSP. ^nil ! Item was added: + ----- Method: CogVMSimulator>>useCogitBreakBlockIfNone (in category 'interpreter shell') ----- + useCogitBreakBlockIfNone + atEachStepBlock ifNil: + [cogit breakBlock ifNotNil: + [: bb| atEachStepBlock := [(bb value: 0) ifTrue: [self halt: 'Cogit breakpoint reached']]]]! Item was changed: ----- Method: StackInterpreter>>printContext: (in category 'debug printing') ----- printContext: aContext | sender ip sp | <inline: false> self shortPrintContext: aContext. sender := objectMemory fetchPointer: SenderIndex ofObject: aContext. ip := objectMemory fetchPointer: InstructionPointerIndex ofObject: aContext. (objectMemory isIntegerObject: sender) ifTrue: [(self checkIsStillMarriedContext: aContext currentFP: framePointer) ifTrue: [self print: 'married (assuming framePointer valid)'; cr] ifFalse: [self print: 'widowed (assuming framePointer valid)'; cr]. self print: 'sender '; printNum: sender; print: ' ('; printHexPtr: (self withoutSmallIntegerTags: sender); printChar: $); cr. self print: 'ip '; printNum: ip; print: ' ('; printHexPtr: (self withoutSmallIntegerTags: ip); printChar: $); cr] ifFalse: [self print: 'sender '; shortPrintOop: sender. self print: 'ip '. ip = objectMemory nilObject ifTrue: [self shortPrintOop: ip] ifFalse: [self printNum: ip; print: ' ('; printNum: (objectMemory integerValueOf: ip); space; printHex: (objectMemory integerValueOf: ip); printChar: $); cr]]. sp := objectMemory fetchPointer: StackPointerIndex ofObject: aContext. + self print: 'sp '; printNum: (objectMemory integerValueOf: sp); print: ' ('; printHex: sp; printChar: $); cr. - sp := sp min: (objectMemory lengthOf: aContext) - ReceiverIndex. - self print: 'sp '; printNum: sp; print: ' ('; printNum: (objectMemory integerValueOf: sp); printChar: $); cr. self print: 'method '; printMethodFieldForPrintContext: aContext. self print: 'closure '; shortPrintOop: (objectMemory fetchPointer: ClosureIndex ofObject: aContext). self print: 'receiver '; shortPrintOop: (objectMemory fetchPointer: ReceiverIndex ofObject: aContext). sp := objectMemory integerValueOf: sp. + sp := sp min: (objectMemory lengthOf: aContext) - ReceiverIndex. 1 to: sp do: [:i| self print: ' '; printNum: i; space; shortPrintOop: (objectMemory fetchPointer: ReceiverIndex + i ofObject: aContext)]! |
Free forum by Nabble | Edit this page |