[Vm-dev] VM Maker: VMMaker.oscog-nice.2073.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jan 5 20:01:05 UTC 2017


Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-nice.2073.mcz

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

Name: VMMaker.oscog-nice.2073
Author: nice
Time: 5 January 2017, 8:59:38.809001 pm
UUID: ea25b651-c0f2-46a4-aae0-8acd00e7c6c2
Ancestors: VMMaker.oscog-rsf.2072

Fix access to 64 bits int from 32 bit VM in primitiveFFIIntegerAtPut

=============== Diff against VMMaker.oscog-rsf.2072 ===============

Item was changed:
  ----- Method: ThreadedFFIPlugin>>primitiveFFIIntegerAtPut (in category 'primitives') -----
  primitiveFFIIntegerAtPut
  	"Store a (signed or unsigned) n byte integer at the given byte offset
  	 in the receiver, using the platform's endianness."
  	| isSigned byteSize byteOffset rcvr addr value max valueOop |
  	<var: 'value' type: #sqLong>
  	<var: 'max' type: #sqLong>
  	<export: true>
  	<inline: false>
  	isSigned := interpreterProxy booleanValueOf: (interpreterProxy stackValue: 0).
  	byteSize := interpreterProxy stackIntegerValue: 1.
  	valueOop := interpreterProxy stackValue: 2.
  	byteOffset := interpreterProxy stackIntegerValue: 3.
  	rcvr := interpreterProxy stackObjectValue: 4.
  	interpreterProxy failed ifTrue:[^0].
  	(byteOffset > 0
  	 and: [(byteSize between: 1 and: 8)
  	 and: [(byteSize bitAnd: byteSize - 1) = 0 "a.k.a. isPowerOfTwo"]]) ifFalse:
  		[^interpreterProxy primitiveFail].
  	addr := self ffiAddressOf: rcvr startingAt: byteOffset size: byteSize.
  	interpreterProxy failed ifTrue:[^0].
  	isSigned 
+ 		ifTrue:[value := interpreterProxy signed64BitValueOf: valueOop]
+ 		ifFalse:[value := interpreterProxy positive64BitValueOf: valueOop].
- 		ifTrue:[value := interpreterProxy signedMachineIntegerValueOf: valueOop]
- 		ifFalse:[value := interpreterProxy positiveMachineIntegerValueOf: valueOop].
  	interpreterProxy failed ifTrue:[^0].
+ 	byteSize < 8 ifTrue:
- 	byteSize < BytesPerWord ifTrue:
  		[isSigned
  			ifTrue:
  				[max := 1 asUnsignedLongLong << (8 * byteSize - 1).
  				(value >= (0 - max) and: [value < max]) ifFalse: [^interpreterProxy primitiveFail]]
  			ifFalse:
  				[value asUnsignedLongLong < (1 asUnsignedLongLong << (8 * byteSize)) ifFalse: [^interpreterProxy primitiveFail]]].
  	byteSize <= 2
  		ifTrue:
  			[byteSize = 1
  				ifTrue: [interpreterProxy byteAt: addr put: value]
  				ifFalse: [interpreterProxy shortAt: addr put: value]]
  		ifFalse:
  			[byteSize = 4
  				ifTrue: [interpreterProxy long32At: addr put: value]
  				ifFalse: [interpreterProxy long64At: addr put: value]].
  	^interpreterProxy pop: 5 thenPush: valueOop!



More information about the Vm-dev mailing list