JTransc + Android/iOS status support
soywiz via Digitalmars-d
digitalmars-d at puremagic.com
Tue Nov 29 00:49:22 PST 2016
@Jacob:
You can just download this:
https://github.com/jtransc/jtransc-examples/tree/master/hello-world
execute `./gradlew runD` or `./gradlew distD` and check the
`build/jtransc-d/program.d` file (about 500kb program.d file with
treeshaking enabled).
Right now it generates classes like `class java_lang_String`, and
method names like `toString__Ljava_lang_String_` (that's because
at the JVM level you can have name overloading with all the same
argument types but a different return type, which is not
supported by D). I could get rid of the names in most cases, but
not optimized yet.
Also it uses gotos, except for functions with exception handlers
where I'm using while+switch to be able to goto try blocks easily.
Also parameter and local variable names are lost and there are
way too many casts, which makes performance be pretty bad right
now.
My objective was to create a working target right now. And later
optimize.
JTransc is divided into two parts: `JVM byte code -> AST` and
`AST -> Other targets`. So when optimizing the first one, all
other targets will benefit.
This will happen before jtransc 1.0 (right now I'm on 0.5.0):
I have to create a SSA form to remove casts. And I can use debug
information to restore local and parameter names. With relooper I
can convert those gotos into proper structures, though for C++
and D targets it is not so important because they have goto and
performance is good enough.
You can convert between `java.lang.String` and D's `wstring` with
`N.str` and `N.istr`.
---------
@Joakim:
Regarding to D. Yep I think I'm in the right place :) I started
using D1 something almost 10 years ago and ended doing this:
https://github.com/soywiz/pspemu
My main concerns by then were: lack of IDE support for major
refactorings and productivity + compilation times (because I was
doing a lot of metaprogramming that affected every compilation).
But I liked D a lot and knew about its strong points.
Moved from D to C#, then returned to AS3 and right now I'm mostly
programming in Kotlin, which is the most productive language I
have ever used (because of the sugar + the awesome IDE support) :)
-
Yeah, I know that ART is an AOT. But Android is so fragmented
that there are still a lot of people with android 4.x using
Dalvik. Also not sure if ART supports simd optimizations. So
probably you cannot leverage that without going native.
It is great to know that some effort has already been merged.
Keep up the good work!
-
I will try it expecting random crashes and will stay tuned for
updates. But as long as not crashes always, I can still validate
it. Thanks!
More information about the Digitalmars-d
mailing list