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

commits at source.squeak.org commits at source.squeak.org
Fri Mar 18 22:58:49 UTC 2016

Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-nice.1735
Author: nice
Time: 18 March 2016, 11:56:29.175 pm
UUID: 498f1478-029f-42dc-8290-20203333af22
Ancestors: VMMaker.oscog-nice.1733

Workaround spurious breakage caused by nice.1732

Slang inliner does inline this call:

    sqInt shifted = 0xFFFFFFFFU;
    shifted = positive32BitIntegerFor(shifted);


    sqInt shifted = 0xFFFFFFFFU;
    if( shifted <= MaxSmallInteger)
        shifted = (shifted << 1) | 1;

shifted interpreted as signed integer is negative.
MaxSmallInteger is a signed integer constant, so the if test is TRUE.
and a negative SmallInteger is created (with value -1) instead of a LargePositiveInteger as it should have been.

The intention is to interpret shifted as an unsigned integer, but since we did not help SLANG with a hint, slang did produce a signed (sqInt) by default.

=============== Diff against VMMaker.oscog-nice.1733 ===============

Item was changed:
  ----- Method: StackInterpreter>>maybeInlinePositive32BitIntegerFor: (in category 'primitive support') -----
  maybeInlinePositive32BitIntegerFor: integerValue
  	"N.B. will *not* cause a GC.
  	 integerValue is interpreted as POSITIVE, e.g. as the result of Bitmap>at:."
  	<notOption: #Spur64BitMemoryManager>
  	<var: 'integerValue' type: #'unsigned int'>
  	| newLargeInteger |
  	self deny: objectMemory hasSixtyFourBitImmediates.
+        "force coercion because slang inliner sometimes incorrectly pass a signed int without converting to unsigned"
+        (self cCoerceSimple: integerValue to: #'unsigned int') <= objectMemory maxSmallInteger
- 	integerValue <= objectMemory maxSmallInteger
  		ifTrue: [^ objectMemory integerObjectOf: integerValue].
  	newLargeInteger := objectMemory
  							eeInstantiateSmallClassIndex: ClassLargePositiveIntegerCompactIndex
  							format: (objectMemory byteFormatForNumBytes: 4)
  							numSlots: 1.
  	self cppIf: VMBIGENDIAN
  				storeByte: 3 ofObject: newLargeInteger withValue: (integerValue >> 24 bitAnd: 16rFF);
  				storeByte: 2 ofObject: newLargeInteger withValue: (integerValue >> 16 bitAnd: 16rFF);
  				storeByte: 1 ofObject: newLargeInteger withValue: (integerValue >>   8 bitAnd: 16rFF);
  				storeByte: 0 ofObject: newLargeInteger withValue: (integerValue ">> 0" bitAnd: 16rFF)]
  			[objectMemory storeLong32: 0 ofObject: newLargeInteger withValue: integerValue].

More information about the Vm-dev mailing list