[Vm-dev] VM Maker: VMMaker.oscog-dtl.873.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Sep 7 17:07:35 UTC 2014


David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-dtl.873.mcz

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

Name: VMMaker.oscog-dtl.873
Author: dtl
Time: 7 September 2014, 1:05:07.707 pm
UUID: fc025445-88f2-407b-bf08-763f27c53502
Ancestors: VMMaker.oscog-eem.872

Merge VMMaker-dtl.350

Fix primitiveBitShift (primitive 17) for sqInt declared 64 bits, as in a VM for 64-bit image format 68002.

In image format 68002, bit shift left failed because of return type limited to a 32-bit large integer, but internally the primitive successfully shifted left into a variable declared as a 64 bit sqInt. The simple fix (implemented here) is to declare the variable as 32 bit unsigned to agree with the 32-bit logic of the existing primitive.

Note that permitting a left shift into a 64 bit variable makes sense generally, and the primitive could be recoded to accomodate this for shift left, with the primitive answering positive64BitIntegerFor: rather than positive32BitIntegerFor: in the case of a shift left to allow for the greater range (not implemented in this update).

With this update, all KernelTests-Numbers tests pass for the 64-bit image format 68002.

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

Item was changed:
  ----- Method: InterpreterPrimitives>>primitiveBitShift (in category 'arithmetic integer primitives') -----
  primitiveBitShift 
  	| integerReceiver integerArgument shifted |
+ 	<var: #shifted type: 'unsigned'>
+ 
  	integerArgument := self popInteger.
  	integerReceiver := self popPos32BitInteger.
  	self successful ifTrue: [
  		integerArgument >= 0 ifTrue: [
  			"Left shift -- must fail if we lose bits beyond 32"
  			self success: integerArgument <= 31.
  			shifted := integerReceiver << integerArgument.
  			self success: (shifted >> integerArgument) = integerReceiver.
  		] ifFalse: [
  			"Right shift -- OK to lose bits"
  			self success: integerArgument >= -31.
  			shifted := integerReceiver >> (0 - integerArgument).
  		].
  	].
  	self successful
  		ifTrue: [self push: (self positive32BitIntegerFor: shifted)]
  		ifFalse: [self unPop: 2]!



More information about the Vm-dev mailing list