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

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

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

Name: VMMaker.oscog-eem.2848
Author: eem
Time: 18 October 2020, 4:58:43.76798 pm
UUID: 4da3724d-ce00-461d-9420-2944dcbfd71a
Ancestors: VMMaker.oscog-eem.2847

Fix an awful regression introduced in VMMaker.oscog-eem.2837.  Have the setFullScreen fag also set the flag that is stored in the image header, hecne having the image start up as it was saved.

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

Item was changed:
+ ----- Method: CoInterpreter>>getImageHeaderFlags (in category 'image save/restore') -----
- ----- Method: CoInterpreter>>getImageHeaderFlags (in category 'internal interpreter access') -----
  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: 16r1DB) "these are any flags we do not recognize"!
- "Answer an array of flags indicating various properties of the Cog VM.
- These are the same as the image header flags shifted right two bits (excluding float order and full screen flags).
- Bit 0: specific to CoInterpreterMT
- 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: specific to CoInterpreterMT
- 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)"
- ^objectMemory integerObjectOf: (flagInterpretedMethods ifTrue: [2] ifFalse: [0])
- + (preemptionYields ifTrue: [0] ifFalse: [4])
- + (newFinalization ifTrue: [16] ifFalse: [0])
- + (sendWheelEvents ifTrue: [32] ifFalse: [0])
- + (primitiveDoMixedArithmetic ifTrue: [0] ifFalse: [64])
- + (imageHeaderFlags >> 2 bitClear: 2 + 4 + 16 + 32 + 64)!

Item was changed:
+ ----- Method: CoInterpreterMT>>getImageHeaderFlags (in category 'image save/restore') -----
- ----- Method: CoInterpreterMT>>getImageHeaderFlags (in category 'internal interpreter access') -----
  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"
+ + (processHasThreadId ifTrue: [4] ifFalse: [0])
+ + (flagInterpretedMethods ifTrue: [8] ifFalse: [0])
+ + (preemptionYields ifTrue: [0] ifFalse: [16r10])
+ + (noThreadingOfGUIThread ifTrue: [16r20] ifFalse: [0])
+ + (newFinalization ifTrue: [16r40] ifFalse: [0])
+ + (sendWheelEvents ifTrue: [16r80] ifFalse: [0])
+ + (primitiveDoMixedArithmetic ifTrue: [0] ifFalse: [16r100])
+ + (imageHeaderFlags bitClear: 16r1FF) "these are any flags we do not recognize"!
- "Answer an array of flags indicating various properties of the Cog VM.
- These are the same as the image header flags shifted right two bits (excluding float order and full screen flags).
- Bit 0: 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 the GUI will run on the first thread and event queues will not be accessed from other threads
- 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)"
- ^objectMemory integerObjectOf: (processHasThreadId ifTrue: [1] ifFalse: [0])
- + (flagInterpretedMethods ifTrue: [2] ifFalse: [0])
- + (preemptionYields ifTrue: [0] ifFalse: [4])
- + (noThreadingOfGUIThread ifTrue: [8] ifFalse: [0])
- + (newFinalization ifTrue: [16] ifFalse: [0])
- + (sendWheelEvents ifTrue: [32] ifFalse: [0])
- + (primitiveDoMixedArithmetic ifTrue: [0] ifFalse: [64])
- + (imageHeaderFlags >> 2 bitClear: 1 + 2 + 4 + 8 + 16 + 32 + 64)!

Item was changed:
  ----- Method: InterpreterPrimitives>>primitiveSetFullScreen (in category 'I/O primitives') -----
  primitiveSetFullScreen
  "On platforms that support it, set full-screen mode to the value of the boolean argument."
 
  | argOop |
  argOop := self stackTop.
  argOop = objectMemory trueObject
+ ifTrue:
+ [self ioSetFullScreen: true]
+ ifFalse:
+ [argOop = objectMemory falseObject
- ifTrue: [self ioSetFullScreen: true]
- ifFalse: [ argOop = objectMemory falseObject
  ifTrue: [self ioSetFullScreen: false]
  ifFalse: [self primitiveFail]].
+ self successful ifTrue:
+ [self setFullScreenFlag: argOop = objectMemory trueObject.
+ self methodReturnReceiver]!
- self successful ifTrue: [self pop: 1]!

Item was added:
+ ----- Method: InterpreterPrimitives>>setFullScreenFlag: (in category 'plugin primitive support') -----
+ setFullScreenFlag: value
+ "stub for overriding by the interpeter"!

Item was changed:
+ ----- Method: StackInterpreter>>getImageHeaderFlags (in category 'image save/restore') -----
- ----- Method: StackInterpreter>>getImageHeaderFlags (in category 'internal interpreter access') -----
  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: 16r1D3) "these are any flags we do not recognize"!
- "Answer an array of flags indicating various properties of the Cog VM.
- These are the same as the image header flags shifted right two bits (excluding float order and full screen flags).
- Bit 0: specific to CoInterpreterMT
- Bit 1: specific to CoInterpreter
- Bit 2: if set, implies preempting a process does not put it to the back of its run queue
- Bit 3: specific to CoInterpreterMT
- 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)"
- ^objectMemory integerObjectOf: (preemptionYields ifTrue: [0] ifFalse: [4])
- + (newFinalization ifTrue: [16] ifFalse: [0])
- + (sendWheelEvents ifTrue: [32] ifFalse: [0])
- + (primitiveDoMixedArithmetic ifTrue: [0] ifFalse: [64])
- + (imageHeaderFlags >> 2 bitClear: 4 + 16 + 32 + 64)!

Item was added:
+ ----- 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: 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 getImageHeaderFlagsParameterObject].
- [48] -> [^self getImageHeaderFlags].
  [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 getImageHeaderFlagsParameterObject.
- result := objectMemory integerObjectOf: self getImageHeaderFlags.
  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"!