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

commits at source.squeak.org commits at source.squeak.org
Wed Mar 12 19:28:26 UTC 2014


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

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

Name: Cog-eem.144
Author: eem
Time: 12 March 2014, 12:27:47.308 pm
UUID: 882e3387-ae14-4514-a820-e937f3ebeef6
Ancestors: Cog-eem.143

Spur bootstrap:
Rename unweildy byteSizeOfInstanceWithIndexableVariables: to
byteSizeOfInstanceOfSize:

Add an accurate version of SpaceTally>>spaceForInstancesOf:

=============== Diff against Cog-eem.143 ===============

Item was changed:
  ----- 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 byteSizeOfInstanceOfSize: 0].
- 		[^self byteSizeOfInstanceWithIndexableVariables: 0].
  	self primitiveFailed!

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

Item was removed:
- ----- 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: sizeRequested
  	"handleFailingBasicNew: 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.  Retry after garbage
  	 collecting and growing memory if necessary.
  
  	 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 byteSizeOfInstanceOfSize: sizeRequested.
- 	bytesRequested := self byteSizeOfInstanceWithIndexableVariables: sizeRequested.
  	Smalltalk garbageCollect < bytesRequested ifTrue:
  		[Smalltalk growMemoryByAtLeast: bytesRequested].
  	"retry after global garbage collect and possible grow"
  	^self handleFailingFailingBasicNew: sizeRequested!

Item was added:
+ ----- Method: SpurBootstrap class>>SpaceTallyPROTOTYPEspaceForInstancesOf: (in category 'method prototypes') -----
+ SpaceTallyPROTOTYPEspaceForInstancesOf: aClass
+ 	"Answer a pair of the number of bytes consumed by all instances of the
+ 	 given class, including their object headers, and the number of instances."
+ 
+ 	| instances total |
+ 	instances := aClass allInstances.
+ 	instances isEmpty ifTrue: [^#(0 0)].
+ 	total := 0.
+ 	aClass isVariable
+ 		ifTrue:
+ 			[instances do:
+ 				[:i| total := total + (aClass byteSizeOfInstanceOfSize: i basicSize)]]
+ 		ifFalse:
+ 			[total := instances size * aClass byteSizeOfInstance].
+ 	^{ total. instances size }!



More information about the Vm-dev mailing list