[Vm-dev] ARMv8 status

Eliot Miranda eliot.miranda at gmail.com
Fri Aug 28 04:21:22 UTC 2020

Hi All,

    I hope I can clear up some confusion as to the status of ARMv8/aarch64
support in the opensmalltalk-vm.

Executive summary: ARMv8 stack and cog VMs fully functional on e.g.
Raspberry Pi 4, except for a special case in the FFI (structs containing
all floats).  The stack interpreter is functional on beta Apple Silicon.
Work is in progress to get the Cogit VM working there-on.

Gory details:
The core VM works in both stack and cogit versions.  A bug with integer
multip-ly was fixed in early June that fixed bugs that appeared to be in
large integer arithmetic (e.g. 100 factorial answered an incorrect value_.
This bug was due to the Cogit not generating code that checked for overflow
in integer multiple, and this was due to my having not noticed that ARMv8
does not set the overflow flag for integer multiple.  The fix was to
generate a proper checking sequence (the upper 64 bits of a 64x64=>128 bit
multiply should be 0 or all ones).

The major known bug is in the FFI. The ARMv8 procedure calling standard
defines Homogenous Floating Aggregates (HFAs) and Homogenous
Vector Aggregates (HVAs).  The former are e.g. C structs whose components
are all floats or all doubles.  The latter are structs whose components are
all the same and of two to four scalar data types.  If argument registers
are available then values of these types will be passed *and* returned in

The bug is that the ThreadedARMv8Plgin does not currently implement this
mapping for floating-point values.  This manifests in 6  ffi tests failing
and two generating errors (provided the -failonffiexception VM argument is
used; if it is not supplied, the VM crashes).  While I don't have time to
work on this at the moment, I'm sure that either Nicolas or myself will get
to this before too long.  But if your interface does not use HFAs or HVAs
we believe the FFI is functional.

Implementors interested in the issue can find the procedure call standard
on this page, hit the Download button to access:

Fabio and I are currently working on Apple Silicon support, very much in
our spare time.  Apple Silicon is the same Apple gives to its own ARMv8
implementation, the A12 (used in beta macos hardware) and the A13.
Currently we have the stack interpreter working, but not the Cogit.  The
issue right now is getting the lldb debugger to debug the Cogit so we can
correctly set up memory at startup, Apple having introduced, or
rather ported, the iPhone security architecture to MacOS, meaning that
jitting code and debugging are carefully controlled actions that need
:entitlements" setting in an executable.  So far I *think* the entitlements
are being set correctly, but for some reason lldb is still not able to
launch or attach to either the stack or the cog VMs.  So while we're stuck
at the moment, Apple is quite responsive in its beta programme and I'm two
messages deep in the exchange on getting lldb to work.  So I expect
progress soon.
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200827/f4cf2c58/attachment-0001.html>

More information about the Vm-dev mailing list