| Thread overview | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 09, 2015 NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
I'm looking at another potential opportunity to get D into the office, but the target's for this particular project are NaCL and/or Emscripten. I was gonna start hacking around to see what the limitations are with Emscripten on D code tonight. Has anyone done any serious investigation here? NaCl is a more useful target, but I think that will rely on a special build of LDC... has there been discussion about that before? Can any of the LDC guys chime in on the possibility? | ||||
January 09, 2015 Re: NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manu | On Friday, 9 January 2015 at 09:28:22 UTC, Manu via Digitalmars-d wrote:
> I was gonna start hacking around to see what the limitations are with
> Emscripten on D code tonight. Has anyone done any serious
> investigation here?
>
> NaCl is a more useful target, but I think that will rely on a special
> build of LDC... has there been discussion about that before?
I have read the standard on ASM.js and some on NaCl. I think you will run into trouble with the GC on both NaCl and ASM.js. If you don't target ASM.js, then you probably could a completely new backend for D that use the standard javascript collector and still get some of the benefits. Remember that only Firefox support ASM.js.
| |||
January 09, 2015 Re: NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad | On 9 January 2015 at 19:51, via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On Friday, 9 January 2015 at 09:28:22 UTC, Manu via Digitalmars-d wrote:
>>
>> I was gonna start hacking around to see what the limitations are with Emscripten on D code tonight. Has anyone done any serious investigation here?
>>
>> NaCl is a more useful target, but I think that will rely on a special build of LDC... has there been discussion about that before?
>
>
> I have read the standard on ASM.js and some on NaCl. I think you will run into trouble with the GC on both NaCl and ASM.js. If you don't target ASM.js, then you probably could a completely new backend for D that use the standard javascript collector and still get some of the benefits. Remember that only Firefox support ASM.js.
I can probably get by with @nogc. There's no threading in asm.js either, so that might be a spanner. Maybe -betterc would be usable out of the box...
| |||
January 09, 2015 Re: NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manu | On Friday, 9 January 2015 at 10:10:36 UTC, Manu via Digitalmars-d wrote: > I can probably get by with @nogc. There's no threading in asm.js > either, so that might be a spanner. You have worker threads, so you would have to use message passing, but I believe you can transfer "byte heaps" by reference between threads in a unique_ptr style (so only one thread can access it at the same time): https://developer.mozilla.org/en-US/docs/Web/API/Transferable Maybe it is possible to get the GC to work too, but it sounds like a lot of work for nothing IMO. | |||
January 09, 2015 Re: NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manu | >
> I can probably get by with @nogc. There's no threading in asm.js
> either, so that might be a spanner. Maybe -betterc would be usable out
> of the box...
You could compile your D code to LLVM IR using ldc2 --output-ll and feed that to emcc to see how far you get.
| |||
January 09, 2015 Re: NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manu | On Friday, 9 January 2015 at 09:28:22 UTC, Manu via Digitalmars-d wrote:
> I'm looking at another potential opportunity to get D into the office,
> but the target's for this particular project are NaCL and/or
> Emscripten.
>
> I was gonna start hacking around to see what the limitations are with
> Emscripten on D code tonight. Has anyone done any serious
> investigation here?
>
> NaCl is a more useful target, but I think that will rely on a special
> build of LDC... has there been discussion about that before? Can any
> of the LDC guys chime in on the possibility?
Both will need a special build of LDC, and runtime support. I know people made that work in the past, but I wouldn't expect the support to be great.
| |||
January 09, 2015 Re: NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manu | On 2015-01-09 10:28, Manu via Digitalmars-d wrote: > I'm looking at another potential opportunity to get D into the office, > but the target's for this particular project are NaCL and/or > Emscripten. > > I was gonna start hacking around to see what the limitations are with > Emscripten on D code tonight. Has anyone done any serious > investigation here? > > NaCl is a more useful target, but I think that will rely on a special > build of LDC... has there been discussion about that before? Can any > of the LDC guys chime in on the possibility? > Don't know if there's any interest but Adam D. Ruppe has hacked DMD to output JavaScript. You should be able to find it somewhere on the newsgroup. -- /Jacob Carlborg | |||
January 09, 2015 Re: NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Friday, 9 January 2015 at 12:46:41 UTC, Jacob Carlborg wrote: > On 2015-01-09 10:28, Manu via Digitalmars-d wrote: >> I'm looking at another potential opportunity to get D into the office, >> but the target's for this particular project are NaCL and/or >> Emscripten. >> >> I was gonna start hacking around to see what the limitations are with >> Emscripten on D code tonight. Has anyone done any serious >> investigation here? >> >> NaCl is a more useful target, but I think that will rely on a special >> build of LDC... has there been discussion about that before? Can any >> of the LDC guys chime in on the possibility? >> > > Don't know if there's any interest but Adam D. Ruppe has hacked DMD to output JavaScript. You should be able to find it somewhere on the newsgroup. guess you're talking about dtojs: https://github.com/adamdruppe/dtojs. | |||
January 09, 2015 Re: NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Mengu | On Friday, 9 January 2015 at 15:27:08 UTC, Mengu wrote:
>> Don't know if there's any interest but Adam D. Ruppe has hacked DMD to output JavaScript. You should be able to find it somewhere on the newsgroup.
>
> guess you're talking about dtojs: https://github.com/adamdruppe/dtojs.
I haven't updated that for a long time though, it probably won't work at all anymore and it was never really production ready. I wouldn't try it on a professional job.
| |||
January 10, 2015 Re: NaCl/Emscripten | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Manu | There are also other compilers from C++ to Javascript, Mandreel and Cheerp. Cheerp claims to support the builtin Javascript garbage collector: «Dynamic memory management. C++ objects are translated directly to JS objects, without the proxy of an emulated, flat memory space. Allow your applications to exploit the JavaScript VM garbage collector and co-exist with fair, on-demand memory allocation.» http://www.leaningtech.com/cheerp/blog/ So if Cheerp is ready for production (I don't know if it is), it might be a better fit for D. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply