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

commits at source.squeak.org commits at source.squeak.org
Thu Feb 16 22:27:12 UTC 2012


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

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

Name: VMMaker.oscog-eem.144
Author: eem
Time: 16 February 2012, 2:24:47.042 pm
UUID: bafb8042-095a-42f3-9058-ee7bd133da50
Ancestors: VMMaker.oscog-eem.143

Make primitiveObjectAtPut fail if used to store other than a
SmallInteger into the method header.

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

Item was changed:
  ----- Method: CoInterpreterPrimitives>>primitiveObjectAtPut (in category 'object access primitives') -----
  primitiveObjectAtPut
+ 	"Store a literal into a CompiledMethod at the given index. Defined for CompiledMethods only."
- "Defined for CompiledMethods only"
  	| thisReceiver rawHeader realHeader index newValue |
  	newValue := self stackValue: 0.
+ 	index := self stackValue: 1.
+ 	((objectMemory isNonIntegerObject: index)
+ 	 or: [index = ConstOne and: [(objectMemory isNonIntegerObject: newValue)]]) ifTrue:
- 	index := self stackIntegerValue: 1.
- 	self successful ifFalse:
  		[^self primitiveFailFor: PrimErrBadArgument].
+ 	index := objectMemory integerValueOf: index.
  	thisReceiver := self stackValue: 2.
  	rawHeader := self rawHeaderOf: thisReceiver.
  	realHeader := (self isCogMethodReference: rawHeader)
  					ifTrue: [(self cCoerceSimple: rawHeader to: #'CogMethod *') methodHeader]
  					ifFalse: [rawHeader].
  	(index > 0
  	 and: [index <= ((self literalCountOfHeader: realHeader) + LiteralStart)]) ifFalse:
  		[^self primitiveFailFor: PrimErrBadIndex].
  	(index = 1
  	 and: [self isCogMethodReference: rawHeader])
  		ifTrue: [(self cCoerceSimple: rawHeader to: #'CogMethod *') methodHeader: newValue]
  		ifFalse: [objectMemory storePointer: index - 1 ofObject: thisReceiver withValue: newValue].
  	self pop: 3 thenPush: newValue!

Item was added:
+ ----- Method: CogVMSimulator>>primitiveObjectAtPut (in category 'object access primitives') -----
+ primitiveObjectAtPut
+ 	| newValue |
+ 	newValue := self stackValue: 0.
+ 	((self stackValue: 1) = ConstOne
+ 	 and: [(objectMemory isIntegerObject: newValue) not
+ 		   or: [(objectMemory integerValueOf: newValue) < 0]]) ifTrue:
+ 		[self halt].
+ 	^super primitiveObjectAtPut!

Item was changed:
  ----- Method: InterpreterPrimitives>>primitiveObjectAtPut (in category 'object access primitives') -----
  primitiveObjectAtPut
+ 	"Store a literal into a CompiledMethod at the given index. Defined for CompiledMethods only."
- "Defined for CompiledMethods only"
  	| thisReceiver index newValue |
  	newValue := self stackValue: 0.
+ 	index := self stackValue: 1.
+ 	((objectMemory isNonIntegerObject: index)
+ 	 or: [index = ConstOne and: [(objectMemory isNonIntegerObject: newValue)]]) ifTrue:
- 	index := self stackIntegerValue: 1.
- 	self successful ifFalse:
  		[^self primitiveFailFor: PrimErrBadArgument].
+ 	index := objectMemory integerValueOf: index.
  	thisReceiver := self stackValue: 2.
  	(index > 0 and: [index <= ((self literalCountOf: thisReceiver) + LiteralStart)]) ifFalse:
  		[^self primitiveFailFor: PrimErrBadIndex].
  	objectMemory storePointer: index - 1 ofObject: thisReceiver withValue: newValue.
  	self pop: 3 thenPush: newValue!



More information about the Vm-dev mailing list