<div dir="ltr"><div><div><div><div><div>Note: I&#39;ve defined 2 more macros:<br><br>/* Since Large Integers are Bytes Oops allways stored as little endian,<br>   the following macros are handy to retrieve 4 or 8 byte limbs */<br>#if VMBIGENDIAN<br>#  define SQ_SWAP_4_BYTES_IF_BIGENDIAN(x) SQ_SWAP_4_BYTES(x)<br>#  define SQ_SWAP_8_BYTES_IF_BIGENDIAN(x) SQ_SWAP_8_BYTES(x)<br>#else<br>#  define SQ_SWAP_4_BYTES_IF_BIGENDIAN(x) (x)<br>#  define SQ_SWAP_8_BYTES_IF_BIGENDIAN(x) (x)<br>#endif<br><br></div>which might be more convenient than testing VMBIGENDIAN at each send site.<br></div>However, this shall necessary go thru objectMemory dispatching, because objectMemory does know, at least for simulation purposes...<br><br></div>(objectMemory byteSwap32ifBigEndian: x).<br><br></div>Theoretically, I should provide a hook when using an objectMemory message in a plugin like I plan to do with LargeIntegers, but I won&#39;t need it because that&#39;ll be replaced by a macro by CCodeGenerator (I&#39;ll add a hook)...<br><br></div>Do you find this OK, or just too crooked?<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-04-03 0:48 GMT+02:00  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:<br>
<a href="http://source.squeak.org/VMMaker/VMMaker.oscog-nice.1757.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/VMMaker/VMMaker.oscog-nice.1757.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: VMMaker.oscog-nice.1757<br>
Author: nice<br>
Time: 3 April 2016, 12:47:06.347 am<br>
UUID: a8652aa5-b750-4c29-bb85-283dc8201c29<br>
Ancestors: VMMaker.oscog-eem.1756<br>
<br>
Use the byte swap macros as provided by sqMemoryAccess.h since svn 3667<br>
<br>
Eliminate the now un-necessary related VMBasicConstants.<br>
<br>
Fx a snafu in StackInterpreter&gt;&gt;getWord32FromFile:swap: and CogVMSimulator&gt;&gt;openOn:extraMemory:  that would have swapped64 a long32 on 64bits VM...<br>
Well, there is no bigEndian 64bits STACK/COG image, so this was only a theoretical bug.<br>
Note: classical interpreter reads a long for image version, not a word32.<br>
<br>
Fix same snafu in StackInterpreter&gt;&gt;getShortFromFile:swap:  alas, I didn&#39;t provide a SQ_SWAP_2_BYTES macro, so open code it for now....<br>
<br>
=============== Diff against VMMaker.oscog-eem.1756 ===============<br>
<br>
Item was added:<br>
+ ----- Method: CCodeGenerator&gt;&gt;generateByteSwap32:on:indent: (in category &#39;C translation&#39;) -----<br>
+ generateByteSwap32: msgNode on: aStream indent: level<br>
+       &quot;Generate the C code for this message onto the given stream.&quot;<br>
+<br>
+       aStream nextPutAll: #&#39;SQ_SWAP_4_BYTES&#39;.<br>
+       aStream nextPut: $(.<br>
+       self emitCExpression: msgNode receiver on: aStream.<br>
+       aStream nextPut: $)!<br>
<br>
Item was added:<br>
+ ----- Method: CCodeGenerator&gt;&gt;generateByteSwap64:on:indent: (in category &#39;C translation&#39;) -----<br>
+ generateByteSwap64: msgNode on: aStream indent: level<br>
+       &quot;Generate the C code for this message onto the given stream.&quot;<br>
+<br>
+       aStream nextPutAll: #&#39;SQ_SWAP_8_BYTES&#39;.<br>
+       aStream nextPut: $(.<br>
+       self emitCExpression: msgNode receiver on: aStream.<br>
+       aStream nextPut: $)!<br>
<br>
Item was changed:<br>
  ----- Method: CCodeGenerator&gt;&gt;initializeCTranslationDictionary (in category &#39;C translation support&#39;) -----<br>
  initializeCTranslationDictionary<br>
        &quot;Initialize the dictionary mapping message names to actions for C code generation.&quot;<br>
<br>
        | pairs |<br>
<br>
        translationDict := Dictionary new: 200.<br>
        pairs := #(<br>
        #&amp;                              #generateAnd:on:indent:<br>
        #|                              #generateOr:on:indent:<br>
        #abs                    #generateAbs:on:indent:<br>
        #and:                   #generateSequentialAnd:on:indent:<br>
        #or:                    #generateSequentialOr:on:indent:<br>
        #not                    #generateNot:on:indent:<br>
<br>
        #+                              #generatePlus:on:indent:<br>
        #-                              #generateMinus:on:indent:<br>
        #negated                #generateNegated:on:indent:<br>
        #*                              #generateTimes:on:indent:<br>
        #/                              #generateDivide:on:indent:<br>
        #//                             #generateDivide:on:indent:<br>
        #\\                             #generateModulo:on:indent:<br>
        #&lt;&lt;                     #generateShiftLeft:on:indent:<br>
        #&gt;&gt;                     #generateShiftRight:on:indent:<br>
        #&gt;&gt;&gt;                    #generateSignedShiftRight:on:indent:<br>
        #min:                   #generateMin:on:indent:<br>
        #max:                   #generateMax:on:indent:<br>
        #between:and:   #generateBetweenAnd:on:indent:<br>
<br>
        #bitAnd:                        #generateBitAnd:on:indent:<br>
        #bitOr:                         #generateBitOr:on:indent:<br>
        #bitXor:                        #generateBitXor:on:indent:<br>
        #bitShift:                      #generateBitShift:on:indent:<br>
        #signedBitShift:        #generateSignedBitShift:on:indent:<br>
        #bitInvert32            #generateBitInvert:on:indent:<br>
        #bitInvert64            #generateBitInvert:on:indent:<br>
        #bitClear:                      #generateBitClear:on:indent:<br>
        #truncateTo:            #generateTruncateTo:on:indent:<br>
        #rounded                        #generateRounded:on:indent:<br>
<br>
+       #byteSwap32             #generateByteSwap32:on:indent:<br>
+       #byteSwap64             #generateByteSwap64:on:indent:<br>
+<br>
        #&lt;                              #generateLessThan:on:indent:<br>
        #&lt;=                     #generateLessThanOrEqual:on:indent:<br>
        #=                              #generateEqual:on:indent:<br>
        #&gt;                              #generateGreaterThan:on:indent:<br>
        #&gt;=                     #generateGreaterThanOrEqual:on:indent:<br>
        #~=                     #generateNotEqual:on:indent:<br>
        #==                     #generateEqual:on:indent:<br>
        #~~                     #generateNotEqual:on:indent:<br>
        #isNil                  #generateIsNil:on:indent:<br>
        #notNil                 #generateNotNil:on:indent:<br>
<br>
        #whileTrue:     #generateWhileTrue:on:indent:<br>
        #whileFalse:    #generateWhileFalse:on:indent:<br>
        #whileTrue      #generateDoWhileTrue:on:indent:<br>
        #whileFalse             #generateDoWhileFalse:on:indent:<br>
        #to:do:                 #generateToDo:on:indent:<br>
        #to:by:do:              #generateToByDo:on:indent:<br>
        #repeat                 #generateRepeat:on:indent:<br>
        #timesRepeat:   #generateTimesRepeat:on:indent:<br>
<br>
        #ifTrue:                        #generateIfTrue:on:indent:<br>
        #ifFalse:               #generateIfFalse:on:indent:<br>
        #ifTrue:ifFalse:        #generateIfTrueIfFalse:on:indent:<br>
        #ifFalse:ifTrue:        #generateIfFalseIfTrue:on:indent:<br>
<br>
        #ifNotNil:              #generateIfNotNil:on:indent:<br>
        #ifNil:                 #generateIfNil:on:indent:<br>
        #ifNotNil:ifNil:        #generateIfNotNilIfNil:on:indent:<br>
        #ifNil:ifNotNil:        #generateIfNilIfNotNil:on:indent:<br>
<br>
        #at:                            #generateAt:on:indent:<br>
        #at:put:                        #generateAtPut:on:indent:<br>
        #basicAt:               #generateAt:on:indent:<br>
        #basicAt:put:   #generateAtPut:on:indent:<br>
<br>
        #integerValueOf:                        #generateIntegerValueOf:on:indent:<br>
        #integerObjectOf:                       #generateIntegerObjectOf:on:indent:<br>
        #isIntegerObject:                       #generateIsIntegerObject:on:indent:<br>
        #cCode:                                 #generateInlineCCode:on:indent:<br>
        #cCode:inSmalltalk:                     #generateInlineCCode:on:indent:<br>
        #cPreprocessorDirective:        #generateInlineCPreprocessorDirective:on:indent:<br>
        #cppIf:ifTrue:ifFalse:          #generateInlineCppIfElse:on:indent:<br>
        #cppIf:ifTrue:                          #generateInlineCppIfElse:on:indent:<br>
        #cCoerce:to:                            #generateCCoercion:on:indent:<br>
        #cCoerceSimple:to:                      #generateCCoercion:on:indent:<br>
        #addressOf:                             #generateAddressOf:on:indent:<br>
        #addressOf:put:                 #generateAddressOf:on:indent:<br>
        #asAddress:put:                 #generateAsAddress:on:indent:<br>
        #signedIntFromLong64            #generateSignedIntFromLong64:on:indent:<br>
        #signedIntFromLong              #generateSignedIntFromLong:on:indent:<br>
        #signedIntFromShort             #generateSignedIntFromShort:on:indent:<br>
        #signedIntToLong64              #generateSignedIntToLong64:on:indent:<br>
        #signedIntToLong                        #generateSignedIntToLong:on:indent:<br>
        #signedIntToShort                       #generateSignedIntToShort:on:indent:<br>
        #preIncrement                           #generatePreIncrement:on:indent:<br>
        #preDecrement                   #generatePreDecrement:on:indent:<br>
        #inline:                                                #generateInlineDirective:on:indent:<br>
        #asFloat                                        #generateAsFloat:on:indent:<br>
        #asInteger                                      #generateAsInteger:on:indent:<br>
        #asUnsignedInteger              #generateAsUnsignedInteger:on:indent:<br>
        #asLong                                 #generateAsLong:on:indent:<br>
        #asUnsignedLong                 #generateAsUnsignedLong:on:indent:<br>
        #asUnsignedLongLong             #generateAsUnsignedLongLong:on:indent:<br>
        #asVoidPointer                          #generateAsVoidPointer:on:indent:<br>
        #asSymbol                                       #generateAsSymbol:on:indent:<br>
        #flag:                                          #generateFlag:on:indent:<br>
        #anyMask:                                       #generateBitAnd:on:indent:<br>
        #allMask:                                       #generateAllMask:on:indent:<br>
        #noMask:                                        #generateNoMask:on:indent:<br>
        #raisedTo:                                      #generateRaisedTo:on:indent:<br>
        #touch:                                         #generateTouch:on:indent:<br>
<br>
        #bytesPerOop                            #generateBytesPerOop:on:indent:<br>
        #bytesPerWord                   #generateBytesPerWord:on:indent:<br>
        #wordSize                                       #generateBytesPerWord:on:indent:<br>
        #baseHeaderSize                 #generateBaseHeaderSize:on:indent:<br>
        #minSmallInteger                        #generateSmallIntegerConstant:on:indent:<br>
        #maxSmallInteger                        #generateSmallIntegerConstant:on:indent:<br>
<br>
        #sharedCodeNamed:inCase:                #generateSharedCodeDirective:on:indent:<br>
<br>
        #perform:                                                       #generatePerform:on:indent:<br>
        #perform:with:                                          #generatePerform:on:indent:<br>
        #perform:with:with:                                     #generatePerform:on:indent:<br>
        #perform:with:with:with:                                #generatePerform:on:indent:<br>
        #perform:with:with:with:with:           #generatePerform:on:indent:<br>
        #perform:with:with:with:with:with:      #generatePerform:on:indent:<br>
<br>
        #value                                                          #generateValue:on:indent:<br>
        #value:                                                         #generateValue:on:indent:<br>
        #value:value:                                           #generateValue:on:indent:<br>
        #value:value:value:                                     #generateValue:on:indent:<br>
        #value:value:value:value:                       #generateValue:on:indent:<br>
<br>
        #deny:                                                          #generateDeny:on:indent:<br>
<br>
        #shouldNotImplement                             #generateSmalltalkMetaError:on:indent:<br>
        #shouldBeImplemented                    #generateSmalltalkMetaError:on:indent:<br>
        #subclassResponsibility                 #generateSmalltalkMetaError:on:indent:<br>
        ).<br>
<br>
        1 to: pairs size by: 2 do: [:i |<br>
                translationDict at: (pairs at: i) put: (pairs at: i + 1)].<br>
<br>
        pairs := #(<br>
        #ifTrue:                                        #generateIfTrueAsArgument:on:indent:<br>
        #ifFalse:                               #generateIfFalseAsArgument:on:indent:<br>
        #ifTrue:ifFalse:                        #generateIfTrueIfFalseAsArgument:on:indent:<br>
        #ifFalse:ifTrue:                        #generateIfFalseIfTrueAsArgument:on:indent:<br>
        #ifNotNil:                              #generateIfNotNilAsArgument:on:indent:<br>
        #ifNil:                                 #generateIfNilAsArgument:on:indent:<br>
        #ifNotNil:ifNil:                        #generateIfNotNilIfNilAsArgument:on:indent:<br>
        #ifNil:ifNotNil:                        #generateIfNilIfNotNilAsArgument:on:indent:<br>
        #cCode:                         #generateInlineCCodeAsArgument:on:indent:<br>
        #cCode:inSmalltalk:             #generateInlineCCodeAsArgument:on:indent:<br>
        #cppIf:ifTrue:ifFalse:  #generateInlineCppIfElseAsArgument:on:indent:<br>
        #cppIf:ifTrue:                  #generateInlineCppIfElseAsArgument:on:indent:<br>
<br>
        #value                                  #generateValueAsArgument:on:indent:<br>
        #value:                                 #generateValueAsArgument:on:indent:<br>
        #value:value:                   #generateValueAsArgument:on:indent:<br>
        ).<br>
<br>
        asArgumentTranslationDict := Dictionary new: 8.<br>
        1 to: pairs size by: 2 do: [:i |<br>
                asArgumentTranslationDict at: (pairs at: i) put: (pairs at: i + 1)].<br>
  !<br>
<br>
Item was changed:<br>
  ----- Method: CogVMSimulator&gt;&gt;openOn:extraMemory: (in category &#39;initialization&#39;) -----<br>
  openOn: fileName extraMemory: extraBytes<br>
        &quot;CogVMSimulator new openOn: &#39;<a href="http://clone.im" rel="noreferrer" target="_blank">clone.im</a>&#39; extraMemory: 100000&quot;<br>
<br>
        | f version headerSize dataSize count oldBaseAddr bytesToShift swapBytes<br>
          headerFlags firstSegSize heapSize<br>
          hdrNumStackPages hdrEdenBytes hdrMaxExtSemTabSize<br>
          hdrCogCodeSize stackZoneSize methodCacheSize primTraceLogSize allocationReserve |<br>
        &quot;open image file and read the header&quot;<br>
<br>
        f := FileStream readOnlyFileNamed: fileName.<br>
        f ifNil: [^self error: &#39;no image found&#39;].<br>
<br>
        &quot;Set the image name and the first argument; there are<br>
         no arguments during simulation unless set explicitly.&quot;<br>
        systemAttributes at: 1 put: fileName; at: 2 put: nil.<br>
<br>
        [&quot;begin ensure block...&quot;<br>
        imageName := f fullName.<br>
        f binary.<br>
<br>
        version := self getWord32FromFile: f swap: false.  &quot;current version: 16r1968 (=6504) vive la revolucion!!&quot;<br>
        (self readableFormat: version)<br>
                ifTrue: [swapBytes := false]<br>
+               ifFalse: [(version := version byteSwap32) = self imageFormatVersion<br>
-               ifFalse: [(version := objectMemory byteSwapped: version) = self imageFormatVersion<br>
                                        ifTrue: [swapBytes := true]<br>
                                        ifFalse: [self error: &#39;incomaptible image format&#39;]].<br>
        headerSize := self getWord32FromFile: f swap: swapBytes.<br>
        dataSize := self getLongFromFile: f swap: swapBytes.  &quot;length of heap in file&quot;<br>
        oldBaseAddr := self getLongFromFile: f swap: swapBytes.  &quot;object memory base address of image&quot;<br>
        objectMemory specialObjectsOop: (self getLongFromFile: f swap: swapBytes).<br>
        objectMemory lastHash: (self getLongFromFile: f swap: swapBytes).  &quot;Should be loaded from, and saved to the image header&quot;<br>
<br>
        savedWindowSize := self getLongFromFile: f swap: swapBytes.<br>
        headerFlags             := self getLongFromFile: f swap: swapBytes.<br>
        self setImageHeaderFlagsFrom: headerFlags.<br>
        extraVMMemory   := self getWord32FromFile: f swap: swapBytes.<br>
        hdrNumStackPages        := self getShortFromFile: f swap: swapBytes.<br>
        &quot;4 stack pages is small.  Should be able to run with as few as<br>
         three. 4 should be comfortable but slow.  8 is a reasonable<br>
         default. Can be changed via vmParameterAt: 43 put: n&quot;<br>
        numStackPages := desiredNumStackPages ~= 0<br>
                                                ifTrue: [desiredNumStackPages]<br>
                                                ifFalse: [hdrNumStackPages = 0<br>
                                                                        ifTrue: [self defaultNumStackPages]<br>
                                                                        ifFalse: [hdrNumStackPages]].<br>
        desiredNumStackPages := hdrNumStackPages.<br>
        stackZoneSize := self computeStackZoneSize.<br>
        &quot;This slot holds the size of the native method zone in 1k units. (pad to word boundary).&quot;<br>
        hdrCogCodeSize := (self getShortFromFile: f swap: swapBytes) * 1024.<br>
        cogCodeSize := desiredCogCodeSize ~= 0<br>
                                                ifTrue: [desiredCogCodeSize]<br>
                                                ifFalse:<br>
                                                        [hdrCogCodeSize = 0<br>
                                                                        ifTrue: [cogit defaultCogCodeSize]<br>
                                                                        ifFalse: [hdrCogCodeSize]].<br>
        desiredCogCodeSize := hdrCogCodeSize.<br>
        self assert: f position = (objectMemory wordSize = 4 ifTrue: [40] ifFalse: [64]).<br>
        hdrEdenBytes    := self getWord32FromFile: f swap: swapBytes.<br>
        objectMemory edenBytes: (desiredEdenBytes ~= 0<br>
                                                ifTrue: [desiredEdenBytes]<br>
                                                ifFalse:<br>
                                                        [hdrEdenBytes = 0<br>
                                                                        ifTrue: [objectMemory defaultEdenBytes]<br>
                                                                        ifFalse: [hdrEdenBytes]]).<br>
        desiredEdenBytes := hdrEdenBytes.<br>
        hdrMaxExtSemTabSize := self getShortFromFile: f swap: swapBytes.<br>
        hdrMaxExtSemTabSize ~= 0 ifTrue:<br>
                [self setMaxExtSemSizeTo: hdrMaxExtSemTabSize].<br>
        &quot;pad to word boundary.  This slot can be used for anything else that will fit in 16 bits.<br>
         Preserve it to be polite to other VMs.&quot;<br>
        the2ndUnknownShort      := self getShortFromFile: f swap: swapBytes.<br>
        self assert: f position = (objectMemory wordSize = 4 ifTrue: [48] ifFalse: [72]).<br>
        firstSegSize := self getLongFromFile: f swap: swapBytes.<br>
        objectMemory firstSegmentSize: firstSegSize.<br>
        &quot;For Open PICs to be able to probe the method cache during<br>
         simulation the methodCache must be relocated to memory.&quot;<br>
        methodCacheSize := methodCache size * objectMemory wordSize.<br>
        primTraceLogSize := primTraceLog size * objectMemory wordSize.<br>
        &quot;allocate interpreter memory. This list is in address order, low to high.<br>
         In the actual VM the stack zone exists on the C stack.&quot;<br>
        heapBase := (Cogit guardPageSize<br>
                                + cogCodeSize<br>
                                + stackZoneSize<br>
                                + methodCacheSize<br>
                                + primTraceLogSize<br>
                                + self rumpCStackSize) roundUpTo: objectMemory allocationUnit.<br>
        &quot;compare memory requirements with availability&quot;<br>
        allocationReserve := self interpreterAllocationReserveBytes.<br>
        objectMemory hasSpurMemoryManagerAPI<br>
                ifTrue:<br>
                        [| freeOldSpaceInImage headroom |<br>
                         freeOldSpaceInImage := self getLongFromFile: f swap: swapBytes.<br>
                         headroom := objectMemory<br>
                                                        initialHeadroom: extraVMMemory<br>
                                                        givenFreeOldSpaceInImage: freeOldSpaceInImage.<br>
                         heapSize := objectMemory roundUpHeapSize:<br>
                                                   dataSize<br>
                                                + headroom<br>
                                                + objectMemory newSpaceBytes<br>
                                                + (headroom &gt; allocationReserve<br>
                                                        ifTrue: [0]<br>
                                                        ifFalse: [allocationReserve])]<br>
                ifFalse:<br>
                        [heapSize :=  dataSize<br>
                                                + extraBytes<br>
                                                + objectMemory newSpaceBytes<br>
                                                + (extraBytes &gt; allocationReserve<br>
                                                        ifTrue: [0]<br>
                                                        ifFalse: [allocationReserve])].<br>
        heapBase := objectMemory<br>
                                        setHeapBase: heapBase<br>
                                        memoryLimit:  heapBase + heapSize<br>
                                        endOfMemory: heapBase + dataSize.<br>
<br>
        self assert: cogCodeSize \\ 4 = 0.<br>
        self assert: objectMemory memoryLimit \\ 4 = 0.<br>
        self assert: self rumpCStackSize \\ 4 = 0.<br>
        &quot;read in the image in bulk, then swap the bytes if necessary&quot;<br>
        f position: headerSize.<br>
        objectMemory memory: ((cogit processor endianness == #little<br>
                                        ifTrue: [LittleEndianBitmap]<br>
                                        ifFalse: [Bitmap]) new: objectMemory memoryLimit // 4).<br>
        count := objectMemory readHeapFromImageFile: f dataBytes: dataSize.<br>
        count ~= dataSize ifTrue: [self halt].<br>
        ]<br>
                ensure: [f close].<br>
        self moveMethodCacheToMemoryAt: objectMemory cogCodeBase + cogCodeSize + stackZoneSize.<br>
        self movePrimTraceLogToMemoryAt: objectMemory cogCodeBase + cogCodeSize + stackZoneSize + methodCacheSize.<br>
<br>
        self ensureImageFormatIsUpToDate: swapBytes.<br>
<br>
        bytesToShift := objectMemory memoryBaseForImageRead - oldBaseAddr.  &quot;adjust pointers for zero base address&quot;<br>
        Utilities<br>
                informUser: &#39;Relocating object pointers...&#39;<br>
                during: [self initializeInterpreter: bytesToShift].<br>
        self initializeCodeGenerator!<br>
<br>
Item was added:<br>
+ ----- Method: Integer&gt;&gt;byteSwap32 (in category &#39;*VMMaker-bit manipulation&#39;) -----<br>
+ byteSwap32<br>
+       &quot;swap the bytes of a 32 bit unsigned integer&quot;<br>
+<br>
+       ^((self &lt;&lt; 24) bitAnd: 16rFF000000) bitOr:<br>
+         (((self &lt;&lt; 8) bitAnd: 16rFF0000) bitOr:<br>
+         (((self &gt;&gt; 8) bitAnd: 16rFF00) bitOr:<br>
+         (((self &gt;&gt; 24) bitAnd: 16rFF))))!<br>
<br>
Item was added:<br>
+ ----- Method: Integer&gt;&gt;byteSwap64 (in category &#39;*VMMaker-bit manipulation&#39;) -----<br>
+ byteSwap64<br>
+       &quot;swap the bytes of a 64 bit unsigned integer&quot;<br>
+<br>
+       ^(((self &lt;&lt; 56) bitAnd: 16rFF00000000000000) bitOr:<br>
+         (((self &lt;&lt; 40) bitAnd: 16rFF000000000000) bitOr:<br>
+         (((self &lt;&lt; 24) bitAnd: 16rFF0000000000) bitOr:<br>
+         (((self &lt;&lt; 8) bitAnd: 16rFF00000000) bitOr:<br>
+         (((self &gt;&gt; 8) bitAnd: 16rFF000000) bitOr:<br>
+         (((self &gt;&gt; 24) bitAnd: 16rFF0000) bitOr:<br>
+         (((self &gt;&gt; 40) bitAnd: 16rFF00) bitOr:<br>
+         ((self &gt;&gt; 56) bitAnd: 16rFF))))))))!<br>
<br>
Item was changed:<br>
  ----- Method: Interpreter&gt;&gt;wordSwapped: (in category &#39;image save/restore&#39;) -----<br>
  wordSwapped: w<br>
        &quot;Return the given 64-bit integer with its halves in the reverse order.&quot;<br>
<br>
        self wordSize = 8 ifFalse: [self error: &#39;This cannot happen.&#39;].<br>
+       ^   ((w &gt;&gt; 32) bitAnd: 16r00000000FFFFFFFF) bitOr:<br>
+            ((w &lt;&lt; 32) bitAnd: 16rFFFFFFFF00000000)<br>
-       ^   ((w bitShift: Byte4ShiftNegated) bitAnd: Bytes3to0Mask)<br>
-         + ((w bitShift: Byte4Shift         ) bitAnd: Bytes7to4Mask)<br>
  !<br>
<br>
Item was changed:<br>
  ----- Method: InterpreterPrimitives&gt;&gt;magnitude64BitIntegerFor:neg: (in category &#39;primitive support&#39;) -----<br>
  magnitude64BitIntegerFor: magnitude neg: isNegative<br>
        &quot;Return a Large Integer object for the given integer magnitude and sign&quot;<br>
        | newLargeInteger largeClass highWord sz isSmall smallVal |<br>
        &lt;var: &#39;magnitude&#39; type: #usqLong&gt;<br>
        &lt;var: &#39;highWord&#39; type: #usqInt&gt;<br>
<br>
        isSmall := isNegative<br>
                                ifTrue: [magnitude &lt;= (objectMemory maxSmallInteger + 1)]<br>
                                ifFalse: [magnitude &lt;= objectMemory maxSmallInteger].<br>
        isSmall ifTrue:<br>
                [smallVal := self cCoerceSimple: magnitude to: #sqInt.<br>
                 isNegative ifTrue: [smallVal := 0 - smallVal].<br>
                 ^objectMemory integerObjectOf: smallVal].<br>
<br>
        largeClass := isNegative<br>
                                        ifTrue: [objectMemory classLargeNegativeInteger]<br>
                                        ifFalse: [objectMemory classLargePositiveInteger].<br>
        objectMemory wordSize = 8<br>
                ifTrue: [sz := 8]<br>
                ifFalse:<br>
                        [(highWord := magnitude &gt;&gt; 32) = 0<br>
                                ifTrue: [sz := 4]<br>
                                ifFalse:<br>
                                        [sz := 5.<br>
                                         (highWord := highWord &gt;&gt; 8) = 0 ifFalse:<br>
                                                [sz := sz + 1.<br>
                                                 (highWord := highWord &gt;&gt; 8) = 0 ifFalse:<br>
                                                        [sz := sz + 1.<br>
                                                         (highWord := highWord &gt;&gt; 8) = 0 ifFalse: [sz := sz + 1]]]]].<br>
        newLargeInteger := objectMemory instantiateClass: largeClass indexableSize:  sz.<br>
        self cppIf: VMBIGENDIAN<br>
                ifTrue:<br>
+                       [sz &gt; 4<br>
+                               ifTrue: [objectMemory storeLong64: 0 ofObject: newLargeInteger withValue: magnitude byteSwap64]<br>
+                               ifFalse: [objectMemory storeLong32: 0 ofObject: newLargeInteger withValue: (magnitude byteSwap32)]]<br>
-                       [sz &gt; 4 ifTrue:<br>
-                               [objectMemory<br>
-                                       storeByte: 7 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 56 bitAnd: 16rFF);<br>
-                                       storeByte: 6 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 48 bitAnd: 16rFF);<br>
-                                       storeByte: 5 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 40 bitAnd: 16rFF);<br>
-                                       storeByte: 4 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 32 bitAnd: 16rFF)].<br>
-                       objectMemory<br>
-                               storeByte: 3 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 24 bitAnd: 16rFF);<br>
-                               storeByte: 2 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 16 bitAnd: 16rFF);<br>
-                               storeByte: 1 ofObject: newLargeInteger withValue: (magnitude &gt;&gt;   8 bitAnd: 16rFF);<br>
-                               storeByte: 0 ofObject: newLargeInteger withValue: (magnitude &quot;&gt;&gt; 0&quot; bitAnd: 16rFF)]<br>
                ifFalse:<br>
                        [sz &gt; 4<br>
                                ifTrue: [objectMemory storeLong64: 0 ofObject: newLargeInteger withValue: magnitude]<br>
                                ifFalse: [objectMemory storeLong32: 0 ofObject: newLargeInteger withValue: (self cCode: [magnitude] inSmalltalk: [magnitude bitAnd: 16rFFFFFFFF])]].<br>
<br>
        ^newLargeInteger!<br>
<br>
Item was changed:<br>
  ----- Method: InterpreterPrimitives&gt;&gt;magnitude64BitValueOf: (in category &#39;primitive support&#39;) -----<br>
  magnitude64BitValueOf: oop<br>
        &quot;Convert the given object into an integer value.<br>
        The object may be either a positive SmallInteger or an eight-byte LargeInteger.&quot;<br>
        | sz value ok smallIntValue |<br>
        &lt;returnTypeC: #usqLong&gt;<br>
        &lt;var: #value type: #usqLong&gt;<br>
<br>
        (objectMemory isIntegerObject: oop) ifTrue:<br>
                [smallIntValue := (objectMemory integerValueOf: oop).<br>
                smallIntValue &lt; 0 ifTrue: [smallIntValue := 0 - smallIntValue].<br>
                ^self cCoerce: smallIntValue to: #usqLong].<br>
<br>
        (objectMemory isNonIntegerImmediate: oop) ifTrue:<br>
                [self primitiveFail.<br>
                 ^0].<br>
<br>
        ok := objectMemory isClassOfNonImm: oop<br>
                                        equalTo: (objectMemory splObj: ClassLargePositiveInteger)<br>
                                        compactClassIndex: ClassLargePositiveIntegerCompactIndex.<br>
        ok<br>
                ifFalse:<br>
                        [ok := objectMemory isClassOfNonImm: oop<br>
                                                        equalTo: (objectMemory splObj: ClassLargeNegativeInteger)<br>
                                                        compactClassIndex: ClassLargeNegativeIntegerCompactIndex.<br>
                        ok ifFalse:<br>
                                [self primitiveFail.<br>
                                 ^0]].<br>
        sz := objectMemory numBytesOfBytes: oop.<br>
        sz &gt; (self sizeof: #sqLong) ifTrue:<br>
                [self primitiveFail.<br>
                 ^0].<br>
<br>
        self cppIf: VMBIGENDIAN<br>
                ifTrue:<br>
+                       [sz &gt; 4<br>
+                               ifTrue: [value := (self cCoerceSimple: (objectMemory fetchLong64: 0 ofObject: oop) to: #usqLong) byteSwap64]<br>
+                               ifFalse: [value := (self cCoerceSimple: (objectMemory fetchLong32: 0 ofObject: oop) to: #&#39;unsigned int&#39;) byteSwap32].]<br>
-                       [value := objectMemory fetchByte: sz - 1 ofObject: oop.<br>
-                       sz - 2 to: 0 by: -1 do:<br>
-                               [:i | value := value &lt;&lt; 8 + (objectMemory fetchByte: i ofObject: oop)]]<br>
                ifFalse:<br>
                        [sz &gt; 4<br>
                                ifTrue: [value := self cCoerceSimple: (objectMemory fetchLong64: 0 ofObject: oop) to: #usqLong]<br>
                                ifFalse: [value := self cCoerceSimple: (objectMemory fetchLong32: 0 ofObject: oop) to: #&#39;unsigned int&#39;].].<br>
        ^value!<br>
<br>
Item was changed:<br>
  ----- Method: InterpreterPrimitives&gt;&gt;positive32BitValueOf: (in category &#39;primitive support&#39;) -----<br>
  positive32BitValueOf: oop<br>
        &quot;Convert the given object into an integer value.<br>
        The object may be either a positive SmallInteger or a four-byte LargePositiveInteger.&quot;<br>
        &lt;returnTypeC: #usqInt&gt;<br>
        | value ok sz |<br>
        (objectMemory isIntegerObject: oop) ifTrue:<br>
                [value := objectMemory integerValueOf: oop.<br>
                 (value &lt; 0<br>
                  or: [objectMemory wordSize &gt; 4<br>
                  and: [self cCode: [(self cCoerceSimple: value to: #&#39;unsigned int&#39;) ~= value]<br>
                                        inSmalltalk: [value &gt;&gt; 32 ~= 0]]]) ifTrue:<br>
                        [self primitiveFail. value := 0].<br>
                 ^value].<br>
<br>
        (objectMemory hasSixtyFourBitImmediates<br>
         or: [objectMemory isNonIntegerImmediate: oop])<br>
                ifTrue:<br>
                        [self primitiveFail.<br>
                         ^0]<br>
                ifFalse:<br>
                        [ok := objectMemory<br>
                                        isClassOfNonImm: oop<br>
                                        equalTo: (objectMemory splObj: ClassLargePositiveInteger)<br>
                                        compactClassIndex: ClassLargePositiveIntegerCompactIndex.<br>
                        ok ifFalse:<br>
                                [self primitiveFail.<br>
                                 ^0].<br>
                        sz := objectMemory numBytesOfBytes: oop.<br>
                        sz &gt; 4 ifTrue:<br>
                                [self primitiveFail.<br>
                                 ^0].<br>
                        ^self cppIf: VMBIGENDIAN<br>
                                ifTrue:<br>
+                                       [(objectMemory fetchLong32: 0 ofObject: oop) byteSwap32]<br>
-                                       [   (objectMemory fetchByte: 0 ofObject: oop)<br>
-                                       + ((objectMemory fetchByte: 1 ofObject: oop) &lt;&lt;  8)<br>
-                                       + ((objectMemory fetchByte: 2 ofObject: oop) &lt;&lt; 16)<br>
-                                       + ((objectMemory fetchByte: 3 ofObject: oop) &lt;&lt; 24)]<br>
                                ifFalse:<br>
                                        [objectMemory fetchLong32: 0 ofObject: oop]]!<br>
<br>
Item was changed:<br>
  ----- Method: InterpreterPrimitives&gt;&gt;positive64BitValueOf: (in category &#39;primitive support&#39;) -----<br>
  positive64BitValueOf: oop<br>
        &quot;Convert the given object into an integer value.<br>
        The object may be either a positive SmallInteger or an eight-byte LargePositiveInteger.&quot;<br>
<br>
        &lt;returnTypeC: #usqLong&gt;<br>
        | sz value ok |<br>
        &lt;var: #value type: #usqLong&gt;<br>
        (objectMemory isIntegerObject: oop) ifTrue:<br>
                [(objectMemory integerValueOf: oop) &lt; 0 ifTrue:<br>
                        [^self primitiveFail].<br>
                 ^objectMemory integerValueOf: oop].<br>
<br>
        (objectMemory isNonIntegerImmediate: oop) ifTrue:<br>
                [self primitiveFail.<br>
                 ^0].<br>
<br>
        ok := objectMemory<br>
                        isClassOfNonImm: oop<br>
                        equalTo: (objectMemory splObj: ClassLargePositiveInteger)<br>
                        compactClassIndex: ClassLargePositiveIntegerCompactIndex.<br>
        ok ifFalse:<br>
                [self primitiveFail.<br>
                 ^0].<br>
        sz := objectMemory numBytesOfBytes: oop.<br>
        sz &gt; (self sizeof: #sqLong) ifTrue:<br>
                [self primitiveFail.<br>
                 ^0].<br>
<br>
        self cppIf: VMBIGENDIAN<br>
                ifTrue:<br>
+                       [sz &gt; 4<br>
+                               ifTrue: [value := (self cCoerceSimple: (objectMemory fetchLong64: 0 ofObject: oop) to: #usqLong) byteSwap64]<br>
+                               ifFalse: [value := (self cCoerceSimple: (objectMemory fetchLong32: 0 ofObject: oop) to: #&#39;unsigned int&#39;) byteSwap32].]<br>
-                       [value := 0.<br>
-                       0 to: sz - 1 do: [:i |<br>
-                               value := value + ((self cCoerce: (objectMemory fetchByte: i ofObject: oop) to: #usqLong) &lt;&lt;  (i*8))]]<br>
                ifFalse:<br>
                        [sz &gt; 4<br>
                                ifTrue: [value := self cCoerceSimple: (objectMemory fetchLong64: 0 ofObject: oop) to: #usqLong]<br>
                                ifFalse: [value := self cCoerceSimple: (objectMemory fetchLong32: 0 ofObject: oop) to: #&#39;unsigned int&#39;].].<br>
        ^value!<br>
<br>
Item was changed:<br>
  ----- Method: InterpreterPrimitives&gt;&gt;positiveMachineIntegerValueOf: (in category &#39;primitive support&#39;) -----<br>
  positiveMachineIntegerValueOf: oop<br>
        &quot;Answer a value of an integer in address range, i.e up to the size of a machine word.<br>
        The object may be either a positive SmallInteger or a LargePositiveInteger of size &lt;= word size.&quot;<br>
        &lt;returnTypeC: #&#39;unsigned long&#39;&gt;<br>
        &lt;inline: true&gt; &quot;only two callers &amp; one is primitiveNewWithArg&quot;<br>
        | value bs ok |<br>
        (objectMemory isIntegerObject: oop) ifTrue:<br>
                [value := objectMemory integerValueOf: oop.<br>
                 value &lt; 0 ifTrue: [^self primitiveFail].<br>
                ^value].<br>
<br>
        (objectMemory isNonIntegerImmediate: oop) ifTrue:<br>
                [self primitiveFail.<br>
                 ^0].<br>
<br>
        ok := objectMemory<br>
                        isClassOfNonImm: oop<br>
                        equalTo: (objectMemory splObj: ClassLargePositiveInteger)<br>
                        compactClassIndex: ClassLargePositiveIntegerCompactIndex.<br>
        ok ifFalse:<br>
                [self primitiveFail.<br>
                 ^0].<br>
        bs := objectMemory numBytesOfBytes: oop.<br>
        bs &gt; (self sizeof: #&#39;unsigned long&#39;) ifTrue:<br>
                [self primitiveFail.<br>
                 ^0].<br>
<br>
        ((self sizeof: #&#39;unsigned long&#39;) = 8<br>
        and: [bs &gt; 4]) ifTrue:<br>
                [^self cppIf: VMBIGENDIAN<br>
                        ifTrue:<br>
+                               [(objectMemory fetchLong64: 0 ofObject: oop) byteSwap64]<br>
-                               [    (objectMemory fetchByte: 0 ofObject: oop)<br>
-                                + ((objectMemory fetchByte: 1 ofObject: oop) &lt;&lt;  8)<br>
-                                + ((objectMemory fetchByte: 2 ofObject: oop) &lt;&lt; 16)<br>
-                                + ((objectMemory fetchByte: 3 ofObject: oop) &lt;&lt; 24)<br>
-                                + ((objectMemory fetchByte: 4 ofObject: oop) &lt;&lt; 32)<br>
-                                + ((objectMemory fetchByte: 5 ofObject: oop) &lt;&lt; 40)<br>
-                                + ((objectMemory fetchByte: 6 ofObject: oop) &lt;&lt; 48)<br>
-                                + ((objectMemory fetchByte: 7 ofObject: oop) &lt;&lt; 56)]<br>
                        ifFalse:<br>
                                [objectMemory fetchLong64: 0 ofObject: oop]]<br>
                ifFalse:<br>
                        [^self cppIf: VMBIGENDIAN<br>
                                ifTrue:<br>
+                                       [(self cCoerceSimple: (objectMemory fetchLong32: 0 ofObject: oop) to: #&#39;unsigned int&#39;) byteSwap32]<br>
-                                       [    (objectMemory fetchByte: 0 ofObject: oop)<br>
-                                        + ((objectMemory fetchByte: 1 ofObject: oop) &lt;&lt;  8)<br>
-                                        + ((objectMemory fetchByte: 2 ofObject: oop) &lt;&lt; 16)<br>
-                                        + ((objectMemory fetchByte: 3 ofObject: oop) &lt;&lt; 24)]<br>
                                ifFalse:<br>
                                        [self cCoerceSimple: (objectMemory fetchLong32: 0 ofObject: oop) to: #&#39;unsigned int&#39;]]!<br>
<br>
Item was changed:<br>
  ----- Method: InterpreterPrimitives&gt;&gt;signed32BitValueOf: (in category &#39;primitive support&#39;) -----<br>
  signed32BitValueOf: oop<br>
        &quot;Convert the given object into an integer value.<br>
        The object may be either a positive SmallInteger or a four-byte LargeInteger.&quot;<br>
        | value negative ok magnitude |<br>
        &lt;inline: false&gt;<br>
        &lt;returnTypeC: #int&gt;<br>
        &lt;var: #value type: #int&gt;<br>
        &lt;var: #magnitude type: #&#39;unsigned int&#39;&gt;<br>
        &lt;var: #value64 type: #long&gt;<br>
        (objectMemory isIntegerObject: oop) ifTrue:<br>
                [objectMemory wordSize = 4<br>
                        ifTrue:<br>
                                [^objectMemory integerValueOf: oop]<br>
                        ifFalse: &quot;Must fail for SmallIntegers with digitLength &gt; 4&quot;<br>
                                [| value64 |<br>
                                 value64 := objectMemory integerValueOf: oop.<br>
                                 (self cCode: [(self cCoerceSimple: value64 to: #int) ~= value64]<br>
                                                inSmalltalk: [value64 &gt;&gt; 31 ~= 0 and: [value64 &gt;&gt; 31 ~= -1]]) ifTrue:<br>
                                        [self primitiveFail. value64 := 0].<br>
                                 ^value64]].<br>
<br>
        (objectMemory isNonIntegerImmediate: oop) ifTrue:<br>
                [self primitiveFail.<br>
                 ^0].<br>
<br>
        ok := objectMemory<br>
                        isClassOfNonImm: oop<br>
                        equalTo: (objectMemory splObj: ClassLargePositiveInteger)<br>
                        compactClassIndex: ClassLargePositiveIntegerCompactIndex.<br>
        ok<br>
                ifTrue: [negative := false]<br>
                ifFalse:<br>
                        [negative := true.<br>
                         ok := objectMemory isClassOfNonImm: oop<br>
                                                        equalTo: (objectMemory splObj: ClassLargeNegativeInteger)<br>
                                                        compactClassIndex: ClassLargeNegativeIntegerCompactIndex.<br>
                         ok ifFalse:<br>
                                [self primitiveFail.<br>
                                 ^0]].<br>
        (objectMemory numBytesOfBytes: oop) &gt; 4 ifTrue:<br>
                [^self primitiveFail].<br>
<br>
        magnitude := self cppIf: VMBIGENDIAN<br>
                                ifTrue:<br>
+                                       [(objectMemory fetchLong32: 0 ofObject: oop) asUnsignedInteger byteSwap32]<br>
-                                       [ (objectMemory fetchByte: 0 ofObject: oop) +<br>
-                                        ((objectMemory fetchByte: 1 ofObject: oop) &lt;&lt;  8) +<br>
-                                        ((objectMemory fetchByte: 2 ofObject: oop) &lt;&lt; 16) +<br>
-                                        ((objectMemory fetchByte: 3 ofObject: oop) &lt;&lt; 24)]<br>
                                ifFalse:<br>
                                        [(objectMemory fetchLong32: 0 ofObject: oop) asUnsignedInteger].<br>
<br>
        (negative<br>
                ifTrue: [magnitude &gt; 16r80000000]<br>
                ifFalse: [magnitude &gt;= 16r80000000])<br>
                        ifTrue:<br>
                                [self primitiveFail.<br>
                                ^0].<br>
        negative<br>
                ifTrue: [value := 0 - magnitude]<br>
                ifFalse: [value := magnitude].<br>
        ^value!<br>
<br>
Item was changed:<br>
  ----- Method: InterpreterPrimitives&gt;&gt;signed64BitValueOf: (in category &#39;primitive support&#39;) -----<br>
  signed64BitValueOf: oop<br>
        &quot;Convert the given object into an integer value.<br>
         The object may be either a positive SmallInteger or a eight-byte LargeInteger.&quot;<br>
        | sz value negative ok magnitude |<br>
        &lt;inline: false&gt;<br>
        &lt;returnTypeC: #sqLong&gt;<br>
        &lt;var: #value type: #sqLong&gt;<br>
        &lt;var: #magnitude type: #usqLong&gt;<br>
        (objectMemory isIntegerObject: oop) ifTrue:<br>
                [^self cCoerce: (objectMemory integerValueOf: oop) to: #sqLong].<br>
<br>
        (objectMemory isNonIntegerImmediate: oop) ifTrue:<br>
                [self primitiveFail.<br>
                 ^0].<br>
<br>
        ok := objectMemory isClassOfNonImm: oop<br>
                                        equalTo: (objectMemory splObj: ClassLargePositiveInteger)<br>
                                        compactClassIndex: ClassLargePositiveIntegerCompactIndex.<br>
        ok<br>
                ifTrue: [negative := false]<br>
                ifFalse:<br>
                        [negative := true.<br>
                         ok := objectMemory isClassOfNonImm: oop<br>
                                                        equalTo: (objectMemory splObj: ClassLargeNegativeInteger)<br>
                                                        compactClassIndex: ClassLargeNegativeIntegerCompactIndex.<br>
                        ok ifFalse:<br>
                                [self primitiveFail.<br>
                                 ^0]].<br>
        sz := objectMemory numBytesOfBytes: oop.<br>
        sz &gt; (self sizeof: #sqLong) ifTrue:<br>
                [self primitiveFail.<br>
                 ^0].<br>
<br>
        self cppIf: VMBIGENDIAN<br>
                ifTrue:<br>
+                       [magnitude := sz &gt; 4<br>
+                                               ifTrue: [(objectMemory fetchLong64: 0 ofObject: oop) byteSwap64]<br>
+                                               ifFalse: [(self cCoerceSimple: (objectMemory fetchLong32: 0 ofObject: oop) to: #&#39;unsigned int&#39;) byteSwap32]]<br>
-                       [magnitude := objectMemory fetchByte: sz - 1 ofObject: oop.<br>
-                        sz - 2 to: 0 by: -1 do: [:i |<br>
-                               magnitude := magnitude &lt;&lt; 8 + (objectMemory fetchByte: i ofObject: oop)]]<br>
                ifFalse:<br>
                        [magnitude := sz &gt; 4<br>
                                                ifTrue: [objectMemory fetchLong64: 0 ofObject: oop]<br>
                                                ifFalse: [self cCoerceSimple: (objectMemory fetchLong32: 0 ofObject: oop) to: #&#39;unsigned int&#39;]].<br>
<br>
        (negative<br>
                ifTrue: [magnitude &gt; 16r8000000000000000]<br>
                ifFalse: [magnitude &gt;= 16r8000000000000000])<br>
                        ifTrue: [self primitiveFail.<br>
                                ^0].<br>
        negative<br>
                ifTrue: [value := 0 - magnitude]<br>
                ifFalse: [value := magnitude].<br>
        ^value!<br>
<br>
Item was changed:<br>
  ----- Method: InterpreterPrimitives&gt;&gt;signedMachineIntegerValueOf: (in category &#39;primitive support&#39;) -----<br>
  signedMachineIntegerValueOf: oop<br>
        &quot;Answer a signed value of an integer up to the size of a machine word.<br>
        The object may be either a positive SmallInteger or a LargeInteger of size &lt;= word size.&quot;<br>
        &lt;returnTypeC: #&#39;long&#39;&gt;<br>
        | negative ok bs value limit magnitude |<br>
        &lt;var: #value type: #long&gt;<br>
        &lt;var: #magnitude type: #usqInt&gt;<br>
        &lt;var: #limit type: #usqInt&gt;<br>
        (objectMemory isIntegerObject: oop) ifTrue:<br>
                [^objectMemory integerValueOf: oop].<br>
<br>
        (objectMemory isNonIntegerImmediate: oop) ifTrue:<br>
                [^self primitiveFail].<br>
<br>
        ok := objectMemory isClassOfNonImm: oop<br>
                                        equalTo: (objectMemory splObj: ClassLargePositiveInteger)<br>
                                        compactClassIndex: ClassLargePositiveIntegerCompactIndex.<br>
        ok<br>
                ifTrue: [negative := false]<br>
                ifFalse:<br>
                        [negative := true.<br>
                         ok := objectMemory isClassOfNonImm: oop<br>
                                                        equalTo: (objectMemory splObj: ClassLargeNegativeInteger)<br>
                                                        compactClassIndex: ClassLargeNegativeIntegerCompactIndex.<br>
                        ok ifFalse: [^self primitiveFail]].<br>
        bs := objectMemory numBytesOf: oop.<br>
        bs &gt; (self sizeof: #&#39;unsigned long&#39;) ifTrue:<br>
                [^self primitiveFail].<br>
<br>
        ((self sizeof: #&#39;unsigned long&#39;) = 8<br>
        and: [bs &gt; 4]) ifTrue:<br>
                [magnitude := self cppIf: VMBIGENDIAN<br>
                                        ifTrue:<br>
+                                               [(objectMemory fetchLong64: 0 ofObject: oop) byteSwap64]<br>
-                                               [    (objectMemory fetchByte: 0 ofObject: oop)<br>
-                                                + ((objectMemory fetchByte: 1 ofObject: oop) &lt;&lt;  8)<br>
-                                                + ((objectMemory fetchByte: 2 ofObject: oop) &lt;&lt; 16)<br>
-                                                + ((objectMemory fetchByte: 3 ofObject: oop) &lt;&lt; 24)<br>
-                                                + ((objectMemory fetchByte: 4 ofObject: oop) &lt;&lt; 32)<br>
-                                                + ((objectMemory fetchByte: 5 ofObject: oop) &lt;&lt; 40)<br>
-                                                + ((objectMemory fetchByte: 6 ofObject: oop) &lt;&lt; 48)<br>
-                                                + ((objectMemory fetchByte: 7 ofObject: oop) &lt;&lt; 56)]<br>
                                        ifFalse:<br>
                                                [objectMemory fetchLong64: 0 ofObject: oop]]<br>
                ifFalse:<br>
                        [magnitude := self cppIf: VMBIGENDIAN<br>
                                                ifTrue:<br>
+                                                       [(objectMemory fetchLong32: 0 ofObject: oop) asUnsignedInteger byteSwap32]<br>
-                                                       [    (objectMemory fetchByte: 0 ofObject: oop)<br>
-                                                        + ((objectMemory fetchByte: 1 ofObject: oop) &lt;&lt;  8)<br>
-                                                        + ((objectMemory fetchByte: 2 ofObject: oop) &lt;&lt; 16)<br>
-                                                        + ((objectMemory fetchByte: 3 ofObject: oop) &lt;&lt; 24)]<br>
                                                ifFalse:<br>
                                                        [(objectMemory fetchLong32: 0 ofObject: oop) asUnsignedInteger]].<br>
<br>
        limit := 1 asUnsignedInteger &lt;&lt; ((self sizeof: #usqInt) * 8 - 1).<br>
        (negative<br>
                ifTrue: [magnitude &gt; limit]<br>
                ifFalse: [magnitude &gt;= limit])<br>
                        ifTrue: [self primitiveFail.<br>
                                ^0].<br>
        negative<br>
                ifTrue: [value := 0 - magnitude]<br>
                ifFalse: [value := magnitude].<br>
        ^value!<br>
<br>
Item was changed:<br>
  ----- Method: InterpreterSimulatorMSB64&gt;&gt;byteSwapped: (in category &#39;memory access&#39;) -----<br>
  byteSwapped: w<br>
        &quot;Return the given integer with its bytes in the reverse order.&quot;<br>
<br>
+       ^w byteSwap64!<br>
-       ^ (super byteSwapped: ((w bitShift: -32) bitAnd: 16rFFFFFFFF)) +<br>
-         ((super byteSwapped: (w bitAnd: 16rFFFFFFFF)) bitShift: 32)!<br>
<br>
Item was changed:<br>
  ----- Method: LargeIntegersPlugin&gt;&gt;cDigitSub:len:with:len:into: (in category &#39;C core&#39;) -----<br>
  cDigitSub: pByteSmall len: smallLen with: pByteLarge len: largeLen into: pByteRes<br>
        | z |<br>
        &lt;var: #pByteSmall type: #&#39;unsigned char *&#39;&gt;<br>
        &lt;var: #pByteLarge type: #&#39;unsigned char *&#39;&gt;<br>
        &lt;var: #pByteRes type: #&#39;unsigned char *&#39;&gt;<br>
+       &lt;var: #z type: #&#39;unsigned int&#39;&gt;<br>
<br>
        z := 0. &quot;Loop invariant is -1&lt;=z&lt;=1&quot;<br>
        0 to: smallLen - 1 do:<br>
                [:i |<br>
                z := z + (pByteLarge at: i) - (pByteSmall at: i).<br>
                pByteRes at: i put: (self cCode: [z] inSmalltalk: [z bitAnd: 255]).<br>
                z := z signedBitShift: -8].<br>
        smallLen to: largeLen - 1 do:<br>
                [:i |<br>
                z := z + (pByteLarge at: i) .<br>
                pByteRes at: i put: (self cCode: [z] inSmalltalk: [z bitAnd: 255]).<br>
                z := z signedBitShift: -8].<br>
  !<br>
<br>
Item was changed:<br>
  ----- Method: ObjectMemory class&gt;&gt;initBytesPerWord: (in category &#39;initialization&#39;) -----<br>
  initBytesPerWord: nBytes<br>
<br>
        BytesPerWord := nBytes.<br>
-       &quot;The following is necessary to avoid confusing the compiler with shifts that are larger than the width of the type on which they operate.  In gcc, such shifts cause incorrect code to be generated.&quot;<br>
-       BytesPerWord = 8<br>
-               ifTrue:                                 &quot;64-bit VM&quot;<br>
-                       [Byte0Mask := 16r00000000000000FF.      Byte0Shift := 0.<br>
-                        Byte1Mask := 16r000000000000FF00.      Byte1Shift := 8.<br>
-                        Byte2Mask := 16r0000000000FF0000.      Byte2Shift := 16.<br>
-                        Byte3Mask := 16r00000000FF000000.      Byte3Shift := 24.<br>
-                        Byte4Mask := 16r000000FF00000000.      Byte4Shift := 32.<br>
-                        Byte5Mask := 16r0000FF0000000000.      Byte5Shift := 40.<br>
-                        Byte6Mask := 16r00FF000000000000.      Byte6Shift := 48.<br>
-                        Byte7Mask := 16rFF00000000000000.      Byte7Shift := 56.<br>
-                        Bytes3to0Mask := 16r00000000FFFFFFFF.<br>
-                        Bytes7to4Mask := 16rFFFFFFFF00000000]<br>
-               ifFalse:                                        &quot;32-bit VM&quot;<br>
-                       [Byte0Mask := 16r00000000000000FF.      Byte0Shift := 0.<br>
-                        Byte1Mask := 16r000000000000FF00.      Byte1Shift := 8.<br>
-                        Byte2Mask := 16r0000000000FF0000.      Byte2Shift := 16.<br>
-                        Byte3Mask := 16r00000000FF000000.      Byte3Shift := 24.<br>
-                        Byte4Mask := 16r0000000000000000.      Byte4Shift := 0.                &quot;unused&quot;<br>
-                        Byte5Mask := 16r0000000000000000.      Byte5Shift := 0.                &quot;unused&quot;<br>
-                        Byte6Mask := 16r0000000000000000.      Byte6Shift := 0.                &quot;unused&quot;<br>
-                        Byte7Mask := 16r0000000000000000.      Byte7Shift := 0.                &quot;unused&quot;<br>
-                        Bytes3to0Mask := 16r0000000000000000.                                  &quot;unused&quot;<br>
-                        Bytes7to4Mask := 16r0000000000000000                                   &quot;unused&quot;].<br>
-       Byte1ShiftNegated := Byte1Shift negated.<br>
-       Byte3ShiftNegated := Byte3Shift negated.<br>
-       Byte4ShiftNegated := Byte4Shift negated.<br>
-       Byte5ShiftNegated := Byte5Shift negated.<br>
-       Byte7ShiftNegated := Byte7Shift negated.<br>
        &quot;N.B.  This is *not* output when generating the interpreter file.<br>
         It is left to the various sqConfig.h files to define correctly.&quot;<br>
        VMBIGENDIAN := Smalltalk endianness == #big!<br>
<br>
Item was changed:<br>
  ----- Method: ObjectMemory&gt;&gt;byteSwapped: (in category &#39;image save/restore&#39;) -----<br>
  byteSwapped: w<br>
        &quot;Answer the given integer with its bytes in the reverse order.&quot;<br>
        &lt;api&gt;<br>
        &lt;returnTypeC: #sqInt&gt;<br>
        self cppIf: self wordSize = 4<br>
+               ifTrue: [^w byteSwap32]<br>
+               ifFalse: [^w byteSwap64]!<br>
-               ifTrue:<br>
-                       [^ ((w bitShift: Byte3ShiftNegated) bitAnd: Byte0Mask)<br>
-                        + ((w bitShift: Byte1ShiftNegated) bitAnd: Byte1Mask)<br>
-                        + ((w bitShift: Byte1Shift         ) bitAnd: Byte2Mask)<br>
-                        + ((w bitShift: Byte3Shift         ) bitAnd: Byte3Mask)]<br>
-               ifFalse:<br>
-                       [^ ((w bitShift: Byte7ShiftNegated) bitAnd: Byte0Mask)<br>
-                        + ((w bitShift: Byte5ShiftNegated) bitAnd: Byte1Mask)<br>
-                        + ((w bitShift: Byte3ShiftNegated) bitAnd: Byte2Mask)<br>
-                        + ((w bitShift: Byte1ShiftNegated) bitAnd: Byte3Mask)<br>
-                        + ((w bitShift: Byte1Shift         ) bitAnd: Byte4Mask)<br>
-                        + ((w bitShift: Byte3Shift         ) bitAnd: Byte5Mask)<br>
-                        + ((w bitShift: Byte5Shift         ) bitAnd: Byte6Mask)<br>
-                        + ((w bitShift: Byte7Shift         ) bitAnd: Byte7Mask)]!<br>
<br>
Item was removed:<br>
- ----- Method: Spur32BitMemoryManager&gt;&gt;byteSwapped32Bits: (in category &#39;snapshot&#39;) -----<br>
- byteSwapped32Bits: w<br>
-       ^self byteSwapped: w!<br>
<br>
Item was changed:<br>
  ----- Method: Spur32BitMemoryManager&gt;&gt;byteSwapped: (in category &#39;snapshot&#39;) -----<br>
  byteSwapped: w<br>
        &quot;Answer the given integer with its bytes in the reverse order.&quot;<br>
        &lt;api&gt;<br>
        &lt;returnTypeC: #sqInt&gt;<br>
+       ^w byteSwap32!<br>
-       ^  ((w bitShift: Byte3ShiftNegated) bitAnd: Byte0Mask)<br>
-        + ((w bitShift: Byte1ShiftNegated) bitAnd: Byte1Mask)<br>
-        + ((w bitShift: Byte1Shift             ) bitAnd: Byte2Mask)<br>
-        + ((w bitShift: Byte3Shift             ) bitAnd: Byte3Mask)!<br>
<br>
Item was removed:<br>
- ----- Method: Spur64BitMemoryManager&gt;&gt;byteSwapped32Bits: (in category &#39;snapshot&#39;) -----<br>
- byteSwapped32Bits: w<br>
-       &quot;Answer the given 32-bit integer with its bytes in the reverse order.&quot;<br>
-       ^  ((w bitShift: Byte3ShiftNegated) bitAnd: Byte0Mask)<br>
-        + ((w bitShift: Byte1ShiftNegated) bitAnd: Byte1Mask)<br>
-        + ((w bitShift: Byte1Shift             ) bitAnd: Byte2Mask)<br>
-        + ((w bitShift: Byte3Shift             ) bitAnd: Byte3Mask)!<br>
<br>
Item was changed:<br>
  ----- Method: Spur64BitMemoryManager&gt;&gt;byteSwapped: (in category &#39;snapshot&#39;) -----<br>
  byteSwapped: w<br>
        &quot;Answer the given integer with its bytes in the reverse order.&quot;<br>
        &lt;api&gt;<br>
        &lt;returnTypeC: #sqInt&gt;<br>
+       ^w byteSwap64!<br>
-       ^  ((w bitShift: Byte7ShiftNegated) bitAnd: Byte0Mask)<br>
-        + ((w bitShift: Byte5ShiftNegated) bitAnd: Byte1Mask)<br>
-        + ((w bitShift: Byte3ShiftNegated) bitAnd: Byte2Mask)<br>
-        + ((w bitShift: Byte1ShiftNegated) bitAnd: Byte3Mask)<br>
-        + ((w bitShift: Byte1Shift             ) bitAnd: Byte4Mask)<br>
-        + ((w bitShift: Byte3Shift             ) bitAnd: Byte5Mask)<br>
-        + ((w bitShift: Byte5Shift             ) bitAnd: Byte6Mask)<br>
-        + ((w bitShift: Byte7Shift             ) bitAnd: Byte7Mask)!<br>
<br>
Item was changed:<br>
  ----- Method: SpurMemoryManager class&gt;&gt;initBytesPerWord: (in category &#39;class initialization&#39;) -----<br>
  initBytesPerWord: wordSize<br>
<br>
        BytesPerWord := BytesPerOop := wordSize.<br>
-       &quot;The following is necessary to avoid confusing the compiler with shifts that are larger than the width of the type on which they operate.  In gcc, such shifts cause incorrect code to be generated.&quot;<br>
-       BytesPerWord = 8<br>
-               ifTrue:                                 &quot;64-bit VM&quot;<br>
-                       [Byte0Mask := 16r00000000000000FF.      Byte0Shift := 0.<br>
-                        Byte1Mask := 16r000000000000FF00.      Byte1Shift := 8.<br>
-                        Byte2Mask := 16r0000000000FF0000.      Byte2Shift := 16.<br>
-                        Byte3Mask := 16r00000000FF000000.      Byte3Shift := 24.<br>
-                        Byte4Mask := 16r000000FF00000000.      Byte4Shift := 32.<br>
-                        Byte5Mask := 16r0000FF0000000000.      Byte5Shift := 40.<br>
-                        Byte6Mask := 16r00FF000000000000.      Byte6Shift := 48.<br>
-                        Byte7Mask := 16rFF00000000000000.      Byte7Shift := 56.<br>
-                        Bytes3to0Mask := 16r00000000FFFFFFFF.<br>
-                        Bytes7to4Mask := 16rFFFFFFFF00000000]<br>
-               ifFalse:                                        &quot;32-bit VM&quot;<br>
-                       [Byte0Mask := 16r00000000000000FF.      Byte0Shift := 0.<br>
-                        Byte1Mask := 16r000000000000FF00.      Byte1Shift := 8.<br>
-                        Byte2Mask := 16r0000000000FF0000.      Byte2Shift := 16.<br>
-                        Byte3Mask := 16r00000000FF000000.      Byte3Shift := 24.<br>
-                        Byte4Mask := nil.                                                      Byte4Shift := 0.        &quot;unused&quot;<br>
-                        Byte5Mask := nil.                                                      Byte5Shift := 0.        &quot;unused&quot;<br>
-                        Byte6Mask := nil.                                                      Byte6Shift := 0.        &quot;unused&quot;<br>
-                        Byte7Mask := nil.                                                      Byte7Shift := 0.        &quot;unused&quot;<br>
-                        Bytes3to0Mask := nil.                                                                                  &quot;unused&quot;<br>
-                        Bytes7to4Mask := nil                                                                                   &quot;unused&quot;].<br>
-       Byte1ShiftNegated := Byte1Shift negated.<br>
-       Byte3ShiftNegated := Byte3Shift negated.<br>
-       Byte4ShiftNegated := Byte4Shift negated.<br>
-       Byte5ShiftNegated := Byte5Shift negated.<br>
-       Byte7ShiftNegated := Byte7Shift negated.<br>
        &quot;N.B.  This is *not* output when generating the interpreter file.<br>
         It is left to the various sqConfig.h files to define correctly.&quot;<br>
        VMBIGENDIAN := Smalltalk endianness == #big!<br>
<br>
Item was removed:<br>
- ----- Method: SpurMemoryManager&gt;&gt;byteSwapped32Bits: (in category &#39;snapshot&#39;) -----<br>
- byteSwapped32Bits: w<br>
-       self subclassResponsibility!<br>
<br>
Item was changed:<br>
  ----- Method: SpurMemoryManager&gt;&gt;reverseBytesIn32BitWordsFrom:to: (in category &#39;snapshot&#39;) -----<br>
  reverseBytesIn32BitWordsFrom: startAddr to: stopAddr<br>
        &quot;Byte-swap the given range of memory (not inclusive of stopAddr!!).&quot;<br>
        | addr |<br>
        addr := startAddr.<br>
        [self oop: addr isLessThan: stopAddr] whileTrue:<br>
+               [self long32At: addr put: ((self long32At: addr) byteSwap32).<br>
-               [self long32At: addr put: (self byteSwapped32Bits: (self long32At: addr)).<br>
                 addr := addr + 4]!<br>
<br>
Item was changed:<br>
  ----- Method: StackInterpreter&gt;&gt;getShortFromFile:swap: (in category &#39;image save/restore&#39;) -----<br>
  getShortFromFile: aFile swap: swapFlag<br>
        &quot;Answer the next 16 bit word read from aFile, byte-swapped according to the swapFlag.&quot;<br>
<br>
        &lt;var: #aFile type: #sqImageFile&gt;<br>
        | w |<br>
+       &lt;var: #w type: #&#39;unsigned short&#39;&gt;<br>
-       &lt;var: #w type: #short&gt;<br>
        w := 0.<br>
        self cCode: [self<br>
                                        sq: (self addressOf: w)<br>
+                                       Image: (self sizeof: #&#39;unsigned short&#39;)<br>
-                                       Image: (self sizeof: #short)<br>
                                        File: 1<br>
                                        Read: aFile]<br>
                inSmalltalk: [w := objectMemory nextShortFrom: aFile].<br>
        ^swapFlag<br>
+               ifTrue: [((w &gt;&gt; 8) bitAnd: 16rFF) bitOr: ((w bitAnd: 16rFF) &lt;&lt; 8)]<br>
-               ifTrue: [objectMemory byteSwapped: w]<br>
                ifFalse: [w]!<br>
<br>
Item was changed:<br>
  ----- Method: StackInterpreter&gt;&gt;getWord32FromFile:swap: (in category &#39;image save/restore&#39;) -----<br>
  getWord32FromFile: aFile swap: swapFlag<br>
        &quot;Answer the next 32 bit word read from aFile, byte-swapped according to the swapFlag.&quot;<br>
<br>
        &lt;var: #aFile type: #sqImageFile&gt;<br>
        | w |<br>
        &lt;var: #w type: #int&gt;<br>
        w := 0.<br>
        self cCode: [self<br>
                                        sq: (self addressOf: w)<br>
                                        Image: (self sizeof: #int)<br>
                                        File: 1<br>
                                        Read: aFile]<br>
                inSmalltalk: [w := objectMemory nextWord32From: aFile].<br>
        ^swapFlag<br>
+               ifTrue: [w byteSwap32]<br>
-               ifTrue: [objectMemory byteSwapped: w]<br>
                ifFalse: [w]!<br>
<br>
Item was changed:<br>
  ----- Method: StackInterpreter&gt;&gt;maybeInlinePositive32BitIntegerFor: (in category &#39;primitive support&#39;) -----<br>
  maybeInlinePositive32BitIntegerFor: integerValue<br>
        &quot;N.B. will *not* cause a GC.<br>
         integerValue is interpreted as POSITIVE, e.g. as the result of Bitmap&gt;at:.&quot;<br>
        &lt;notOption: #Spur64BitMemoryManager&gt;<br>
        &lt;var: &#39;integerValue&#39; type: #&#39;unsigned int&#39;&gt;<br>
        | newLargeInteger |<br>
        self deny: objectMemory hasSixtyFourBitImmediates.<br>
         &quot;force coercion because slang inliner sometimes incorrectly pass a signed int without converting to unsigned&quot;<br>
         (self cCode: [self cCoerceSimple: integerValue to: #&#39;unsigned int&#39;]<br>
                        inSmalltalk: [integerValue bitAnd: 1 &lt;&lt; 32 - 1]) &lt;= objectMemory maxSmallInteger ifTrue:<br>
                [^objectMemory integerObjectOf: integerValue].<br>
        newLargeInteger := objectMemory<br>
                                                        eeInstantiateSmallClassIndex: ClassLargePositiveIntegerCompactIndex<br>
                                                        format: (objectMemory byteFormatForNumBytes: 4)<br>
                                                        numSlots: 1.<br>
        self cppIf: VMBIGENDIAN<br>
                ifTrue:<br>
+                       [objectMemory storeLong32: 0 ofObject: newLargeInteger withValue: integerValue byteSwap32]<br>
-                       [objectMemory<br>
-                               storeByte: 3 ofObject: newLargeInteger withValue: (integerValue &gt;&gt; 24 bitAnd: 16rFF);<br>
-                               storeByte: 2 ofObject: newLargeInteger withValue: (integerValue &gt;&gt; 16 bitAnd: 16rFF);<br>
-                               storeByte: 1 ofObject: newLargeInteger withValue: (integerValue &gt;&gt;   8 bitAnd: 16rFF);<br>
-                               storeByte: 0 ofObject: newLargeInteger withValue: (integerValue &quot;&gt;&gt; 0&quot; bitAnd: 16rFF)]<br>
                ifFalse:<br>
                        [objectMemory storeLong32: 0 ofObject: newLargeInteger withValue: integerValue].<br>
        ^newLargeInteger!<br>
<br>
Item was changed:<br>
  ----- Method: StackInterpreter&gt;&gt;noInlineSigned32BitIntegerFor: (in category &#39;primitive support&#39;) -----<br>
  noInlineSigned32BitIntegerFor: integerValue<br>
        &quot;Answer a full 32 bit integer object for the given integer value.&quot;<br>
        &lt;notOption: #Spur64BitMemoryManager&gt;<br>
        | newLargeInteger value largeClass |<br>
        &lt;inline: false&gt;<br>
        (objectMemory isIntegerValue: integerValue) ifTrue:<br>
                [^objectMemory integerObjectOf: integerValue].<br>
        self deny: objectMemory hasSixtyFourBitImmediates.<br>
         integerValue &lt; 0<br>
                ifTrue: [largeClass := ClassLargeNegativeIntegerCompactIndex.<br>
                                value := 0 - integerValue]<br>
                ifFalse: [largeClass := ClassLargePositiveIntegerCompactIndex.<br>
                                value := integerValue].<br>
        newLargeInteger := objectMemory<br>
                                                        eeInstantiateSmallClassIndex: largeClass<br>
                                                        format: (objectMemory byteFormatForNumBytes: 4)<br>
                                                        numSlots: 1.<br>
        self cppIf: VMBIGENDIAN<br>
                ifTrue:<br>
+                       [objectMemory storeLong32: 0 ofObject: newLargeInteger withValue: value byteSwap32]<br>
-                       [objectMemory<br>
-                               storeByte: 3 ofObject: newLargeInteger withValue: ((value &gt;&gt; 24) bitAnd: 16rFF);<br>
-                               storeByte: 2 ofObject: newLargeInteger withValue: ((value &gt;&gt; 16) bitAnd: 16rFF);<br>
-                               storeByte: 1 ofObject: newLargeInteger withValue: ((value &gt;&gt; 8) bitAnd: 16rFF);<br>
-                               storeByte: 0 ofObject: newLargeInteger withValue: (value bitAnd: 16rFF)]<br>
                ifFalse:<br>
                        [objectMemory storeLong32: 0 ofObject: newLargeInteger withValue: value].<br>
        ^newLargeInteger!<br>
<br>
Item was changed:<br>
  ----- Method: StackInterpreter&gt;&gt;positive64BitIntegerFor: (in category &#39;primitive support&#39;) -----<br>
  positive64BitIntegerFor: integerValue<br>
        &lt;api&gt;<br>
        &lt;var: &#39;integerValue&#39; type: #usqLong&gt;<br>
        &lt;var: &#39;highWord&#39; type: #&#39;unsigned int&#39;&gt;<br>
        &quot;Answer a Large Positive Integer object for the given integer value.  N.B. will *not* cause a GC.&quot;<br>
        | newLargeInteger highWord sz |<br>
        objectMemory hasSixtyFourBitImmediates<br>
                ifTrue:<br>
                        [(self cCode: [integerValue] inSmalltalk: [integerValue bitAnd: 1 &lt;&lt; 64 - 1]) &lt;= objectMemory maxSmallInteger ifTrue:<br>
                                [^objectMemory integerObjectOf: integerValue].<br>
                         sz := 8]<br>
                ifFalse:<br>
                        [(highWord := integerValue &gt;&gt; 32) = 0 ifTrue:<br>
                                [^self positive32BitIntegerFor: integerValue].<br>
                         sz := 5.<br>
                         (highWord := highWord &gt;&gt; 8) = 0 ifFalse:<br>
                                [sz := sz + 1.<br>
                                 (highWord := highWord &gt;&gt; 8) = 0 ifFalse:<br>
                                        [sz := sz + 1.<br>
                                         (highWord := highWord &gt;&gt; 8) = 0 ifFalse:[sz := sz + 1]]]].<br>
        newLargeInteger := objectMemory<br>
                                                        eeInstantiateSmallClassIndex: ClassLargePositiveIntegerCompactIndex<br>
                                                        format: (objectMemory byteFormatForNumBytes: sz)<br>
                                                        numSlots: 8 / objectMemory bytesPerOop.<br>
        self cppIf: VMBIGENDIAN<br>
                ifTrue:<br>
+                       [objectMemory storeLong64: 0 ofObject: newLargeInteger withValue: integerValue byteSwap64]<br>
-                       [objectMemory<br>
-                               storeByte: 7 ofObject: newLargeInteger withValue: (integerValue &gt;&gt; 56 bitAnd: 16rFF);<br>
-                               storeByte: 6 ofObject: newLargeInteger withValue: (integerValue &gt;&gt; 48 bitAnd: 16rFF);<br>
-                               storeByte: 5 ofObject: newLargeInteger withValue: (integerValue &gt;&gt; 40 bitAnd: 16rFF);<br>
-                               storeByte: 4 ofObject: newLargeInteger withValue: (integerValue &gt;&gt; 32 bitAnd: 16rFF);<br>
-                               storeByte: 3 ofObject: newLargeInteger withValue: (integerValue &gt;&gt; 24 bitAnd: 16rFF);<br>
-                               storeByte: 2 ofObject: newLargeInteger withValue: (integerValue &gt;&gt; 16 bitAnd: 16rFF);<br>
-                               storeByte: 1 ofObject: newLargeInteger withValue: (integerValue &gt;&gt;   8 bitAnd: 16rFF);<br>
-                               storeByte: 0 ofObject: newLargeInteger withValue: (integerValue &quot;&gt;&gt; 0&quot; bitAnd: 16rFF)]<br>
                ifFalse:<br>
                        [objectMemory storeLong64: 0 ofObject: newLargeInteger withValue: integerValue].<br>
        ^newLargeInteger<br>
  !<br>
<br>
Item was changed:<br>
  ----- Method: StackInterpreter&gt;&gt;signed64BitIntegerFor: (in category &#39;primitive support&#39;) -----<br>
  signed64BitIntegerFor: integerValue<br>
        &lt;var: &#39;integerValue&#39; type: #sqLong&gt;<br>
        &quot;Answer a Large Integer object for the given integer value.  N.B. will *not* cause a GC.&quot;<br>
        | newLargeInteger magnitude largeClass highWord sz |<br>
        &lt;inline: false&gt;<br>
        &lt;var: &#39;magnitude&#39; type: #usqLong&gt;<br>
        &lt;var: &#39;highWord&#39; type: #usqInt&gt;<br>
<br>
        integerValue &lt; 0<br>
                ifTrue:[        integerValue &gt;= objectMemory minSmallInteger ifTrue: [^objectMemory integerObjectOf: integerValue asInteger].<br>
                                largeClass := ClassLargeNegativeIntegerCompactIndex.<br>
                                magnitude := 0 - (self cCoerceSimple: integerValue to: #usqLong)]<br>
                ifFalse:[       integerValue &lt;= objectMemory maxSmallInteger ifTrue: [^objectMemory integerObjectOf: integerValue asInteger].<br>
                                largeClass := ClassLargePositiveIntegerCompactIndex.<br>
                                magnitude := integerValue].<br>
<br>
        objectMemory wordSize = 8<br>
                ifTrue: [sz := 8]<br>
                ifFalse: [<br>
                 (highWord := magnitude &gt;&gt; 32) = 0<br>
                        ifTrue: [sz := 4]<br>
                        ifFalse:<br>
                                [sz := 5.<br>
                                 (highWord := highWord &gt;&gt; 8) = 0 ifFalse:<br>
                                        [sz := sz + 1.<br>
                                         (highWord := highWord &gt;&gt; 8) = 0 ifFalse:<br>
                                                [sz := sz + 1.<br>
                                                 (highWord := highWord &gt;&gt; 8) = 0 ifFalse:<br>
                                                        [sz := sz + 1]]]]].<br>
<br>
        newLargeInteger := objectMemory<br>
                                                        eeInstantiateSmallClassIndex: largeClass<br>
                                                        format: (objectMemory byteFormatForNumBytes: sz)<br>
                                                        numSlots: sz + 3 // objectMemory bytesPerOop.<br>
        self cppIf: VMBIGENDIAN<br>
                ifTrue:<br>
+                       [sz &gt; 4<br>
+                               ifTrue: [objectMemory storeLong64: 0 ofObject: newLargeInteger withValue: magnitude byteSwap64]<br>
+                               ifFalse: [objectMemory storeLong32: 0 ofObject: newLargeInteger withValue: magnitude byteSwap32]]<br>
-                       [sz &gt; 4 ifTrue:<br>
-                               [objectMemory<br>
-                                       storeByte: 7 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 56 bitAnd: 16rFF);<br>
-                                       storeByte: 6 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 48 bitAnd: 16rFF);<br>
-                                       storeByte: 5 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 40 bitAnd: 16rFF);<br>
-                                       storeByte: 4 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 32 bitAnd: 16rFF)].<br>
-                       objectMemory<br>
-                               storeByte: 3 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 24 bitAnd: 16rFF);<br>
-                               storeByte: 2 ofObject: newLargeInteger withValue: (magnitude &gt;&gt; 16 bitAnd: 16rFF);<br>
-                               storeByte: 1 ofObject: newLargeInteger withValue: (magnitude &gt;&gt;   8 bitAnd: 16rFF);<br>
-                               storeByte: 0 ofObject: newLargeInteger withValue: (magnitude &quot;&gt;&gt; 0&quot; bitAnd: 16rFF)]<br>
                ifFalse:<br>
                        [sz &gt; 4<br>
                                ifTrue: [objectMemory storeLong64: 0 ofObject: newLargeInteger withValue: magnitude]<br>
                                ifFalse: [objectMemory storeLong32: 0 ofObject: newLargeInteger withValue: (self cCode: [magnitude] inSmalltalk: [magnitude bitAnd: 16rFFFFFFFF])]].<br>
        ^newLargeInteger!<br>
<br>
Item was changed:<br>
  ----- Method: StackInterpreter&gt;&gt;wordSwapped: (in category &#39;image save/restore&#39;) -----<br>
  wordSwapped: w<br>
        &quot;Return the given 64-bit integer with its halves in the reverse order.&quot;<br>
<br>
        objectMemory wordSize = 8 ifFalse: [self error: &#39;This cannot happen.&#39;].<br>
+       ^   ((w &gt;&gt; 32) bitAnd: 16r00000000FFFFFFFF) bitOr:<br>
+            ((w &lt;&lt; 32) bitAnd: 16rFFFFFFFF00000000)<br>
-       ^   ((w bitShift: Byte4ShiftNegated) bitAnd: Bytes3to0Mask)<br>
-         + ((w bitShift: Byte4Shift         ) bitAnd: Bytes7to4Mask)<br>
  !<br>
<br>
Item was changed:<br>
  ----- Method: ThreadedFFIPlugin&gt;&gt;ffiCreateIntegralResultOop:ofAtomicType:in: (in category &#39;callout support&#39;) -----<br>
  ffiCreateIntegralResultOop: retVal ofAtomicType: atomicType in: calloutState<br>
        &lt;inline: true&gt;<br>
        &lt;var: #calloutState type: #&#39;CalloutState *&#39;&gt;<br>
        &lt;var: #retVal type: #usqLong&gt;<br>
        &quot;Callout support. Return the appropriate oop for the given atomic type&quot;<br>
        | shift value mask byteSize |<br>
        &lt;var: &#39;value&#39; type: #usqLong&gt;<br>
        &lt;var: &#39;mask&#39; type: #usqLong&gt;<br>
        self assert: atomicType &lt; FFITypeSingleFloat.<br>
<br>
        atomicType = FFITypeBool ifTrue:<br>
                [&quot;Make sure bool honors the byte size requested&quot;<br>
                 byteSize := calloutState ffiRetHeader bitAnd: FFIStructSizeMask.<br>
                 value := byteSize = (self sizeof: retVal)<br>
                                        ifTrue:[retVal]<br>
                                        ifFalse:[retVal bitAnd: 1 &lt;&lt; (byteSize * 8) - 1].<br>
                 ^value = 0<br>
                        ifTrue:[interpreterProxy falseObject]<br>
                        ifFalse:[interpreterProxy trueObject]].<br>
        atomicType &lt;= FFITypeSignedInt ifTrue:<br>
                [&quot;these are all generall integer returns&quot;<br>
                atomicType &lt;= (BytesPerWord = 8 ifTrue: [FFITypeSignedInt] ifFalse: [FFITypeSignedShort]) ifTrue:<br>
                        [&quot;byte/short. first extract partial word, then sign extend&quot;<br>
                        shift := (BytesPerWord = 8 and: [atomicType &gt;= FFITypeUnsignedInt])<br>
                                                ifTrue: [32]<br>
                                                ifFalse: [(atomicType &gt;&gt; 1) * 8]. &quot;# of significant bits&quot;<br>
                        value := retVal bitAnd: (1 asUnsignedLong &lt;&lt; shift - 1).<br>
                        (atomicType anyMask: 1) ifTrue:<br>
                                [&quot;make the guy signed&quot;<br>
                                mask := 1 asUnsignedLong &lt;&lt; (shift-1).<br>
                                value := (value bitAnd: mask-1) - (value bitAnd: mask)].<br>
                        ^interpreterProxy integerObjectOf: value].<br>
                &quot;Word sized integer return&quot;<br>
                ^(atomicType anyMask: 1)<br>
                        ifTrue:[interpreterProxy signedMachineIntegerFor: retVal] &quot;signed return&quot;<br>
                        ifFalse:[interpreterProxy positiveMachineIntegerFor: retVal]]. &quot;unsigned return&quot;<br>
<br>
        &quot;longlong, char&quot;<br>
        ^(atomicType &gt;&gt; 1) = (FFITypeSignedLongLong &gt;&gt; 1)<br>
                ifTrue:<br>
                        [(atomicType anyMask: 1)<br>
                                ifTrue:[interpreterProxy signed64BitIntegerFor: retVal] &quot;signed return&quot;<br>
                                ifFalse:[interpreterProxy positive64BitIntegerFor: retVal]]<br>
                ifFalse:<br>
+                       [interpreterProxy characterObjectOf: (retVal bitAnd: 16rFF)]!<br>
-                       [interpreterProxy characterObjectOf: (retVal bitAnd: Byte0Mask)]!<br>
<br>
Item was changed:<br>
  SharedPool subclass: #VMBasicConstants<br>
        instanceVariableNames: &#39;&#39;<br>
+       classVariableNames: &#39;BaseHeaderSize BytesPerOop BytesPerWord COGMTVM COGVM DisownVMLockOutFullGC DoAssertionChecks DoExpensiveAssertionChecks GCModeBecome GCModeFreeSpace GCModeFull GCModeImageSegment GCModeIncremental GCModeNewSpace IMMUTABILITY MULTIPLEBYTECODESETS NewspeakVM PharoVM PrimErrBadArgument PrimErrBadIndex PrimErrBadMethod PrimErrBadNumArgs PrimErrBadReceiver PrimErrGenericFailure PrimErrInappropriate PrimErrLimitExceeded PrimErrNamedInternal PrimErrNoCMemory PrimErrNoMemory PrimErrNoModification PrimErrNotFound PrimErrObjectIsPinned PrimErrObjectMayMove PrimErrUnsupported PrimErrWritePastObject PrimNoErr SPURVM STACKVM SistaVM VMBIGENDIAN&#39;<br>
-       classVariableNames: &#39;BaseHeaderSize Byte0Mask Byte0Shift Byte1Mask Byte1Shift Byte1ShiftNegated Byte2Mask Byte2Shift Byte3Mask Byte3Shift Byte3ShiftNegated Byte4Mask Byte4Shift Byte4ShiftNegated Byte5Mask Byte5Shift Byte5ShiftNegated Byte6Mask Byte6Shift Byte7Mask Byte7Shift Byte7ShiftNegated Bytes3to0Mask Bytes7to4Mask BytesPerOop BytesPerWord COGMTVM COGVM DisownVMLockOutFullGC DoAssertionChecks DoExpensiveAssertionChecks GCModeBecome GCModeFreeSpace GCModeFull GCModeImageSegment GCModeIncremental GCModeNewSpace IMMUTABILITY MULTIPLEBYTECODESETS NewspeakVM PharoVM PrimErrBadArgument PrimErrBadIndex PrimErrBadMethod PrimErrBadNumArgs PrimErrBadReceiver PrimErrGenericFailure PrimErrInappropriate PrimErrLimitExceeded PrimErrNamedInternal PrimErrNoCMemory PrimErrNoMemory PrimErrNoModification PrimErrNotFound PrimErrObjectIsPinned PrimErrObjectMayMove PrimErrUnsupported PrimErrWritePastObject PrimNoErr SPURVM STACKVM SistaVM VMBIGENDIAN&#39;<br>
        poolDictionaries: &#39;&#39;<br>
        category: &#39;VMMaker-Interpreter&#39;!<br>
<br>
  !VMBasicConstants commentStamp: &#39;&lt;historical&gt;&#39; prior: 0!<br>
  I am a shared pool for basic constants upon which the VM as a whole depends.<br>
<br>
  self ensureClassPool.<br>
  self classPool declare: #BytesPerWord from: VMSqueakV3ObjectRepresentationConstants classPool.<br>
  self classPool declare: #BaseHeaderSize from: VMSqueakV3ObjectRepresentationConstants classPool<br>
  (ObjectMemory classPool keys select: [:k| k beginsWith: &#39;Byte&#39;]) do:<br>
        [:k| self classPool declare: k from: ObjectMemory classPool]!<br>
<br>
</blockquote></div><br></div>