Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.765.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.765 Author: eem Time: 7 June 2014, 3:01:19.865 pm UUID: ea6eeed7-03ea-4538-9d63-25f2e260f6b4 Ancestors: VMMaker.oscog-eem.764 Remove some compilation warnings in cogit.c. Remember to update genActiveContextTrampolineLarge:inBlock:called: to the new genTrampolineFor: signature. =============== Diff against VMMaker.oscog-eem.764 =============== Item was changed: ----- Method: CogMethodZone>>relocateAndPruneYoungReferrers (in category 'young referers') ----- relocateAndPruneYoungReferrers | source dest next cogMethod | <var: #source type: #usqInt> <var: #dest type: #usqInt> <var: #next type: #usqInt> <var: #cogMethod type: #'CogMethod *'> <inline: false> self assert: youngReferrers <= limitAddress. youngReferrers = limitAddress ifTrue: [^nil]. dest := limitAddress. [next := dest - BytesPerWord. next >= youngReferrers and: [(cogMethod := coInterpreter cCoerceSimple: (objectMemory longAt: next) to: #'CogMethod *') cmType ~= CMFree and: [cogMethod cmRefersToYoung]]] whileTrue: [cogMethod objectHeader ~= 0 ifTrue: [coInterpreter longAt: next put: cogMethod asInteger + cogMethod objectHeader]. dest := next]. self assert: dest >= youngReferrers. source := dest - BytesPerWord. [source >= youngReferrers] whileTrue: [cogMethod := coInterpreter cCoerceSimple: (objectMemory longAt: source) to: #'CogMethod *'. (cogMethod cmType ~= CMFree and: [cogMethod cmRefersToYoung]) ifTrue: [self assert: source < (dest - BytesPerWord). cogMethod objectHeader ~= 0 ifTrue: + [cogMethod := coInterpreter + cCoerceSimple: cogMethod asInteger + cogMethod objectHeader asInteger - [cogMethod := coInterpreter cCoerceSimple: cogMethod asInteger + cogMethod objectHeader to: #'CogMethod *']. objectMemory longAt: (dest := dest - BytesPerWord) put: cogMethod asInteger]. source := source - BytesPerWord]. youngReferrers := dest. "this assert must be deferred until after compaction. See the end of compactCogCompiledCode" "self assert: self kosherYoungReferrers"! Item was changed: ----- Method: CogObjectRepresentationForSpur>>genActiveContextTrampolineLarge:inBlock:called: (in category 'initialization') ----- genActiveContextTrampolineLarge: isLarge inBlock: isInBlock called: aString + <var: #aString type: #'char *'> "Create a trampoline to answer the active context that will answer it if a frame is already married, and create it otherwise. Assume numArgs is in SendNumArgsReg and ClassReg is free." | startAddress | startAddress := cogit methodZoneBase. cogit zeroOpcodeIndex. self genGetActiveContextLarge: isLarge inBlock: isInBlock. cogit outputInstructionsForGeneratedRuntimeAt: startAddress. cogit recordGeneratedRunTime: aString address: startAddress. cogit recordRunTimeObjectReferences. ^startAddress! Item was changed: ----- Method: Cogit class>>declareCVarsIn: (in category 'translation') ----- declareCVarsIn: aCCodeGenerator #( 'coInterpreter' 'objectMemory' 'methodZone' 'objectRepresentation' 'cogBlockMethodSurrogateClass' 'cogMethodSurrogateClass' 'threadManager' 'processor' 'lastNInstructions' 'simulatedAddresses' 'simulatedTrampolines' 'simulatedVariableGetters' 'simulatedVariableSetters' 'printRegisters' 'printInstructions' 'clickConfirm' 'singleStep') do: [:simulationVariableNotNeededForRealVM| aCCodeGenerator removeVariable: simulationVariableNotNeededForRealVM]. NewspeakVM ifFalse: [#( 'dynSuperEntry' 'dynSuperEntryAlignment' 'dynamicSuperSendTrampolines' 'ceImplicitReceiverTrampoline' 'ceExplicitReceiverTrampoline' 'cmDynSuperEntryOffset') do: [:variableNotNeededInNormalVM| aCCodeGenerator removeVariable: variableNotNeededInNormalVM]]. aCCodeGenerator removeConstant: #COGMTVM. "this should be defined at compile time" aCCodeGenerator addHeaderFile:'<stddef.h>'; "for e.g. offsetof" addHeaderFile:'"sqCogStackAlignment.h"'; addHeaderFile:'"cogmethod.h"'; addHeaderFile:'#if COGMTVM'; addHeaderFile:'"cointerpmt.h"'; addHeaderFile:'#else'; addHeaderFile:'"cointerp.h"'; addHeaderFile:'#endif'; addHeaderFile:'"cogit.h"'; addHeaderFile:'"dispdbg.h"'. aCCodeGenerator var: #ceGetSP declareC: 'unsigned long (*ceGetSP)(void)'; var: #ceCaptureCStackPointers declareC: 'void (*ceCaptureCStackPointers)(void)'; var: #ceEnterCogCodePopReceiverReg declareC: 'void (*ceEnterCogCodePopReceiverReg)(void)'; var: #realCEEnterCogCodePopReceiverReg declareC: 'void (*realCEEnterCogCodePopReceiverReg)(void)'; var: #ceEnterCogCodePopReceiverAndClassRegs declareC: 'void (*ceEnterCogCodePopReceiverAndClassRegs)(void)'; var: #realCEEnterCogCodePopReceiverAndClassRegs declareC: 'void (*realCEEnterCogCodePopReceiverAndClassRegs)(void)'; var: #ceFlushICache declareC: 'static void (*ceFlushICache)(unsigned long from, unsigned long to)'; var: #ceCheckFeaturesFunction declareC: 'static unsigned long (*ceCheckFeaturesFunction)(void)'; var: #ceTryLockVMOwner declareC: 'unsigned long (*ceTryLockVMOwner)(void)'; var: #ceUnlockVMOwner declareC: 'void (*ceUnlockVMOwner)(void)'; var: #postCompileHook declareC: 'void (*postCompileHook)(CogMethod *, void *)'; var: #openPICList declareC: 'CogMethod *openPICList = 0'; var: #maxMethodBefore type: #'CogBlockMethod *'. aCCodeGenerator declareVar: 'aMethodLabel' type: #'AbstractInstruction'; "Has to come lexicographically before backEnd & methodLabel" var: #backEnd declareC: 'AbstractInstruction * const backEnd = &aMethodLabel'; var: #methodLabel declareC: 'AbstractInstruction * const methodLabel = &aMethodLabel'; var: #primInvokeLabel type: #'AbstractInstruction *'. self declareC: #(abstractOpcodes stackCheckLabel blockEntryLabel blockEntryNoContextSwitch stackOverflowCall sendMiss sendMissCall entry noCheckEntry dynSuperEntry + mnuCall interpretCall interpretLabel endCPICCase0 endCPICCase1) - mnuCall interpretCall endCPICCase0 endCPICCase1) as: #'AbstractInstruction *' in: aCCodeGenerator. aCCodeGenerator declareVar: #annotations type: #'InstructionAnnotation *'; declareVar: #blockStarts type: #'BlockStart *'; declareVar: #fixups type: #'BytecodeFixup *'. aCCodeGenerator var: #sendTrampolines declareC: 'sqInt sendTrampolines[NumSendTrampolines]'; var: #superSendTrampolines declareC: 'sqInt superSendTrampolines[NumSendTrampolines]'; var: #dynamicSuperSendTrampolines declareC: 'sqInt dynamicSuperSendTrampolines[NumSendTrampolines]'; var: #trampolineAddresses declareC: 'static char *trampolineAddresses[NumTrampolines*2]'; var: #objectReferencesInRuntime declareC: 'static sqInt objectReferencesInRuntime[NumObjRefsInRuntime]'; var: #labelCounter type: #int; var: #traceFlags declareC: 'int traceFlags = 8 /* prim trace log on by default */'; var: #cStackAlignment declareC: 'const int cStackAlignment = STACK_ALIGN_BYTES'. aCCodeGenerator declareVar: #CFramePointer type: #'void *'; declareVar: #CStackPointer type: #'void *'; declareVar: #minValidCallAddress type: #'unsigned long'; declareVar: #debugPrimCallStackOffset type: #'unsigned long'. aCCodeGenerator vmClass generatorTable ifNotNil: [:bytecodeGenTable| aCCodeGenerator var: #generatorTable declareC: 'BytecodeDescriptor generatorTable[', bytecodeGenTable size, ']', (self tableInitializerFor: bytecodeGenTable in: aCCodeGenerator); var: #primitiveGeneratorTable declareC: 'PrimitiveDescriptor primitiveGeneratorTable[MaxCompiledPrimitiveIndex+1]', (self tableInitializerFor: aCCodeGenerator vmClass primitiveTable in: aCCodeGenerator)]. "In C the abstract opcode names clash with the Smalltak generator syntactic sugar. Most of the syntactic sugar is inlined, but alas some remains. Rename the syntactic sugar to avoid the clash." (self organization listAtCategoryNamed: #'abstract instructions') do: [:s| aCCodeGenerator addSelectorTranslation: s to: 'g', (aCCodeGenerator cFunctionNameFor: s)]. aCCodeGenerator addSelectorTranslation: #halt: to: 'haltmsg'! Item was changed: ----- Method: Cogit>>genSafeTrampolineFor:called:arg:arg: (in category 'initialization') ----- genSafeTrampolineFor: aRoutine called: aString arg: regOrConst0 arg: regOrConst1 "Generate a trampoline with two arguments that will save and restore all registers around the call" <var: #aRoutine type: #'void *'> <var: #aString type: #'char *'> ^self genTrampolineFor: aRoutine called: aString - callJumpBar: true numArgs: 2 arg: regOrConst0 arg: regOrConst1 arg: nil arg: nil saveRegs: true + pushLinkReg: true resultReg: nil appendOpcodes: false! Item was changed: ----- Method: Cogit>>printTrampolineTable (in category 'debugging') ----- printTrampolineTable <api> 0 to: trampolineTableIndex - 1 by: 2 do: [:i| coInterpreter printHex: (trampolineAddresses at: i + 1) asInteger; print: ': '; + print: (self cCoerceSimple: (trampolineAddresses at: i) to: #'char *'); - print: (trampolineAddresses at: i); cr]! |
Free forum by Nabble | Edit this page |