graal + node.js: how does it work?

Jan Stola jan.stola at oracle.com
Tue Dec 19 09:42:28 UTC 2017


Hi Adam,

thanks for your interest in graal-node.js. Node.js embeds V8 JavaScript 
engine by default. It accesses it through its API (represented by v8.h 
mainly). We keep all the native code of the original Node.js (almost) 
intact. We just replace V8 engine by our JavaScript engine (Graal.js). 
We do that by providing an implementation of the native V8 API. Our 
implementation of this API delegates to the corresponding Graal.js 
calls. So, the native Node.js code "thinks" that it uses V8 still but it 
is using Graal.js instead.

Honza


On 19.12.2017 4:55, Adam McMahon wrote:
> Hi,
>
> I am interested in learning more about graal + node.js, and I am wondering
> how node.js is integrated into graal/jvm?
>
> Can you let me know if the following is about correct?
>
> [1] Node.js core was re-written from c++ to java (this seems to be the old
> avatar project??)
> [2] Graal.js calls into the java implementation of node for the JVM.
>
> Does the above sound correct?
>
> I am interested in how node code can run well on the JVM.  I have a partial
> implementation that I wrote of node.js modules that are a thin JS wrapper
> on top of vert.x Javasscript. This approach has worked well for me (still
> in early stages), but I was interested on you all have implemented node.js
>
> Best,
>
> -Adam
>



More information about the graal-dev mailing list