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

commits at source.squeak.org commits at source.squeak.org
Sun Nov 21 06:28:50 UTC 2021


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

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

Name: VMMaker.oscog-eem.3103
Author: eem
Time: 20 November 2021, 10:28:32.93554 pm
UUID: bb290580-b6e4-4b61-9b09-646e111025de
Ancestors: VMMaker.oscog-eem.3102

SpurMemoryManager simulation:
Implement a null pointer trap by not including the first word in simulated memory.  So instead of adding one to the reduced memory address in SpurNNBitMMLE[Co]Sim,ulator???>>longAt:[put:] et al, just divide by the word size.  Hence 0 to wordSize - 1 map to zero, which is an invalid index.

This has pervasive effects in the surrogate classes.  So refactor them, adding a new class CogSurrogate. Implement their code generators in the CogSurrogate hierarchy, invoked from the relevant classes in the VMStructType hierarchy.  Have these surrogates access memory via objectMemory, rather than accessing an objectMemory's memory directly.  This implies signed/unsigned conversions in places.

Although this is an enormous amount of work for a little change, it is worth it.  Thie simulator has been missing null pointer references for ever.  Not good ;-).  And at least we get rid of the horrible little CogitFaker class which was used only to check the location of the cpicHasMNUCaseOrCMIsFullBlock flag bit.

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

Item was changed:
  SystemOrganization addCategory: #'VMMaker-Building'!
  SystemOrganization addCategory: #'VMMaker-Interpreter'!
  SystemOrganization addCategory: #'VMMaker-InterpreterSimulation'!
  SystemOrganization addCategory: #'VMMaker-JIT'!
  SystemOrganization addCategory: #'VMMaker-JITSimulation'!
  SystemOrganization addCategory: #'VMMaker-Multithreading'!
  SystemOrganization addCategory: #'VMMaker-Plugins'!
  SystemOrganization addCategory: #'VMMaker-Plugins-FFI'!
  SystemOrganization addCategory: #'VMMaker-Plugins-IOS'!
  SystemOrganization addCategory: #'VMMaker-PostProcessing'!
  SystemOrganization addCategory: #'VMMaker-SmartSyntaxPlugins'!
  SystemOrganization addCategory: #'VMMaker-SpurMemoryManager'!
  SystemOrganization addCategory: #'VMMaker-SpurMemoryManagerSimulation'!
  SystemOrganization addCategory: #'VMMaker-Support'!
  SystemOrganization addCategory: #'VMMaker-Tests'!
  SystemOrganization addCategory: #'VMMaker-Translation to C'!
  SystemOrganization addCategory: #'VMMaker-Utilities'!
- SystemOrganization addCategory: #'VMMaker-JIT-Simulation'!

Item was removed:
- ----- Method: CogBlockMethodSurrogate32>>cmIsUnlinked (in category 'accessing generated') -----
- cmIsUnlinked
- 	^(((memory unsignedByteAt: address + 6) bitShift: -4) bitAnd: 16r1) ~= 0!

Item was removed:
- ----- Method: CogBlockMethodSurrogate32>>cmIsUnlinked: (in category 'accessing generated') -----
- cmIsUnlinked: aValue
- 	memory
- 		unsignedByteAt: address + 6
- 		put: (((memory unsignedByteAt: address + 6) bitAnd: 16rEF) + ((aValue ifTrue: [1] ifFalse: [0]) bitShift: 4)).
- 	^aValue!

Item was changed:
  ----- Method: CogBlockMethodSurrogate32>>padToWord (in category 'accessing generated') -----
  padToWord
+ 	^objectMemory long32At: address + 4!
- 	^memory unsignedLongAt: address + 5!

Item was changed:
  ----- Method: CogBlockMethodSurrogate32>>padToWord: (in category 'accessing generated') -----
  padToWord: aValue
  	
  	| index delta |
+ 	index := address + 4.
- 	index := address + 5.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
- 		 memory
- 			unsignedLongAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: index
  		put: aValue!

Item was removed:
- ----- Method: CogBlockMethodSurrogate64>>cmIsUnlinked (in category 'accessing generated') -----
- cmIsUnlinked
- 	^(((memory unsignedByteAt: address + 10) bitShift: -4) bitAnd: 16r1) ~= 0!

Item was removed:
- ----- Method: CogBlockMethodSurrogate64>>cmIsUnlinked: (in category 'accessing generated') -----
- cmIsUnlinked: aValue
- 	memory
- 		unsignedByteAt: address + 10
- 		put: (((memory unsignedByteAt: address + 10) bitAnd: 16rEF) + ((aValue ifTrue: [1] ifFalse: [0]) bitShift: 4)).
- 	^aValue!

Item was changed:
  ----- Method: CogBlockMethodSurrogate64>>padToWord (in category 'accessing generated') -----
  padToWord
+ 	^objectMemory long64At: address + 4!
- 	^memory unsignedLong64At: address + 5!

Item was changed:
  ----- Method: CogBlockMethodSurrogate64>>padToWord: (in category 'accessing generated') -----
  padToWord: aValue
  	
  	| index delta |
+ 	index := address + 4.
- 	index := address + 5.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
- 		 memory
- 			unsignedLong64At: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: index
  		put: aValue!

Item was changed:
+ CogSurrogate subclass: #CogMethodSurrogate
+ 	instanceVariableNames: 'baseHeaderSize'
- VMClass subclass: #CogMethodSurrogate
- 	instanceVariableNames: 'address memory baseHeaderSize cogit'
  	classVariableNames: ''
  	poolDictionaries: 'CogMethodConstants VMBytecodeConstants'
  	category: 'VMMaker-JITSimulation'!
+ 
+ !CogMethodSurrogate commentStamp: 'eem 11/20/2021 12:02' prior: 0!
+ A CogMethodSurrogate is an emulation of the in-memory structs that are used for the header of methods, in-lined block methods, and pics.
+ 
+ Instance Variables
+ 	address:	<Integer>
+ 	offset:		<Integer>
+ 	cogit:		<SimpleStackBasedCogit>
+ 	memory:	<Bitmap|LittleEndianBitmap|DoubleWordArray>
+ 
+ address
+ 	- the address in memory of the start of the struct
+ 
+ offset
+ 	- an offset to be added to the address so that it can adapt to object header sizes, and SpurMemoryManager's memoryOffset
+ 
+ cogit
+ 	- the instance of SimpleStackBasedCogit or subclass that created this surrogate
+ 
+ memory
+ 	- the cogit's objectMemory's memory array, which is accessed directly!

Item was added:
+ ----- Method: CogMethodSurrogate>>at:cogit:objectMemory: (in category 'instance initialization') -----
+ at: anAddress cogit: aCogit objectMemory: anObjectMemory
+ 	super at: anAddress cogit: aCogit objectMemory: anObjectMemory.
+ 	baseHeaderSize := anObjectMemory baseHeaderSize!

Item was removed:
- ----- Method: CogMethodSurrogate>>at:memory:headerSize:cogit: (in category 'instance initialization') -----
- at: anAddress memory: memoryArray headerSize: headerSize cogit: aCogit
- 	address := anAddress.
- 	memory := memoryArray.
- 	baseHeaderSize := headerSize.
- 	cogit := aCogit!

Item was removed:
- ----- Method: CogMethodSurrogate>>at:objectMemory:cogit: (in category 'instance initialization') -----
- at: anAddress objectMemory: objectMemory cogit: aCogit
- 	address := anAddress.
- 	memory := objectMemory memory.
- 	baseHeaderSize := objectMemory baseHeaderSize.
- 	cogit := aCogit!

Item was changed:
  ----- Method: CogMethodSurrogate>>cbUsesInstVars (in category 'accessing generated') -----
  cbUsesInstVars
+ 	<bitPosition: 17 width: 1>
+ 	^(((objectMemory byteAt: address + 2 + baseHeaderSize) bitShift: -1) bitAnd: 16r1) ~= 0!
- 	^(((memory unsignedByteAt: address + 3 + baseHeaderSize) bitShift: -1) bitAnd: 16r1) ~= 0!

Item was changed:
  ----- Method: CogMethodSurrogate>>cbUsesInstVars: (in category 'accessing generated') -----
  cbUsesInstVars: aValue
  	
  	| index delta |
+ 	index := address + 2 + baseHeaderSize.
- 	index := address + baseHeaderSize + 3.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rFD) + (aValue ifTrue: [2] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rFD) + (aValue ifTrue: [2] ifFalse: [0])).
- 		 memory
- 			unsignedByteAt: index - delta
- 			put: (((memory unsignedByteAt: index - delta) bitAnd: 16rFD) + (aValue ifTrue: [2] ifFalse: [0]))].
- 	memory
- 		unsignedByteAt: index
- 		put: (((memory unsignedByteAt: index) bitAnd: 16rFD) + (aValue ifTrue: [2] ifFalse: [0])).
  	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmHasMovableLiteral (in category 'accessing generated') -----
  cmHasMovableLiteral
+ 	<bitPosition: 18 width: 1>
+ 	^(((objectMemory byteAt: address + 2 + baseHeaderSize) bitShift: -2) bitAnd: 16r1) ~= 0!
- 	^(((memory unsignedByteAt: address + 3 + baseHeaderSize) bitShift: -2) bitAnd: 16r1) ~= 0!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmHasMovableLiteral: (in category 'accessing generated') -----
  cmHasMovableLiteral: aValue
  	
  	| index delta |
+ 	index := address + 2 + baseHeaderSize.
- 	index := address + baseHeaderSize + 3.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rFB) + (aValue ifTrue: [4] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rFB) + (aValue ifTrue: [4] ifFalse: [0])).
- 		 memory
- 			unsignedByteAt: index - delta
- 			put: (((memory unsignedByteAt: index - delta) bitAnd: 16rFB) + (aValue ifTrue: [4] ifFalse: [0]))].
- 	memory
- 		unsignedByteAt: index
- 		put: (((memory unsignedByteAt: index) bitAnd: 16rFB) + (aValue ifTrue: [4] ifFalse: [0])).
  	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmNumArgs (in category 'accessing generated') -----
  cmNumArgs
+ 	<bitPosition: 0 width: 8>
+ 	^objectMemory byteAt: address + baseHeaderSize!
- 	^memory unsignedByteAt: address + 1 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmNumArgs: (in category 'accessing generated') -----
  cmNumArgs: aValue
  	
  	| index delta |
+ 	index := address + baseHeaderSize.
- 	index := address + baseHeaderSize + 1.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
- 		 memory
- 			unsignedByteAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		byteAt: index
- 	^memory
- 		unsignedByteAt: index
  		put: aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmRefersToYoung (in category 'accessing generated') -----
  cmRefersToYoung
+ 	<bitPosition: 11 width: 1>
+ 	^(((objectMemory byteAt: address + 1 + baseHeaderSize) bitShift: -3) bitAnd: 16r1) ~= 0!
- 	^(((memory unsignedByteAt: address + 2 + baseHeaderSize) bitShift: -3) bitAnd: 16r1) ~= 0!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmRefersToYoung: (in category 'accessing generated') -----
  cmRefersToYoung: aValue
  	
  	| index delta |
+ 	index := address + 1 + baseHeaderSize.
- 	index := address + baseHeaderSize + 2.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rF7) + (aValue ifTrue: [8] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rF7) + (aValue ifTrue: [8] ifFalse: [0])).
- 		 memory
- 			unsignedByteAt: index - delta
- 			put: (((memory unsignedByteAt: index - delta) bitAnd: 16rF7) + (aValue ifTrue: [8] ifFalse: [0]))].
- 	memory
- 		unsignedByteAt: index
- 		put: (((memory unsignedByteAt: index) bitAnd: 16rF7) + (aValue ifTrue: [8] ifFalse: [0])).
  	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmType (in category 'accessing generated') -----
  cmType
+ 	<bitPosition: 8 width: 3>
+ 	^(objectMemory byteAt: address + 1 + baseHeaderSize) bitAnd: 16r7!
- 	^(memory unsignedByteAt: address + 2 + baseHeaderSize) bitAnd: 16r7!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmType: (in category 'accessing generated') -----
  cmType: aValue
  	
  	| index delta |
+ 	index := address + 1 + baseHeaderSize.
- 	index := address + baseHeaderSize + 2.
  	self assert: (aValue between: 0 and: 16r7).
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: ((objectMemory byteAt: index - delta) bitAnd: 16rF8) + aValue].
+ 	objectMemory
+ 		byteAt: index
+ 		put: ((objectMemory byteAt: index) bitAnd: 16rF8) + aValue.
- 		 memory
- 			unsignedByteAt: index - delta
- 			put: ((memory unsignedByteAt: index - delta) bitAnd: 16rF8) + aValue].
- 	memory
- 		unsignedByteAt: index
- 		put: ((memory unsignedByteAt: index) bitAnd: 16rF8) + aValue.
  	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmUsageCount (in category 'accessing generated') -----
  cmUsageCount
+ 	<bitPosition: 13 width: 3>
+ 	^((objectMemory byteAt: address + 1 + baseHeaderSize) bitShift: -5) bitAnd: 16r7!
- 	^((memory unsignedByteAt: address + 2 + baseHeaderSize) bitShift: -5) bitAnd: 16r7!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmUsageCount: (in category 'accessing generated') -----
  cmUsageCount: aValue
  	
  	| index delta |
+ 	index := address + 1 + baseHeaderSize.
- 	index := address + baseHeaderSize + 2.
  	self assert: (aValue between: 0 and: 16r7).
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: ((objectMemory byteAt: index - delta) bitAnd: 16r1F) + (aValue bitShift: 5)].
+ 	objectMemory
+ 		byteAt: index
+ 		put: ((objectMemory byteAt: index) bitAnd: 16r1F) + (aValue bitShift: 5).
- 		 memory
- 			unsignedByteAt: index - delta
- 			put: ((memory unsignedByteAt: index - delta) bitAnd: 16r1F) + (aValue bitShift: 5)].
- 	memory
- 		unsignedByteAt: index
- 		put: ((memory unsignedByteAt: index) bitAnd: 16r1F) + (aValue bitShift: 5).
  	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmUsesPenultimateLit (in category 'accessing generated') -----
  cmUsesPenultimateLit
+ 	<bitPosition: 16 width: 1>
+ 	^((objectMemory byteAt: address + 2 + baseHeaderSize) bitAnd: 16r1) ~= 0!
- 	^((memory unsignedByteAt: address + 3 + baseHeaderSize) bitAnd: 16r1) ~= 0!

Item was changed:
  ----- Method: CogMethodSurrogate>>cmUsesPenultimateLit: (in category 'accessing generated') -----
  cmUsesPenultimateLit: aValue
  	
  	| index delta |
+ 	index := address + 2 + baseHeaderSize.
- 	index := address + baseHeaderSize + 3.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rFE) + (aValue ifTrue: [1] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rFE) + (aValue ifTrue: [1] ifFalse: [0])).
- 		 memory
- 			unsignedByteAt: index - delta
- 			put: (((memory unsignedByteAt: index - delta) bitAnd: 16rFE) + (aValue ifTrue: [1] ifFalse: [0]))].
- 	memory
- 		unsignedByteAt: index
- 		put: (((memory unsignedByteAt: index) bitAnd: 16rFE) + (aValue ifTrue: [1] ifFalse: [0])).
  	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>cpicHasMNUCaseOrCMIsFullBlock (in category 'accessing generated') -----
  cpicHasMNUCaseOrCMIsFullBlock
+ 	<bitPosition: 12 width: 1>
+ 	^(((objectMemory byteAt: address + 1 + baseHeaderSize) bitShift: -4) bitAnd: 16r1) ~= 0!
- 	^(((memory unsignedByteAt: address + 2 + baseHeaderSize) bitShift: -4) bitAnd: 16r1) ~= 0!

Item was changed:
  ----- Method: CogMethodSurrogate>>cpicHasMNUCaseOrCMIsFullBlock: (in category 'accessing generated') -----
  cpicHasMNUCaseOrCMIsFullBlock: aValue
  	
  	| index delta |
+ 	index := address + 1 + baseHeaderSize.
- 	index := address + baseHeaderSize + 2.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rEF) + (aValue ifTrue: [16] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rEF) + (aValue ifTrue: [16] ifFalse: [0])).
- 		 memory
- 			unsignedByteAt: index - delta
- 			put: (((memory unsignedByteAt: index - delta) bitAnd: 16rEF) + (aValue ifTrue: [16] ifFalse: [0]))].
- 	memory
- 		unsignedByteAt: index
- 		put: (((memory unsignedByteAt: index) bitAnd: 16rEF) + (aValue ifTrue: [16] ifFalse: [0])).
  	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>homeOffset (in category 'accessing generated') -----
  homeOffset
+ 	<bitPosition: 0 width: 16>
+ 	^objectMemory shortAt: address!
- 	^memory unsignedShortAt: address + 1!

Item was changed:
  ----- Method: CogMethodSurrogate>>homeOffset: (in category 'accessing generated') -----
  homeOffset: aValue
  	
  	| index delta |
+ 	index := address.
- 	index := address + 1.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			shortAt: index - delta
- 		 memory
- 			unsignedShortAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		shortAt: index
- 	^memory
- 		unsignedShortAt: index
  		put: aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>objectHeader (in category 'accessing') -----
  objectHeader
  	"N.B. This *must* be signed.  We use it for relocation when compacting the code zone."
  	^baseHeaderSize = 8
+ 		ifTrue: [(objectMemory long64At: address) signedIntFromLong64]
+ 		ifFalse: [(objectMemory longAt: address) signedIntFromLong]!
- 		ifTrue: [memory long64At: address + 1]
- 		ifFalse: [memory longAt: address + 1]!

Item was changed:
  ----- Method: CogMethodSurrogate>>objectHeader: (in category 'accessing') -----
  objectHeader: aValue
  	| delta |
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
  		 baseHeaderSize = 8
+ 			ifTrue: [objectMemory long64At: address - delta put: aValue signedIntToLong64]
+ 			ifFalse: [objectMemory longAt: address - delta put: aValue signedIntToLong]].
+ 	baseHeaderSize = 8
+ 		ifTrue: [objectMemory long64At: address put: aValue signedIntToLong64]
+ 		ifFalse: [objectMemory longAt: address put: aValue signedIntToLong].
+ 	^aValue!
- 			ifTrue: [memory long64At: address - delta + 1 put: aValue]
- 			ifFalse: [memory longAt: address - delta + 1 put: aValue]].
- 	^baseHeaderSize = 8
- 		ifTrue: [memory long64At: address + 1 put: aValue]
- 		ifFalse: [memory longAt: address + 1 put: aValue]!

Item was changed:
  ----- Method: CogMethodSurrogate>>stackCheckOffset (in category 'accessing generated') -----
  stackCheckOffset
+ 	<bitPosition: 20 width: 12>
+ 	^((objectMemory shortAt: address + 2 + baseHeaderSize) bitShift: -4) bitAnd: 16rFFF!
- 	^((memory unsignedShortAt: address + 3 + baseHeaderSize) bitShift: -4) bitAnd: 16rFFF!

Item was changed:
  ----- Method: CogMethodSurrogate>>stackCheckOffset: (in category 'accessing generated') -----
  stackCheckOffset: aValue
  	
  	| index delta |
+ 	index := address + 2 + baseHeaderSize.
- 	index := address + baseHeaderSize + 3.
  	self assert: (aValue between: 0 and: 16rFFF).
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			shortAt: index - delta
+ 			put: ((objectMemory shortAt: index - delta) bitAnd: 16rF) + (aValue bitShift: 4)].
+ 	objectMemory
+ 		shortAt: index
+ 		put: ((objectMemory shortAt: index) bitAnd: 16rF) + (aValue bitShift: 4).
- 		 memory
- 			unsignedShortAt: index - delta
- 			put: ((memory unsignedShortAt: index - delta) bitAnd: 16rF) + (aValue bitShift: 4)].
- 	memory
- 		unsignedShortAt: index
- 		put: ((memory unsignedShortAt: index) bitAnd: 16rF) + (aValue bitShift: 4).
  	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate>>startpc (in category 'accessing generated') -----
  startpc
+ 	<bitPosition: 16 width: 16>
+ 	^objectMemory shortAt: address + 2!
- 	^memory unsignedShortAt: address + 3!

Item was changed:
  ----- Method: CogMethodSurrogate>>startpc: (in category 'accessing generated') -----
  startpc: aValue
  	
  	| index delta |
+ 	index := address + 2.
- 	index := address + 3.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			shortAt: index - delta
- 		 memory
- 			unsignedShortAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		shortAt: index
- 	^memory
- 		unsignedShortAt: index
  		put: aValue!

Item was changed:
  ----- Method: CogMethodSurrogate32>>blockEntryOffset (in category 'accessing generated') -----
  blockEntryOffset
+ 	<bitPosition: 48 width: 16>
+ 	^objectMemory shortAt: address + 6 + baseHeaderSize!
- 	^memory unsignedShortAt: address + 7 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate32>>blockEntryOffset: (in category 'accessing generated') -----
  blockEntryOffset: aValue
  	
  	| index delta |
+ 	index := address + 6 + baseHeaderSize.
- 	index := address + baseHeaderSize + 7.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			shortAt: index - delta
- 		 memory
- 			unsignedShortAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		shortAt: index
- 	^memory
- 		unsignedShortAt: index
  		put: aValue!

Item was changed:
  ----- Method: CogMethodSurrogate32>>blockSize (in category 'accessing generated') -----
  blockSize
+ 	<bitPosition: 32 width: 16>
+ 	^objectMemory shortAt: address + 4 + baseHeaderSize!
- 	^memory unsignedShortAt: address + 5 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate32>>blockSize: (in category 'accessing generated') -----
  blockSize: aValue
  	
  	| index delta |
+ 	index := address + 4 + baseHeaderSize.
- 	index := address + baseHeaderSize + 5.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			shortAt: index - delta
- 		 memory
- 			unsignedShortAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		shortAt: index
- 	^memory
- 		unsignedShortAt: index
  		put: aValue!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cbUsesInstVars (in category 'accessing generated') -----
+ cbUsesInstVars
+ 	<bitPosition: 17 width: 1>
+ 	^(((objectMemory byteAt: address + 2 + baseHeaderSize) bitShift: -1) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cbUsesInstVars: (in category 'accessing generated') -----
+ cbUsesInstVars: aValue
+ 	
+ 	| index delta |
+ 	index := address + 2 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rFD) + (aValue ifTrue: [2] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rFD) + (aValue ifTrue: [2] ifFalse: [0])).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmHasMovableLiteral (in category 'accessing generated') -----
+ cmHasMovableLiteral
+ 	<bitPosition: 18 width: 1>
+ 	^(((objectMemory byteAt: address + 2 + baseHeaderSize) bitShift: -2) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmHasMovableLiteral: (in category 'accessing generated') -----
+ cmHasMovableLiteral: aValue
+ 	
+ 	| index delta |
+ 	index := address + 2 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rFB) + (aValue ifTrue: [4] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rFB) + (aValue ifTrue: [4] ifFalse: [0])).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmNumArgs (in category 'accessing generated') -----
+ cmNumArgs
+ 	<bitPosition: 0 width: 8>
+ 	^objectMemory byteAt: address + baseHeaderSize!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmNumArgs: (in category 'accessing generated') -----
+ cmNumArgs: aValue
+ 	
+ 	| index delta |
+ 	index := address + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		byteAt: index
+ 		put: aValue!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmRefersToYoung (in category 'accessing generated') -----
+ cmRefersToYoung
+ 	<bitPosition: 11 width: 1>
+ 	^(((objectMemory byteAt: address + 1 + baseHeaderSize) bitShift: -3) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmRefersToYoung: (in category 'accessing generated') -----
+ cmRefersToYoung: aValue
+ 	
+ 	| index delta |
+ 	index := address + 1 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rF7) + (aValue ifTrue: [8] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rF7) + (aValue ifTrue: [8] ifFalse: [0])).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmType (in category 'accessing generated') -----
+ cmType
+ 	<bitPosition: 8 width: 3>
+ 	^(objectMemory byteAt: address + 1 + baseHeaderSize) bitAnd: 16r7!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmType: (in category 'accessing generated') -----
+ cmType: aValue
+ 	
+ 	| index delta |
+ 	index := address + 1 + baseHeaderSize.
+ 	self assert: (aValue between: 0 and: 16r7).
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: ((objectMemory byteAt: index - delta) bitAnd: 16rF8) + aValue].
+ 	objectMemory
+ 		byteAt: index
+ 		put: ((objectMemory byteAt: index) bitAnd: 16rF8) + aValue.
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmUsageCount (in category 'accessing generated') -----
+ cmUsageCount
+ 	<bitPosition: 13 width: 3>
+ 	^((objectMemory byteAt: address + 1 + baseHeaderSize) bitShift: -5) bitAnd: 16r7!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmUsageCount: (in category 'accessing generated') -----
+ cmUsageCount: aValue
+ 	
+ 	| index delta |
+ 	index := address + 1 + baseHeaderSize.
+ 	self assert: (aValue between: 0 and: 16r7).
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: ((objectMemory byteAt: index - delta) bitAnd: 16r1F) + (aValue bitShift: 5)].
+ 	objectMemory
+ 		byteAt: index
+ 		put: ((objectMemory byteAt: index) bitAnd: 16r1F) + (aValue bitShift: 5).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmUsesPenultimateLit (in category 'accessing generated') -----
+ cmUsesPenultimateLit
+ 	<bitPosition: 16 width: 1>
+ 	^((objectMemory byteAt: address + 2 + baseHeaderSize) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cmUsesPenultimateLit: (in category 'accessing generated') -----
+ cmUsesPenultimateLit: aValue
+ 	
+ 	| index delta |
+ 	index := address + 2 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rFE) + (aValue ifTrue: [1] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rFE) + (aValue ifTrue: [1] ifFalse: [0])).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cpicHasMNUCaseOrCMIsFullBlock (in category 'accessing generated') -----
+ cpicHasMNUCaseOrCMIsFullBlock
+ 	<bitPosition: 12 width: 1>
+ 	^(((objectMemory byteAt: address + 1 + baseHeaderSize) bitShift: -4) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate32>>cpicHasMNUCaseOrCMIsFullBlock: (in category 'accessing generated') -----
+ cpicHasMNUCaseOrCMIsFullBlock: aValue
+ 	
+ 	| index delta |
+ 	index := address + 1 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rEF) + (aValue ifTrue: [16] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rEF) + (aValue ifTrue: [16] ifFalse: [0])).
+ 	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate32>>methodHeader (in category 'accessing generated') -----
  methodHeader
+ 	^objectMemory long32At: address + 12 + baseHeaderSize!
- 	^memory unsignedLongAt: address + 13 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate32>>methodHeader: (in category 'accessing generated') -----
  methodHeader: aValue
  	
  	| index delta |
+ 	index := address + 12 + baseHeaderSize.
- 	index := address + baseHeaderSize + 13.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
- 		 memory
- 			unsignedLongAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: index
  		put: aValue!

Item was changed:
  ----- Method: CogMethodSurrogate32>>methodObject (in category 'accessing generated') -----
  methodObject
+ 	^objectMemory long32At: address + 8 + baseHeaderSize!
- 	^memory unsignedLongAt: address + 9 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate32>>methodObject: (in category 'accessing generated') -----
  methodObject: aValue
  	
  	| index delta |
+ 	index := address + 8 + baseHeaderSize.
- 	index := address + baseHeaderSize + 9.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
- 		 memory
- 			unsignedLongAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: index
  		put: aValue!

Item was changed:
  ----- Method: CogMethodSurrogate32>>selector (in category 'accessing generated') -----
  selector
+ 	^objectMemory long32At: address + 16 + baseHeaderSize!
- 	^memory unsignedLongAt: address + 17 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate32>>selector: (in category 'accessing generated') -----
  selector: aValue
  	
  	| index delta |
+ 	index := address + 16 + baseHeaderSize.
- 	index := address + baseHeaderSize + 17.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
- 		 memory
- 			unsignedLongAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: index
  		put: aValue!

Item was added:
+ ----- Method: CogMethodSurrogate32>>stackCheckOffset (in category 'accessing generated') -----
+ stackCheckOffset
+ 	<bitPosition: 20 width: 12>
+ 	^((objectMemory shortAt: address + 2 + baseHeaderSize) bitShift: -4) bitAnd: 16rFFF!

Item was added:
+ ----- Method: CogMethodSurrogate32>>stackCheckOffset: (in category 'accessing generated') -----
+ stackCheckOffset: aValue
+ 	
+ 	| index delta |
+ 	index := address + 2 + baseHeaderSize.
+ 	self assert: (aValue between: 0 and: 16rFFF).
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			shortAt: index - delta
+ 			put: ((objectMemory shortAt: index - delta) bitAnd: 16rF) + (aValue bitShift: 4)].
+ 	objectMemory
+ 		shortAt: index
+ 		put: ((objectMemory shortAt: index) bitAnd: 16rF) + (aValue bitShift: 4).
+ 	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate64>>blockEntryOffset (in category 'accessing generated') -----
  blockEntryOffset
+ 	<bitPosition: 48 width: 16>
+ 	^objectMemory shortAt: address + 6 + baseHeaderSize!
- 	^memory unsignedShortAt: address + 7 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate64>>blockEntryOffset: (in category 'accessing generated') -----
  blockEntryOffset: aValue
  	
  	| index delta |
+ 	index := address + 6 + baseHeaderSize.
- 	index := address + baseHeaderSize + 7.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			shortAt: index - delta
- 		 memory
- 			unsignedShortAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		shortAt: index
- 	^memory
- 		unsignedShortAt: index
  		put: aValue!

Item was changed:
  ----- Method: CogMethodSurrogate64>>blockSize (in category 'accessing generated') -----
  blockSize
+ 	<bitPosition: 32 width: 16>
+ 	^objectMemory shortAt: address + 4 + baseHeaderSize!
- 	^memory unsignedShortAt: address + 5 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate64>>blockSize: (in category 'accessing generated') -----
  blockSize: aValue
  	
  	| index delta |
+ 	index := address + 4 + baseHeaderSize.
- 	index := address + baseHeaderSize + 5.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			shortAt: index - delta
- 		 memory
- 			unsignedShortAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		shortAt: index
- 	^memory
- 		unsignedShortAt: index
  		put: aValue!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cbUsesInstVars (in category 'accessing generated') -----
+ cbUsesInstVars
+ 	<bitPosition: 17 width: 1>
+ 	^(((objectMemory byteAt: address + 2 + baseHeaderSize) bitShift: -1) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cbUsesInstVars: (in category 'accessing generated') -----
+ cbUsesInstVars: aValue
+ 	
+ 	| index delta |
+ 	index := address + 2 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rFD) + (aValue ifTrue: [2] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rFD) + (aValue ifTrue: [2] ifFalse: [0])).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmHasMovableLiteral (in category 'accessing generated') -----
+ cmHasMovableLiteral
+ 	<bitPosition: 18 width: 1>
+ 	^(((objectMemory byteAt: address + 2 + baseHeaderSize) bitShift: -2) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmHasMovableLiteral: (in category 'accessing generated') -----
+ cmHasMovableLiteral: aValue
+ 	
+ 	| index delta |
+ 	index := address + 2 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rFB) + (aValue ifTrue: [4] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rFB) + (aValue ifTrue: [4] ifFalse: [0])).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmNumArgs (in category 'accessing generated') -----
+ cmNumArgs
+ 	<bitPosition: 0 width: 8>
+ 	^objectMemory byteAt: address + baseHeaderSize!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmNumArgs: (in category 'accessing generated') -----
+ cmNumArgs: aValue
+ 	
+ 	| index delta |
+ 	index := address + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		byteAt: index
+ 		put: aValue!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmRefersToYoung (in category 'accessing generated') -----
+ cmRefersToYoung
+ 	<bitPosition: 11 width: 1>
+ 	^(((objectMemory byteAt: address + 1 + baseHeaderSize) bitShift: -3) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmRefersToYoung: (in category 'accessing generated') -----
+ cmRefersToYoung: aValue
+ 	
+ 	| index delta |
+ 	index := address + 1 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rF7) + (aValue ifTrue: [8] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rF7) + (aValue ifTrue: [8] ifFalse: [0])).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmType (in category 'accessing generated') -----
+ cmType
+ 	<bitPosition: 8 width: 3>
+ 	^(objectMemory byteAt: address + 1 + baseHeaderSize) bitAnd: 16r7!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmType: (in category 'accessing generated') -----
+ cmType: aValue
+ 	
+ 	| index delta |
+ 	index := address + 1 + baseHeaderSize.
+ 	self assert: (aValue between: 0 and: 16r7).
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: ((objectMemory byteAt: index - delta) bitAnd: 16rF8) + aValue].
+ 	objectMemory
+ 		byteAt: index
+ 		put: ((objectMemory byteAt: index) bitAnd: 16rF8) + aValue.
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmUsageCount (in category 'accessing generated') -----
+ cmUsageCount
+ 	<bitPosition: 13 width: 3>
+ 	^((objectMemory byteAt: address + 1 + baseHeaderSize) bitShift: -5) bitAnd: 16r7!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmUsageCount: (in category 'accessing generated') -----
+ cmUsageCount: aValue
+ 	
+ 	| index delta |
+ 	index := address + 1 + baseHeaderSize.
+ 	self assert: (aValue between: 0 and: 16r7).
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: ((objectMemory byteAt: index - delta) bitAnd: 16r1F) + (aValue bitShift: 5)].
+ 	objectMemory
+ 		byteAt: index
+ 		put: ((objectMemory byteAt: index) bitAnd: 16r1F) + (aValue bitShift: 5).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmUsesPenultimateLit (in category 'accessing generated') -----
+ cmUsesPenultimateLit
+ 	<bitPosition: 16 width: 1>
+ 	^((objectMemory byteAt: address + 2 + baseHeaderSize) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cmUsesPenultimateLit: (in category 'accessing generated') -----
+ cmUsesPenultimateLit: aValue
+ 	
+ 	| index delta |
+ 	index := address + 2 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rFE) + (aValue ifTrue: [1] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rFE) + (aValue ifTrue: [1] ifFalse: [0])).
+ 	^aValue!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cpicHasMNUCaseOrCMIsFullBlock (in category 'accessing generated') -----
+ cpicHasMNUCaseOrCMIsFullBlock
+ 	<bitPosition: 12 width: 1>
+ 	^(((objectMemory byteAt: address + 1 + baseHeaderSize) bitShift: -4) bitAnd: 16r1) ~= 0!

Item was added:
+ ----- Method: CogMethodSurrogate64>>cpicHasMNUCaseOrCMIsFullBlock: (in category 'accessing generated') -----
+ cpicHasMNUCaseOrCMIsFullBlock: aValue
+ 	
+ 	| index delta |
+ 	index := address + 1 + baseHeaderSize.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			byteAt: index - delta
+ 			put: (((objectMemory byteAt: index - delta) bitAnd: 16rEF) + (aValue ifTrue: [16] ifFalse: [0]))].
+ 	objectMemory
+ 		byteAt: index
+ 		put: (((objectMemory byteAt: index) bitAnd: 16rEF) + (aValue ifTrue: [16] ifFalse: [0])).
+ 	^aValue!

Item was changed:
  ----- Method: CogMethodSurrogate64>>methodHeader (in category 'accessing generated') -----
  methodHeader
+ 	^objectMemory long64At: address + 16 + baseHeaderSize!
- 	^memory unsignedLong64At: address + 17 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate64>>methodHeader: (in category 'accessing generated') -----
  methodHeader: aValue
  	
  	| index delta |
+ 	index := address + 16 + baseHeaderSize.
- 	index := address + baseHeaderSize + 17.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
- 		 memory
- 			unsignedLong64At: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: index
  		put: aValue!

Item was changed:
  ----- Method: CogMethodSurrogate64>>methodObject (in category 'accessing generated') -----
  methodObject
+ 	^objectMemory long64At: address + 8 + baseHeaderSize!
- 	^memory unsignedLong64At: address + 9 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate64>>methodObject: (in category 'accessing generated') -----
  methodObject: aValue
  	
  	| index delta |
+ 	index := address + 8 + baseHeaderSize.
- 	index := address + baseHeaderSize + 9.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
- 		 memory
- 			unsignedLong64At: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: index
  		put: aValue!

Item was changed:
  ----- Method: CogMethodSurrogate64>>selector (in category 'accessing generated') -----
  selector
+ 	^objectMemory long64At: address + 24 + baseHeaderSize!
- 	^memory unsignedLong64At: address + 25 + baseHeaderSize!

Item was changed:
  ----- Method: CogMethodSurrogate64>>selector: (in category 'accessing generated') -----
  selector: aValue
  	
  	| index delta |
+ 	index := address + 24 + baseHeaderSize.
- 	index := address + baseHeaderSize + 25.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
- 		 memory
- 			unsignedLong64At: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: index
  		put: aValue!

Item was added:
+ ----- Method: CogMethodSurrogate64>>stackCheckOffset (in category 'accessing generated') -----
+ stackCheckOffset
+ 	<bitPosition: 20 width: 12>
+ 	^((objectMemory shortAt: address + 2 + baseHeaderSize) bitShift: -4) bitAnd: 16rFFF!

Item was added:
+ ----- Method: CogMethodSurrogate64>>stackCheckOffset: (in category 'accessing generated') -----
+ stackCheckOffset: aValue
+ 	
+ 	| index delta |
+ 	index := address + 2 + baseHeaderSize.
+ 	self assert: (aValue between: 0 and: 16rFFF).
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			shortAt: index - delta
+ 			put: ((objectMemory shortAt: index - delta) bitAnd: 16rF) + (aValue bitShift: 4)].
+ 	objectMemory
+ 		shortAt: index
+ 		put: ((objectMemory shortAt: index) bitAnd: 16rF) + (aValue bitShift: 4).
+ 	^aValue!

Item was changed:
  ----- Method: CogNewspeakMethodSurrogate32>>nextMethodOrIRCs (in category 'accessing generated') -----
  nextMethodOrIRCs
+ 	^objectMemory long32At: address + 20 + baseHeaderSize!
- 	^memory unsignedLongAt: address + 21 + baseHeaderSize!

Item was changed:
  ----- Method: CogNewspeakMethodSurrogate32>>nextMethodOrIRCs: (in category 'accessing generated') -----
  nextMethodOrIRCs: aValue
  	
  	| index delta |
+ 	index := address + baseHeaderSize + 20.
- 	index := address + baseHeaderSize + 21.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			longAt: index - delta
- 		 memory
- 			unsignedLongAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		longAt: index
- 	^memory
- 		unsignedLongAt: index
  		put: aValue!

Item was changed:
  ----- Method: CogNewspeakMethodSurrogate64>>nextMethodOrIRCs (in category 'accessing generated') -----
  nextMethodOrIRCs
+ 	^objectMemory long64At: address + 32 + baseHeaderSize!
- 	^memory unsignedLong64At: address + 33 + baseHeaderSize!

Item was changed:
  ----- Method: CogNewspeakMethodSurrogate64>>nextMethodOrIRCs: (in category 'accessing generated') -----
  nextMethodOrIRCs: aValue
  	
  	| index delta |
+ 	index := address + baseHeaderSize + 32.
- 	index := address + baseHeaderSize + 33.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
- 		 memory
- 			unsignedLong64At: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: index
  		put: aValue!

Item was changed:
  ----- Method: CogObjectRepresentationFor64BitSpur>>bitAndByteOffsetOfIsFullBlockBitInto: (in category 'in-line cacheing') -----
  bitAndByteOffsetOfIsFullBlockBitInto: aBlock
  	<inline: true>
  	"This supplies the bitmask for the isFullBlock bit, and the offset of the byte containing
  	 that bit in a CogMethod header to aBlock.  We don't have named variables holding this
  	 offset.  The following assert tests whether the values are correct by creating a surrogate
  	 on an empty ByteArray, setting the bit, and checking that the expected values are set
  	 in the ByteArray."
  	self cCode: [] inSmalltalk:
+ 		[| pragma |
+ 		pragma := (CogMethodSurrogate64 >> #cpicHasMNUCaseOrCMIsFullBlock)
+ 						pragmaAt: #bitPosition:width:.
+ 		self assert: pragma arguments = #(12 "4th bit of 2nd byte after objectHeader" 1)].
- 		[| m |
- 		m := ByteArray new: 16.
- 		CogBlockMethodSurrogate64 new
- 			at: 0 memory: m headerSize: 8 cogit: CogitFaker new;
- 			cpicHasMNUCaseOrCMIsFullBlock: true.
- 		self assert: m = #[0 0 0 0 0 0 0 0 0 16 0 0 0 0 0 0].
- 		self assert: (m at: objectMemory baseHeaderSize + 2) = 16].
  	aBlock value: 16 value: objectMemory baseHeaderSize + 1 "zero-relative"!

Item was changed:
  ----- Method: CogSistaMethodSurrogate32>>counters (in category 'accessing generated') -----
  counters
+ 	^objectMemory long32At: address + 20 + baseHeaderSize!
- 	^memory unsignedLongAt: address + 21 + baseHeaderSize!

Item was changed:
  ----- Method: CogSistaMethodSurrogate32>>counters: (in category 'accessing generated') -----
  counters: aValue
  	
  	| index delta |
+ 	index := address + 20 + baseHeaderSize.
- 	index := address + baseHeaderSize + 21.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
- 		 memory
- 			unsignedLongAt: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: index
  		put: aValue!

Item was changed:
  ----- Method: CogSistaMethodSurrogate64>>counters (in category 'accessing generated') -----
  counters
+ 	^objectMemory long64At: address + 32 + baseHeaderSize!
- 	^memory unsignedLong64At: address + 33 + baseHeaderSize!

Item was changed:
  ----- Method: CogSistaMethodSurrogate64>>counters: (in category 'accessing generated') -----
  counters: aValue
  	
  	| index delta |
+ 	index := address + 32 + baseHeaderSize.
- 	index := address + baseHeaderSize + 33.
  	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
  		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
- 		 memory
- 			unsignedLong64At: index - delta
  			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: index
  		put: aValue!

Item was added:
+ ----- Method: CogStackPage class>>fieldAccessorSourceFor:bytesPerWord: (in category 'code generation') -----
+ fieldAccessorSourceFor: surrogateClass bytesPerWord: bytesPerWord
+ 	^(super fieldAccessorSourceFor: surrogateClass bytesPerWord: bytesPerWord)
+ 		removeKey: {surrogateClass. #padToWord } ifAbsent: [];
+ 		removeKey: {surrogateClass. #padToWord: } ifAbsent: [];
+ 		yourself!

Item was removed:
- ----- Method: CogStackPage class>>getter:bitPosition:bitWidth:type: (in category 'code generation') -----
- getter: getter bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
- 	^String streamContents:
- 		[:s| | startByte endByte accessor |
- 		startByte := bitPosition // 8.
- 		endByte := bitPosition + bitWidth - 1 // 8.
- 		self assert: bitPosition \\ 8 = 0.
- 		self assert: startByte \\ (bitWidth // 8) = 0.
- 		accessor := #('byte' 'short' 'long' 'long')
- 							at: endByte - startByte + 1
- 							ifAbsent: ['long64'].
- 		s	nextPutAll: getter; crtab: 1; nextPut: $^.
- 		(typeOrNil notNil and: [typeOrNil last = $*]) ifTrue:
- 			[accessor := 'unsigned', (accessor copy
- 										at: 1 put: accessor first asUppercase;
- 										yourself)].
- 		(typeOrNil notNil and: ['*StackPage*' match: typeOrNil]) ifTrue:
- 			[s nextPutAll: 'stackPages surrogateAtAddress: ('].
- 		s nextPutAll: 'memory ';
- 		   nextPutAll: accessor;
- 		   nextPutAll: 'At: address + '; print: startByte + 1.
- 		(typeOrNil notNil and: ['*StackPage*' match: typeOrNil]) ifTrue:
- 			[s nextPut: $)]]
- 
- 	"| bitPosition |
- 	bitPosition := 0.
- 	(self fieldAccessorsForBytesPerWord: 4) collect:
- 		[:spec|
- 		bitPosition := bitPosition + spec second.
- 		self getter: spec first
- 			 bitPosition: bitPosition - spec second
- 			 bitWidth: spec second
- 			 type: (spec at: 3 ifAbsent: [])]"!

Item was removed:
- ----- Method: CogStackPage class>>setter:bitPosition:bitWidth:type: (in category 'code generation') -----
- setter: getter bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
- 	^String streamContents:
- 		[:s| | startByte endByte accessor |
- 		startByte := bitPosition // 8.
- 		endByte := bitPosition + bitWidth - 1 // 8.
- 		self assert: bitPosition \\ 8 = 0.
- 		self assert: startByte \\ (bitWidth // 8) = 0.
- 		accessor := #('byte' 'short' 'long' 'long')
- 							at: endByte - startByte + 1
- 							ifAbsent: ['long64'].
- 		s	nextPutAll: getter; nextPutAll: ': aValue'; crtab: 1;
- 			nextPutAll: 'self assert: (address + '; print: startByte;
- 			nextPutAll: ' >= zoneBase and: [address + '; print: endByte;
- 			nextPutAll: ' < zoneLimit]).'; crtab: 1.
- 		(typeOrNil notNil and: [typeOrNil last = $*]) ifTrue:
- 			[accessor := 'unsigned', (accessor copy
- 										at: 1 put: accessor first asUppercase;
- 										yourself)].
- 		(typeOrNil notNil and: ['*StackPage*' match: typeOrNil]) ifFalse:
- 			[s nextPut: $^].
- 		s nextPutAll: 'memory ';
- 		   nextPutAll: accessor; nextPutAll: 'At: address + '; print: startByte + 1;
- 		   nextPutAll: ' put: aValue'.
- 		(typeOrNil notNil and: ['*StackPage*' match: typeOrNil]) ifTrue:
- 			[s nextPutAll: ' asInteger.'; crtab: 1; nextPutAll: '^aValue']]
- 
- 	"| bitPosition |
- 	bitPosition := 0.
- 	(self fieldAccessorsForBytesPerWord: 4) collect:
- 		[:spec|
- 		bitPosition := bitPosition + spec second.
- 		self setter: spec first
- 			 bitPosition: bitPosition - spec second
- 			 bitWidth: spec second
- 			 type: (spec at: 3 ifAbsent: [])]"!

Item was changed:
+ CogSurrogate subclass: #CogStackPageSurrogate
+ 	instanceVariableNames: 'stackPages zoneBase zoneLimit'
- Object subclass: #CogStackPageSurrogate
- 	instanceVariableNames: 'address stackPages memory zoneBase zoneLimit'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'VMMaker-JITSimulation'!

Item was added:
+ ----- Method: CogStackPageSurrogate class>>getter:offsetExpression:bitPosition:bitWidth:type: (in category 'code generation') -----
+ getter: getter offsetExpression: offsetExpr bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
+ 	self assert: offsetExpr isNil.
+ 	^String streamContents:
+ 		[:s| | startByte endByte accessor |
+ 		startByte := bitPosition // 8.
+ 		endByte := bitPosition + bitWidth - 1 // 8.
+ 		self assert: bitPosition \\ 8 = 0.
+ 		self assert: startByte \\ (bitWidth // 8) = 0.
+ 		accessor := #(byteAt: shortAt: long32At: long64At:) at: (endByte - startByte) highBit + 1.
+ 		s	nextPutAll: getter; crtab: 1; nextPut: $^.
+ 		typeOrNil ifNotNil:
+ 			[('*StackPage*' match: typeOrNil) ifTrue:
+ 				[s nextPutAll: 'stackPages surrogateAtAddress: ('].
+ 			 typeOrNil == #int ifTrue:
+ 				[s nextPut: $(]].
+ 		s nextPutAll: #objectMemory; space;
+ 		   nextPutAll: accessor;
+ 		   nextPutAll: ' address'.
+ 		startByte > 0 ifTrue:
+ 			[s nextPutAll: ' + '; print: startByte].
+ 		typeOrNil ifNotNil:
+ 			[('*StackPage*' match: typeOrNil) ifTrue:
+ 				[s nextPut: $)].
+ 			 typeOrNil == #int ifTrue:
+ 				[s nextPutAll: ') '; nextPutAll: #signedIntFromLong]]]
+ 
+ 	"| bitPosition |
+ 	bitPosition := 0.
+ 	(CogStackPage fieldAccessorsForBytesPerWord: BytesPerWord) collect:
+ 		[:spec|
+ 		bitPosition := bitPosition + spec second.
+ 		self getter: spec first
+ 			offsetExpression: nil
+ 			bitPosition: bitPosition - spec second
+ 			bitWidth: spec second
+ 			type: (spec at: 3 ifAbsent: [])]"!

Item was added:
+ ----- Method: CogStackPageSurrogate class>>setter:offsetExpression:bitPosition:bitWidth:type: (in category 'code generation') -----
+ setter: getter offsetExpression: offsetExpr bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
+ 	self assert: offsetExpr isNil.
+ 	^String streamContents:
+ 		[:s| | startByte endByte accessor |
+ 		startByte := bitPosition // 8.
+ 		endByte := bitPosition + bitWidth - 1 // 8.
+ 		self assert: bitPosition \\ 8 = 0.
+ 		self assert: startByte \\ (bitWidth // 8) = 0.
+ 		accessor := #(byteAt: shortAt: long32At: long64At:) at: (endByte - startByte) highBit + 1.
+ 		s	nextPutAll: getter; nextPutAll: ': aValue'; crtab: 1;
+ 			nextPutAll: 'self assert: (address'.
+ 		startByte > 0 ifTrue:
+ 			[s nextPutAll: ' + '; print: startByte].
+ 		s nextPutAll: ' >= zoneBase and: [address + '; print: endByte;
+ 		   nextPutAll: ' < zoneLimit]).'; crtab: 1.
+ 		typeOrNil ifNotNil:
+ 			[(typeOrNil == #int or: ['*StackPage*' match: typeOrNil]) ifFalse:
+ 				[s nextPut: $^]].
+ 		s nextPutAll: #objectMemory; space;
+ 		   nextPutAll: accessor;
+ 		   nextPutAll: ' address'.
+ 		startByte > 0 ifTrue:
+ 			[s nextPutAll: ' + '; print: startByte].
+ 		s nextPutAll: ' put: aValue'.
+ 		typeOrNil ifNotNil:
+ 			[('*StackPage*' match: typeOrNil) ifTrue:
+ 				[s nextPutAll: ' asInteger.'; crtab; nextPutAll: '^aValue'].
+ 			 typeOrNil == #int ifTrue:
+ 				[s space; nextPutAll: #signedIntToLong; nextPut: $.; crtab; nextPutAll: '^aValue']]]
+ 
+ 	"| bitPosition |
+ 	bitPosition := 0.
+ 	(CogStackPage fieldAccessorsForBytesPerWord: BytesPerWord) collect:
+ 		[:spec|
+ 		bitPosition := bitPosition + spec second.
+ 		self setter: spec first
+ 			offsetExpression: nil
+ 			 bitPosition: bitPosition - spec second
+ 			 bitWidth: spec second
+ 			 type: (spec at: 3 ifAbsent: [])]"!

Item was changed:
  ----- Method: CogStackPageSurrogate>>address:simulator:zoneBase:zoneLimit: (in category 'instance initialization') -----
  address: theAddress simulator: aCoInterpreterSimulator zoneBase: base zoneLimit: limit
  	address := theAddress.
  	stackPages := aCoInterpreterSimulator stackPages.
+ 	objectMemory := aCoInterpreterSimulator objectMemory.
- 	memory := aCoInterpreterSimulator memory.
  	zoneBase := base.
  	zoneLimit := limit!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>baseAddress (in category 'accessing generated') -----
  baseAddress
+ 	^objectMemory long32At: address + 16!
- 	^memory unsignedLongAt: address + 17!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>baseAddress: (in category 'accessing generated') -----
  baseAddress: aValue
  	self assert: (address + 16 >= zoneBase and: [address + 19 < zoneLimit]).
+ 	^objectMemory long32At: address + 16 put: aValue!
- 	^memory unsignedLongAt: address + 17 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>baseFP (in category 'accessing generated') -----
  baseFP
+ 	^objectMemory long32At: address + 12!
- 	^memory unsignedLongAt: address + 13!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>baseFP: (in category 'accessing generated') -----
  baseFP: aValue
  	self assert: (address + 12 >= zoneBase and: [address + 15 < zoneLimit]).
+ 	^objectMemory long32At: address + 12 put: aValue!
- 	^memory unsignedLongAt: address + 13 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>headFP (in category 'accessing generated') -----
  headFP
+ 	^objectMemory long32At: address + 8!
- 	^memory unsignedLongAt: address + 9!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>headFP: (in category 'accessing generated') -----
  headFP: aValue
  	self assert: (address + 8 >= zoneBase and: [address + 11 < zoneLimit]).
+ 	^objectMemory long32At: address + 8 put: aValue!
- 	^memory unsignedLongAt: address + 9 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>headSP (in category 'accessing generated') -----
  headSP
+ 	^objectMemory long32At: address + 4!
- 	^memory unsignedLongAt: address + 5!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>headSP: (in category 'accessing generated') -----
  headSP: aValue
  	self assert: (address + 4 >= zoneBase and: [address + 7 < zoneLimit]).
+ 	^objectMemory long32At: address + 4 put: aValue!
- 	^memory unsignedLongAt: address + 5 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>lastAddress (in category 'accessing generated') -----
  lastAddress
+ 	^objectMemory long32At: address + 24!
- 	^memory unsignedLongAt: address + 25!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>lastAddress: (in category 'accessing generated') -----
  lastAddress: aValue
  	self assert: (address + 24 >= zoneBase and: [address + 27 < zoneLimit]).
+ 	^objectMemory long32At: address + 24 put: aValue!
- 	^memory unsignedLongAt: address + 25 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>nextPage (in category 'accessing generated') -----
  nextPage
+ 	^stackPages surrogateAtAddress: (objectMemory long32At: address + 32)!
- 	^stackPages surrogateAtAddress: (memory unsignedLongAt: address + 33)!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>nextPage: (in category 'accessing generated') -----
  nextPage: aValue
  	self assert: (address + 32 >= zoneBase and: [address + 35 < zoneLimit]).
+ 	objectMemory long32At: address + 32 put: aValue asInteger.
- 	memory unsignedLongAt: address + 33 put: aValue asInteger.
  	^aValue!

Item was removed:
- ----- Method: CogStackPageSurrogate32>>padToWord (in category 'accessing generated') -----
- padToWord
- 	^memory longAt: address + 33!

Item was removed:
- ----- Method: CogStackPageSurrogate32>>padToWord: (in category 'accessing generated') -----
- padToWord: aValue
- 	self assert: (address + 32 >= zoneBase and: [address + 35 < zoneLimit]).
- 	^memory longAt: address + 33 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>prevPage (in category 'accessing generated') -----
  prevPage
+ 	^stackPages surrogateAtAddress: (objectMemory long32At: address + 36)!
- 	^stackPages surrogateAtAddress: (memory unsignedLongAt: address + 37)!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>prevPage: (in category 'accessing generated') -----
  prevPage: aValue
  	self assert: (address + 36 >= zoneBase and: [address + 39 < zoneLimit]).
+ 	objectMemory long32At: address + 36 put: aValue asInteger.
- 	memory unsignedLongAt: address + 37 put: aValue asInteger.
  	^aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>realStackLimit (in category 'accessing generated') -----
  realStackLimit
+ 	^objectMemory long32At: address + 20!
- 	^memory unsignedLongAt: address + 21!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>realStackLimit: (in category 'accessing generated') -----
  realStackLimit: aValue
  	self assert: (address + 20 >= zoneBase and: [address + 23 < zoneLimit]).
+ 	^objectMemory long32At: address + 20 put: aValue!
- 	^memory unsignedLongAt: address + 21 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>stackLimit (in category 'accessing generated') -----
  stackLimit
+ 	^objectMemory long32At: address!
- 	^memory unsignedLongAt: address + 1!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>stackLimit: (in category 'accessing generated') -----
  stackLimit: aValue
+ 	self assert: (address >= zoneBase and: [address + 3 < zoneLimit]).
+ 	^objectMemory long32At: address put: aValue!
- 	self assert: (address + 0 >= zoneBase and: [address + 3 < zoneLimit]).
- 	^memory unsignedLongAt: address + 1 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>trace (in category 'accessing generated') -----
  trace
+ 	^(objectMemory long32At: address + 28) signedIntFromLong!
- 	^memory longAt: address + 29!

Item was changed:
  ----- Method: CogStackPageSurrogate32>>trace: (in category 'accessing generated') -----
  trace: aValue
  	self assert: (address + 28 >= zoneBase and: [address + 31 < zoneLimit]).
+ 	objectMemory long32At: address + 28 put: aValue signedIntToLong.
+ 	^aValue!
- 	^memory longAt: address + 29 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>baseAddress (in category 'accessing generated') -----
  baseAddress
+ 	^objectMemory long64At: address + 32!
- 	^memory unsignedLong64At: address + 33!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>baseAddress: (in category 'accessing generated') -----
  baseAddress: aValue
  	self assert: (address + 32 >= zoneBase and: [address + 39 < zoneLimit]).
+ 	^objectMemory long64At: address + 32 put: aValue!
- 	^memory unsignedLong64At: address + 33 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>baseFP (in category 'accessing generated') -----
  baseFP
+ 	^objectMemory long64At: address + 24!
- 	^memory unsignedLong64At: address + 25!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>baseFP: (in category 'accessing generated') -----
  baseFP: aValue
  	self assert: (address + 24 >= zoneBase and: [address + 31 < zoneLimit]).
+ 	^objectMemory long64At: address + 24 put: aValue!
- 	^memory unsignedLong64At: address + 25 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>headFP (in category 'accessing generated') -----
  headFP
+ 	^objectMemory long64At: address + 16!
- 	^memory unsignedLong64At: address + 17!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>headFP: (in category 'accessing generated') -----
  headFP: aValue
  	self assert: (address + 16 >= zoneBase and: [address + 23 < zoneLimit]).
+ 	^objectMemory long64At: address + 16 put: aValue!
- 	^memory unsignedLong64At: address + 17 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>headSP (in category 'accessing generated') -----
  headSP
+ 	^objectMemory long64At: address + 8!
- 	^memory unsignedLong64At: address + 9!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>headSP: (in category 'accessing generated') -----
  headSP: aValue
  	self assert: (address + 8 >= zoneBase and: [address + 15 < zoneLimit]).
+ 	^objectMemory long64At: address + 8 put: aValue!
- 	^memory unsignedLong64At: address + 9 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>lastAddress (in category 'accessing generated') -----
  lastAddress
+ 	^objectMemory long64At: address + 48!
- 	^memory unsignedLong64At: address + 49!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>lastAddress: (in category 'accessing generated') -----
  lastAddress: aValue
  	self assert: (address + 48 >= zoneBase and: [address + 55 < zoneLimit]).
+ 	^objectMemory long64At: address + 48 put: aValue!
- 	^memory unsignedLong64At: address + 49 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>nextPage (in category 'accessing generated') -----
  nextPage
+ 	^stackPages surrogateAtAddress: (objectMemory long64At: address + 64)!
- 	^stackPages surrogateAtAddress: (memory unsignedLong64At: address + 65)!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>nextPage: (in category 'accessing generated') -----
  nextPage: aValue
  	self assert: (address + 64 >= zoneBase and: [address + 71 < zoneLimit]).
+ 	objectMemory long64At: address + 64 put: aValue asInteger.
- 	memory unsignedLong64At: address + 65 put: aValue asInteger.
  	^aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>padToWord (in category 'accessing generated') -----
  padToWord
+ 	^(objectMemory long32At: address + 60) signedIntFromLong!
- 	^memory longAt: address + 61!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>padToWord: (in category 'accessing generated') -----
  padToWord: aValue
  	self assert: (address + 60 >= zoneBase and: [address + 63 < zoneLimit]).
+ 	^objectMemory long32At: address + 60 put: aValue!
- 	^memory longAt: address + 61 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>prevPage (in category 'accessing generated') -----
  prevPage
+ 	^stackPages surrogateAtAddress: (objectMemory long64At: address + 72)!
- 	^stackPages surrogateAtAddress: (memory unsignedLong64At: address + 73)!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>prevPage: (in category 'accessing generated') -----
  prevPage: aValue
  	self assert: (address + 72 >= zoneBase and: [address + 79 < zoneLimit]).
+ 	objectMemory long64At: address + 72 put: aValue asInteger.
- 	memory unsignedLong64At: address + 73 put: aValue asInteger.
  	^aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>realStackLimit (in category 'accessing generated') -----
  realStackLimit
+ 	^objectMemory long64At: address + 40!
- 	^memory unsignedLong64At: address + 41!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>realStackLimit: (in category 'accessing generated') -----
  realStackLimit: aValue
  	self assert: (address + 40 >= zoneBase and: [address + 47 < zoneLimit]).
+ 	^objectMemory long64At: address + 40 put: aValue!
- 	^memory unsignedLong64At: address + 41 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>stackLimit (in category 'accessing generated') -----
  stackLimit
+ 	^objectMemory long64At: address!
- 	^memory unsignedLong64At: address + 1!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>stackLimit: (in category 'accessing generated') -----
  stackLimit: aValue
+ 	self assert: (address >= zoneBase and: [address + 7 < zoneLimit]).
+ 	^objectMemory long64At: address put: aValue!
- 	self assert: (address + 0 >= zoneBase and: [address + 7 < zoneLimit]).
- 	^memory unsignedLong64At: address + 1 put: aValue!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>trace (in category 'accessing generated') -----
  trace
+ 	^(objectMemory long32At: address + 56) signedIntFromLong!
- 	^memory longAt: address + 57!

Item was changed:
  ----- Method: CogStackPageSurrogate64>>trace: (in category 'accessing generated') -----
  trace: aValue
  	self assert: (address + 56 >= zoneBase and: [address + 59 < zoneLimit]).
+ 	objectMemory long32At: address + 56 put: aValue signedIntToLong.
+ 	^aValue!
- 	^memory longAt: address + 57 put: aValue!

Item was added:
+ VMClass subclass: #CogSurrogate
+ 	instanceVariableNames: 'address cogit objectMemory'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'VMMaker-Support'!

Item was added:
+ ----- Method: CogSurrogate class>>getter:offsetExpression:bitPosition:bitWidth:type: (in category 'code generation') -----
+ getter: getter offsetExpression: offsetExpression bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
+ 	^String streamContents:
+ 		[:s| | startByte endByte alignedPowerOf2 shift |
+ 		startByte := bitPosition // 8.
+ 		endByte := bitPosition + bitWidth - 1 // 8.
+ 		shift := bitPosition \\ 8.
+ 		alignedPowerOf2 := (#(8 16 32 64) includes: bitWidth) and: [shift = 0].
+ 		s nextPutAll: getter; crtab.
+ 		bitWidth < (BytesPerWord * 8) ifTrue:
+ 			[s nextPut: $<; print: (Message selector: #bitPosition:width: arguments: {bitPosition. bitWidth}); nextPut: $>; crtab].
+ 		(typeOrNil notNil and: [typeOrNil last = $*]) ifTrue:
+ 			[s nextPutAll: '| v |'; crtab: 1].
+ 		s nextPut: $^.
+ 		typeOrNil ifNotNil:
+ 			[s nextPut: $(.
+ 			 typeOrNil last = $* ifTrue:
+ 				[s nextPutAll: 'v := ']].
+ 		alignedPowerOf2 ifFalse:
+ 			[s nextPut: $(].
+ 		shift ~= 0 ifTrue:
+ 			[s nextPut: $(].
+ 		s nextPutAll: #objectMemory; space;
+ 		   nextPutAll: (#(byteAt: shortAt: long32At: long64At:) at: (endByte - startByte) highBit + 1);
+ 		  nextPutAll: ' address'.
+ 		startByte > 0 ifTrue:
+ 			[s nextPutAll: ' + '; print: startByte].
+ 		offsetExpression ifNotNil:
+ 			[s nextPutAll: ' + '; nextPutAll: offsetExpression].
+ 		shift ~= 0 ifTrue:
+ 			[s nextPutAll: ') bitShift: -'; print: shift].
+ 		alignedPowerOf2 ifFalse:
+ 			[s nextPutAll: ') bitAnd: '; nextPutAll: ((1 << bitWidth) - 1) hex].
+ 		typeOrNil ifNotNil:
+ 			[s nextPutAll: ') ~= 0'.
+ 			typeOrNil last = $* ifTrue:
+ 				[s nextPutAll: ' ifTrue:';
+ 					crtab: 2;
+ 					nextPutAll: '[cogit cCoerceSimple: v to: ';
+ 					store: typeOrNil;
+ 					nextPut: $]]]]!

Item was added:
+ ----- Method: CogSurrogate class>>putAtPut:type:mask:shift:on:indent: (in category 'code generation') -----
+ putAtPut: accessor type: typeOrNil mask: maskOrNil shift: shift on: s indent: indent
+ 	"This is the inner part of the ap:put: in a setter, abstracted to eliminate duplication
+ 	 given the overrides in CogBlockMethod et al for dual zone write simulation."
+ 	s nextPutAll: #objectMemory;
+ 	  crtab: indent; nextPutAll: accessor;
+ 	  crtab: indent; nextPutAll: 'put: '.
+ 	typeOrNil ifNotNil:
+ 		[s nextPut: $(].
+ 	maskOrNil ifNotNil:
+ 		[s nextPutAll: '((objectMemory '; nextPutAll: accessor;
+ 		    nextPutAll: ') bitAnd: '; nextPutAll: maskOrNil hex;
+ 		    nextPutAll: ') + '].
+ 	s nextPutAll: (typeOrNil
+ 					caseOf: {
+ 						[nil] -> [shift = 0 ifTrue: ['aValue'] ifFalse: ['(aValue bitShift: ', shift printString, ')']].
+ 						[#Boolean] -> ['(aValue ifTrue: [', (1 << shift) printString, '] ifFalse: [0])'] }
+ 					otherwise: ['(aValue ifNotNil: [aValue asUnsignedInteger', (shift = 0 ifTrue: [''] ifFalse: [' bitShift: ', shift printString]), '] ifNil: [0])']).
+ 	typeOrNil ifNotNil:
+ 		[s nextPut: $)]!

Item was added:
+ ----- Method: CogSurrogate class>>setter:offsetExpression:bitPosition:bitWidth:type: (in category 'code generation') -----
+ setter: getter offsetExpression: offsetExpression bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
+ 	^String streamContents:
+ 		[:s| | startByte endByte shift alignedPowerOf2 accessor mask |
+ 		startByte := bitPosition // 8.
+ 		endByte := bitPosition + bitWidth - 1 // 8.
+ 		shift := bitPosition \\ 8.
+ 		alignedPowerOf2 := (#(8 16 32 64) includes: bitWidth) and: [shift = 0].
+ 		accessor := (#(byteAt: shortAt: long32At: long64At:) at: (endByte - startByte) highBit + 1),
+ 					' index'.
+ 		mask := (2 raisedTo: endByte - startByte + 1 * 8) - 1.
+ 		s nextPutAll: getter; nextPutAll: ': aValue'; crtab: 1.
+ 		s crtab: 1; nextPutAll: '| index delta |'; crtab: 1.
+ 		s nextPutAll: 'index := address'.
+ 		startByte > 0 ifTrue:
+ 			[s nextPutAll: ' + '; print: startByte].
+ 		offsetExpression ifNotNil:
+ 			[s nextPutAll: ' + '; nextPutAll: offsetExpression].
+ 		s nextPut: $.; crtab: 1.
+ 		(typeOrNil notNil or: [alignedPowerOf2]) ifFalse:
+ 			[s nextPutAll: 'self assert: (aValue between: 0 and: '; nextPutAll:  ((1 << bitWidth) - 1) hex; nextPutAll: ').'; crtab: 1].
+ 		s nextPutAll: '(delta := cogit getCodeToDataDelta) > 0 ifTrue:'; crtab: 2.
+ 		s nextPutAll: '[self assert: (cogit addressIsInCodeZone: address - delta).'; crtab: 2; space.
+ 		self putAtPut: accessor, ' - delta'
+ 			type: typeOrNil
+ 			mask: (alignedPowerOf2 ifFalse: [mask - ((1 << bitWidth - 1) << shift)])
+ 			shift: shift
+ 			on: s
+ 			indent: 3.
+ 		s nextPutAll: '].'; crtab: 1.
+ 		alignedPowerOf2 ifTrue:
+ 			[s nextPut: $^].
+ 		self putAtPut: accessor
+ 			type: typeOrNil
+ 			mask: (alignedPowerOf2 ifFalse: [mask - ((1 << bitWidth - 1) << shift)])
+ 			shift: shift
+ 			on: s
+ 			indent: 2.
+ 		alignedPowerOf2 ifFalse:
+ 			[s nextPut: $.; crtab: 1; nextPutAll: '^aValue']]!

Item was added:
+ ----- Method: CogSurrogate>>at:cogit:objectMemory: (in category 'instance initialization') -----
+ at: anAddress cogit: aCogit objectMemory: anObjectMemory
+ 	address := anAddress.
+ 	cogit := aCogit.
+ 	objectMemory := anObjectMemory!

Item was changed:
  ----- Method: Cogit>>cogBlockMethodSurrogateAt: (in category 'simulation only') -----
  cogBlockMethodSurrogateAt: address
  	<doNotGenerate>
  	self assert: (address bitAnd: objectMemory wordSize - 1) = 0.
  	^cogBlockMethodSurrogateClass new
  		at: address
+ 		cogit: self
+ 		objectMemory: objectMemory!
- 		objectMemory: objectMemory
- 		cogit: self!

Item was changed:
  ----- Method: Cogit>>cogMethodSurrogateAt: (in category 'simulation only') -----
  cogMethodSurrogateAt: address
  	<doNotGenerate>
  	self assert: (address < 0 or: [(address bitAnd: objectMemory wordSize - 1) = 0]).
  	^cogMethodSurrogateClass new
  		at: address
+ 		cogit: self
+ 		objectMemory: objectMemory!
- 		objectMemory: objectMemory
- 		cogit: self!

Item was changed:
  ----- Method: Cogit>>initializeCodeZoneFrom:upTo: (in category 'initialization') -----
  initializeCodeZoneFrom: startAddress upTo: endAddress
  	<api>
  	self initializeBackend.
  	self sqMakeMemoryExecutableFrom: startAddress
  		To: endAddress
  		CodeToDataDelta: (self cppIf: #DUAL_MAPPED_CODE_ZONE
  								ifTrue: [self addressOf: codeToDataDelta put: [:v| codeToDataDelta := v]]
  								ifFalse: [nil]).
  	codeBase := methodZoneBase := startAddress.
  	backEnd stopsFrom: startAddress to: endAddress - 1.
  	self cCode: '' inSmalltalk:
  		[self initializeProcessor.
+ 		 backEnd stopsFrom: objectMemory memoryOffset "first word may not exist in the simulator's memory" to: guardPageSize - 1.
- 		 backEnd stopsFrom: 0 to: guardPageSize - 1.
  		 backEnd has64BitPerformanceCounter ifTrue:
  			[self initializeSimulationIOHighResClockForProfiling]].
  	methodZone manageFrom: methodZoneBase to: endAddress.
  	self assertValidDualZone.
  	backEnd detectFeatures.
  	self maybeGenerateCacheFlush.
  	self generateVMOwnerLockFunctions.
  	self genGetLeafCallStackPointers.
  	self generateStackPointerCapture.
  	self generateTrampolines.
  	self computeEntryOffsets.
  	self computeFullBlockEntryOffsets.
  	self generateClosedPICPrototype.
  	self alignMethodZoneBase.
  
  	"None of the above is executed beyond ceCheckFeatures, so a bulk flush now is the leanest thing to do."
  	backEnd flushICacheFrom: startAddress to: methodZoneBase asUnsignedInteger.
  	self maybeFlushWritableZoneFrom: startAddress to: methodZoneBase asUnsignedInteger.
  	"Repeat so that now the methodZone ignores the generated run-time."
  	methodZone manageFrom: methodZoneBase to: endAddress.
  	"N.B. this is assumed to be the last thing done in initialization; see Cogit>>initialized.
  	 This is done only to compute openPICSize; the generated code is discarded."
  	self generateOpenPICPrototype!

Item was changed:
  ----- Method: Cogit>>initializeProcessor (in category 'initialization') -----
  initializeProcessor
  	"Initialize the simulation processor, arranging that its initial stack is somewhere on the rump C stack."
  	<doNotGenerate>
  	guardPageSize := self class guardPageSize.
  	lastNInstructions := OrderedCollection new.
+ 	processor
+ 		memoryOffset: objectMemory memoryOffset;
+ 		initializeStackFor: self.
+ 	self initializeProcessorStack: coInterpreter initialCStackAddress.
- 	processor initializeStackFor: self.
- 	self initializeProcessorStack: coInterpreter rumpCStackAddress.
  	coInterpreter setCFramePointer: processor fp setCStackPointer: processor sp.
  	(InitializationOptions at: #UseMultiProcessor ifAbsent: [false]) ifTrue:
  		[processor := MultiProcessor for: processor coInterpreter: coInterpreter].
  	processorLock := Mutex new!

Item was changed:
  ----- Method: Cogit>>nsSendCacheSurrogateAt: (in category 'simulation only') -----
  nsSendCacheSurrogateAt: address
  	<doNotGenerate>
  	self assert: (address < 0 or: [(address bitAnd: objectMemory wordSize - 1) = 0]).
  	^nsSendCacheSurrogateClass new
  		at: address
+ 		cogit: self
+ 		objectMemory: objectMemory!
- 		objectMemory: objectMemory
- 		cogit: self!

Item was removed:
- Object subclass: #CogitFaker
- 	instanceVariableNames: ''
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'VMMaker-JIT-Simulation'!

Item was removed:
- ----- Method: CogitFaker>>assertValidDualZoneWriteAddress: (in category 'accessing') -----
- assertValidDualZoneWriteAddress: address!

Item was removed:
- ----- Method: CogitFaker>>getCodeToDataDelta (in category 'accessing') -----
- getCodeToDataDelta
- 	^0!

Item was changed:
+ CogSurrogate subclass: #NSSendCacheSurrogate
+ 	instanceVariableNames: ''
- VMClass subclass: #NSSendCacheSurrogate
- 	instanceVariableNames: 'address memory cogit'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'VMMaker-JITSimulation'!

Item was removed:
- ----- Method: NSSendCacheSurrogate>>at:objectMemory:cogit: (in category 'as yet unclassified') -----
- at: anAddress objectMemory: objectMemory cogit: aCogit
- 	address := anAddress.
- 	memory := objectMemory memory.
- 	cogit := aCogit!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>classTag (in category 'accessing generated') -----
  classTag
+ 	^objectMemory long32At: address!
- 	^memory unsignedLongAt: address + 1!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>classTag: (in category 'accessing generated') -----
  classTag: aValue
+ 	
+ 	| index delta |
+ 	index := address.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: address + 1
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>depth (in category 'accessing generated') -----
  depth
+ 	^objectMemory long32At: address + 20!
- 	^memory unsignedLongAt: address + 21!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>depth: (in category 'accessing generated') -----
  depth: aValue
+ 	
+ 	| index delta |
+ 	index := address + 20.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: address + 21
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>enclosingObject (in category 'accessing generated') -----
  enclosingObject
+ 	^objectMemory long32At: address + 4!
- 	^memory unsignedLongAt: address + 5!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>enclosingObject: (in category 'accessing generated') -----
  enclosingObject: aValue
+ 	
+ 	| index delta |
+ 	index := address + 4.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: address + 5
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>numArgs (in category 'accessing generated') -----
  numArgs
+ 	^objectMemory long32At: address + 16!
- 	^memory unsignedLongAt: address + 17!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>numArgs: (in category 'accessing generated') -----
  numArgs: aValue
+ 	
+ 	| index delta |
+ 	index := address + 16.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: address + 17
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>selector (in category 'accessing generated') -----
  selector
+ 	^objectMemory long32At: address + 12!
- 	^memory unsignedLongAt: address + 13!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>selector: (in category 'accessing generated') -----
  selector: aValue
+ 	
+ 	| index delta |
+ 	index := address + 12.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: address + 13
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>target (in category 'accessing generated') -----
  target
+ 	^objectMemory long32At: address + 8!
- 	^memory unsignedLongAt: address + 9!

Item was changed:
  ----- Method: NSSendCacheSurrogate32>>target: (in category 'accessing generated') -----
  target: aValue
+ 	
+ 	| index delta |
+ 	index := address + 8.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long32At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long32At: index
- 	^memory
- 		unsignedLongAt: address + 9
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>classTag (in category 'accessing generated') -----
  classTag
+ 	^objectMemory long64At: address!
- 	^memory unsignedLong64At: address + 1!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>classTag: (in category 'accessing generated') -----
  classTag: aValue
+ 	
+ 	| index delta |
+ 	index := address.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: address + 1
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>depth (in category 'accessing generated') -----
  depth
+ 	^objectMemory long64At: address + 40!
- 	^memory unsignedLong64At: address + 41!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>depth: (in category 'accessing generated') -----
  depth: aValue
+ 	
+ 	| index delta |
+ 	index := address + 40.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: address + 41
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>enclosingObject (in category 'accessing generated') -----
  enclosingObject
+ 	^objectMemory long64At: address + 8!
- 	^memory unsignedLong64At: address + 9!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>enclosingObject: (in category 'accessing generated') -----
  enclosingObject: aValue
+ 	
+ 	| index delta |
+ 	index := address + 8.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: address + 9
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>numArgs (in category 'accessing generated') -----
  numArgs
+ 	^objectMemory long64At: address + 32!
- 	^memory unsignedLong64At: address + 33!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>numArgs: (in category 'accessing generated') -----
  numArgs: aValue
+ 	
+ 	| index delta |
+ 	index := address + 32.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: address + 33
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>selector (in category 'accessing generated') -----
  selector
+ 	^objectMemory long64At: address + 24!
- 	^memory unsignedLong64At: address + 25!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>selector: (in category 'accessing generated') -----
  selector: aValue
+ 	
+ 	| index delta |
+ 	index := address + 24.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: address + 25
  		put: aValue!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>target (in category 'accessing generated') -----
  target
+ 	^objectMemory long64At: address + 16!
- 	^memory unsignedLong64At: address + 17!

Item was changed:
  ----- Method: NSSendCacheSurrogate64>>target: (in category 'accessing generated') -----
  target: aValue
+ 	
+ 	| index delta |
+ 	index := address + 16.
+ 	(delta := cogit getCodeToDataDelta) > 0 ifTrue:
+ 		[self assert: (cogit addressIsInCodeZone: address - delta).
+ 		 objectMemory
+ 			long64At: index - delta
+ 			put: aValue].
+ 	^objectMemory
+ 		long64At: index
- 	^memory
- 		unsignedLong64At: address + 17
  		put: aValue!

Item was added:
+ ----- Method: NewCoObjectMemorySimulator>>memoryOffset (in category 'simulation only') -----
+ memoryOffset
+ 	^0!

Item was changed:
  ----- Method: NewObjectMemory>>printMemoryFrom:to: (in category 'printing') -----
  printMemoryFrom: start to: end
  	<doNotGenerate>
+ 	| transcript address |
- 	| address |
  	address := start bitAnd: (self wordSize - 1) bitInvert.
+ 	(transcript := coInterpreter transcript) ensureCr.
  	[address < end] whileTrue:
+ 		[(coInterpreter pst: '%WP: %WP\n') f: transcript printf: { address. self longAt: address}.
- 		[coInterpreter printHex: address; printChar: $:; space; printHex: (self longAt: address); cr.
  		 address := address + self wordSize]!

Item was added:
+ ----- Method: SmallInteger>>signedIntToLong64 (in category '*VMMaker-interpreter simulator') -----
+ signedIntToLong64
+ 	"Produces a 64-bit value in twos-comp form. Truncates if out-of-range as per a C cast.
+ 	 Self is a signed or unsigned 64-bit integer.
+ 	 Currently SmallIntegers are either 31-bit (in the 32-bit implementation) or 61-bit
+ 	 (in the 64-bit implementation) so save some time by overriding in the subclass."
+ 
+ 	self >= 0 ifTrue: [^self].
+ 	^super signedIntToLong64!

Item was changed:
  ----- Method: Spur32BitMMLECoSimulator>>byteAt: (in category 'memory access') -----
  byteAt: byteAddress
  	| lowBits long32 |
  	lowBits := byteAddress bitAnd: 3.
+ 	long32 := memory at: byteAddress - lowBits // 4.
- 	long32 := self long32At: byteAddress - lowBits.
  	^(long32 bitShift: -8 * lowBits) bitAnd: 16rFF!

Item was changed:
  ----- Method: Spur32BitMMLECoSimulator>>byteAt:put: (in category 'memory access') -----
  byteAt: byteAddress put: byte
  	| lowBits long32 longAddress mask value |
  	lowBits := byteAddress bitAnd: 3.
+ 	longAddress := byteAddress - lowBits // 4.
+ 	long32 := memory at: longAddress.
- 	longAddress := byteAddress - lowBits.
- 	long32 := self long32At: longAddress.
  	mask := (16rFF bitShift: 8 * lowBits) bitInvert.
  	value := byte bitShift: 8 * lowBits.
+ 	memory at: longAddress put: ((long32 bitAnd: mask) bitOr: value).
- 	self long32At: longAddress put: ((long32 bitAnd: mask) bitOr: value).
  	^byte!

Item was changed:
+ ----- Method: Spur32BitMMLECoSimulator>>cogCodeBase (in category 'Cog JIT support') -----
- ----- Method: Spur32BitMMLECoSimulator>>cogCodeBase (in category 'simulation only') -----
  cogCodeBase
  	^Cogit guardPageSize!

Item was changed:
  ----- Method: Spur32BitMMLECoSimulator>>long64At: (in category 'memory access') -----
  long64At: byteAddress
+ 	"memory is a Bitmap, a 32-bit indexable array of bits.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"memory is a Bitmap, a 32-bit indexable array of bits"
  	| hiWord loWord |
  	byteAddress \\ 8 ~= 0 ifTrue: [self unalignedAccessError].
+ 	loWord := memory at: byteAddress // 4.
+ 	hiWord := memory at: byteAddress // 4 + 1.
- 	loWord := memory at: byteAddress // 4 + 1.
- 	hiWord := memory at: byteAddress // 4 + 2.
  	^hiWord = 0
  		ifTrue: [loWord]
  		ifFalse: [(hiWord bitShift: 32) + loWord]!

Item was changed:
  ----- Method: Spur32BitMMLECoSimulator>>longAt: (in category 'memory access') -----
  longAt: byteAddress
+ 	"Note: Adjusted for Smalltalk's 1-based array indexing.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"Note: Adjusted for Smalltalk's 1-based array indexing."
  	byteAddress \\ 4 ~= 0 ifTrue: [self unalignedAccessError].
+ 	^memory at: byteAddress // 4!
- 	^memory at: byteAddress // 4 + 1!

Item was changed:
  ----- Method: Spur32BitMMLECoSimulator>>longAt:put: (in category 'memory access') -----
  longAt: byteAddress put: a32BitValue
+ 	"Note: Adjusted for Smalltalk's 1-based array indexing.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"Note: Adjusted for Smalltalk's 1-based array indexing."
- 	"(byteAddress = 16r101348 and: [a32BitValue = 16r53]) ifTrue:
- 		[self halt]."
- 	"((byteAddress between: 16rda8ac and: 16rda8c0)
- 	 or: [byteAddress between: 16r8eb98 and: 16r8ebb0]) ifTrue:
- 		[self halt]."
  	byteAddress \\ 4 ~= 0 ifTrue: [self unalignedAccessError].
+ 
+ 	"((byteAddress between: 16rA and: 16rB) and: [a32BitValue = 16rC]) ifTrue:
+ 		[self halt]."
+ 
+ 	^memory at: byteAddress // 4 put: a32BitValue!
- 	^memory at: byteAddress // 4 + 1 put: a32BitValue!

Item was changed:
  ----- Method: Spur32BitMMLECoSimulator>>memoryBaseForImageRead (in category 'snapshot') -----
  memoryBaseForImageRead
  	"Answer the address to read the image into.  Override so that when bootstrapping,
  	 the segmentManager's segments are undisturbed in adjustSegmentSwizzlesBy:"
  	^bootstrapping
+ 		ifTrue: [self startOfMemory] 
- 		ifTrue: [0] 
  		ifFalse: [super memoryBaseForImageRead]!

Item was added:
+ ----- Method: Spur32BitMMLECoSimulator>>memoryOffset (in category 'Cog JIT support') -----
+ memoryOffset
+ 	"The first word of memory is unused in order to implement a null pointer trap.
+ 	 Hence the processor simulators must offset addresses by minus this amount."
+ 	^4!

Item was changed:
  ----- Method: Spur32BitMMLESimulator>>byteAt: (in category 'memory access') -----
  byteAt: byteAddress
  	| lowBits long32 |
  	lowBits := byteAddress bitAnd: 3.
+ 	long32 := memory at: byteAddress - lowBits // 4.
- 	long32 := self long32At: byteAddress - lowBits.
  	^(long32 bitShift: -8 * lowBits) bitAnd: 16rFF!

Item was changed:
  ----- Method: Spur32BitMMLESimulator>>byteAt:put: (in category 'memory access') -----
  byteAt: byteAddress put: byte
  	| lowBits long32 longAddress mask value |
  	lowBits := byteAddress bitAnd: 3.
+ 	longAddress := byteAddress - lowBits // 4.
+ 	long32 := memory at: longAddress.
- 	longAddress := byteAddress - lowBits.
- 	long32 := self long32At: longAddress.
  	mask := (16rFF bitShift: 8 * lowBits) bitInvert.
  	value := byte bitShift: 8 * lowBits.
+ 	memory at: longAddress put: ((long32 bitAnd: mask) bitOr: value).
- 	self long32At: longAddress put: ((long32 bitAnd: mask) bitOr: value).
  	^byte!

Item was changed:
  ----- Method: Spur32BitMMLESimulator>>long64At: (in category 'memory access') -----
  long64At: byteAddress
+ 	"memory is a Bitmap, a 32-bit indexable array of bits.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"memory is a Bitmap, a 32-bit indexable array of bits"
  	| hiWord loWord |
  	byteAddress \\ 8 ~= 0 ifTrue: [self unalignedAccessError].
+ 	loWord := memory at: byteAddress // 4.
+ 	hiWord := memory at: byteAddress // 4 + 1.
- 	loWord := memory at: byteAddress // 4 + 1.
- 	hiWord := memory at: byteAddress // 4 + 2.
  	^hiWord = 0
  		ifTrue: [loWord]
  		ifFalse: [(hiWord bitShift: 32) + loWord]!

Item was changed:
  ----- Method: Spur32BitMMLESimulator>>longAt: (in category 'memory access') -----
  longAt: byteAddress
+ 	"Note: Adjusted for Smalltalk's 1-based array indexing.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"Note: Adjusted for Smalltalk's 1-based array indexing."
  	byteAddress \\ 4 ~= 0 ifTrue: [self unalignedAccessError].
+ 	^memory at: byteAddress // 4!
- 	^memory at: byteAddress // 4 + 1!

Item was changed:
  ----- Method: Spur32BitMMLESimulator>>longAt:put: (in category 'memory access') -----
  longAt: byteAddress put: a32BitValue
+ 	"Note: Adjusted for Smalltalk's 1-based array indexing.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"Note: Adjusted for Smalltalk's 1-based array indexing."
- 	"(byteAddress = 16r183FB00 and: [a32BitValue = 16r3FFFFC]) ifTrue:
- 		[self halt]."
- 	"(byteAddress between: 16r33FBB8 and: 16r33FBCF) ifTrue:
- 		[self halt]."
  	byteAddress \\ 4 ~= 0 ifTrue: [self unalignedAccessError].
+ 
+ 	"((byteAddress between: 16rA and: 16rB) and: [a32BitValue = 16rC]) ifTrue:
+ 		[self halt]."
+ 
+ 	^memory at: byteAddress // 4 put: a32BitValue!
- 	^memory at: byteAddress // 4 + 1 put: a32BitValue!

Item was changed:
  ----- Method: Spur32BitMMLESimulator>>memoryBaseForImageRead (in category 'snapshot') -----
  memoryBaseForImageRead
  	"Answer the address to read the image into.  Override so that when bootstrapping,
  	 the segmentManager's segments are undisturbed in adjustSegmentSwizzlesBy:"
  	^bootstrapping
+ 		ifTrue: [self startOfMemory] 
- 		ifTrue: [0] 
  		ifFalse: [super memoryBaseForImageRead]!

Item was changed:
+ ----- Method: Spur64BitMMLECoSimulator>>cogCodeBase (in category 'Cog JIT support') -----
- ----- Method: Spur64BitMMLECoSimulator>>cogCodeBase (in category 'simulation only') -----
  cogCodeBase
  	^Cogit guardPageSize!

Item was changed:
  ----- Method: Spur64BitMMLECoSimulator>>long32At: (in category 'memory access') -----
  long32At: byteAddress
+ 	"Note: Adjusted for Smalltalk's 1-based array indexing.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"Note: Adjusted for Smalltalk's 1-based array indexing."
  	byteAddress \\ 4 ~= 0 ifTrue: [self unalignedAccessError].
+ 	^memory at: byteAddress // 4!
- 	^memory at: byteAddress // 4 + 1!

Item was changed:
  ----- Method: Spur64BitMMLECoSimulator>>long32At:put: (in category 'memory access') -----
  long32At: byteAddress put: a32BitValue
+ 	"Note: Adjusted for Smalltalk's 1-based array indexing.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"Note: Adjusted for Smalltalk's 1-based array indexing."
- 	"(byteAddress = 16r183FB00 and: [a32BitValue = 16r3FFFFC]) ifTrue:
- 		[self halt]."
- 	"(byteAddress between: 16r33FBB8 and: 16r33FBCF) ifTrue:
- 		[self halt]."
  	byteAddress \\ 4 ~= 0 ifTrue: [self unalignedAccessError].
+ 
+ 	"((byteAddress between: 16rA and: 16rB) and: [a32BitValue = 16rC]) ifTrue:
+ 		[self halt]."
+ 
+ 	^memory at: byteAddress // 4 put: a32BitValue!
- 	^memory at: byteAddress // 4 + 1 put: a32BitValue!

Item was changed:
  ----- Method: Spur64BitMMLECoSimulator>>long64At: (in category 'memory access') -----
  long64At: byteAddress
+ 	"memory is a Bitmap, a 32-bit indexable array of bits.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
- 	"memory is a Bitmap, a 32-bit indexable array of bits"
  	| hiWord loWord |
+ 
  	byteAddress \\ 8 ~= 0 ifTrue: [self unalignedAccessError].
+ 	loWord := memory at: byteAddress // 4.
+ 	hiWord := memory at: byteAddress // 4 + 1.
- 	loWord := memory at: byteAddress // 4 + 1.
- 	hiWord := memory at: byteAddress // 4 + 2.
  	^hiWord = 0
  		ifTrue: [loWord]
  		ifFalse: [(hiWord bitShift: 32) + loWord]!

Item was changed:
  ----- Method: Spur64BitMMLECoSimulator>>memoryBaseForImageRead (in category 'snapshot') -----
  memoryBaseForImageRead
  	"Answer the address to read the image into.  Override so that when bootstrapping,
  	 the segmentManager's segments are undisturbed in adjustSegmentSwizzlesBy:"
  	^bootstrapping
+ 		ifTrue: [self startOfMemory] 
- 		ifTrue: [0] 
  		ifFalse: [super memoryBaseForImageRead]!

Item was added:
+ ----- Method: Spur64BitMMLECoSimulator>>memoryOffset (in category 'Cog JIT support') -----
+ memoryOffset
+ 	"The first word of memory is unused in order to implement a null pointer trap.
+ 	 Hence the processor simulators must offset addresses by minus this amount."
+ 	^4!

Item was changed:
  ----- Method: Spur64BitMMLECoSimulatorFor64Bits>>byteAt: (in category 'memory access') -----
  byteAt: byteAddress
  	| lowBits long64 |
  	lowBits := byteAddress bitAnd: 7.
+ 	long64 := memory at: byteAddress - lowBits // 8.
- 	long64 := self long64At: byteAddress - lowBits.
  	^(long64 bitShift: -8 * lowBits) bitAnd: 16rFF!

Item was changed:
  ----- Method: Spur64BitMMLECoSimulatorFor64Bits>>byteAt:put: (in category 'memory access') -----
  byteAt: byteAddress put: byte
+ 	| lowBits longWord longAddress shift |
- 	| lowBits long64 longAddress mask value |
  	lowBits := byteAddress bitAnd: 7.
+ 	longAddress := byteAddress - lowBits // 8.
+ 	longWord := memory at: longAddress.
+ 	shift := lowBits * 8.
+ 	longWord := longWord
+ 				- (longWord bitAnd: (16rFF bitShift: shift)) 
+ 				+ (byte bitShift: shift).
+ 	memory at: longAddress put: longWord.
- 	longAddress := byteAddress - lowBits.
- 	long64 := self long64At: longAddress.
- 	mask := (16rFF bitShift: 8 * lowBits) bitInvert.
- 	value := byte bitShift: 8 * lowBits.
- 	self long64At: longAddress put: ((long64 bitAnd: mask) bitOr: value).
  	^byte!

Item was changed:
  ----- Method: Spur64BitMMLECoSimulatorFor64Bits>>long64At: (in category 'memory access') -----
  long64At: byteAddress
  	"memory is a DoubleWordArray, a 64-bit indexable array of bits"
+ 
  	byteAddress \\ 8 ~= 0 ifTrue: [self unalignedAccessError].
+ 	^memory at: byteAddress // 8!
- 	^memory at: byteAddress // 8 + 1!

Item was changed:
  ----- Method: Spur64BitMMLECoSimulatorFor64Bits>>long64At:put: (in category 'memory access') -----
  long64At: byteAddress put: a64BitValue
+ 	"memory is a DoubleWordArray, a 64-bit indexable array of bits.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"memory is a DoubleWordArray, a 64-bit indexable array of bits"
  	byteAddress \\ 8 ~= 0 ifTrue: [self unalignedAccessError].
+ 
+ 	"((byteAddress between: 16rA and: 16rB) and: [a64BitValue = 16rC]) ifTrue:
+ 		[self halt]."
+ 
+ 	^memory at: byteAddress // 8 put: a64BitValue!
- 	^memory at: byteAddress // 8 + 1 put: a64BitValue!

Item was added:
+ ----- Method: Spur64BitMMLECoSimulatorFor64Bits>>memoryOffset (in category 'Cog JIT support') -----
+ memoryOffset
+ 	"The first word of memory is unused in order to implement a null pointer trap.
+ 	 Hence the processor simulators must offset addresses by minus this amount."
+ 	^8!

Item was changed:
  ----- Method: Spur64BitMMLESimulator>>long32At: (in category 'memory access') -----
  long32At: byteAddress
+ 	"Note: Adjusted for Smalltalk's 1-based array indexing.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"Note: Adjusted for Smalltalk's 1-based array indexing."
  	byteAddress \\ 4 ~= 0 ifTrue: [self unalignedAccessError].
+ 	^memory at: byteAddress // 4!
- 	^memory at: byteAddress // 4 + 1!

Item was changed:
  ----- Method: Spur64BitMMLESimulator>>long32At:put: (in category 'memory access') -----
  long32At: byteAddress put: a32BitValue
+ 	"Note: Adjusted for Smalltalk's 1-based array indexing.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"Note: Adjusted for Smalltalk's 1-based array indexing."
- 	"(byteAddress = 16r183FB00 and: [a32BitValue = 16r3FFFFC]) ifTrue:
- 		[self halt]."
- 	"(byteAddress between: 16r33FBB8 and: 16r33FBCF) ifTrue:
- 		[self halt]."
  	byteAddress \\ 4 ~= 0 ifTrue: [self unalignedAccessError].
+ 
+ 	"((byteAddress between: 16rA and: 16rB) and: [a32BitValue = 16rC]) ifTrue:
+ 		[self halt]."
+ 
+ 	^memory at: byteAddress // 4 put: a32BitValue!
- 	^memory at: byteAddress // 4 + 1 put: a32BitValue!

Item was changed:
  ----- Method: Spur64BitMMLESimulator>>long64At: (in category 'memory access') -----
  long64At: byteAddress
+ 	"memory is a Bitmap, a 32-bit indexable array of bits.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
- 	"memory is a Bitmap, a 32-bit indexable array of bits"
  	| hiWord loWord |
+ 
  	byteAddress \\ 8 ~= 0 ifTrue: [self unalignedAccessError].
+ 	loWord := memory at: byteAddress // 4.
+ 	hiWord := memory at: byteAddress // 4 + 1.
- 	loWord := memory at: byteAddress // 4 + 1.
- 	hiWord := memory at: byteAddress // 4 + 2.
  	^hiWord = 0
  		ifTrue: [loWord]
  		ifFalse: [(hiWord bitShift: 32) + loWord]!

Item was changed:
  ----- Method: Spur64BitMMLESimulator>>memoryBaseForImageRead (in category 'snapshot') -----
  memoryBaseForImageRead
  	"Answer the address to read the image into.  Override so that when bootstrapping,
  	 the segmentManager's segments are undisturbed in adjustSegmentSwizzlesBy:"
  	^bootstrapping
+ 		ifTrue: [self startOfMemory] 
- 		ifTrue: [0] 
  		ifFalse: [super memoryBaseForImageRead]!

Item was changed:
  ----- Method: Spur64BitMMLESimulatorFor64Bits>>byteAt: (in category 'memory access') -----
  byteAt: byteAddress
  	| lowBits long64 |
  	lowBits := byteAddress bitAnd: 7.
+ 	long64 := memory at: byteAddress - lowBits // 8.
- 	long64 := self long64At: byteAddress - lowBits.
  	^(long64 bitShift: -8 * lowBits) bitAnd: 16rFF!

Item was changed:
  ----- Method: Spur64BitMMLESimulatorFor64Bits>>byteAt:put: (in category 'memory access') -----
  byteAt: byteAddress put: byte
+ 	| lowBits longWord longAddress shift |
- 	| lowBits long64 longAddress mask value |
  	lowBits := byteAddress bitAnd: 7.
+ 	longAddress := byteAddress - lowBits // 8.
+ 	longWord := memory at: longAddress.
+ 	shift := lowBits * 8.
+ 	longWord := longWord
+ 				- (longWord bitAnd: (16rFF bitShift: shift)) 
+ 				+ (byte bitShift: shift).
+ 	memory at: longAddress put: longWord.
- 	longAddress := byteAddress - lowBits.
- 	long64 := self long64At: longAddress.
- 	mask := (16rFF bitShift: 8 * lowBits) bitInvert.
- 	value := byte bitShift: 8 * lowBits.
- 	self long64At: longAddress put: ((long64 bitAnd: mask) bitOr: value).
  	^byte!

Item was changed:
  ----- Method: Spur64BitMMLESimulatorFor64Bits>>long64At: (in category 'memory access') -----
  long64At: byteAddress
+ 	"memory is a DoubleWordArray, a 64-bit indexable array of bits.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"memory is a DoubleWordArray, a 64-bit indexable array of bits"
  	byteAddress \\ 8 ~= 0 ifTrue: [self unalignedAccessError].
+ 	^memory at: byteAddress // 8!
- 	^memory at: byteAddress // 8 + 1!

Item was changed:
  ----- Method: Spur64BitMMLESimulatorFor64Bits>>long64At:put: (in category 'memory access') -----
  long64At: byteAddress put: a64BitValue
+ 	"memory is a DoubleWordArray, a 64-bit indexable array of bits.
+ 	 0 is the null pointer, intended to produce an error; in practice 0 through 7 are all null pointers."
+ 
- 	"memory is a DoubleWordArray, a 64-bit indexable array of bits"
  	byteAddress \\ 8 ~= 0 ifTrue: [self unalignedAccessError].
+ 
+ 	"((byteAddress between: 16rA and: 16rB) and: [a64BitValue = 16rC]) ifTrue:
+ 		[self halt]."
+ 
+ 	^memory at: byteAddress // 8 put: a64BitValue!
- 	^memory at: byteAddress // 8 + 1 put: a64BitValue!

Item was changed:
  ----- Method: SpurMemoryManager>>printMemoryFrom:to: (in category 'debug printing') -----
  printMemoryFrom: start to: end
  	<doNotGenerate>
+ 	| transcript address |
- 	| address |
  	address := start bitAnd: (self wordSize - 1) bitInvert.
+ 	(transcript := coInterpreter transcript) ensureCr.
  	[address < end] whileTrue:
+ 		[(coInterpreter pst: '%WP: %WP\n') f: transcript printf: { address. self longAt: address}.
- 		[coInterpreter printHex: address; printChar: $:; space; printHex: (self longAt: address); cr.
  		 address := address + self wordSize]!

Item was changed:
  ----- Method: SpurMemoryManager>>startOfMemory (in category 'accessing') -----
  startOfMemory
+ 	"Answer the start of object memory. Use a macro so as not to punish the debug VM.
+ 	 Leave a guard page at the beginning for error checking."
- 	"Return the start of object memory. Use a macro so as not to punish the debug VM."
  	<cmacro: '() GIV(memory)'>
  	<returnTypeC: #usqInt>
+ 	^1024!
- 	^0!

Item was changed:
  ----- Method: SpurSegmentManager>>readHeapFrom:at:dataBytes: (in category 'private') -----
  readHeapFrom: f at: location dataBytes: numBytes
  	"Read numBytes from f into mmory at location.  Answer the number of bytes read."
  	<inline: true>
  	^self cCode:
  			[self
  				sq: (self pointerForOop: location)
  				Image: (self sizeof: #char)
  				File: numBytes
  				Read: f]
  		inSmalltalk:
  			[| bytesPerElement |
  			 bytesPerElement := manager memory bytesPerElement.
  			 (f	readInto: manager memory
+ 				startingAt: location // bytesPerElement
- 				startingAt: location // bytesPerElement + 1
  				count: numBytes // bytesPerElement)
  			  * bytesPerElement]!

Item was changed:
  ----- Method: VMStructType class>>fieldAccessorSourceFor:bytesPerWord: (in category 'code generation') -----
  fieldAccessorSourceFor: surrogateClass bytesPerWord: bytesPerWord
  	"Answer a Dictionary of MethodReference to source for the accessors of the inst vars of the
  	 receiver and the alignedByteSize class method in surrogateClass with the given word size."
  
  	"{CogBlockMethod fieldAccessorSourceFor: CogBlockMethodSurrogate32 bytesPerWord: 4.
  	 CogMethod fieldAccessorSourceFor: CogMethodSurrogate32 bytesPerWord: 4.
  	 CogBlockMethod fieldAccessorSourceFor: CogBlockMethodSurrogate64 bytesPerWord: 8.
  	 CogMethod fieldAccessorSourceFor: CogMethodSurrogate64 bytesPerWord: 8}"
  	| methods bitPosition alignedByteSize currentOffset |
  	methods := Dictionary new.
  	bitPosition := 0.
  	(self fieldAccessorsForBytesPerWord: bytesPerWord) do:
  		[:spec|
  		"reset the bitPosition if the offset expression changes."
  		currentOffset ~= (self offsetForInstVar: spec first) ifTrue:
  			[bitPosition := 0.
  			 currentOffset := self offsetForInstVar: spec first].
  		spec first ~= #unused ifTrue:
  			[methods
  				at: {surrogateClass. spec first asSymbol}
+ 					put: (surrogateClass
+ 							getter: spec first
+ 							offsetExpression: (self offsetForInstVar: spec first)
+ 							bitPosition: bitPosition
+ 							bitWidth: spec second
+ 							type: (spec at: 3 ifAbsent: []));
- 					put: (self getter: spec first
- 							 bitPosition: bitPosition
- 							 bitWidth: spec second
- 							 type: (spec at: 3 ifAbsent: []));
  				at: {surrogateClass. (spec first, ':') asSymbol}
+ 					put: (surrogateClass
+ 							setter: spec first
+ 							offsetExpression: (self offsetForInstVar: spec first)
+ 							bitPosition: bitPosition
+ 							bitWidth: spec second
+ 							type: (spec at: 3 ifAbsent: []))].
- 					put: (self setter: spec first
- 							 bitPosition: bitPosition
- 							 bitWidth: spec second
- 							 type: (spec at: 3 ifAbsent: []))].
  		bitPosition := bitPosition + spec second].
  	alignedByteSize := (self roundUpBitPosition: bitPosition toWordBoundary: bytesPerWord) / 8.
  	self assert: alignedByteSize isInteger.
  	methods
  		at: {surrogateClass class. #alignedByteSize}
  		put: #alignedByteSize
  			, (String with: Character cr with: Character tab with: $^)
  			, alignedByteSize printString,
  			(currentOffset ifNil: [''] ifNotNil: [' + self ', currentOffset]).
  	^methods!

Item was changed:
  ----- Method: VMStructType class>>fieldAccessorsForBytesPerWord: (in category 'code generation') -----
  fieldAccessorsForBytesPerWord: bytesPerWord
  	| fieldSpecs |
  	fieldSpecs := OrderedCollection new.
  	self instVarNamesAndTypesForTranslationDo:
  		[:ivn :typeTuple| | index replacement |
  		(index := typeTuple indexOf: #BytesPerWord ifAbsent: 0) > 0
  			ifTrue:
  				[(typeTuple at: index + 1) = bytesPerWord ifTrue:
  					[replacement := typeTuple copyReplaceFrom: index to: index + 1 with: #().
  					 replacement size = 1 ifTrue:
  						[replacement := replacement first].
  					fieldSpecs add: { ivn. replacement }]]
  			ifFalse:
  				[fieldSpecs add: { ivn. typeTuple }]].
  	^fieldSpecs collect:
  		[:tuple|
  			[:ivn :typeTuple|
  			{ ('*unused*' match: ivn) ifTrue: [#unused] ifFalse: [ivn].
  			  (typeTuple isArray and: ['unsigned' = typeTuple first])
  				ifTrue:
  					[Integer readFrom: (typeTuple last readStream skipTo: $:; skipSeparators)]
  				ifFalse:
  					[typeTuple
  						caseOf: {
  								[#char]				->	[8].
  								[#'unsigned char']	->	[8].
  								[#short]			->	[16].
  								[#'unsigned short']	->	[16].
  								[#int]				->	[32].
  								[#'unsigned int']	->	[32] }
  						otherwise: [bytesPerWord * 8]].
  			typeTuple isArray
  				ifTrue:
  					[(typeTuple size >= 3 and: [typeTuple second = #Boolean]) ifTrue:
  						[#Boolean]]
  				ifFalse:
+ 					[(typeTuple last = $*
+ 					 and: [typeTuple beginsWith: 'struct _']) "remove struct tag if any"
+ 						ifTrue: [(typeTuple allButFirst: 8) asSymbol]
+ 						ifFalse: [typeTuple]] }] valueWithArguments: tuple]
- 					[typeTuple last = $* ifTrue:
- 						[(typeTuple beginsWith: 'struct _') "remove struct tag if any"
- 							ifTrue: [(typeTuple allButFirst: 8) asSymbol]
- 							ifFalse: [typeTuple]]] }] valueWithArguments: tuple]
  
  	"#(4 8) collect: [:bpw| (CogBlockMethod fieldAccessorsForBytesPerWord: bpw) asArray]"
  	"#(4 8) collect: [:bpw| (CogMethod fieldAccessorsForBytesPerWord: bpw) asArray]"!

Item was removed:
- ----- Method: VMStructType class>>getter:bitPosition:bitWidth:type: (in category 'code generation') -----
- getter: getter bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
- 	^String streamContents:
- 		[:s| | startByte endByte alignedPowerOf2 shift |
- 		startByte := bitPosition // 8.
- 		endByte := bitPosition + bitWidth - 1 // 8.
- 		shift := bitPosition \\ 8.
- 		alignedPowerOf2 := (#(8 16 32 64) includes: bitWidth) and: [shift = 0].
- 		s nextPutAll: getter; crtab: 1.
- 		(typeOrNil notNil and: [typeOrNil last = $*]) ifTrue:
- 			[s nextPutAll: '| v |'; crtab: 1].
- 		s nextPut: $^.
- 		typeOrNil ifNotNil:
- 			[s nextPut: $(.
- 			 typeOrNil last = $* ifTrue:
- 				[s nextPutAll: 'v := ']].
- 		alignedPowerOf2 ifFalse:
- 			[s nextPut: $(].
- 		shift ~= 0 ifTrue:
- 			[s nextPut: $(].
- 		s nextPutAll: 'memory unsigned';
- 		   nextPutAll: (#('Byte' 'Short' 'Long' 'Long')
- 							at: endByte - startByte + 1
- 							ifAbsent: ['Long64']);
- 		  nextPutAll: 'At: address + '; print: startByte + 1.
- 		(self offsetForInstVar: getter) ifNotNil:
- 			[:offsetExpr| s nextPutAll: ' + '; nextPutAll: offsetExpr].
- 		shift ~= 0 ifTrue:
- 			[s nextPutAll: ') bitShift: -'; print: shift].
- 		alignedPowerOf2 ifFalse:
- 			[s nextPutAll: ') bitAnd: '; nextPutAll: ((1 << bitWidth) - 1) hex].
- 		typeOrNil ifNotNil:
- 			[s nextPutAll: ') ~= 0'.
- 			typeOrNil last = $* ifTrue:
- 				[s nextPutAll: ' ifTrue:';
- 					crtab: 2;
- 					nextPutAll: '[cogit cCoerceSimple: v to: ';
- 					store: typeOrNil;
- 					nextPut: $]]]]!

Item was removed:
- ----- Method: VMStructType class>>putAtPut:type:mask:shift:on:indent: (in category 'code generation') -----
- putAtPut: accessor type: typeOrNil mask: maskOrNil shift: shift on: s indent: indent
- 	"This is the inner part of the ap:put: in a setter, abstracted to eliminate duplication
- 	 given the overrides in CogBlockMethod et al for dual zone write simulation."
- 	s nextPutAll: 'memory';
- 	  crtab: indent; nextPutAll: accessor.
- 	s crtab: indent; nextPutAll: 'put: '.
- 	typeOrNil ifNotNil:
- 		[s nextPut: $(].
- 	maskOrNil ifNotNil:
- 		[s nextPutAll: '((memory '; nextPutAll: accessor;
- 		    nextPutAll: ') bitAnd: '; nextPutAll: maskOrNil hex;
- 		    nextPutAll: ') + '].
- 	s nextPutAll: (typeOrNil
- 					caseOf: {
- 						[nil] -> [shift = 0 ifTrue: ['aValue'] ifFalse: ['(aValue bitShift: ', shift printString, ')']].
- 						[#Boolean] -> ['(aValue ifTrue: [', (1 << shift) printString, '] ifFalse: [0])'] }
- 					otherwise: ['(aValue ifNotNil: [aValue asUnsignedInteger', (shift = 0 ifTrue: [''] ifFalse: [' bitShift: ', shift printString]), '] ifNil: [0])']).
- 	typeOrNil ifNotNil:
- 		[s nextPut: $)]!

Item was changed:
  ----- Method: VMStructType class>>setter:bitPosition:bitWidth:type: (in category 'code generation') -----
  setter: getter bitPosition: bitPosition bitWidth: bitWidth type: typeOrNil
+ 	self shouldNotImplement. "should be under CogSurrogate class"
  	^String streamContents:
  		[:s| | startByte endByte shift indexExpr accessor alignedPowerOf2 mask |
  		startByte := bitPosition // 8.
  		endByte := bitPosition + bitWidth - 1 // 8.
  		shift := bitPosition \\ 8.
  		s nextPutAll: getter; nextPutAll: ': aValue'; crtab: 1.
  		indexExpr := 'address + ',
  						((self offsetForInstVar: getter) ifNotNil: [:offsetExpr| offsetExpr, ' + '] ifNil: ['']),
  						(startByte + 1) printString.
  		accessor := 'unsigned'
  					, (#('Byte' 'Short' 'Long' 'Long')
  							at: endByte - startByte + 1
  							ifAbsent: ['Long64'])
  					, 'At: '.
  		(alignedPowerOf2 := (#(8 16 32 64) includes: bitWidth) and: [shift = 0])
  			ifTrue: "index used once; no point using a temp to hold it"
  				[accessor := accessor, indexExpr]
  			ifFalse: "index used twice; cache it"
  				[s nextPutAll: '| index |'; crtab: 1; nextPutAll: 'index := '; nextPutAll: indexExpr; nextPut: $.; crtab: 1.
  				 accessor := accessor, 'index'].
  		mask := #(16rFF 16rFFFF 16rFFFFFFFF 16rFFFFFFFF)
  						at: endByte - startByte + 1
  						ifAbsent: [(2 raisedTo: 64) - 1].
  		(typeOrNil notNil or: [alignedPowerOf2]) ifFalse:
  			[s nextPutAll: 'self assert: (aValue between: 0 and: '; nextPutAll:  ((1 << bitWidth) - 1) hex; nextPutAll: ').'; crtab: 1].
  		alignedPowerOf2 ifTrue:
  			[s nextPut: $^].
  		self putAtPut: accessor
  			type: typeOrNil
  			mask: (alignedPowerOf2 ifFalse: [mask - ((1 << bitWidth - 1) << shift)])
  			shift: shift
  			on: s
  			indent: 2.
  		alignedPowerOf2 ifFalse:
  			[s nextPut: $.; crtab: 1; nextPutAll: '^aValue']]!



More information about the Vm-dev mailing list