[Vm-dev] VM Maker: VMMaker.oscog-eem.1054.mcz
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Wed Feb 11 22:05:04 UTC 2015
If I reformulate:
1) there is a speed-up consisting in bitAnd'ing bitOr'ing the Oop (shifted
integer value+tag) directly without need to decode anything when both are
immediate SmallInteger
2) this speed-up is already performed in interpreter special bytecode
handling and/or in JIT
3) so checking again in the primitive is a loss of time
4) the primitive is there just in case the receiver and/or argument is a
LargePositiveInteger outside immediate range, but still fitting in an
unsigned long (32 or 64 bits)
2015-02-11 22:20 GMT+01:00 <commits at source.squeak.org>:
>
> Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1054.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker.oscog-eem.1054
> Author: eem
> Time: 11 February 2015, 1:20:01.475 pm
> UUID: 3d511797-53fc-4848-b1ec-4b8a1eb0c0ff
> Ancestors: VMMaker.oscog-eem.1053
>
> Broaden primitiveBitAnd and primitiveBitOr for Spur
> 64-bits. Make the bytecodes handle the common
> SmallInteger op SmallInteger case.
>
> Fix C code for and endianness under simulation of
> Spur64BitMemoryManager>>fetchLong32:ofFloatObject:
>
> =============== Diff against VMMaker.oscog-eem.1053 ===============
>
> Item was changed:
> ----- Method: InterpreterPrimitives>>primitiveBitAnd (in category
> 'arithmetic integer primitives') -----
> primitiveBitAnd
> + <inline: false>
> | integerReceiver integerArgument |
> + integerArgument := self stackTop.
> + integerReceiver := self stackValue: 1.
> + "Comment out the short-cut. Either the inline interpreter
> bytecode or the JIT primitive will handle this case.
> + ((objectMemory isIntegerObject: integerArgument)
> + and: [objectMemory isIntegerObject: integerReceiver])
> + ifTrue: [self pop: 2 thenPush: (integerArgument bitAnd:
> integerReceiver)]
> + ifFalse:
> + ["objectMemory wordSize = 8
> + ifTrue:
> + [integerArgument := self
> positive64BitValueOf: integerArgument.
> + integerReceiver := self
> positive64BitValueOf: integerReceiver.
> + self successful ifTrue:
> + [self pop: 2 thenPush:
> (self positive64BitIntegerFor: (integerArgument bitAnd: integerReceiver))]]
> + ifFalse:
> + [integerArgument := self
> positive32BitValueOf: integerArgument.
> + integerReceiver := self
> positive32BitValueOf: integerReceiver.
> + self successful ifTrue:
> + [self pop: 2 thenPush:
> (self positive32BitIntegerFor: (integerArgument bitAnd:
> integerReceiver))]]"]"!
> - integerArgument := self popPos32BitInteger.
> - integerReceiver := self popPos32BitInteger.
> - self successful
> - ifTrue: [self push: (self positive32BitIntegerFor:
> - (integerReceiver bitAnd:
> integerArgument))]
> - ifFalse: [self unPop: 2]!
>
> Item was changed:
> ----- Method: InterpreterPrimitives>>primitiveBitOr (in category
> 'arithmetic integer primitives') -----
> primitiveBitOr
> + <inline: false>
> | integerReceiver integerArgument |
> + integerArgument := self stackTop.
> + integerReceiver := self stackValue: 1.
> + "Comment out the short-cut. Either the inline interpreter
> bytecode or the JIT primitive will handle this case.
> + ((objectMemory isIntegerObject: integerArgument)
> + and: [objectMemory isIntegerObject: integerReceiver])
> + ifTrue: [self pop: 2 thenPush: (integerArgument bitOr:
> integerReceiver)]
> + ifFalse:
> + ["objectMemory wordSize = 8
> + ifTrue:
> + [integerArgument := self
> positive64BitValueOf: integerArgument.
> + integerReceiver := self
> positive64BitValueOf: integerReceiver.
> + self successful ifTrue:
> + [self pop: 2 thenPush:
> (self positive64BitIntegerFor: (integerArgument bitOr: integerReceiver))]]
> + ifFalse:
> + [integerArgument := self
> positive32BitValueOf: integerArgument.
> + integerReceiver := self
> positive32BitValueOf: integerReceiver.
> + self successful ifTrue:
> + [self pop: 2 thenPush:
> (self positive32BitIntegerFor: (integerArgument bitOr:
> integerReceiver))]]"]"!
> - integerArgument := self popPos32BitInteger.
> - integerReceiver := self popPos32BitInteger.
> - self successful
> - ifTrue: [self push: (self positive32BitIntegerFor:
> - (integerReceiver bitOr:
> integerArgument))]
> - ifFalse: [self unPop: 2]!
>
> Item was changed:
> ----- Method: Spur64BitMemoryManager>>fetchLong32:ofFloatObject: (in
> category 'object access') -----
> fetchLong32: fieldIndex ofFloatObject: oop
> "index by word size, and return a pointer as long as the word size"
>
> | bits |
> (self isImmediateFloat: oop) ifFalse:
> [^self fetchLong32: fieldIndex ofObject: oop].
> bits := self smallFloatBitsOf: oop.
> ^self
> + cCode: [(self cCoerceSimple: (self addressOf: bits) to:
> #'int *') at: fieldIndex]
> + inSmalltalk:
> + [self flag: #endian.
> + fieldIndex = 0
> + ifTrue: [bits bitAnd: 16rFFFFFFFF]
> + ifFalse: [bits >> 32]]!
> - cCode: [self longAt: (self cCoerceSimple: (self addressOf:
> bits) to: #'char *')
> - + (fieldIndex <<
> self shiftForWord)]
> - inSmalltalk: [self flag: #endian.
> - fieldIndex = 0
> - ifTrue: [bits >> 32]
> - ifFalse: [bits bitAnd:
> 16rFFFFFFFF]]!
>
> Item was changed:
> ----- Method: StackInterpreter>>bytecodePrimBitAnd (in category 'common
> selector sends') -----
> bytecodePrimBitAnd
> + | rcvr arg |
> + arg := self internalStackTop.
> + rcvr := self internalStackValue: 1.
> + ((objectMemory isIntegerObject: arg)
> + and: [objectMemory isIntegerObject: rcvr]) ifTrue:
> + [self internalPop: 2 thenPush: (arg bitAnd: rcvr).
> + ^self fetchNextBytecode "success"].
>
> self initPrimCall.
> self externalizeIPandSP.
> self primitiveBitAnd.
> self internalizeIPandSP.
> + self successful ifTrue:
> + [^self fetchNextBytecode "success"].
> - self successful ifTrue: [^ self fetchNextBytecode "success"].
>
> messageSelector := self specialSelector: 14.
> argumentCount := 1.
> self normalSend!
>
> Item was changed:
> ----- Method: StackInterpreter>>bytecodePrimBitOr (in category 'common
> selector sends') -----
> bytecodePrimBitOr
> + | rcvr arg |
> + arg := self internalStackTop.
> + rcvr := self internalStackValue: 1.
> + ((objectMemory isIntegerObject: arg)
> + and: [objectMemory isIntegerObject: rcvr]) ifTrue:
> + [self internalPop: 2 thenPush: (arg bitOr: rcvr).
> + ^self fetchNextBytecode "success"].
>
> self initPrimCall.
> self externalizeIPandSP.
> self primitiveBitOr.
> self internalizeIPandSP.
> + self successful ifTrue:
> + [^self fetchNextBytecode "success"].
> - self successful ifTrue: [^ self fetchNextBytecode "success"].
>
> messageSelector := self specialSelector: 15.
> argumentCount := 1.
> self normalSend!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150211/48dea335/attachment-0001.htm
More information about the Vm-dev
mailing list