Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2849.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.2849 Author: eem Time: 18 October 2020, 5:32:46.306263 pm UUID: e029d24d-607b-4d1f-a117-14d381a9dcb3 Ancestors: VMMaker.oscog-eem.2848 And have the flags not recognised by a specific VM still get recorded in imageHeaderFlags, so set parameters will get set in the image header. =============== Diff against VMMaker.oscog-eem.2848 =============== Item was changed: ----- Method: CoInterpreter>>getImageHeaderFlags (in category 'image save/restore') ----- getImageHeaderFlags "Answer the flags that are contained in the 7th long of the image header." ^fullScreenFlag "0 or 1" + (VMBIGENDIAN ifTrue: [0] ifFalse: [2]) "this is the imageFloatsLittleEndian flag" + (flagInterpretedMethods ifTrue: [8] ifFalse: [0]) + (preemptionYields ifTrue: [0] ifFalse: [16r10]) + (newFinalization ifTrue: [16r40] ifFalse: [0]) + (sendWheelEvents ifTrue: [16r80] ifFalse: [0]) + (primitiveDoMixedArithmetic ifTrue: [0] ifFalse: [16r100]) + + (imageHeaderFlags bitClear: 1+2+8+16r10+16r40+16r80+16r100) "these are any flags we do not recognize"! - + (imageHeaderFlags bitClear: 16r1DB) "these are any flags we do not recognize"! Item was changed: ----- Method: CoInterpreter>>setImageHeaderFlags: (in category 'internal interpreter access') ----- setImageHeaderFlags: flags + "Set an array of flags indicating various properties of the saved image, responded to on image load. + These are the same as the image header flags shifted right two bits, omitting the fullScreenFlag and float byte order flag. + Bit 0: if set, implies the image's Process class has threadId as its 3rd inst var (zero relative) (meaningful to the MT VM only) - "Set an array of flags indicating various properties of the Cog VM. - Bit 0: if set, implies the image's Process class has threadId as its 3rd inst var (zero relative) Bit 1: if set, methods that are interpreted will have the flag bit set in their header Bit 2: if set, implies preempting a process does not put it to the back of its run queue + Bit 3: if set, implies a threaded VM will not disown the VM if owned by the GUI thread (meaningful to the MT VM only) - Bit 3: if set, implies a threaded VM will not dosown the VM if owned by the GUI thread Bit 4: if set, implies the new finalization scheme where WeakArrays are queued Bit 5: if set, implies wheel events will be delivered as such and not mapped to arrow key events Bit 6: if set, implies arithmetic primitives will fail if given arguments of different types (float vs int)" flags asUnsignedInteger > 127 ifTrue: [^self primitiveFailFor: PrimErrUnsupported]. "processHasThreadId := flags anyMask: 1. specific to CoInterpreterMT" + imageHeaderFlags := (flags anyMask: 1) + ifTrue: [imageHeaderFlags bitOr: 4] + ifFalse: [imageHeaderFlags bitClear: 4]. flagInterpretedMethods := flags anyMask: 2. preemptionYields := flags noMask: 4. "noThreadingOfGUIThread := flags anyMask: 8.. specific to CoInterpreterMT" + imageHeaderFlags := (flags anyMask: 8) + ifTrue: [imageHeaderFlags bitOr: 32] + ifFalse: [imageHeaderFlags bitClear: 32]. newFinalization := flags anyMask: 16. sendWheelEvents := flags anyMask: 32. primitiveDoMixedArithmetic := flags noMask: 64! Item was changed: ----- Method: CoInterpreterMT>>setImageHeaderFlags: (in category 'internal interpreter access') ----- setImageHeaderFlags: flags + "Set an array of flags indicating various properties of the saved image, responded to on image load. + These are the same as the image header flags shifted right two bits, omitting the fullScreenFlag and float byte order flag. - "Set an array of flags indicating various properties of the Cog VM. Bit 0: if set, implies the image's Process class has threadId as its 3rd inst var (zero relative) Bit 1: if set, methods that are interpreted will have the flag bit set in their header Bit 2: if set, implies preempting a process does not put it to the back of its run queue + Bit 3: if set, implies a threaded VM will not disown the VM if owned by the GUI thread - Bit 3: if set, implies a threaded VM will not dosown the VM if owned by the GUI thread Bit 4: if set, implies the new finalization scheme where WeakArrays are queued Bit 5: if set, implies wheel events will be delivered as such and not mapped to arrow key events Bit 6: if set, implies arithmetic primitives will fail if given arguments of different types (float vs int)" flags asUnsignedInteger > 127 ifTrue: [^self primitiveFailFor: PrimErrUnsupported]. processHasThreadId := flags anyMask: 1. flagInterpretedMethods := flags anyMask: 2. preemptionYields := flags noMask: 4. noThreadingOfGUIThread := flags anyMask: 8. newFinalization := flags anyMask: 16. sendWheelEvents := flags anyMask: 32. primitiveDoMixedArithmetic := flags noMask: 64! Item was changed: ----- Method: StackInterpreter>>getImageHeaderFlags (in category 'image save/restore') ----- getImageHeaderFlags "Answer the flags that are contained in the 7th long of the image header." ^fullScreenFlag "0 or 1" + (VMBIGENDIAN ifTrue: [0] ifFalse: [2]) "this is the imageFloatsLittleEndian flag" + (preemptionYields ifTrue: [0] ifFalse: [16r10]) + (newFinalization ifTrue: [16r40] ifFalse: [0]) + (sendWheelEvents ifTrue: [16r80] ifFalse: [0]) + (primitiveDoMixedArithmetic ifTrue: [0] ifFalse: [16r100]) + + (imageHeaderFlags bitClear: 1+2+16r10+16r40+16r80+16r100) "these are any flags we do not recognize"! - + (imageHeaderFlags bitClear: 16r1D3) "these are any flags we do not recognize"! Item was added: + ----- Method: StackInterpreter>>getImageHeaderFlagsParameter (in category 'image save/restore') ----- + getImageHeaderFlagsParameter + "Answer the flags that are contained in the 7th long of the image header + as reported to the image through the vm parameter primitives # 48." + ^objectMemory integerObjectOf: self getImageHeaderFlags >> 2! Item was removed: - ----- Method: StackInterpreter>>getImageHeaderFlagsParameterObject (in category 'image save/restore') ----- - getImageHeaderFlagsParameterObject - "Answer the flags that are contained in the 7th long of the image header - as reported to the image through the vm parameter primitives." - ^objectMemory integerObjectOf: self getImageHeaderFlags >> 2! Item was changed: ----- Method: StackInterpreter>>setImageHeaderFlags: (in category 'internal interpreter access') ----- setImageHeaderFlags: flags + "Set an array of flags indicating various properties of the saved image, responded to on image load. + These are the same as the image header flags shifted right two bits, omitting the fullScreenFlag and float byte order flag. + Bit 0: if set, implies the image's Process class has threadId as its 3rd inst var (zero relative) (meaningful to the MT VM only) + Bit 1: if set, methods that are interpreted will have the flag bit set in their header (meaningful to the Cog VM only) - "Set an array of flags indicating various properties of the Cog VM. Bit 2: if set, implies preempting a process does not put it to the back of its run queue + Bit 3: if set, implies a threaded VM will not disown the VM if owned by the GUI thread (meaningful to the MT VM only) Bit 4: if set, implies the new finalization scheme where WeakArrays are queued Bit 5: if set, implies wheel events will be delivered as such and not mapped to arrow key events Bit 6: if set, implies arithmetic primitives will fail if given arguments of different types (float vs int)" flags asUnsignedInteger > 127 ifTrue: [^self primitiveFailFor: PrimErrUnsupported]. "processHasThreadId := flags anyMask: 1. specific to CoInterpreterMT" + imageHeaderFlags := (flags anyMask: 1) + ifTrue: [imageHeaderFlags bitOr: 4] + ifFalse: [imageHeaderFlags bitClear: 4]. "flagInterpretedMethods := flags anyMask: 2. specific to CoInterpreter" + imageHeaderFlags := (flags anyMask: 2) + ifTrue: [imageHeaderFlags bitOr: 8] + ifFalse: [imageHeaderFlags bitClear: 8]. preemptionYields := flags noMask: 4. "noThreadingOfGUIThread := flags anyMask: 8.. specific to CoInterpreterMT" + imageHeaderFlags := (flags anyMask: 8) + ifTrue: [imageHeaderFlags bitOr: 32] + ifFalse: [imageHeaderFlags bitClear: 32]. newFinalization := flags anyMask: 16. sendWheelEvents := flags anyMask: 32. primitiveDoMixedArithmetic := flags noMask: 64! Item was changed: ----- Method: StackInterpreterPrimitives>>primitiveAllVMParameters: (in category 'system control primitives') ----- (excessive size, no diff calculated) Item was changed: ----- Method: StackInterpreterPrimitives>>primitiveGetVMParameter: (in category 'system control primitives') ----- primitiveGetVMParameter: arg "See primitiveVMParameter method comment. N.B. written as a returning case to avoid branch limits in the V3 bytecode set." arg caseOf: { [1] -> [^self positiveMachineIntegerFor: objectMemory oldSpaceSize]. [2] -> [^objectMemory integerObjectOf: objectMemory newSpaceSize]. [3] -> [^self positiveMachineIntegerFor: objectMemory totalMemorySize]. [6] -> [^objectMemory integerObjectOf: objectMemory tenuringThreshold]. [7] -> [^objectMemory integerObjectOf: objectMemory statFullGCs]. [8] -> [^objectMemory integerObjectOf: objectMemory statFullGCUsecs + 500 // 1000]. [9] -> [^objectMemory integerObjectOf: (objectMemory hasSpurMemoryManagerAPI ifTrue: [objectMemory statScavenges] ifFalse: [objectMemory statIncrGCs])]. [10] -> [^objectMemory integerObjectOf: (objectMemory hasSpurMemoryManagerAPI ifTrue: [objectMemory statScavengeGCUsecs] ifFalse: [objectMemory statIncrGCUsecs]) + 500 // 1000]. [11] -> [^objectMemory integerObjectOf: objectMemory statTenures]. [12] -> [^ConstZero]. "Was JITTER VM info" [13] -> [^self getVMTickerStartUSecs]. [14] -> [^self getVMTickerCount]. [15] -> [^self getVMTickeeCallCount]. [16] -> [^self positive64BitIntegerFor: statIdleUsecs]. [17] -> [^(SistaVM and: [self isCog]) ifTrue: [objectMemory floatObjectOf: self getCogCodeZoneThreshold] ifFalse: [ConstZero]]. [18] -> [^objectMemory hasSpurMemoryManagerAPI ifTrue: [objectMemory integerObjectOf: objectMemory statCompactionUsecs + 500 // 1000] ifFalse: [ConstZero]]. [19] -> [^objectMemory hasSpurMemoryManagerAPI ifTrue: [objectMemory integerObjectOf: objectMemory scavengeThresholdAsExtent] ifFalse: [ConstZero]]. [20] -> [^objectMemory positive64BitIntegerFor: self ioUTCStartMicroseconds]. [21] -> [^objectMemory integerObjectOf: objectMemory rootTableCount]. [22] -> [^objectMemory integerObjectOf: objectMemory statRootTableOverflows]. [23] -> [^objectMemory integerObjectOf: extraVMMemory]. [24] -> [^objectMemory integerObjectOf: objectMemory shrinkThreshold]. [25] -> [^objectMemory integerObjectOf: objectMemory growHeadroom]. [26] -> [^objectMemory integerObjectOf: self ioHeartbeatMilliseconds]. [27] -> [^objectMemory integerObjectOf: objectMemory statMarkCount]. [28] -> [^objectMemory integerObjectOf: objectMemory statSweepCount]. [29] -> [^objectMemory integerObjectOf: objectMemory statMkFwdCount]. [30] -> [^objectMemory integerObjectOf: objectMemory statCompMoveCount]. [31] -> [^objectMemory integerObjectOf: objectMemory statGrowMemory]. [32] -> [^objectMemory integerObjectOf: objectMemory statShrinkMemory]. [33] -> [^objectMemory integerObjectOf: objectMemory statRootTableCount]. [34] -> [^objectMemory hasSpurMemoryManagerAPI ifTrue:"was statAllocationCount" [objectMemory positive64BitIntegerFor: objectMemory currentAllocatedBytes]]. [35] -> [^objectMemory integerObjectOf: objectMemory statSurvivorCount]. [36] -> [^objectMemory integerObjectOf: (self microsecondsToMilliseconds: objectMemory statGCEndUsecs)]. [37] -> [^objectMemory integerObjectOf: objectMemory statSpecialMarkCount]. [38] -> [^objectMemory integerObjectOf: objectMemory statIGCDeltaUsecs + 500 // 1000]. [39] -> [^objectMemory integerObjectOf: statPendingFinalizationSignals]. [40] -> [^objectMemory integerObjectOf: objectMemory wordSize]. [41] -> [^objectMemory integerObjectOf: self imageFormatVersion]. [42] -> [^objectMemory integerObjectOf: numStackPages]. [43] -> [^objectMemory integerObjectOf: desiredNumStackPages]. [44] -> [^objectMemory integerObjectOf: objectMemory edenBytes]. [45] -> [^objectMemory integerObjectOf: desiredEdenBytes]. [46] -> [^self getCogCodeSize]. [47] -> [^self getDesiredCogCodeSize]. + [48] -> [^self getImageHeaderFlagsParameter]. - [48] -> [^self getImageHeaderFlagsParameterObject]. [49] -> [^objectMemory integerObjectOf: self ioGetMaxExtSemTableSize]. [52] -> [^objectMemory integerObjectOf: objectMemory rootTableCapacity]. [53] -> [^objectMemory hasSpurMemoryManagerAPI ifTrue: [objectMemory integerObjectOf: objectMemory numSegments]]. [54] -> [^objectMemory hasSpurMemoryManagerAPI ifTrue: [objectMemory integerObjectOf: objectMemory freeSize]]. [55] -> [^objectMemory hasSpurMemoryManagerAPI ifTrue: [objectMemory floatObjectOf: objectMemory getHeapGrowthToSizeGCRatio]]. [56] -> [^self positive64BitIntegerFor: statProcessSwitch]. [57] -> [^self positive64BitIntegerFor: statIOProcessEvents]. [58] -> [^self positive64BitIntegerFor: statForceInterruptCheck]. [59] -> [^self positive64BitIntegerFor: statCheckForEvents]. [60] -> [^self positive64BitIntegerFor: statStackOverflow]. [61] -> [^self positive64BitIntegerFor: statStackPageDivorce]. [62] -> [^self getCodeCompactionCount]. [63] -> [^self getCodeCompactionMSecs]. [64] -> [^self getCogMethodCount]. [65] -> [^self getCogVMFeatureFlags]. [66] -> [^objectMemory integerObjectOf: self stackPageByteSize]. [67] -> [^objectMemory hasSpurMemoryManagerAPI ifTrue: [self positiveMachineIntegerFor: objectMemory maxOldSpaceSize]]. [68] -> [^objectMemory floatObjectOf: stackPages statAverageLivePagesWhenMapping]. [69] -> [^objectMemory integerObjectOf: stackPages statMaxPageCountWhenMapping]. [70] -> [^objectMemory integerObjectOf: self vmProxyMajorVersion]. [71] -> [^objectMemory integerObjectOf: self vmProxyMinorVersion]. [72] -> [^objectMemory integerObjectOf: objectMemory statMarkUsecs + 500 // 1000]. [73] -> [^objectMemory integerObjectOf: objectMemory statSweepUsecs + 500 // 1000]. [74] -> [^objectMemory hasSpurMemoryManagerAPI ifTrue: [objectMemory integerObjectOf: objectMemory statMaxAllocSegmentTime + 500 // 1000]]. [75] -> [^objectMemory booleanObjectOf: self primitiveDoMixedArithmetic] } otherwise: [^nil]! Item was changed: ----- Method: StackInterpreterPrimitives>>primitiveSetVMParameter:arg: (in category 'system control primitives') ----- primitiveSetVMParameter: index arg: argOop "See primitiveVMParameter method comment" | arg result | "argOop read & checks; in most cases this is an integer parameter. Handle the exceptions." index caseOf: { [17] -> [((objectMemory isFloatInstance: argOop) or: [objectMemory isIntegerObject: argOop]) ifFalse: [primFailCode := PrimErrBadArgument]]. [55] -> [((objectMemory isFloatInstance: argOop) or: [objectMemory isIntegerObject: argOop]) ifFalse: [primFailCode := PrimErrBadArgument]]. [68] -> [((objectMemory isFloatInstance: argOop) or: [objectMemory isIntegerObject: argOop]) ifFalse: [primFailCode := PrimErrBadArgument]]. [67] -> [arg := self positiveMachineIntegerValueOf: argOop]. [75] -> [arg := objectMemory booleanValueOf: argOop] } otherwise: [arg := objectMemory integerValueOf: argOop]. self failed ifTrue: [^self primitiveFailFor: PrimErrBadArgument]. "assume failure, then set success for handled indices" self primitiveFailFor: PrimErrBadArgument. index caseOf: { [5] -> [objectMemory hasSpurMemoryManagerAPI ifFalse: ["Was: result := allocationsBetweenGCs. allocationsBetweenGCs := arg." "Ignore for now, because old images won't start up otherwise. See 45 for eden size setting." result := objectMemory nilObject. self initPrimCall]]. [6] -> [result := objectMemory integerObjectOf: objectMemory tenuringThreshold. primFailCode := objectMemory tenuringThreshold: arg]. [11] -> [arg >= 0 ifTrue: [result := objectMemory integerObjectOf: objectMemory statTenures. objectMemory statTenures: arg. self initPrimCall]]. [17] -> [(SistaVM and: [self isCog]) ifTrue: [result := objectMemory floatObjectOf: self getCogCodeZoneThreshold. primFailCode := self setCogCodeZoneThreshold: (self noInlineLoadFloatOrIntFrom: argOop)]]. [23] -> [result := objectMemory integerObjectOf: extraVMMemory. extraVMMemory := arg. self initPrimCall]. [24] -> [arg > 0 ifTrue: [result := objectMemory integerObjectOf: objectMemory shrinkThreshold. objectMemory shrinkThreshold: arg. self initPrimCall]]. [25] -> [arg > 0 ifTrue: [result := objectMemory integerObjectOf: objectMemory growHeadroom. objectMemory growHeadroom: arg. self initPrimCall]]. [26] -> [arg >= 0 ifTrue: "0 turns off the heartbeat" [result := objectMemory integerObjectOf: self ioHeartbeatMilliseconds. self ioSetHeartbeatMilliseconds: arg. self initPrimCall]]. [34] -> [(objectMemory hasSpurMemoryManagerAPI "was statAllocationCount; now statAllocatedBytes" and: [arg >= 0]) ifTrue: [result := objectMemory positive64BitIntegerFor: objectMemory currentAllocatedBytes. objectMemory setCurrentAllocatedBytesTo: arg. self initPrimCall]]. [43] -> [(arg between: 0 and: 65535) ifTrue: [result := objectMemory integerObjectOf: desiredNumStackPages. desiredNumStackPages := arg. self initPrimCall]]. [45] -> [arg >= 0 ifTrue: [result := objectMemory integerObjectOf: desiredEdenBytes. desiredEdenBytes := arg. self initPrimCall]]. [47] -> [(self isCog and: [arg between: 0 and: self maxCogCodeSize]) ifTrue: [result := objectMemory integerObjectOf: self getDesiredCogCodeSize. self setDesiredCogCodeSize: arg. self initPrimCall]]. [48] -> [arg >= 0 ifTrue: [| oldPrimitiveDoMixedArithmetic | oldPrimitiveDoMixedArithmetic := primitiveDoMixedArithmetic. + result := self getImageHeaderFlagsParameter. - result := self getImageHeaderFlagsParameterObject. self initPrimCall. "i.e. setImageHeaderFlags: can fail" self setImageHeaderFlags: arg. (primFailCode = 0 and: [oldPrimitiveDoMixedArithmetic ~= primitiveDoMixedArithmetic]) ifTrue: [self flushMethodCache. self flushMethodsWithMachineCodePrimitivesAndContinueAnswering: result "NOT REACHED (in CoInterpreter)"]]]. [49] -> [(arg between: 0 and: 65535) ifTrue: [result := objectMemory integerObjectOf: self ioGetMaxExtSemTableSize. self initPrimCall. "i.e. ioSetMaxExtSemTableSize: is allowed to fail" self setMaxExtSemSizeTo: arg]]. [55] -> [objectMemory hasSpurMemoryManagerAPI ifTrue: [result := objectMemory floatObjectOf: objectMemory getHeapGrowthToSizeGCRatio. primFailCode := objectMemory setHeapGrowthToSizeGCRatio: (self noInlineLoadFloatOrIntFrom: argOop)]]. [67] -> [(arg >= 0 and: [objectMemory hasSpurMemoryManagerAPI]) ifTrue: [result := self positiveMachineIntegerFor: objectMemory maxOldSpaceSize. primFailCode := objectMemory setMaxOldSpaceSize: arg]]. [68] -> [result := objectMemory floatObjectOf: stackPages statAverageLivePagesWhenMapping. self initPrimCall. "i.e. statAverageLivePagesWhenMapping: is allowed to fail" stackPages statAverageLivePagesWhenMapping: (self noInlineLoadFloatOrIntFrom: argOop)]. [69] -> [arg >= 0 ifTrue: [result := objectMemory integerObjectOf: stackPages statMaxPageCountWhenMapping. stackPages statMaxPageCountWhenMapping: arg. self initPrimCall]]. [74] -> [(arg >= 0 and: [objectMemory hasSpurMemoryManagerAPI]) ifTrue: [result := objectMemory integerObjectOf: objectMemory statMaxAllocSegmentTime + 500 // 1000. stackPages statMaxAllocSegmentTime: arg. "usually 0" self initPrimCall]]. [75] -> [| mustFlush | result := objectMemory booleanObjectOf: self primitiveDoMixedArithmetic. self initPrimCall. mustFlush := primitiveDoMixedArithmetic ~= arg. primitiveDoMixedArithmetic := arg. mustFlush ifTrue: [self flushMethodCache. self flushMethodsWithMachineCodePrimitivesAndContinueAnswering: result "NOT REACHED (in CoInterpreter)"]] } otherwise: []. self successful ifTrue: [self methodReturnValue: result] "return old value" ifFalse: [self primitiveFailFor: PrimErrInappropriate] "attempting to write a read-only or non-existent parameter"! |
Free forum by Nabble | Edit this page |