-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for Atomic Operators (like CAS, etc.) #92
Comments
@Shinmera I'll take a look at what we need to do. I have some notes from a couple years back that I need to dig up… |
So I did a little looking. Sadly this requires targeting 1.7 and not 1.6 |
ABCL 2 will Thanks for looking into this. |
I'd be happy to work on this bug but I've no idea when abcl 2 is being release, so if you have some method of notification please drop me a message. |
ABCL 2 is scheduled for September 2020, when I intend to release a version targeting openjdk8 @Slids I guess I should fork ABCL now to give ya a place to add patches. Stay tuned… |
is the basic operation on Java Atomics. It was introduced in openjdk8, but I wonder if it is possible to synthesize a version in pure Java that would work on openjdk6? Then we could add a compatibility layer to back-port. |
The real problem is with calling compare and set on vectors, you have to
look at the type possibilities.
…On Sun, Jun 7, 2020, 2:43 AM Mark Evenson ***@***.***> wrote:
boolean compareAndSet(expectedValue, updateValue)
is the basic operation on Java Atomics. It was introduced in openjdk8, but
I wonder if it is possible to synthesize a version in pure Java that would
work on openjdk6? Then we could add a compatibility layer to back-port.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#92 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD7Y3JZ3SMAEQRYHXDBW6X3RVMZIPANCNFSM4GSBOVXQ>
.
|
Having my paws bloody overhauling our byte vectors with |
I would avoid any self implementation and just sue the java concurrent libraries. |
Actually this requires openjdk9, which we don't support, so the current target of minimum openjdk8 for the next ABCL is not sufficient if we wish to efficiently implement the necessary semantics on any memory that a So, the question becomes: it is ok if ABCL2 drops openjdk8 support, and only supports openjdk11? |
It's OK for me! However, doesn't this require the compiler to target newer
bytecode? Isn't it still targeting Java 5 bytecode?
…On Tue, 6 Oct 2020 at 17:53, Mark Evenson ***@***.***> wrote:
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/invoke/VarHandle.html
Actually this requires openjdk9, which we don't support.
So, the question becomes: it is ok if ABCL2 drops openjdk8 support, and
only supports openjdk11?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#92 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHV3NR4S65VVD5ABXQJPKTSJM4PTANCNFSM4GSBOVXQ>
.
|
Sent from my iPad
On 06.10.2020, at 18:56, Alessio Stalla ***@***.***> wrote:
It's OK for me! However, doesn't this require the compiler to target newer
bytecode? Isn't it still targeting Java 5 bytecode?
Nope. We compile and load Java 5 bytecode today, working through openjdk15.
The Bear lopes through the loophole that while the system classloaders require an advanced minimum bytecode, one is still able to load Java 5 bytecode from arrays of bytes.
|
I mean, to use VarHandles, doesn't the classfile version have to be quite
recent?
…On Tue, 6 Oct 2020 at 20:16, Mark Evenson ***@***.***> wrote:
Sent from my iPad
> On 06.10.2020, at 18:56, Alessio Stalla ***@***.***>
wrote:
>
>
> It's OK for me! However, doesn't this require the compiler to target
newer
> bytecode? Isn't it still targeting Java 5 bytecode?
>
Nope. We compile and load Java 5 bytecode today, working through openjdk15.
The Bear lopes through the loophole that while the system classloaders
require an advanced minimum bytecode, one is still able to load Java 5
bytecode from arrays of bytes.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#92 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHV3NSV6O5FTDOHAXRM7VLSJNNITANCNFSM4GSBOVXQ>
.
|
Hmm. Not sure, as it depends if we would have to change our compiler. The Java code of the ABCL gets compiled with But modernizing the compiler output is certainly one of the high-priority tasks with the putative ABCL2 codebase. |
Oh I see I thought it was another thing like InvokeDynamic which cannot be
expressed in Java but I was wrong.
…On Wed, 7 Oct 2020 at 10:42, Mark Evenson ***@***.***> wrote:
I mean, to use VarHandles, doesn't the classfile version have to be quite
recent?
Hmm. Not sure, as it depends if we would have to change our compiler. The
Java code of the ABCL gets compiled with javac against the JDK platform
libraries, so if we were able to replace LispObject purely Java-side, we
wouldn't necessarily need to change the compiler.
But modernizing the compiler output is certainly one of the high-priority
tasks with the putative ABCL2 codebase.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#92 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHV3NU6SWZ3HWGM2RMXNLDSJQSW3ANCNFSM4GSBOVXQ>
.
|
Would using AtomicReferenceFieldUpdater work? It wouldn't require updating to a newer Java version (available since Java 5) and it wouldn't require changing the compiler. The downside is that fields like car and cdr would have to be declared volatile, which might degrade performance when not using CAS. |
Not sure if relevant. Ignore if not. I've implemented AtomicReference here: |
VarHandles were introduced in openjdk9, so the code needs to be conditionalized somehow. It is currently being developed on openjdk17. <armedbear#92>
VarHandles were introduced in openjdk9, so the code needs to be conditionalized somehow. It is currently being developed on openjdk17. <armedbear#92>
It would be great if ABCL offered support for CAS and other atomic operators in order to allow the implementation of lock-free datastructures and algorithms.
A variety of implementations already offer support for operations like
cas
,atomic-incf
,atomic-push
, andatomic-pop
. For instance, both ECL and SBCL follow the protocol described in the SBCL manual.I've accumulated the information for atomic operator support in a new portability library called Atomics. For ABCL to be supported, it would need to offer CAS on at least
svref
,car
,cdr
, and structure accessor places. Naturally it would be great if it offered more than that still, but those are the most fundamental.As for how to achieve this: since I don't know anything about ABCL internals I can't say too much, though Java itself offers support for CAS through
sun.misc.Unsafe
andjava.util.concurrent.atomic.*
.The text was updated successfully, but these errors were encountered: