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
registers.
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:
https://developer.arm.com/documentation/ihi0055/b/
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
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 4b17e6e5daec9e302a3bb743016779e2d6d3100b
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/4b17e6e5daec9e302a…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2020-08-27 (Thu, 27 Aug 2020)
Changed paths:
M nsspur64src/vm/cogit.h
M nsspur64src/vm/cogitARMv8.c
M nsspur64src/vm/cogitX64SysV.c
M nsspur64src/vm/cogitX64WIN64.c
M nsspur64src/vm/cointerp.c
M nsspur64src/vm/cointerp.h
M nsspur64src/vm/gcc3x-cointerp.c
M nsspursrc/vm/cogit.h
M nsspursrc/vm/cogitARMv5.c
M nsspursrc/vm/cogitIA32.c
M nsspursrc/vm/cogitMIPSEL.c
M nsspursrc/vm/cointerp.c
M nsspursrc/vm/cointerp.h
M nsspursrc/vm/gcc3x-cointerp.c
M spur64src/vm/cogit.h
M spur64src/vm/cogitARMv8.c
M spur64src/vm/cogitX64SysV.c
M spur64src/vm/cogitX64WIN64.c
M spur64src/vm/cointerp.c
M spur64src/vm/cointerp.h
M spur64src/vm/cointerpmt.c
M spur64src/vm/cointerpmt.h
M spur64src/vm/gcc3x-cointerp.c
M spur64src/vm/gcc3x-cointerpmt.c
M spurlowcode64src/vm/cogit.h
M spurlowcode64src/vm/cogitARMv8.c
M spurlowcode64src/vm/cogitX64SysV.c
M spurlowcode64src/vm/cogitX64WIN64.c
M spurlowcode64src/vm/cointerp.c
M spurlowcode64src/vm/cointerp.h
M spurlowcode64src/vm/gcc3x-cointerp.c
M spurlowcodesrc/vm/cogit.h
M spurlowcodesrc/vm/cogitARMv5.c
M spurlowcodesrc/vm/cogitIA32.c
M spurlowcodesrc/vm/cogitMIPSEL.c
M spurlowcodesrc/vm/cointerp.c
M spurlowcodesrc/vm/cointerp.h
M spurlowcodesrc/vm/gcc3x-cointerp.c
M spursista64src/vm/cogit.h
M spursista64src/vm/cogitARMv8.c
M spursista64src/vm/cogitX64SysV.c
M spursista64src/vm/cogitX64WIN64.c
M spursista64src/vm/cointerp.c
M spursista64src/vm/cointerp.h
M spursista64src/vm/gcc3x-cointerp.c
M spursistasrc/vm/cogit.h
M spursistasrc/vm/cogitARMv5.c
M spursistasrc/vm/cogitIA32.c
M spursistasrc/vm/cogitMIPSEL.c
M spursistasrc/vm/cointerp.c
M spursistasrc/vm/cointerp.h
M spursistasrc/vm/gcc3x-cointerp.c
M spursrc/vm/cogit.h
M spursrc/vm/cogitARMv5.c
M spursrc/vm/cogitIA32.c
M spursrc/vm/cogitMIPSEL.c
M spursrc/vm/cointerp.c
M spursrc/vm/cointerp.h
M spursrc/vm/cointerpmt.c
M spursrc/vm/cointerpmt.h
M spursrc/vm/gcc3x-cointerp.c
M spursrc/vm/gcc3x-cointerpmt.c
M src/vm/cogit.h
M src/vm/cogitARMv5.c
M src/vm/cogitIA32.c
M src/vm/cogitMIPSEL.c
M src/vm/cointerp.c
M src/vm/cointerp.h
M src/vm/cointerpmt.c
M src/vm/cointerpmt.h
M src/vm/gcc3x-cointerp.c
M src/vm/gcc3x-cointerpmt.c
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.2794
Fix long-standing confusion in generating the interface header files between
the CoInterpreter and the Cogit. VM_EXPORT is the marker for export between
the VM and external plugins (dlls/shared-objects). Between the CoInterpreter
and the Cogit we need nothing more than extern.
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: d16264b1558d88bdf178ff3d6e12f2fd18e3885c
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/d16264b1558d88bdf1…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2020-08-27 (Thu, 27 Aug 2020)
Changed paths:
M .gitignore
M build.macos64ARMv8/common/Makefile.app
A build.macos64ARMv8/common/entitlements.plist
Log Message:
-----------
Add Apple Silicon entitlements (still no joy with lldb though).
Clean up build directory .gitignore hackery. [ci skip]
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2793.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2793
Author: eem
Time: 24 August 2020, 7:47:53.984785 pm
UUID: 87cb649c-1079-4e58-9e4c-cbf9d4f6669d
Ancestors: VMMaker.oscog-eem.2792
SmartSyntaxPlugins:
methodReturnFoo's are too useful an ideom not to support properly. Ensure that SmartSyntaxPluginCodeGenerator is smart enough not to require the use of an explicit return for a trailing methodReturnFoo. And yes, this bit me.
=============== Diff against VMMaker.oscog-eem.2792 ===============
Item was added:
+ ----- Method: SmartSyntaxPluginTMethod>>endsWithMethodReturnExpression (in category 'testing') -----
+ endsWithMethodReturnExpression
+ | operativeReturn |
+ operativeReturn := (parseTree statements last isReturn
+ and: [parseTree statements last expression isLeaf])
+ ifTrue: [(parseTree statements last: 2) first]
+ ifFalse: [parseTree statements last].
+ ^operativeReturn isSend
+ and: [#(methodReturnReceiver
+ methodReturnFloat:
+ methodReturnValue:
+ methodReturnInteger:
+ methodReturnBool:
+ methodReturnString:
+ methodReturnStringOrNil:) includes: operativeReturn selector]!
Item was changed:
----- Method: SmartSyntaxPluginTMethod>>fixUpReturns (in category 'transforming') -----
fixUpReturns
"Replace each return statement in this method with (a) the given postlog, (b) code to pop the receiver and the given number of arguments, and (c) code to push the integer result and return."
+ self endsWithMethodReturnExpression ifTrue:
+ [parseTree statements last isSend ifFalse:
+ [parseTree setStatements: parseTree statements allButLast]].
+ parseTree nodesDo:
+ [:node |
+ node isStmtList ifTrue:
+ [node setStatements: (Array streamContents:
-
- parseTree nodesDo: [:node |
- node isStmtList ifTrue: [
- node setStatements: (Array streamContents:
[:sStream |
node statements do:
[:stmt | self fixUpReturnOneStmt: stmt on: sStream]])]]!
Hi--
If you're interested in implementing OpenSmalltalk/Cog/Spur on
WebAssembly, this would be a good time to get involved in the WASM
garbage collection design discussion. It's getting more concrete, and
has the attention of all the major committed participants.
-C
***
-------- Forwarded Message --------
Subject: Re: [WebAssembly/gc] Requirements (#121)
Date: Mon, 24 Aug 2020 13:18:23 -0700
From: Thomas Lively
To: WebAssembly/gc
*@tlively* commented on this pull request.
Personally, I've been assuming that we are designing to optimize peak
performance for optimizing engines that will not do dynamic feedback
collection. I agree that it would be helpful to check for consensus on
what design constraints we are assuming for the top-tier of engines we
are designing for.
------------------------------------------------------------------------
In Requirements.md
<https://github.com/WebAssembly/gc/pull/121#discussion_r475869312>:
> +1. Performance is more important than convenience.
+
+ Since WASM-GC is not intended as a user-facing technology,
convenience here refers to the ease with which toolchain authors can
target WASM-GC. + + Convenience for toolchain authors is still
important however, as that affects adoption of WASM-GC. +
+ +## Critical Success Factors
+
+A critical success factor is an aspect or property of possible
solutions that may or may not be directly focused on the primary
objective, but none-the-less is estimated to be crucially important to
the success of the effort.
+
+1. Permit ‘cycle detection’ between host structures and language
structures; so that such cycles can be collected if there are no other
references to them.
+
+ When a WASM-GC module accesses host capabilities, or when a host
application access structures from a WASM-GC library, cross references
between them are likely to be established. For example, a DOM node may
have an event listener that is actually implemented in WASM. The event
listener, in turn, may have a reference to the DOM node it is listening
to. This represents a cycle between the host and WASM-GC. If there are
no other references to this cycles (if, for example, the DOM node is
removed) then the entire cycle must be able to be collected.
+
+1. Performance implications of WASM-GC code should be straightforward.
***
--
Craig Latta
Black Page Digital
Berkeley, California
blackpagedigital.com