JTransc + Android/iOS status support

soywiz via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 29 02:37:53 PST 2016


On Tuesday, 29 November 2016 at 09:09:40 UTC, Jacob Carlborg 
wrote:
> On 2016-11-29 02:09, soywiz wrote:
>
>> And for iOS it just supports an AOT approach except for 
>> javascript. So
>> it is great too.
>
> BTW, it's possible to interface Objective-C from D [1].
>
> [1] http://dlang.org/spec/objc_interface.html

@Jacob
Cool. So I can expect it to work on iOS Obj-C too right? Someone 
tried a wrapper using RAII to emulate partially (except for weak 
references) ARC?

On Tuesday, 29 November 2016 at 09:53:21 UTC, Joakim wrote:
> On Tuesday, 29 November 2016 at 08:49:22 UTC, soywiz wrote:
>> @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) :)
>
> Oh, nice to see an old user coming back. :)
>
>> 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!
>
> Most of my Android work has been merged, especially in 
> druntime/phobos upstream.  Last remaining portions are getting 
> ldc to use llvm's emulated TLS by registering that data 
> properly with the GC and finishing up Kai and Kinke's work to 
> get ldc to cross-compile reals properly 
> (https://github.com/ldc-developers/ldc/pull/1317).  Once those 
> two are done, it should be possible to provide official Android 
> builds from ldc master, both native and cross-compiling.
>
>> 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!
>
> No crashes if running on the command-line, which is easy to do 
> with the Termux app on any Android device:
>
> https://play.google.com/store/apps/details?id=com.termux&hl=en
>
> I'm seeing random crashes of apk builds, ie actual Android GUI 
> apps, even with source that hasn't changed at all and used to 
> work fine before.  That means there's been a regression 
> somewhere in the toolchain, got to figure out where.

Amazing! Right now all the generated code uses __gshared. In Java 
you have to use 
https://docs.oracle.com/javase/8/docs/api/java/lang/ThreadLocal.html to get TLS. And I didn't implemented it yet for multithreading. Because the initial jtransc design was to support all targets including javascript that doesn't support the traditional threading model, but one based on workers without sharing state at all. But I will try to implement multithreading soon for supported targets.

I used termux, but they do not support java/openjdk yet; so no 
gradle. Even when I'm able to transcompile jtransc itself so I 
could convert it to javascript and run it on node converting 
.class and .jar files into something else. But it is ideally used 
from gradle and compiling java/kt files into .class in the 
process. Also gradle really needs dynamic loading, so no AOT 
possible. It would be amazing if termux people support java.

What I can do is to generate the program.d file in my desktop and 
try D compiler on it.
But I have to investigate it a bit more.


More information about the Digitalmars-d mailing list