[Vm-dev] VM Maker: VMMaker.oscog-eem.3227.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Jul 29 03:39:36 UTC 2022
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3227.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3227
Author: eem
Time: 28 July 2022, 8:39:20.376112 pm
UUID: 3f4b7c6c-fd6b-4555-96a7-b62d694b8ef7
Ancestors: VMMaker.oscog-eem.3226
Rescue compilation of the ThreadedFFIPlugin on gcc 12 systems where it appears gcc 12 has lost the ability to distinguish between the variable and function namespaces isAlien: => isAlien, and ffiAtomicArgByReference:Class:in: used to have a flag variable called isAlien.
=============== Diff against VMMaker.oscog-eem.3226 ===============
Item was changed:
----- Method: ThreadedFFIPlugin>>ffiAtomicArgByReference:Class:in: (in category 'callout support') -----
ffiAtomicArgByReference: oop Class: oopClass in: calloutState
<var: #calloutState type: #'CalloutState *'>
"Support for generic callout. Prepare a pointer reference to an atomic type for callout.
Note:
for type 'void*' we allow ByteArray/String/Symbol, wordVariableSubclass, Alien or ExternalAddress.
for other types we allow ByteArray, wordVariableSubclass, Alien or ExternalAddress."
+ | atomicType isExternalAddress isStringObj isAlienObj |
- | atomicType isExternalAddress isString isAlien |
<inline: #always>
atomicType := self atomicTypeOf: calloutState ffiArgHeader.
atomicType = FFITypeBool ifTrue: "No bools on input"
[^FFIErrorCoercionFailed].
(isExternalAddress := oopClass = interpreterProxy classExternalAddress)
+ ifTrue: [isAlienObj := isStringObj := false]
- ifTrue: [isAlien := isString := false]
ifFalse:
+ [(isStringObj := interpreterProxy
- [(isString := interpreterProxy
includesBehavior: oopClass
ThatOf: interpreterProxy classString)
+ ifTrue: [isAlienObj := false]
- ifTrue: [isAlien := false]
ifFalse:
+ [isAlienObj := interpreterProxy
- [isAlien := interpreterProxy
includesBehavior: oopClass
ThatOf: interpreterProxy classAlien]].
(atomicType >> 1) = (FFITypeSignedChar8 >> 1) ifTrue:"string value (char*)"
"note: the only types allowed for passing into char* types are
ByteArray, String, Symbol, Alien and *no* other byte indexed objects
(e.g., CompiledMethod, LargeInteger). We only check for strings
here and fall through to the byte* check otherwise."
+ [isStringObj ifTrue:"String/Symbol"
- [isString ifTrue:"String/Symbol"
"Strings must be allocated by the ffi support code"
[^self ffiPushString: (interpreterProxy firstIndexableField: oop)
OfLength: (interpreterProxy byteSizeOf: oop)
in: calloutState].
"Fall through to byte* test"
atomicType := FFITypeUnsignedInt8].
self cppIf: COGMTVM ifTrue:
["Since all the following pass the address of the first indexable field we need to fail
the call if it is threaded and the object is young, since it may move during the call."
(isExternalAddress not
and: [(calloutState callFlags anyMask: FFICallFlagThreaded)
+ and: [(isAlienObj not or: [self isDirectAlien: oop])
- and: [(isAlien not or: [self isDirectAlien: oop])
and: [self cppIf: #SPURVM
ifTrue: [(interpreterProxy isPinned: oop) not]
ifFalse: [interpreterProxy isYoung: oop]]]]) ifTrue:
[^PrimErrObjectMayMove negated]].
(atomicType >> 1) = (FFITypeSignedInt8 >> 1) ifTrue:
"byte* -- see comment on string above"
+ [(isStringObj or: [oopClass = interpreterProxy classByteArray]) ifTrue: "String/Symbol/ByteArray"
- [(isString or: [oopClass = interpreterProxy classByteArray]) ifTrue: "String/Symbol/ByteArray"
[^self ffiPushPointer: (interpreterProxy firstIndexableField: oop) in: calloutState].
isExternalAddress ifTrue:
[^self ffiPushPointer: (self longAt: oop + interpreterProxy baseHeaderSize) in: calloutState].
+ isAlienObj ifTrue:
- isAlien ifTrue:
[^self ffiPushPointer: (self pointerForOop: (self startOfData: oop)) in: calloutState].
atomicType = FFITypeVoid ifFalse:
[^FFIErrorCoercionFailed]].
"note: type void falls through"
"I can push pointers to any type (take for instance calls who receive int* output arguments, etc.)
but I need to store them into a ByteArray, ExternalAddress or Alien"
(atomicType <= FFITypeDoubleFloat) ifTrue:
[isExternalAddress ifTrue:
[^self ffiPushPointer: (self longAt: oop + interpreterProxy baseHeaderSize) in: calloutState].
+ isAlienObj ifTrue:
- isAlien ifTrue:
[^self ffiPushPointer: (self pointerForOop: (self startOfData: oop)) in: calloutState].
(interpreterProxy isWordsOrBytes: oop) ifTrue:
[^self ffiPushPointer: (interpreterProxy firstIndexableField: oop) in: calloutState]].
^FFIErrorCoercionFailed!
More information about the Vm-dev
mailing list