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

commits at source.squeak.org commits at source.squeak.org
Mon Nov 25 20:54:02 UTC 2013


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

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

Name: Cog-eem.123
Author: eem
Time: 25 November 2013, 12:53:46.988 pm
UUID: 3390bef4-24bf-4728-94a2-c94df99e1e2a
Ancestors: Cog-eem.122

Fix Behavior>>handleFailingBasicNew: in the Spur bootastrap by
redefining primitiveGarbageCollect to answer the byte size of the
largest free chunk, rather than the total ammount of free space,
and by adding Behavior>>byteSizeOfInstanceWithIndexableVariables:.

Fix the bootstrap to not waste memory allocating an unused code zone.

=============== Diff against Cog-eem.122 ===============

Item was added:
+ ----- Method: SpurBootstrap class>>BehaviorPROTOTYPEbyteSizeOfInstance (in category 'method prototypes') -----
+ BehaviorPROTOTYPEbyteSizeOfInstance
+ 	"Answer the total memory size of an instance of the receiver."
+ 
+ 	<primitive: 181>
+ 	self isVariable ifTrue:
+ 		[^self byteSizeOfInstanceWithIndexableVariables: 0].
+ 	self primitiveFailed!

Item was added:
+ ----- Method: SpurBootstrap class>>BehaviorPROTOTYPEbyteSizeOfInstanceWithIndexableVariables: (in category 'method prototypes') -----
+ BehaviorPROTOTYPEbyteSizeOfInstanceWithIndexableVariables: sizeRequested
+ 	"Answer the total memory size of an instance of the receiver
+ 	 with the given number of indexable instance variables."
+ 
+ 	<primitive: 181>
+ 	self isVariable ifFalse:
+ 		[sizeRequested = 0 ifTrue:
+ 			[^self byteSizeOfInstance]].
+ 	self primitiveFailed!

Item was changed:
  ----- Method: SpurBootstrap class>>BehaviorPROTOTYPEhandleFailingBasicNew (in category 'method prototypes') -----
  BehaviorPROTOTYPEhandleFailingBasicNew
  	"This basicNew gets sent after basicNew has failed and allowed a
  	 scavenging garbage collection to occur.  The scavenging collection
  	 will have happened as the VM is activating the (failing) basicNew.
  	 If failingBasicNew fails then the scavenge failed to reclaim sufficient
  	 space and a global garbage collection is required.
  
  	 Primitive. Answer an instance of this class with the number of indexable
  	 variables specified by the argument, sizeRequested.  Fail if this class is not
  	 indexable or if the argument is not a positive Integer, or if there is not
  	 enough memory available. Essential. See Object documentation whatIsAPrimitive."
  
  	<primitive: 70>
- 	self isVariable ifTrue: [^self basicNew: 0].
  	Smalltalk garbageCollect < 1048576 ifTrue:
  		[Smalltalk growMemoryByAtLeast: 1048576].
  	^self handleFailingFailingBasicNew "retry after global garbage collect"!

Item was changed:
  ----- Method: SpurBootstrap class>>BehaviorPROTOTYPEhandleFailingBasicNew: (in category 'method prototypes') -----
  BehaviorPROTOTYPEhandleFailingBasicNew: sizeRequested
  	"This basicNew: gets sent after basicNew: has failed and allowed a
  	 scavenging garbage collection to occur.  The scavenging collection
  	 will have happened as the VM is activating the (failing) basicNew:.
  	 If handleFailingBasicNew: fails then the scavenge failed to reclaim
  	 sufficient space and a global garbage collection is required.
  
  	 Primitive. Answer an instance of this class with the number of indexable
  	 variables specified by the argument, sizeRequested.  Fail if this class is not
  	 indexable or if the argument is not a positive Integer, or if there is not
  	 enough memory available. Essential. See Object documentation whatIsAPrimitive."
  
  	<primitive: 71>
+ 	| bytesRequested |
+ 	bytesRequested := self byteSizeOfInstanceWithIndexableVariables: sizeRequested.
+ 	Smalltalk garbageCollect < bytesRequested ifTrue:
+ 		[Smalltalk growMemoryByAtLeast: bytesRequested].
+ 	"retry after global garbage collect and possible grow"
+ 	^self handleFailingFailingBasicNew: sizeRequested!
- 	self isVariable ifFalse:
- 		[self error: self printString, ' cannot have variable sized instances'].
- 	(sizeRequested isInteger and: [sizeRequested >= 0]) ifTrue:
- 		[Smalltalk garbageCollect < sizeRequested ifTrue:
- 			[Smalltalk growMemoryByAtLeast: sizeRequested * self elementSize].
- 		^self handleFailingFailingBasicNew: sizeRequested  "retry after global garbage collect and possible grow"].
- 	self primitiveFailed!

Item was changed:
  ----- Method: SpurBootstrap class>>BehaviorPROTOTYPEhandleFailingFailingBasicNew (in category 'method prototypes') -----
  BehaviorPROTOTYPEhandleFailingFailingBasicNew
  	"This basicNew gets sent after failingBasicNew: has sent Smalltalk garbageCollect.
  	 If this fails then the system really is low on space.
  
  	 Primitive. Answer an instance of this class with the number of indexable
  	 variables specified by the argument, sizeRequested.  Fail if this class is not
  	 indexable or if the argument is not a positive Integer, or if there is not
  	 enough memory available. Essential. See Object documentation whatIsAPrimitive."
  
  	<primitive: 70>
- 	self isVariable ifTrue: [^self basicNew: 0].
  	"space must be low"
  	OutOfMemory signal.
  	^self basicNew  "retry if user proceeds"!

Item was changed:
  ----- Method: SpurBootstrap class>>BehaviorPROTOTYPEhandleFailingFailingBasicNew: (in category 'method prototypes') -----
  BehaviorPROTOTYPEhandleFailingFailingBasicNew: sizeRequested
  	"This basicNew: gets sent after failingBasicNew: has sent Smalltalk garbageCollect.
  	 If that fails the system really is low on space.
  
  	 Primitive. Answer an instance of this class with the number of indexable
  	 variables specified by the argument, sizeRequested.  Fail if this class is not
  	 indexable or if the argument is not a positive Integer, or if there is not
  	 enough memory available. Essential. See Object documentation whatIsAPrimitive."
  
  	<primitive: 71>
+ 	"arg okay; space must be low."
+ 	OutOfMemory signal.
+ 	^self basicNew: sizeRequested  "retry if user proceeds"!
- 	self isVariable ifFalse:
- 		[self error: self printString, ' cannot have variable sized instances'].
- 	(sizeRequested isInteger and: [sizeRequested >= 0]) ifTrue:
- 		["arg okay; space must be low."
- 		OutOfMemory signal.
- 		^self basicNew: sizeRequested  "retry if user proceeds"].
- 	self primitiveFailed!

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
  		allocateMemoryOfSize: (oldHeap youngStart * 3 / 2 roundUpTo: 1024 * 1024)
  		newSpaceSize: 1024 * 1024
  		stackSize: 1024 * 1024
+ 		codeSize: 0.
- 		codeSize: 1024 * 1024.
  	newHeap setCheckForLeaks: 15 - 6. "don't check become; or newSpace; soooo many rehashes in bootstrap"
  	map := Dictionary new: oldHeap memory size // 4.
  	reverseMap := Dictionary new: oldHeap memory size // 4.
  	classToIndex := Dictionary new: 1024.
  	literalMap := IdentityDictionary new.
  	methodClasses := Set new.
  	installedPrototypes := Set new!



More information about the Vm-dev mailing list