[Vm-dev] VM Maker: VMMaker.oscog-eem.3035.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Aug 13 18:58:54 UTC 2021
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3035.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3035
Author: eem
Time: 13 August 2021, 11:58:40.766763 am
UUID: fb618590-b3d1-46f5-9454-89b87658f4a8
Ancestors: VMMaker.oscog-eem.3034
CoInterpreter: Make primitiveCompareBytes a FastCPrimitive.
ThreadedFFIPlugin: Provide a fast primitive to create a new ExternalAddress.
=============== Diff against VMMaker.oscog-eem.3034 ===============
Item was changed:
----- Method: InterpreterPrimitives>>primitiveCompareBytes (in category 'indexing primitives') -----
primitiveCompareBytes
"Primitive. Compare two byte-indexed objects for equality"
+ <export: true flags: #FastCPrimitiveFlag>
+ | arg1 arg2 len |
- | arg1 arg2 len1 len2 |
- <export: true>
- argumentCount = 1 ifFalse:[self primitiveFail. ^self].
arg1 := self stackValue: 1.
arg2 := self stackValue: 0.
- ((objectMemory isBytes: arg1) and:[objectMemory isBytes: arg2])
- ifFalse:[self primitiveFail. ^self].
"Quick identity test"
+ arg1 = arg2 ifTrue:
+ [^self methodReturnBool: true].
+ ((objectMemory isBytes: arg1) and:[objectMemory isBytes: arg2]) ifFalse:
+ [^self primitiveFailFor: PrimErrBadArgument].
+ len := objectMemory numBytesOfBytes: arg1.
+ len = (objectMemory numBytesOfBytes: arg2) ifFalse:
+ [^self methodReturnBool: false].
+ 0 to: len - 1 do:
+ [:i|
+ (objectMemory fetchByte: i ofObject: arg1) = (objectMemory fetchByte: i ofObject: arg2) ifFalse:
+ [^self methodReturnBool: false]].
+ ^self methodReturnBool: true!
- (arg1 = arg2) ifTrue:[^self pop: 2 thenPush: objectMemory trueObject].
- len1 := objectMemory byteSizeOf: arg1.
- len2 := objectMemory byteSizeOf: arg2.
- len1 = len2 ifFalse:[^self pop: 2 thenPush: objectMemory falseObject].
- 0 to: len1-1 do:[:i|
- (objectMemory fetchByte: i ofObject: arg1) = (objectMemory fetchByte: i ofObject: arg2)
- ifFalse:[^self pop: 2 thenPush: objectMemory falseObject]].
- self pop: 2 thenPush: objectMemory trueObject.
- !
Item was added:
+ ----- Method: ThreadedFFIPlugin>>primitiveExternalAddressFromInteger (in category 'primitives') -----
+ primitiveExternalAddressFromInteger
+ "Answer a 4 byte or 8 byte ExternalAddress with value of the argument."
+ <export: true flags: #FastCPrimitiveFlag>
+ | value |
+ value := interpreterProxy positiveMachineIntegerValueOf: (interpreterProxy stackValue: 0).
+ interpreterProxy failed ifTrue:
+ [^interpreterProxy primitiveFailFor: PrimErrBadArgument].
+ (interpreterProxy instantiateClass: interpreterProxy classExternalAddress indexableSize: BytesPerWord)
+ ifNil: [^interpreterProxy primitiveFailFor: PrimErrNoMemory]
+ ifNotNil:
+ [:address|
+ (self cCoerce: (interpreterProxy firstIndexableField: address) to: #usqIntptr_t) at: 0 put: value.
+ ^interpreterProxy methodReturnValue: address]!
More information about the Vm-dev
mailing list