[Vm-dev] Errored: OpenSmalltalk/opensmalltalk-vm#1932 (Cog - 1cbb668)
builds at travis-ci.org
Fri Jan 31 02:45:47 UTC 2020
Build Update for OpenSmalltalk/opensmalltalk-vm
Duration: 22 mins and 57 secs
Commit: 1cbb668 (Cog)
Author: Eliot Miranda
Message: CogVM source as per VMMaker.oscog-eem.2692
FFI support for returning of a packed struct by value in X64 SysV
On X64/SysV struct up to 16 byte long can be passed by value into a pair of
8-byte registers. The problem is to know whether these are int (RAX RDX) or
float (XMM0 XMM1) registers or eventually a mix of...
For each 8-byte, we must know if it contains at least an int (in which case we
have to use an int register), or exclusively floating points (a pair of float
or a double). Previous algorithm did check first two fields, or last two
fields which does not correctly cover all cases...
For example int-int-float has last two fields int-float, though it will use
So we have to know about struct layout... Unfortunately, this information is
not included into the compiledSpec. The idea here is to reconstruct the
information. See #registerTypeForStructSpecs:OfLength:
It's also impossible to cover the exotic alignments like packed structure
cases... But if we really want to pass that, this will mean passing the
alignment information, a more involved change of #compiledSpec (we need
up to 16 bits by field to handle that information since our FFI struct
are limited to 65535 bytes anyway).
For returning a struct, that's the same problem. We have four possible
combinations of int-float registers. Consequently, the idea is to analyze
the ffiRetSpec compiledSpec object thru CalloutState (it's the Smalltalk
WordArray object, not a pointer to its firstIndexableField) for performing
this analysis... Not sure if the best choice.
Since we have 4 different SixteenByte types, I have changed
value, since it's what will be used to memcpy to allocated ByteArray handle.
Checking the size of a struct is not the only condition for returning a struct
via registers. Some ABI like X64 SysV also mandates that struct fields be
properly aligned. Therefore, we cannot just rely on #returnStructInRegisters:.
Rename #returnStructInRegisters: -> #canReturnInRegistersStructOfSize:
Perform a more thorough analysis during the setup in #ffiCheckReturn:With:in:
The ABI will #encodeStructReturnTypeIn: a new callout state.
This structReturnType is telling how the struct should be returned
- via registers (and which registers)
- or via pointer to memory allocated by caller
This structReturnType will be used at time of:
- allocating the memory in caller - see #ffiCall:ArgArrayOrNil:NumArgs:
- dispatching to the correct FFI prototype - see ThreadedX64SysVFFIPlugin>>#ffiCalloutTo:SpecOnStack:in:
- copying back the struct contents to ExternalStructure handle (a ByteArray) - see #ffiReturnStruct:ofType:in:
Since structReturnType is encoded, it is not necessarily accessed directly,
but rather via new implementation of #returnStructInRegisters: whch now
takes the calloutState and knows how to decode its structReturnType.
Check for unaligned struct and pass them in MEMORY (alloca'd memory passed
thru a pointer).
Use a new (branchless) formulation for aligning the byteSize to next multiple
Encode registryType of invalid unaligned candidate as 2r110, and pass the
struct address returned by the foreign function in $RAX register in place
of callout limit when stuct is returned by MEMORY.
CoInterpreter: eliminate all but one compiler warning.
Cogit/Slang: fix several C compiler warnings re the Cogits.
Cogit: DUAL_MAPPED_CODE_ZONE (require -DDUAL_MAPPED_CODE_ZONE=1 to enable)
Fix denial of write/execute facility on modern Linuxes by dual mapping the code
zone in to a read/execute address range for code execution and a read/write
address range for code editing. Maintain codeToDataDelta and provide
codeXXXAt:put: to write at address + codeToDataDelta to the offset writable
Hence DUAL_MAPPED_CODE_ZONE requires a new executbale permissions applyer that
will also do the dual mapping, sqMakeMemoryExecutableFrom:To:CodeToDataDelta:.
Provide writableMethodFor: as a convenience for obtaining a writable cogMethod.
No longer have the fillInXXXHeaderYYY: methods answer anything since they're
given the writable header, not the actual header.
Refactor indexForSelector:in:at: to indexForSelector:in: in the back end so it
can be inlined (via a macro).
emit constant for (M << N) and (M - N) - L for constant integers.
Fix in slang case statement expansion labels.
During expansion in case statements, trees are duplicated and expanded.
View the changeset: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/4e57f60a0980...1cbb668e7f45
View the full build log and details: https://travis-ci.org/OpenSmalltalk/opensmalltalk-vm/builds/644159560?utm_medium=notification&utm_source=email
You can unsubscribe from build emails from the OpenSmalltalk/opensmalltalk-vm repository going to https://travis-ci.org/account/preferences/unsubscribe?repository=8795279&utm_medium=notification&utm_source=email.
Or unsubscribe from *all* email updating your settings at https://travis-ci.org/account/preferences/unsubscribe?utm_medium=notification&utm_source=email.
Or configure specific recipients for build notifications in your .travis.yml file. See https://docs.travis-ci.com/user/notifications.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev