[Vm-dev] VM Maker: VMMaker.oscog-eem.2837.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Oct 8 18:26:39 UTC 2020


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

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

Name: VMMaker.oscog-eem.2837
Author: eem
Time: 8 October 2020, 11:26:31.348674 am
UUID: 1585531f-f2b9-4ddc-b11c-668c69eca442
Ancestors: VMMaker.oscog-eem.2836

Rename CogVMFlags to ImageHeaderFlags.

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

Item was removed:
- ----- Method: CoInterpreter>>getCogVMFlags (in category 'internal interpreter access') -----
- getCogVMFlags
- 	"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: CoInterpreter>>getImageHeaderFlags (in category 'internal interpreter access') -----
- ----- Method: CoInterpreter>>getImageHeaderFlags (in category 'image save/restore') -----
  getImageHeaderFlags
+ 	"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)!
- 	"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"!

Item was removed:
- ----- Method: CoInterpreter>>setCogVMFlags: (in category 'internal interpreter access') -----
- setCogVMFlags: flags
- 	"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 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"
- 	flagInterpretedMethods := flags anyMask: 2.
- 	preemptionYields := flags noMask: 4.
- 	"noThreadingOfGUIThread := flags anyMask: 8.. specific to CoInterpreterMT"
- 	newFinalization := flags anyMask: 16.
- 	sendWheelEvents := flags anyMask: 32.
- 	primitiveDoMixedArithmetic := flags noMask: 64!

Item was added:
+ ----- Method: CoInterpreter>>setImageHeaderFlags: (in category 'internal interpreter access') -----
+ setImageHeaderFlags: flags
+ 	"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 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"
+ 	flagInterpretedMethods := flags anyMask: 2.
+ 	preemptionYields := flags noMask: 4.
+ 	"noThreadingOfGUIThread := flags anyMask: 8.. specific to CoInterpreterMT"
+ 	newFinalization := flags anyMask: 16.
+ 	sendWheelEvents := flags anyMask: 32.
+ 	primitiveDoMixedArithmetic := flags noMask: 64!

Item was removed:
- ----- Method: CoInterpreterMT>>getCogVMFlags (in category 'internal interpreter access') -----
- getCogVMFlags
- 	"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: CoInterpreterMT>>getImageHeaderFlags (in category 'internal interpreter access') -----
- ----- Method: CoInterpreterMT>>getImageHeaderFlags (in category 'image save/restore') -----
  getImageHeaderFlags
+ 	"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)!
- 	"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"!

Item was removed:
- ----- Method: CoInterpreterMT>>setCogVMFlags: (in category 'internal interpreter access') -----
- setCogVMFlags: flags
- 	"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 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 added:
+ ----- Method: CoInterpreterMT>>setImageHeaderFlags: (in category 'internal interpreter access') -----
+ setImageHeaderFlags: flags
+ 	"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 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 removed:
- ----- Method: CogVMSimulator>>getCogVMFlags (in category 'multi-threading simulation switch') -----
- getCogVMFlags
- 	"This method includes or excludes CoInterpreterMT methods as required.
- 	 Auto-generated by CogVMSimulator>>ensureMultiThreadingOverridesAreUpToDate"
- 
- 	^self perform: #getCogVMFlags
- 		withArguments: {}
- 		inSuperclass: (cogThreadManager ifNil: [CoInterpreterPrimitives] ifNotNil: [CoInterpreterMT])!

Item was changed:
  ----- Method: CogVMSimulator>>getImageHeaderFlags (in category 'multi-threading simulation switch') -----
  getImageHeaderFlags
  	"This method includes or excludes CoInterpreterMT methods as required.
  	 Auto-generated by CogVMSimulator>>ensureMultiThreadingOverridesAreUpToDate"
  
  	^self perform: #getImageHeaderFlags
  		withArguments: {}
  		inSuperclass: (cogThreadManager ifNil: [CoInterpreterPrimitives] ifNotNil: [CoInterpreterMT])!

Item was removed:
- ----- Method: CogVMSimulator>>setCogVMFlags: (in category 'multi-threading simulation switch') -----
- setCogVMFlags: flags
- 	"This method includes or excludes CoInterpreterMT methods as required.
- 	 Auto-generated by CogVMSimulator>>ensureMultiThreadingOverridesAreUpToDate"
- 
- 	^self perform: #setCogVMFlags:
- 		withArguments: {flags}
- 		inSuperclass: (cogThreadManager ifNil: [CoInterpreterPrimitives] ifNotNil: [CoInterpreterMT])!

Item was added:
+ ----- Method: CogVMSimulator>>setImageHeaderFlags: (in category 'multi-threading simulation switch') -----
+ setImageHeaderFlags: flags
+ 	"This method includes or excludes CoInterpreterMT methods as required.
+ 	 Auto-generated by CogVMSimulator>>ensureMultiThreadingOverridesAreUpToDate"
+ 
+ 	^self perform: #setImageHeaderFlags:
+ 		withArguments: {flags}
+ 		inSuperclass: (cogThreadManager ifNil: [CoInterpreterPrimitives] ifNotNil: [CoInterpreterMT])!

Item was removed:
- ----- Method: StackInterpreter>>getCogVMFlags (in category 'internal interpreter access') -----
- getCogVMFlags
- 	"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 changed:
+ ----- Method: StackInterpreter>>getImageHeaderFlags (in category 'internal interpreter access') -----
- ----- Method: StackInterpreter>>getImageHeaderFlags (in category 'image save/restore') -----
  getImageHeaderFlags
+ 	"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)!
- 	"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"!

Item was removed:
- ----- Method: StackInterpreter>>setCogVMFlags: (in category 'internal interpreter access') -----
- setCogVMFlags: flags
- 	"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 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"
- 	"flagInterpretedMethods := flags anyMask: 2. specific to CoInterpreter"
- 	preemptionYields := flags noMask: 4.
- 	"noThreadingOfGUIThread := flags anyMask: 8.. specific to CoInterpreterMT"
- 	newFinalization := flags anyMask: 16.
- 	sendWheelEvents := flags anyMask: 32.
- 	primitiveDoMixedArithmetic := flags noMask: 64!

Item was added:
+ ----- Method: StackInterpreter>>setImageHeaderFlags: (in category 'internal interpreter access') -----
+ setImageHeaderFlags: flags
+ 	"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 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"
+ 	"flagInterpretedMethods := flags anyMask: 2. specific to CoInterpreter"
+ 	preemptionYields := flags noMask: 4.
+ 	"noThreadingOfGUIThread := flags anyMask: 8.. specific to CoInterpreterMT"
+ 	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 getImageHeaderFlags].
- 			[48] ->	[^self getCogVMFlags].
  			[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 := objectMemory integerObjectOf: self getImageHeaderFlags.
+ 					 self initPrimCall. "i.e. setImageHeaderFlags: can fail"
+ 					 self setImageHeaderFlags: arg.
- 					 result := objectMemory integerObjectOf: self getCogVMFlags.
- 					 self initPrimCall. "i.e. setCogVMFlags: can fail"
- 					 self setCogVMFlags: 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"!

Item was changed:
  ----- Method: StackInterpreterPrimitives>>primitiveVMParameter (in category 'system control primitives') -----
  primitiveVMParameter
  	"Behaviour depends on argument count:
  		0 args:	return an Array of VM parameter values;
  		1 arg:	return the indicated VM parameter;
  		2 args:	set the VM indicated parameter.
  	VM parameters are numbered as follows:
  		1	end (v3)/size(Spur) of old-space (0-based, read-only)
  		2	end (v3)/size(Spur) of young/new-space (read-only)
  		3	end (v3)/size(Spur) of heap (read-only)
  		4	nil (was allocationCount (read-only))
  		5	nil (was allocations between GCs (read-write)
  		6	survivor count tenuring threshold (read-write)
  		7	full GCs since startup (read-only)
  		8	total milliseconds in full GCs since startup (read-only)
  		9	incremental GCs (SqueakV3) or scavenges (Spur) since startup (read-only)
  		10	total milliseconds in incremental GCs (SqueakV3) or scavenges (Spur) since startup (read-only)
  		11	tenures of surving objects since startup or reset (read-write)
  		12-20 were specific to ikp's JITTER VM, now 12 16 open for use
  		13	if started, the start time in utc microseconds of the high-priority ticker
  		14	if started, the number of checkHighPriorityTickees calls
  		15	if started, the number of tickee calls from checkHighPriorityTickees
  		16	total microseconds at idle since start-up (if non-zero)
  		17	fraction of the code zone to use (Sista only; used to control code zone use to preserve sendAndBranchData on counter tripped callback)
  		18	total milliseconds in compaction phase of full GC since start-up (Spur only)
  		19	scavenge threshold, the effective size of eden.  When eden fills to the threshold a scavenge is scheduled. Newer Spur VMs only.
  		20	utc microseconds at VM start-up (actually at time initialization, which precedes image load).
  		21	root/remembered table size (occupancy) (read-only)
  		22	root table overflows since startup (read-only)
  		23	bytes of extra memory to reserve for VM buffers, plugins, etc (stored in image file header).
  		24	memory threshold above which shrinking object memory (rw)
  		25	memory headroom when growing object memory (rw)
  		26	interruptChecksEveryNms - force an ioProcessEvents every N milliseconds (rw)
  		27	number of times mark loop iterated for current IGC/FGC (read-only) includes ALL marking
  		28	number of times sweep loop iterated for current IGC/FGC (read-only)
  		29	number of times make forward loop iterated for current IGC/FGC (read-only)
  		30	number of times compact move loop iterated for current IGC/FGC (read-only)
  		31	number of grow memory requests (read-only)
  		32	number of shrink memory requests (read-only)
  		33	number of root table entries used for current IGC/FGC (read-only)
  		34	Spur: bytes allocated in total since start-up or reset (read-write) (Used to be number of allocations done before current IGC/FGC (read-only))
  		35	number of survivor objects after current IGC/FGC (read-only)
  		36	millisecond clock when current IGC/FGC completed (read-only)
  		37	number of marked objects for Roots of the world, not including Root Table entries for current IGC/FGC (read-only)
  		38	milliseconds taken by current IGC (read-only)
  		39	Number of finalization signals for Weak Objects pending when current IGC/FGC completed (read-only)
  		40	BytesPerOop for this image
  		41	imageFormatVersion for the VM
  		42	number of stack pages in use
  		43	desired number of stack pages (stored in image file header, max 65535)
  		44	size of eden, in bytes
  		45	desired size of eden, in bytes (stored in image file header)
  		46	machine code zone size, in bytes (Cog only; otherwise nil)
  		47	desired machine code zone size (stored in image file header; Cog only; otherwise nil)
+ 		48	various header flags.  See getImageHeaderFlags.
- 		48	various header flags.  See getCogVMFlags.
  		49	max size the image promises to grow the external semaphore table to (0 sets to default, which is 256 as of writing)
  		50-51 nil; reserved for VM parameters that persist in the image (such as eden above)
  		52	root/remembered table capacity
  		53	number of segments (Spur only; otherwise nil)
  		54	total size of free old space (Spur only, otherwise nil)
  		55	ratio of growth and image size at or above which a GC will be performed post scavenge
  		56	number of process switches since startup (read-only)
  		57	number of ioProcessEvents calls since startup (read-only)
  		58	number of ForceInterruptCheck calls since startup (read-only)
  		59	number of check event calls since startup (read-only)
  		60	number of stack page overflows since startup (read-only)
  		61	number of stack page divorces since startup (read-only)
  		62	compiled code compactions since startup (read-only; Cog only; otherwise nil)
  		63	total milliseconds in compiled code compactions since startup (read-only; Cog only; otherwise nil)
  		64	the number of methods that currently have jitted machine-code
+ 		65	various VM feature flags; see getCogVMFeatureFlags
- 		65	whether the VM supports a certain feature, MULTIPLE_BYTECODE_SETS is bit 0, IMMUTABILITY is bit 1
  		66	the byte size of a stack page
  		67	the max allowed size of old space (Spur only; nil otherwise; 0 implies no limit except that of the underlying platform)
  		68	the average number of live stack pages when scanned by GC (at scavenge/gc/become et al) (read-write)
  		69	the maximum number of live stack pages when scanned by GC (at scavenge/gc/become et al) (read-write)
  		70	the vmProxyMajorVersion (the interpreterProxy VM_MAJOR_VERSION)
  		71	the vmProxyMinorVersion (the interpreterProxy VM_MINOR_VERSION)
  		72 total milliseconds in full GCs Mark phase since startup (read-only)
  		73 total milliseconds in full GCs Sweep phase since startup (read-only, can be 0 depending on compactors)
  		74 maximum pause time due to segment allocation
  		75 whether the arithmetic primitives perform conversion in case of mixed SmallInteger/Float (true) or fail (false)
  		
  	Note: Thanks to Ian Piumarta for this primitive."
  
  	| paramsArraySize index |
  	paramsArraySize := 75.
  	argumentCount = 0 ifTrue: [^self primitiveAllVMParameters: paramsArraySize].
  	argumentCount > 2 ifTrue: [^self primitiveFailFor: PrimErrBadNumArgs].
  	
  	"index read & checks"
  	index := self stackValue: (argumentCount = 1 ifTrue: [0] ifFalse: [1]).
  	(objectMemory isIntegerObject: index) ifFalse: [^self primitiveFailFor: PrimErrBadArgument].
  	index := objectMemory integerValueOf: index.
  	(index < 1 or: [index > paramsArraySize]) ifTrue: [^self primitiveFailFor: PrimErrBadIndex].
  	
  	argumentCount = 1 ifTrue:	 "read VM parameter; written this way to avoid branch limits in V3 bytecode set"
  		[| result |
  		 result := self primitiveGetVMParameter: index.
  		 ^self methodReturnValue: (result ifNil: [objectMemory nilObject])].
  
  	"write a VM parameter"
  	self primitiveSetVMParameter: index arg: self stackTop!




More information about the Vm-dev mailing list