[Vm-dev] VM Maker: Cog-eem.66.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Sep 3 01:23:49 UTC 2013


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

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

Name: Cog-eem.66
Author: eem
Time: 2 September 2013, 6:23:37.336 pm
UUID: 66744cc4-36ff-4638-847f-f7fdfc4c08ef
Ancestors: Cog-eem.65

Rename CogMemoryManager et al to SpurMemoryManager et al.

Add class initialization of SpurMemoryManager.

Move assignment of classTableRootObj: so SMM can cache classTableFirstPage.

Add comment to defineKnownClassIndices to ref mirror init in
SMM class.

=============== Diff against Cog-eem.65 ===============

Item was changed:
  ----- Method: SpurBootstrap>>allocateClassTable (in category 'bootstrap') -----
  allocateClassTable
  	"Allocate the root of the classTable plus enough pages to accomodate all classes in
  	 the classToIndex map.  Don;t fill in the entries yet; the classes have yet to be cloned."
  	| tableRootSize tableRoot page maxSize numPages |
  	tableRootSize := self classTableSize / newHeap classTablePageSize.
  	tableRoot := newHeap
  					allocateSlots: tableRootSize
  					format: newHeap arrayFormat
  					classIndex: newHeap arrayClassIndexPun.
  	self assert: (newHeap numSlotsOf: tableRoot) = tableRootSize.
  	self assert: (newHeap formatOf: tableRoot) = newHeap arrayFormat.
  	self assert: (newHeap classIndexOf: tableRoot) = newHeap arrayClassIndexPun.
- 	newHeap classTableRootObj: tableRoot.
  	newHeap nilFieldsOf: tableRoot.
  	"first page is strong"
  	page := newHeap
  					allocateSlots: newHeap classTablePageSize
  					format: newHeap arrayFormat
  					classIndex: newHeap arrayClassIndexPun.
  	self assert: (newHeap numSlotsOf: page) = newHeap classTablePageSize.
  	self assert: (newHeap formatOf: tableRoot) = newHeap arrayFormat.
  	self assert: (newHeap classIndexOf: tableRoot) = newHeap arrayClassIndexPun.
  	self assert: (newHeap objectAfter: tableRoot) = page.
  	newHeap nilFieldsOf: page.
  	newHeap storePointer: 0 ofObject: tableRoot withValue: page.
+ 	newHeap classTableRootObj: tableRoot.
  	maxSize := classToIndex inject: 0 into: [:a :b| a max: b].
  	numPages := (maxSize + newHeap classTableMinorIndexMask / newHeap classTablePageSize) truncated.
  	2 to: numPages do:
  		[:i|
  		page := newHeap
  					allocateSlots: newHeap classTablePageSize
  					format: newHeap weakArrayFormat
  					classIndex: newHeap weakArrayClassIndexPun.
  		self assert: (newHeap numSlotsOf: page) = newHeap classTablePageSize.
  		self assert: (newHeap formatOf: page) = newHeap weakArrayFormat.
  		self assert: (newHeap classIndexOf: page) = newHeap weakArrayClassIndexPun.
  		newHeap nilFieldsOf: page.
  		newHeap storePointer: i - 1 ofObject: tableRoot withValue: page.
  		self assert: (newHeap objectAfter: (newHeap fetchPointer: i - 2 ofObject: tableRoot)) = page].
  	pastClassTable := newHeap freeStart.!

Item was changed:
  ----- Method: SpurBootstrap>>defineKnownClassIndices (in category 'class indices') -----
  defineKnownClassIndices
  	"The classTable is laid out
  		- to make it easy to map immediates to classes; the tag pattern of an immediate is its class index.
  		  hence there are two entries for SmallInteger
  		- to assign small indices to well-known classes such as Array, Message et al
  		- to leave plenty of room for new known classes; hence the first page contains only well-known classes
  		- to enable overlaps and avoid conflicts with indices in the specialObjectsArray (?really? eem)
  		- to provide a WeakArray pun for the pages of the table itself so that these do not show up as instances of WeakArray"
  	| classMethodContext classBlockClosure classMessage "no api method for these" |
  	classMessage := oldHeap splObj: (VMObjectIndices bindingOf: #ClassMessage) value.
  	classMethodContext := oldHeap splObj: (VMObjectIndices bindingOf: #ClassMethodContext) value.
  	classBlockClosure := oldHeap splObj: (VMObjectIndices bindingOf: #ClassBlockClosure) value.
+ 	"c.f. CogMemoryManager class>>intializeCompactClassIndices"
  	classToIndex
  		at: oldHeap classSmallInteger put: 1; "N.B. must fill-in index 3 manually"
  		at: oldHeap classCharacter put: 2;
  		"at: oldHeap classSmallInteger put: 3" "N.B. must fill-in index 3 manually"
  		"leave room for up to 15 tagged classes"
  		"leave room for up to 16 puns"
  		at: oldHeap classLargePositiveInteger put: 32;
  		at: oldHeap classLargeNegativeInteger put: 33;
  		at: oldHeap classFloat put: 34;
  
  		at: "oldHeap" classMessage put: 35;
  		at: "oldHeap" classMethodContext put: 36;
  		at: "oldHeap" classBlockClosure put: 37;
  
  		at: oldHeap classSemaphore put: 48;
  		at: oldHeap classMutex put: 49;
  
  		at: oldHeap classByteArray put: 50;
  		at: oldHeap classArray put: 51;
  		at: oldHeap classString put: 52;
  		at: oldHeap classBitmap put: 53;
  		at: oldHeap classPoint put: 54;
  
  		at: oldHeap classExternalAddress put: 128;
  		at: oldHeap classExternalData put: 129;
  		at: oldHeap classExternalFunction put: 130;
  		at: oldHeap classExternalLibrary put: 131;
  		at: oldHeap classExternalStructure put: 132;
  		at: oldHeap classAlien put: 133;
  		at: oldHeap classUnsafeAlien put: 133!

Item was changed:
  ----- Method: SpurBootstrap>>launch (in category 'testing') -----
  launch
  	| sim |
+ 	SpurMemoryManager initializeWithOptions: Dictionary new.
  	sim := StackInterpreterSimulator new.
  	sim instVarNamed: #objectMemory put: newHeap.
  	newHeap coInterpreter: sim.
  	newHeap initializePostBootstrap.
  	sim initializeInterpreter: 0.
  	sim run!

Item was changed:
  ----- Method: SpurBootstrap>>on: (in category 'initialize-release') -----
  on: imageName
  	StackInterpreter initializeWithOptions: Dictionary new.
  	oldInterpreter := StackInterpreterSimulator new.
  	oldInterpreter openOn: imageName extraMemory: 0.
  	oldHeap := oldInterpreter objectMemory.
+ 	newHeap := Spur32BitMMLESimulator new.
- 	newHeap := CMM32LSBSimulator new.
  	newHeap
  		allocateMemoryOfSize: (oldHeap youngStart * 5 / 4 roundUpTo: 8)
  		newSpaceSize: 1024 * 1024
  		codeSize: 1024 * 1024.
  	map := Dictionary new: oldHeap memory size // 4.
  	reverseMap := Dictionary new: oldHeap memory size // 4.
  	classToIndex := Dictionary new: 1024!



More information about the Vm-dev mailing list