Skip to content
This repository has been archived by the owner on Dec 10, 2022. It is now read-only.

Implement memory effects of volatiles #263

Open
intrigus opened this issue Aug 23, 2017 · 6 comments
Open

Implement memory effects of volatiles #263

intrigus opened this issue Aug 23, 2017 · 6 comments
Assignees

Comments

@intrigus
Copy link
Contributor

volatiles have certain memory effects when being read or when being written to.
For this we have to use some low-level stuff to implement the needed memory barriers.

See

@intrigus intrigus self-assigned this Aug 23, 2017
@intrigus intrigus added the cpp label Aug 23, 2017
@soywiz
Copy link
Member

soywiz commented Aug 23, 2017

What about replacing field access by a couple of synthetic synchronized methods getter/setter and implement it as a programfeature for targets that do not implement volatile in a more performant way?

@intrigus
Copy link
Contributor Author

To be honest I don't really care about haxe or other targets. (Except maybe C# and c++)
That's why I'm not sure whether haxe does support synchronized.
It may be theoretically possible to replace volatile with synchronized but there are other parts of the Java Memory Model which have certain memory effects, e.g. writing to a final field.

So I'd like to ask how you intend to implement synchronized for the haxe target?
I don't want to be negative but I don't think that haxe can implement this part of the JMM or the JMM at all.

@soywiz
Copy link
Member

soywiz commented Aug 23, 2017

The most basic primitive is the enter/exit monitor. The idea is to provide those two functions in N native class and use defines to chose the right implementation (when suitable). Javascript for example doesnt require it. But c++ can use it.
http://api.haxe.org/cpp/vm/Mutex.html
Until C++ target is mature (for example tools to target ios and or android native), we need to use Haxe/C++ for it.
For me, the most important targets are Js, C++ and C# and the usefulness of other targets are to be able to run java libraries in other languages.

@ghost
Copy link

ghost commented Aug 23, 2017

For me not general language, for me need iOs, tvOS, windows native, Android, we spend 6 mouths and after 1 months we will be release... And we can not spend time for non Haxecpp targets, and very very need sync in jtransc. Thanks.

@intrigus
Copy link
Contributor Author

What do you mean with "tools to target ios and or android native"?
Which tools do you think are needed to mature the cpp target?

@soywiz
Copy link
Member

soywiz commented Aug 24, 2017

Yep thats why i want to support haxe target too. Until all that effort is backported we need to support haxe too. But even later i dont see problems supporting haxe too. Libgdx+libs like payments working on those platforms without modified code, providing app icons, one command for deploying... Those things. After implementing these required things + full java8 support i can help with toolchains to get the same experience with pure c++ target which should be supperior in runtime performance, compilation time and executable size. And if we can run original libgdx unmodified that would be even better! But it will take some months to achieve that and Sergey doesnt have that time for his release

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants