Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.217.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.217 Author: eem Time: 20 November 2012, 3:31:56.014 pm UUID: 8d1d7d80-fce3-4a84-9f8f-b07f482d81f7 Ancestors: VMMaker.oscog-eem.216
Hide extA, extB & bytecodeSetSelector from vanilla VMs, now that the code is neater in using cppIf:ifTrue:[ifFalse:].
=============== Diff against VMMaker.oscog-eem.216 ===============
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]. "record entry time when running as a browser plug-in" self browserPluginInitialiseIfNeeded. self internalizeIPandSP. self fetchNextBytecode. + self initExtensions. - extA := extB := 0. [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 changed: ----- Method: StackInterpreter class>>declareCVarsIn: (in category 'translation') ----- declareCVarsIn: aCCodeGenerator self class == thisContext methodClass ifFalse: [^self]. "Don't duplicate decls in subclasses" aCCodeGenerator addHeaderFile:'<stddef.h> /* for e.g. alloca */'; addHeaderFile:'<setjmp.h>'; addHeaderFile:'"vmCallback.h"'; addHeaderFile:'"sqMemoryFence.h"'; addHeaderFile:'"dispdbg.h"'. self declareInterpreterVersionIn: aCCodeGenerator defaultName: 'Stack'. aCCodeGenerator var: #interpreterProxy type: #'struct VirtualMachine*'. aCCodeGenerator declareVar: #sendTrace type: 'volatile int'; declareVar: #byteCount type: 'unsigned long'. "These need to be pointers or unsigned." self declareC: #(instructionPointer method newMethod) as: #usqInt in: aCCodeGenerator. "These are all pointers; char * because Slang has no support for C pointer arithmetic." self declareC: #(localIP localSP localFP stackPointer framePointer stackLimit stackMemory) as: #'char *' in: aCCodeGenerator. self declareC: #(stackPage overflowedPage) as: #'StackPage *' in: aCCodeGenerator. aCCodeGenerator removeVariable: 'stackPages'. "this is an implicit receiver in the translated code." "This defines bytecodeSetSelector as 0 if MULTIPLEBYTECODESETS is not defined, for the benefit of the interpreter on slow machines." aCCodeGenerator addConstantForBinding: (self bindingOf: #MULTIPLEBYTECODESETS). + MULTIPLEBYTECODESETS == false ifTrue: - MULTIPLEBYTECODESETS ifFalse: [aCCodeGenerator + removeVariable: 'extA'; + removeVariable: 'extB'; + removeVariable: 'bytecodeSetSelector']. - var: #bytecodeSetSelector - declareC: '#define bytecodeSetSelector 0']. aCCodeGenerator var: #methodCache declareC: 'long methodCache[MethodCacheSize + 1 /* ', (MethodCacheSize + 1) printString, ' */]'. aCCodeGenerator var: #atCache declareC: 'sqInt atCache[AtCacheTotalSize + 1 /* ', (AtCacheTotalSize + 1) printString, ' */]'. aCCodeGenerator var: #primitiveTable declareC: 'void (*primitiveTable[MaxPrimitiveIndex + 2 /* ', (MaxPrimitiveIndex +2) printString, ' */])(void) = ', self primitiveTableString. self primitiveTable do: [:symbolOrNot| (symbolOrNot isSymbol and: [symbolOrNot ~~ #primitiveFail]) ifTrue: [(aCCodeGenerator methodNamed: symbolOrNot) ifNotNil: [:tMethod| tMethod returnType: #void]]]. aCCodeGenerator var: #primitiveFunctionPointer declareC: 'void (*primitiveFunctionPointer)()'. aCCodeGenerator var: #externalPrimitiveTable declareC: 'void (*externalPrimitiveTable[MaxExternalPrimitiveTableSize + 1 /* ', (MaxExternalPrimitiveTableSize + 1) printString, ' */])(void)'. aCCodeGenerator var: #showSurfaceFn type: #'void *'. aCCodeGenerator var: #jmpBuf declareC: 'jmp_buf jmpBuf[MaxJumpBuf + 1 /* ', (MaxJumpBuf + 1) printString, ' */]'. aCCodeGenerator var: #suspendedCallbacks declareC: 'usqInt suspendedCallbacks[MaxJumpBuf + 1 /* ', (MaxJumpBuf + 1) printString, ' */]'. aCCodeGenerator var: #suspendedMethods declareC: 'usqInt suspendedMethods[MaxJumpBuf + 1 /* ', (MaxJumpBuf + 1) printString, ' */]'. aCCodeGenerator var: #interruptCheckChain declareC: 'void (*interruptCheckChain)(void) = 0'. aCCodeGenerator var: #breakSelector type: #'char *'; var: #breakSelectorLength declareC: 'sqInt breakSelectorLength = -1'.
self declareC: #(nextPollUsecs nextWakeupUsecs longRunningPrimitiveGCUsecs longRunningPrimitiveStartUsecs longRunningPrimitiveStopUsecs) as: #usqLong in: aCCodeGenerator. aCCodeGenerator var: #nextProfileTick type: #sqLong!
Item was changed: ----- Method: StackInterpreter>>initExtensions (in category 'simulation support') ----- initExtensions + <inline: true> + self cppIf: MULTIPLEBYTECODESETS ifTrue: [extA := extB := 0]! - <doNotGenerate> - "In the real VM, these are zeroed in interpret, in which they are localized. - But we need to zero them for simulation also." - extA := extB := 0!
Item was changed: ----- Method: StackInterpreter>>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 browser plugin VM, however, it must return control to the 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."
<inline: false> "If stacklimit is zero then the stack pages have not been initialized." stackLimit = 0 ifTrue: [^self initStackPagesAndInterpret]. "record entry time when running as a browser plug-in" self browserPluginInitialiseIfNeeded. self internalizeIPandSP. self fetchNextBytecode. + self initExtensions. - extA := extB := 0. [true] whileTrue: [self dispatchOn: currentBytecode in: BytecodeTable]. localIP := localIP - 1. "undo the pre-increment of IP before returning" self externalizeIPandSP. ^nil !
vm-dev@lists.squeakfoundation.org