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

commits at source.squeak.org commits at source.squeak.org
Tue Nov 20 19:21:20 UTC 2012


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

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

Name: VMMaker.oscog-eem.215
Author: eem
Time: 20 November 2012, 11:18:46.058 am
UUID: 91c4320a-7127-4488-8997-7aff2e49ee37
Ancestors: VMMaker.oscog-eem.214

Make instantiation primitives pop arguments, not assume arg count,
for Newspeak.  Make them answer error codes, and streamline,
avoiding using self success.

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

Item was changed:
  ----- Method: InterpreterPrimitives>>primitiveNew (in category 'object access primitives') -----
  primitiveNew
+ 	"Allocate a new fixed-size instance. Fail if the allocation would leave less than lowSpaceThreshold bytes free. May cause a GC."
- 	"Allocate a new fixed-size instance. Fail if the allocation would leave less than lowSpaceThreshold bytes free. May cause a GC"
  
- 	| class spaceOkay |
- 	class := self stackTop.
  	"The following may cause GC!!"
+ 	(objectMemory sufficientSpaceToInstantiate: self stackTop indexableSize: 0)
+ 		ifTrue: [self
+ 					pop: argumentCount + 1
+ 					thenPush: (objectMemory instantiateClass: self stackTop indexableSize: 0)]
+ 		ifFalse: [self primitiveFailFor: PrimErrNoMemory]!
- 	spaceOkay := objectMemory sufficientSpaceToInstantiate: class indexableSize: 0.
- 	self success: spaceOkay.
- 	self successful ifTrue:
- 			[self push: (objectMemory instantiateClass: self popStack indexableSize: 0)]!

Item was changed:
  ----- Method: InterpreterPrimitives>>primitiveNewWithArg (in category 'object access primitives') -----
  primitiveNewWithArg
+ 	"Allocate a new indexable instance. Fail if the allocation would leave less than lowSpaceThreshold bytes free. May cause a GC."
+ 	| size |
- 	"Allocate a new indexable instance. Fail if the allocation would leave less than lowSpaceThreshold bytes free."
- 	| size class spaceOkay |
  	size := self positive32BitValueOf: self stackTop.
+ 	(self successful and: [size >= 0])
+ 		ifTrue:
+ 			[(objectMemory sufficientSpaceToInstantiate: (self stackValue: 1) indexableSize: size)
+ 				ifTrue:
+ 					[self
+ 						pop: argumentCount + 1
+ 						thenPush: (objectMemory instantiateClass: (self stackValue: 1) indexableSize: size)]
+ 				ifFalse:
+ 					[self primitiveFailFor: PrimErrNoMemory]]
+ 		ifFalse:
+ 			[self primitiveFailFor: PrimErrBadArgument]!
- 	class := self stackValue: 1.
- 	self success: size >= 0.
- 	self successful ifTrue:
- 		["The following may cause GC!!"
- 		spaceOkay := objectMemory sufficientSpaceToInstantiate: class indexableSize: size.
- 		self success: spaceOkay.
- 		class := self stackValue: 1].
- 	self successful ifTrue:
- 		[self pop: 2 thenPush: (objectMemory instantiateClass: class indexableSize: size)]!



More information about the Vm-dev mailing list