Giter Club home page Giter Club logo

oracle / graaljs Goto Github PK

View Code? Open in Web Editor NEW
1.6K 63.0 181.0 853 MB

A ECMAScript 2023 compliant JavaScript implementation built on GraalVM. With polyglot language interoperability support. Running Node.js applications!

License: Universal Permissive License v1.0

Python 1.98% Java 3.95% JavaScript 12.49% Shell 0.27% Makefile 0.12% R 0.01% HTML 0.34% C++ 27.93% C 23.12% Perl 16.52% CMake 0.03% Batchfile 0.02% CSS 0.01% Roff 0.21% Assembly 12.96% DIGITAL Command Language 0.01% M4 0.06% eC 0.01% Emacs Lisp 0.01% Scheme 0.01%
graalvm javascript nodejs java

graaljs's People

Contributors

addaleax avatar aduh95 avatar bnoordhuis avatar bridgear avatar cjihrig avatar danbev avatar eleinadani avatar iamstolis avatar indutny avatar isaacs avatar jasnell avatar joyeecheung avatar lpinca avatar mhdawson avatar mscdex avatar mylesborins avatar nodejs-github-bot avatar piscisaureus avatar refack avatar richardlau avatar ronag avatar rvagg avatar ry avatar sam-github avatar targos avatar tniessen avatar trott avatar vsemozhetbyt avatar wirthi avatar woess avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graaljs's Issues

Question: unexpected behavior of Object.prototype.hasOwnProperty and ProxyObject

Hello, I am new to GraalVM

Is there a documentation about how certain functions, such as Object.prototype.hasOwnProperty, behaves interoperating with ProxyObjects? E.g.

Map<String, Object> map = new HashMap<>();
map.put("foo", "bar");
ProxyObject p = ProxyObject.fromMap(map);
ctx.eval("js", "x => Object.prototype.hasOwnProperty.call(x, 'foo')").execute(p).asBoolean();

would yield always false, while in the case of a class extending ProxyObject and override its methods, always true

EDIT: My observation above turned out to be wrong. This will always return true, as in the case of any ProxyObject. This has been confirmed below by (at)wirthi

Document Java.Worker

When looking at:

https://github.com/graalvm/graal-js-archetype/blob/master/archetype/src/main/resources/archetype-resources/src/main/js/launcher.js#L52

You'll see:

var executor = new Java.Worker();

And that it looks be allow scheduling tasks on the engine thread using a single thread executor.

This is an alternative to spawning threads but it is not documented, from the code, it looks that the executor has a method submit that returns a Promise but it is not totally clear what inputs it take.

Further analysis of the node wrapper, it seems that it can replace the Worker factory with a custom executor, so it feels like this could be overloaded also by other projects namely vert.x to match the threading model.

Finally is this Worker used internally? if overloaded what are the side effects?

These answers should be documented somewhere...

Crash of GraalJS testing tail call optimization

Spec: http://www.ecma-international.org/ecma-262/6.0/#sec-tail-position-calls

Reproducer (from the kangax table test suit):

var evalcode = "(function test() {\n        \"use strict\";\n        return (function f(n){\n          if (n <= 0) {\n            return  \"foo\";\n          }\n          return f(n - 1);\n        }(1e6)) === \"foo\";\n      })();";
try {
    var res = eval(evalcode);
    if (res !== true && res !== 1) { throw new Error("failed: " + res); }
    print("[SUCCESS]");
} catch (e) {
    print("[FAILURE] " + e);
    /*throw e;*/
}

Results into:

java.lang.LinkageError: com/oracle/truffle/api/TruffleStackTrace$1
        at com.oracle.truffle.api.TruffleStackTrace.addStackFrames(TruffleStackTrace.java:322)
        at com.oracle.truffle.api.TruffleStackTrace.fillIn(TruffleStackTrace.java:202)
        at com.oracle.truffle.api.TruffleStackTrace.find(TruffleStackTrace.java:100)
        at com.oracle.truffle.api.TruffleStackTraceElement.getStackTrace(TruffleStackTraceElement.java:94)
        at com.oracle.truffle.api.vm.PolyglotExceptionImpl.<init>(PolyglotExceptionImpl.java:94)
        at com.oracle.truffle.api.vm.PolyglotExceptionImpl.<init>(PolyglotExceptionImpl.java:80)
        at com.oracle.truffle.api.vm.PolyglotImpl.wrapGuestException(PolyglotImpl.java:275)
        at com.oracle.truffle.api.vm.PolyglotContextImpl.eval(PolyglotContextImpl.java:753)
        at org.graalvm.polyglot.Context.eval(Context.java:311)
        at com.oracle.truffle.js.shell.JSLauncher.executeScripts(JSLauncher.java:333)
        at com.oracle.truffle.js.shell.JSLauncher.launch(JSLauncher.java:80)
        at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:107)
        at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:54)
        at com.oracle.truffle.js.shell.JSLauncher.main(JSLauncher.java:70)

Expected:

Either a SUCCESS or FAILURE message.

Run command:

graalvm/bin/js --jvm jstest.js

Support for instanceof of ProxyInstantiable

I'm exposing a "type object" that implements ProxyInstantiable. I wan't to be able to check if the instance returned from newInstance is actually an instance of the type object.

Here's my code:

public class MainType {
    public static void main(String[] args) {
        Context context = Context.create("js");

        context.getBindings("js").putMember("MyType", new TypeLike());

        String src = "var instance = new MyType();\n" +
                "print(instance instanceof MyType);";
        context.eval("js", src);
    }

    public static class TypeLike implements ProxyInstantiable {
        @Override
        public Object newInstance(Value... arguments) {
            return new InstanceLike();
        }
    }

    public static class InstanceLike implements ProxyObject {

        @Override
        public Object getMember(String key) {
            return null;
        }

        @Override
        public Object getMemberKeys() {
            return new String[0];
        }

        @Override
        public boolean hasMember(String key) {
            return false;
        }

        @Override
        public void putMember(String key, Value value) {

        }
    }
}

It prints:

Exception in thread "main" TypeError: Right-hand-side of instanceof is not an object
	at <js> :program(Unnamed:2:35-60)
	at org.graalvm.polyglot.Context.eval(Context.java:336)
	at com.programmaticallyspeaking.gho.MainType.main(MainType.java:16)

I also tried to implement ProxyObject on the host type class, but I get the same result.

When a Java method is passed a JavaScript lambda, should resolve to a Java overload with a SAM interface

The RxJava 1.x subscribe method is overloaded like this

public Subscription subscribe(Action1 onNext);
public Subscription subscribe(Observer observer);

where Action1 is a SAM interface with a single method intended for lambdas, and Observer is an interface with 3 methods.

I cannot call subscribe due to this error:

TypeError: INVOKE on JavaObject[rx.Observable@66c38e51 (rx.Observable)] failed due to: java.lang.IllegalArgumentException: Multiple applicable overloads found for method name subscribe (candidates: [Method[public final rx.Subscription rx.Observable.subscribe(rx.functions.Action1)], Method[public final rx.Subscription rx.Observable.subscribe(rx.Observer)]], arguments: [DynamicObject@6e33fcae (b)])

It seems like there's an intuitive resolution here.

JavaScript can't see Java properties/functions

Hey,
I'm playing around with GraalVM/Graaljs and I stumbled upon an issue. Snippet first:

class Application {
    public static void main(String[] args) {
        String script = "console.log(phone.number)";
        String script2 = "phone.call('Somebody')";
        Phone phone = new Phone();

        Context context = Context.create("js");
        context.getBindings("js").putMember("phone", phone);

        runScript(script, context);
        runScript(script2, context);
    }
    private static Value runScript(String script, Context context) {
        return context.eval("js", script);
    }
}
class Phone {
    public int number = 123;
    public void call(String name) {
        System.out.println("Calling...: " + name);
    }
}

When I execute the main method, that's what I'm getting:
image

In my pom.xml, there's graal-sdk included.

ArrayStoreException for delegating object/function proxy

In my Nashorn application, I have a piece of code that accepts a JavaScript function that comes from Jasmine (it's a spy function). The code creates a wrapper that delegates function execution as well as member access. The purpose is to process the return value of the spy function so that it mimics the "real world".

While converting this code to GraalJS, I ran into a problem - I get ArrayStoreException. I have created a minimal example that reproduces the problem.

My delegating function looks like this:

public class DelegatingFunction implements ProxyObject, ProxyExecutable {
    private final Value delegee;

    public DelegatingFunction(Value delegee) {
        this.delegee = delegee;
    }

    public Object execute(Value... arguments) {
        return delegee.execute(arguments);
    }

    public Object getMember(String key) {
        return delegee.getMember(key);
    }

    public Object getMemberKeys() {
        return delegee.getMemberKeys();
    }

    public boolean hasMember(String key) {
        return delegee.hasMember(key);
    }

    public void putMember(String key, Value value) {
        delegee.putMember(key, value);
    }

    public boolean removeMember(String key) {
        return delegee.removeMember(key);
    }
}

(It delegates member access since the spy function has identification properties.)

And my test code looks like this:

public class DelegatingFunctionTest {
    public static void main(String[] args) {
        Context context = Context.create("js");
        Value bindings = context.getBindings("js");


        bindings.putMember("main", new DelegatingFunctionTest());

        String src = "var original = function (arg) { print(arg); };\n" +
                "var wrapper = main.wrap(original);\n" +
                "wrapper('test');";
        context.eval("js", src);
    }

    public Object wrap(Value function) {
        assert function.canExecute() : "Not a function";
        return new DelegatingFunction(function);
    }
}

The error I get is:

Exception in thread "main" org.graalvm.polyglot.PolyglotException: java.lang.ArrayStoreException: java.lang.String
	at com.oracle.truffle.api.vm.PolyglotLanguageContext$ToGuestValuesNode.fastToGuestValuesUnroll(PolyglotLanguageContext.java:479)
	at com.oracle.truffle.api.vm.PolyglotLanguageContext$ToGuestValuesNode.apply(PolyglotLanguageContext.java:450)
	at com.oracle.truffle.api.vm.PolyglotValue$Interop$AbstractExecuteNode.executeShared(PolyglotValue.java:2166)
	at com.oracle.truffle.api.vm.PolyglotValue$Interop$ExecuteNode.executeImpl(PolyglotValue.java:2248)
	at com.oracle.truffle.api.vm.PolyglotValue$PolyglotNode.execute(PolyglotValue.java:551)
	at org.graalvm.polyglot.Value.execute(Value.java:312)
	at com.programmaticallyspeaking.gho.DelegatingFunction.execute(DelegatingFunction.java:16)
	at <js> :program(Unnamed:3:82-96)
	at org.graalvm.polyglot.Context.eval(Context.java:336)
	at com.programmaticallyspeaking.gho.DelegatingFunctionTest.main(DelegatingFunctionTest.java:17)
Original Internal Error: 
java.lang.ArrayStoreException: java.lang.String
	at com.oracle.truffle.api.vm.PolyglotLanguageContext$ToGuestValuesNode.fastToGuestValuesUnroll(PolyglotLanguageContext.java:479)
	at com.oracle.truffle.api.vm.PolyglotLanguageContext$ToGuestValuesNode.apply(PolyglotLanguageContext.java:450)
	at com.oracle.truffle.api.vm.PolyglotValue$Interop$AbstractExecuteNode.executeShared(PolyglotValue.java:2166)
	at com.oracle.truffle.api.vm.PolyglotValue$Interop$ExecuteNode.executeImpl(PolyglotValue.java:2248)
	at com.oracle.truffle.api.vm.PolyglotValue$PolyglotNode.execute(PolyglotValue.java:551)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:262)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:251)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:241)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:226)
	at org.graalvm.compiler.truffle.runtime.GraalTVMCI.callProfiled(GraalTVMCI.java:86)
	at com.oracle.truffle.api.impl.Accessor.callProfiled(Accessor.java:724)
	at com.oracle.truffle.api.vm.VMAccessor.callProfiled(VMAccessor.java:93)
	at com.oracle.truffle.api.vm.PolyglotValue$Interop.execute(PolyglotValue.java:1410)
	at org.graalvm.polyglot.Value.execute(Value.java:312)
	at com.programmaticallyspeaking.gho.DelegatingFunction.execute(DelegatingFunction.java:16)
	at com.oracle.truffle.api.vm.PolyglotProxy$ProxyExecuteNode.executeProxy(PolyglotProxy.java:137)
	at com.oracle.truffle.api.vm.PolyglotProxy$ProxyRootNode.execute(PolyglotProxy.java:96)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:262)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:251)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:241)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:226)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:209)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.api.interop.InteropAccessNode.doCached(InteropAccessNode.java:186)
	at com.oracle.truffle.api.interop.InteropAccessNodeGen.executeAndSpecialize(InteropAccessNodeGen.java:82)
	at com.oracle.truffle.api.interop.InteropAccessNodeGen.executeImpl(InteropAccessNodeGen.java:45)
	at com.oracle.truffle.api.interop.InteropAccessNode.execute(InteropAccessNode.java:67)
	at com.oracle.truffle.api.interop.ForeignAccess.sendExecute(ForeignAccess.java:420)
	at com.oracle.truffle.js.runtime.truffleinterop.JSInteropNodeUtil.call(JSInteropNodeUtil.java:254)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$ForeignExecuteNode.executeCallImpl(JSFunctionCallNode.java:1043)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$ForeignExecuteNode.executeCall(JSFunctionCallNode.java:1035)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:665)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:699)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CallNode.execute(JSFunctionCallNode.java:255)
	at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.execute_generic3(JSWriteCurrentFrameSlotNodeGen.java:149)
	at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.execute(JSWriteCurrentFrameSlotNodeGen.java:84)
	at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.executeVoid(JSWriteCurrentFrameSlotNodeGen.java:281)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:68)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:262)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:251)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:241)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:226)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:209)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.parser.JavaScriptLanguage$1.execute(JavaScriptLanguage.java:211)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:262)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:251)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:241)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:226)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.call(OptimizedCallTarget.java:202)
	at com.oracle.truffle.api.vm.PolyglotContextImpl.eval(PolyglotContextImpl.java:746)
	at org.graalvm.polyglot.Context.eval(Context.java:311)
	at org.graalvm.polyglot.Context.eval(Context.java:336)
	at com.programmaticallyspeaking.gho.DelegatingFunctionTest.main(DelegatingFunctionTest.java:17)
Caused by: Attached Guest Language Frames (4)

What am I doing wrong?

Dealing with host exceptions

I'm having some trouble with host exceptions. Consider the following code:

public class MainEx {
    public static void main(String[] args) {
        Context context = Context.create("js");

        context.getBindings("js").putMember("evil", new Evil());

        String src = "try {\n" +
                "  evil.callMe();\n" +
                "} catch (e) {\n" +
                "  print(e);\n" +
                "  print(e.message);\n" +
                "  print(e.stack);\n" +
                "}";
        context.eval("js", src);
    }

    public static class Evil {
        public void callMe() {
            throw new RuntimeException("boo");
        }
    }
}

It prints:

com.oracle.truffle.api.vm.HostException: boo
undefined
undefined

The problem is that a test framework like Jasmine (and I suppose any other JavaScript code that catches exceptions) tries to access the properties message and stack.

In Nashorn this wasn't a problem, because I could wrap a host exception (I'm in control of nearly all calls from JavaScript) in a custom exception with a getStack method, and getMessage is of course already there. Due to Nashorn's bean-property-access convention, this worked well.

How should I make Graal host exceptions JavaScript compatible?

Cannot pass proxy function to Array.prototype.map.call

I have the following code:

public class ProxyFun {

    public static void main(String[] args) {
        Context context = Context.create("js");

        Value callFun = context.eval("js", "Array.prototype.map.call.bind(Array.prototype.map)");
        Value theArray = context.eval("js", "[1,2]");

        Object proxyFun = new FunctionThatReturns("testing");

        Value result = callFun.execute(theArray, proxyFun);
        System.out.println(result);
    }

    static class FunctionThatReturns implements ProxyExecutable {
        private final Object value;

        FunctionThatReturns(Object value) {
            this.value = value;
        }

        @Override
        public Object execute(Value... arguments) {
            return value;
        }
    }
}

I expect my proxy function to be called for each item and thus produce new array items. Instead I get:

Exception in thread "main" TypeError: com.oracle.truffle.api.vm.PolyglotProxy$EngineProxy@6d763516 is not a function
	at org.graalvm.polyglot.Value.execute(Value.java:312)
	at ProxyFun.main(ProxyFun.java:30)

Unable to run threads in node.js using --jvm integration.

The following code fails because I am pretending to execute code on a separated thread:
executor-node-graal
NOTE: I use Nashorn interoperability here.

Although I understand the single-threaded nature of node applications, I would like to know if there is any way to run several Java threads with in the node.js context? Meaning: bypass the single threaded limitation?

Thanks in advance,
Rolando

Arrays passed to JS using ProxyArray do not mimic JS arrays

I have a Java host application that is executing JS scripts as guest using the Polyglot API. I would like to pass Java arrays (ArrayList) to the JS side and treat the array on the JS side as if it was a "native" JS array. As suggested in this SOF post:
https://stackoverflow.com/questions/51707039/injected-members-from-the-host-language-to-arrive-to-guest-language-as-guest-lan
I am using ProxyArray to achieve that. Specifically, I am using ProxyArray.fromArray() to pass the Java ArrayList to the JS side using bindings:

Value guestLanguageBindings = context.getBindings("js"); guestLanguageBindings.putMember("arrParamName", ProxyArray.fromArray(arrayArg));

However in the JS side (guest language) the array is not seen as a JS array, instead it is of type: org.graalvm.polyglot.proxy.ProxyArray (also a Java type). This prevents me from being able to use the array as if it were a regular JS array. Statements like arr[0] work, however specific calls such as arr.sort() fail.

The screenshot below illustrate a debugging session where variable is passed as described above with the resulting error.

screen shot 2018-08-20 at 18 17 05

Threads

Hi,

Dose this also offer support for threading as Nashorn ?

How to identify global as Value

This issue is similar to #34, but the object in question is the global object.

Again, my test method looks like this:

public void acceptValue(Value v) {
    System.out.println("value = " + v);
    System.out.println("meta = " + v.getMetaObject());
    System.out.println("meta:type = " + v.getMetaObject().getMember("type"));
    System.out.println("meta:className = " + v.getMetaObject().getMember("className"));
    System.out.println("meta:description = " + v.getMetaObject().getMember("description"));
}

And I'm calling it like this:

context.eval("js", "main.acceptValue(this);");

This is the printout:

value = global {global: {...}, Object: {...}, Function: {...}, Array: {...}, ...
meta = Object
meta:type = object
meta:className = Object
meta:description = global {global: {...}, Object: {...}, Function: {...}, Array: {...}, ...

My current solution is checking that description starts with "global {". It feels like a hack though.

Is there a better solution?

Cannot Java.extend non-bootclasspath classes

This was reported back in February on https://stackoverflow.com/questions/48728080/graalvm-nashorn-cannot-extend-classes but I couldn't find a reference here and I'm hitting it in rc5, so here goes:

$ mkdir -p org/example
$ echo "package org.example; public interface Example {}" > org/example/Example.java
$ javac org/example/Example.java
$ js --jvm --jvm.classpath=.
> Graal
{language: "JavaScript", versionJS: "1.0", versionGraalVM: "1.0.0-rc5", isGraalRuntime: true}
> Java.extend(org.example.Example)
TypeError: Could not determine a class loader with access to the JS engine and interface org.example.Example
	at <js> :program(<shell>:2:1:0-31)

As mentioned in https://stackoverflow.com/questions/48728080, adding the class to be extended to the boot class path works around the issue:

$ js --jvm --jvm.Xbootclasspath/a:.
> Java.extend(org.example.Example)
JavaClass[org.example.Example$$JSJavaAdapter]

Source name for "new Function( ... )"

In nodeprof, we've noticed that the source name for the code created from the 'new Function (...)' is <function> while the source name for 'eval(...)' is something like eval at :anonymous (xxxx:21:1). The latter one has extra useful information for profiling tools about the enclosing file and the detailed line column numbers where the code is dynamically evaluated.

The question is: is it possible to have similar information for the source created from 'new Function(...)'?

A related issue is that the stack trace printed inside the 'new Function(...)' will be different from v8.
This can be reproduced (with the latest graal.js version available 020e88a) for the code below:

var f = new Function("var a = 1; console.log((new Error()).stack);");
f();

v8 output:

$ node reproduce.js 
Error
=>  at eval (eval at <anonymous> (xxx/reproduce.js:1:71), <anonymous>:3:25)
    at Object.<anonymous> (xxx/reproduce.js:2:1)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:238:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

graal.js output:

$ mx node reproduce.js
Error
=>  at eval (<function>:2:25)
    at Object.<anonymous> (xxx/reproduce.js:2:1)
    at Module._compile (module.js:652:30)
    at Object.<anonymous> (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function._load (module.js:497:3)
    at Function.runMain (module.js:693:10)
    at startup (bootstrap_node.js:12:3)
    at bootstrap_node.js:10:2

The different line is highlighted with =>

env.parseInline() causes NPE

I am trying to inline-parse "this" which causes the following exception (current.function() returns null, because current is an instance of DebugEnvironment):

Caused by: java.lang.NullPointerException
	at com.oracle.truffle.js.parser.env.Environment.createReadLocalVarNodeFromSlot(Environment.java:386)
	at com.oracle.truffle.js.parser.env.Environment.access$0(Environment.java:384)
	at com.oracle.truffle.js.parser.env.Environment$FrameSlotVarRef.createReadNode(Environment.java:637)
	at com.oracle.truffle.js.parser.GraalJSTranslator.createThisNode(GraalJSTranslator.java:1507)
	at com.oracle.truffle.js.parser.GraalJSTranslator.enterIdentNode(GraalJSTranslator.java:1477)
	at com.oracle.truffle.js.parser.JavaScriptTranslator.enterIdentNode(JavaScriptTranslator.java:1)
	at com.oracle.truffle.js.parser.GraalJSTranslator.enterIdentNode(GraalJSTranslator.java:1)
	at com.oracle.js.parser.ir.IdentNode.accept(IdentNode.java:92)
	at com.oracle.truffle.js.parser.GraalJSTranslator.transform(GraalJSTranslator.java:201)
	at com.oracle.truffle.js.parser.GraalJSTranslator.translateExpression(GraalJSTranslator.java:250)
	at com.oracle.truffle.js.parser.JavaScriptTranslator.translateExpression(JavaScriptTranslator.java:99)
	at com.oracle.truffle.js.parser.GraalJSEvaluator.parseInlineExpression(GraalJSEvaluator.java:177)
	at com.oracle.truffle.js.parser.JavaScriptLanguage.parseInline(JavaScriptLanguage.java:360)
	at com.oracle.truffle.js.parser.JavaScriptLanguage$2.<init>(JavaScriptLanguage.java:234)
	at com.oracle.truffle.js.parser.JavaScriptLanguage.parse(JavaScriptLanguage.java:233)
	at com.oracle.truffle.api.TruffleLanguage$InlineParsingRequest.parse(TruffleLanguage.java:710)
	at com.oracle.truffle.api.TruffleLanguage.parseInline(TruffleLanguage.java:1115)
	at com.oracle.truffle.api.TruffleLanguage$LanguageImpl.parseInline(TruffleLanguage.java:2115)
	at com.oracle.truffle.api.instrumentation.TruffleInstrument$Env.parseInline(TruffleInstrument.java:377)
	at de.hpi.swa.trufflelsp.InlineEvaluationEventFactory$1.onEnter(InlineEvaluationEventFactory.java:29)
	at com.oracle.truffle.api.instrumentation.ProbeNode$EventProviderChainNode.innerOnEnter(ProbeNode.java:1431)
	at com.oracle.truffle.api.instrumentation.ProbeNode$EventChainNode.onEnter(ProbeNode.java:880)

The triggering code snippet inside an ExcutionEventNode.onEnter(EventContext) call is:

Source source = Source.newBuilder(code).name("eval inline").language(info.getId()).mimeType("content/unknown").build();
ExecutableNode fragment = env.parseInline(source, eventContext.getInstrumentedNode(), frame.materialize());

With code = 'this'

I am using the code-base from master 020e88a .

Extending Java classes from JavaScript code

I'm interested to learn how to extend Java classes/interfaces with graal.js.
I know of the "nashorn way" to extend Java classes/interfaces, which is using either the new operator or to use Java.extend, but I'm not sure how this can be achieved in graal.js without the nashorn compatibility mode?

java.lang.IllegalArgumentException: The frame slot '0' is not known by the frame descriptor.

The exception occurs in the following code, since rc2.
To reproduce it's essential to

  • create a new Context from the same Engine. When creating contexts with Context.create("js") (and a new engine is used each time) there's no error.
  • context must be closed after use; if not closed there's no error
  • javascript contains a const; for a var there's no error

The error occurs on the 2nd iteration.

import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Engine;

public class Bug {

  public static void main(String[] args) throws Exception {

    String snippet = "const x=1";

    Engine engine = Engine.create();
    Context context;

    for (int i = 0; i < 2; i++) {
      context = Context.newBuilder("js").engine(engine).build();
      context.eval("js", snippet);
      context.close();
      System.out.println("ok");
    }
  }
}

Result of running the class:

hans@ubuntu-desktop:~/graal$ java Bug
ok
Exception in thread "main" org.graalvm.polyglot.PolyglotException: java.lang.IllegalArgumentException: The frame slot '0' is not known by the frame descriptor.
at org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing.checkSlotIndex(FrameWithoutBoxing.java:297)
at org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing.verifySet(FrameWithoutBoxing.java:280)
at org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing.setObject(FrameWithoutBoxing.java:122)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNode.doObject(JSWriteFrameSlotNode.java:138)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNodeGen.executeAndSpecialize(JSWriteScopeFrameSlotNodeGen.java:366)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNodeGen.execute_generic3(JSWriteScopeFrameSlotNodeGen.java:195)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNodeGen.execute(JSWriteScopeFrameSlotNodeGen.java:88)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNodeGen.executeVoid(JSWriteScopeFrameSlotNodeGen.java:294)
at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:68)
at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
at :program(Unknown)
at org.graalvm.polyglot.Context.eval(Context.java:336)
at Bug.main(Bug.java:15)
Original Internal Error:
java.lang.IllegalArgumentException: The frame slot '0' is not known by the frame descriptor.
at org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing.checkSlotIndex(FrameWithoutBoxing.java:297)
at org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing.verifySet(FrameWithoutBoxing.java:280)
at org.graalvm.compiler.truffle.runtime.FrameWithoutBoxing.setObject(FrameWithoutBoxing.java:122)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNode.doObject(JSWriteFrameSlotNode.java:138)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNodeGen.executeAndSpecialize(JSWriteScopeFrameSlotNodeGen.java:366)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNodeGen.execute_generic3(JSWriteScopeFrameSlotNodeGen.java:195)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNodeGen.execute(JSWriteScopeFrameSlotNodeGen.java:88)
at com.oracle.truffle.js.nodes.access.JSWriteScopeFrameSlotNodeGen.executeVoid(JSWriteScopeFrameSlotNodeGen.java:294)
at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:68)
at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:262)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:251)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:241)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:226)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:209)
at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
at com.oracle.truffle.js.parser.JavaScriptLanguage$1.execute(JavaScriptLanguage.java:211)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:262)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:251)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:241)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:226)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.call(OptimizedCallTarget.java:202)
at com.oracle.truffle.api.vm.PolyglotContextImpl.eval(PolyglotContextImpl.java:746)
at org.graalvm.polyglot.Context.eval(Context.java:311)
at org.graalvm.polyglot.Context.eval(Context.java:336)
at Bug.main(Bug.java:15)
Caused by: Attached Guest Language Frames (2)

Use proxy for global bindings?

In Nashorn, I can set the global bindings of the ScriptEngine to a custom Bindings implementation that performs special lookup of unknown variables that otherwise would result in ReferenceError. This allows me to use "dynamic globals" in JS code.

In GraalJS, I'm not allowed to set the global bindings. I tried the following instead (Scala code):

  private[graal] def enableFreeVariableSupport(context: Context, bindings: Value): Unit = {
    bindings.putMember("__fvl", new FreeVariableLookupBridge)
    context.eval("js",
      """
        |this.__noSuchProperty__ = function (name) {
        |  var result = __fvl.lookup(name);
        |  if (result === null) throw new ReferenceError('"' + name + '" is not defined');
        |  return result;
        |};
      """.stripMargin)
  }

However, the problem is that __noSuchProperty__ is called also for a typeof expression, so both of these expressions throw an error for a truly unknown variable:

trulyUnknown
typeof trulyUnknown

...whereas I would expect the latter to return undefined. This could be solved if __noSuchProperty__ was called with an extra contextual argument, but there is no such thing.

Is it possible to achieve what I want in GraalJs? One possibility would be to allow setting the bindings to a ProxyObject.

ScriptEngine behaviour is non-standard and different to Nashorn

As per the Java Scripting API docs (https://docs.oracle.com/javase/7/docs/api/javax/script/ScriptContext.html) a ScriptEngine should honour the Scope of a Binding:

ENGINE_SCOPE: EngineScope attributes are visible during the lifetime of a single ScriptEngine and a set of attributes is maintained for each engine.
GLOBAL_SCOPE: GlobalScope attributes are visible to all engines created by same ScriptEngineFactory.

So I expect that an attribute set with a Global scope should be accessible to all engines from the same ScriptEngine, this does not appear to be the behaviour in graaljs though.

GraalJS code that fails:

        ScriptEngine eng = new ScriptEngineManager().getEngineByName("graal.js");
        eng.getBindings(ScriptContext.GLOBAL_SCOPE).put("globalThing", "asdf");
        Object globalResult = eng.eval("globalThing", eng.getBindings(ScriptContext.GLOBAL_SCOPE));
        Object engineResult = eng.eval("globalThing", eng.getBindings(ScriptContext.ENGINE_SCOPE));

with:

Exception in thread "main" javax.script.ScriptException: org.graalvm.polyglot.PolyglotException: ReferenceError: globalThing is not defined
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:199)
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:176)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
	at Main.main(Main.java:15)
Caused by: org.graalvm.polyglot.PolyglotException: ReferenceError: globalThing is not defined
	at <js>.:program(<eval>:1)
	at org.graalvm.polyglot.Context.eval(Context.java:313)
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:197)
	... 3 more

Same code with nashorn engine that works:

        ScriptEngine eng = new ScriptEngineManager().getEngineByName("nashorn");
        eng.getBindings(ScriptContext.GLOBAL_SCOPE).put("globalThing", "asdf");
        Object globalResult = eng.eval("globalThing", eng.getBindings(ScriptContext.GLOBAL_SCOPE));
        Object engineResult = eng.eval("globalThing", eng.getBindings(ScriptContext.ENGINE_SCOPE));

I'm looking into JSR223 APIs as i'm trying to find a clean way of either sharing values across Graal Contexts or "resetting" a context after an execution and Bindings / Scopes seem a good way to do it, relates to oracle/graal#631

Need docs on how to interact with the Node event loop when in JVM node

I read the docs but I still am unclear on a few things.

If I use node --jvm and my program starts in Javascript context, then I call into Java to create a Java main thread to run a Java program, how can I call back and forth between those two threads - how can I submit work to the node event loop? (a node event loop? i assume we can only have one!)

For example, assume I have a JavaFX app and I'd like to use node modules from it. AFAICT there are two ways to do this:

  1. Implement the core NodeJS API on top of the JVM. Disadvantage: lots of work, may not help with modules that use native code, advantage: presumably the Node event loop could be precisely controlled e.g. integrated with a Netty or JavaFX event loop.

  2. Allow Node to start up the JVM and control the main thread, start a separate thread to run my Java main method on. Advantage: works with graaljs as it is now. Disadvantage: using JS code might require a blocking call into the node event loop.

With (2), if I break the rules and use the JS in a multi-threaded way and call it on a separate non-Node thread, what happens if I lose my bet and the code wants to register a callback on the libuv event loop? Do I get an error?

Some samples and docs would go a long way here.

README.md is confusing

The README.md is confusing because when using GraalVM 1.0.0 RC1, you run into problems executing mx --dynamicimports /compiler build, as recommended in "With Graal". I guess what is meant is "with the Graal compiler", but the wording is confusing here. What that README is probably talking about is "using LabsJDK + Graal compiler". It would be nice to know how to run from source with the default GraalVM and to distinguish that in the README from running with the Graal compiler also built from source.

__DIR__ not available?

I just upgraded from rc2 to rc5 and new things started to fail. In rc2, the (Nashorn) extension variable DIR worked (I didn't use compatibility mode). In rc5, it doesn't. Is there a replacement?

Java property access shorthand only works for direct access

Under Nashorn, Java getters and setters can be accessed from JavaScript with property syntax:

$ jjs -version
nashorn 1.8.0_121
jjs> java.lang.Runtime.runtime
java.lang.Runtime@11c20519

This syntax works in GraalJS when Nashorn compatibility is enabled:

$ js --jvm --js.nashorn-compat=true
> Graal
{language: "JavaScript", versionJS: "1.0", versionGraalVM: "1.0.0-rc5", isGraalRuntime: true}
> java.lang.Runtime.runtime
JavaObject[java.lang.Runtime]

However, Nashorn also supports indirect access to those properties:

jjs> java.lang.Runtime["runtime"]
java.lang.Runtime@11c20519

Whereas GraalJS doen't:

> typeof java.lang.Runtime["runtime"]
undefined

I have a body of JS code that expects this consistency between o.p and o["p"]. Is this an oversight or is it a known limitation of the Nashorn compatibility? By the way, I think mapping getters and setters to JS properties is a great feature and it puzzles me that it's only available under the Nashorn compatibility flag. Thanks!

Cannot set system properties using --jvm.Dfoo=bar

The docs led me to believe I can pass JVM parameters using --jvm.paramname=value however this does not work for system properties.

One line JS program:

console.log(Java.type("java.lang.System").getProperties().toString())

and run it like this:

node --jvm test.js --jvm.Dfoo=bar|grep foo

... silence

Put this on maven central so that openjdk users can use graal.js

Right now, maven central has 2 of 4 jars needed to run graal.js on non-graalvm jdks. Graal-sdk, and truffle api. Tregex and graal.js.jar should me published to maven central as well so people can start testing running the polyglot engine and graal.js on non-graal vm jdks. I've tested this setup works by ripping the graal.js and tregex from a graalvm ce 1.0.0-rc2 release and putting them on the classpath with the graal-sdk and truffle api jars.

Attempting to instantiate an interface causes a crash in the interpreter or C2

mike@littlegreen ~/C/open> node --jvm
> new (Packages.java.lang.Runnable)()
java.lang.NullPointerException
	at com.oracle.truffle.js.runtime.GraalJSException$FrameVisitorImpl.visitFrame(GraalJSException.java:264)
	at com.oracle.truffle.js.runtime.GraalJSException.getJSStackTrace(GraalJSException.java:188)
	at com.oracle.truffle.js.runtime.GraalJSException.materializeJSStackTrace(GraalJSException.java:174)
	at com.oracle.truffle.js.runtime.GraalJSException.getJSStackTrace(GraalJSException.java:169)
	at com.oracle.truffle.js.runtime.builtins.JSError.prepareStack(JSError.java:277)
	at com.oracle.truffle.js.runtime.builtins.JSError$1.get(JSError.java:120)
	at com.oracle.truffle.js.runtime.objects.JSProperty.getValue(JSProperty.java:98)
	at com.oracle.truffle.js.nodes.access.PropertyGetNode$ObjectPropertyGetNode.getValueUnchecked(PropertyGetNode.java:375)
	at com.oracle.truffle.js.nodes.access.PropertyGetNode$LinkedPropertyGetNode.getValue(PropertyGetNode.java:205)
	at com.oracle.truffle.js.nodes.access.PropertyGetNode$UninitializedPropertyGetNode.getValue(PropertyGetNode.java:1422)
	at com.oracle.truffle.js.nodes.access.PropertyNode.executeWithTarget(PropertyNode.java:135)
	at com.oracle.truffle.js.nodes.access.PropertyNode.execute(PropertyNode.java:122)
	at com.oracle.truffle.js.nodes.binary.JSAndNode.execute(JSAndNode.java:65)
	at com.oracle.truffle.js.nodes.unary.JSNotNodeGen.executeBoolean_generic1(JSNotNodeGen.java:50)
	at com.oracle.truffle.js.nodes.unary.JSNotNodeGen.executeBoolean(JSNotNodeGen.java:34)
	at com.oracle.truffle.js.nodes.unary.JSNotNodeGen.execute(JSNotNodeGen.java:78)
	at com.oracle.truffle.js.nodes.binary.JSOrNode.execute(JSOrNode.java:65)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeBoolean(JavaScriptNode.java:151)
	at com.oracle.truffle.js.nodes.control.IfNode.executeCondition(IfNode.java:218)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:158)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.binary.DualNode.execute(DualNode.java:106)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:675)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltins$JSCallNode.call(FunctionPrototypeBuiltins.java:405)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltinsFactory$JSCallNodeGen.execute(FunctionPrototypeBuiltinsFactory.java:502)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.control.IfNode.execute(IfNode.java:143)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CallNode.execute(JSFunctionCallNode.java:255)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.executeVoid(VoidNodeGen.java:45)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.DirectBreakTargetNode.executeVoid(DirectBreakTargetNode.java:73)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.function.BlockScopeNode$FrameBlockScopeNode.executeVoid(BlockScopeNode.java:138)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:68)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.TryCatchNode.executeCatchInner(TryCatchNode.java:192)
	at com.oracle.truffle.js.nodes.control.TryCatchNode.executeCatch(TryCatchNode.java:169)
	at com.oracle.truffle.js.nodes.control.TryCatchNode.execute(TryCatchNode.java:150)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.function.BlockScopeNode$FrameBlockScopeNode.executeVoid(BlockScopeNode.java:138)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltins$JSApplyNode.apply(FunctionPrototypeBuiltins.java:389)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltins$JSApplyNode.applyFunction(FunctionPrototypeBuiltins.java:375)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltinsFactory$JSApplyNodeGen.executeAndSpecialize(FunctionPrototypeBuiltinsFactory.java:396)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltinsFactory$JSApplyNodeGen.execute(FunctionPrototypeBuiltinsFactory.java:374)
	at com.oracle.truffle.js.nodes.function.JSBuiltinNode$LazyBuiltinNode.execute(JSBuiltinNode.java:167)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.execute_generic3(JSWriteCurrentFrameSlotNodeGen.java:149)
	at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.execute(JSWriteCurrentFrameSlotNodeGen.java:84)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.executeVoid(VoidNodeGen.java:45)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:68)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CallNode.execute(JSFunctionCallNode.java:255)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.binary.DualNode.execute(DualNode.java:106)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltins$JSCallNode.call(FunctionPrototypeBuiltins.java:405)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltinsFactory$JSCallNodeGen.executeAndSpecialize(FunctionPrototypeBuiltinsFactory.java:525)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltinsFactory$JSCallNodeGen.execute(FunctionPrototypeBuiltinsFactory.java:505)
	at com.oracle.truffle.js.nodes.function.JSBuiltinNode$LazyBuiltinNode.execute(JSBuiltinNode.java:167)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.AbstractRepeatingNode.executeBody(AbstractRepeatingNode.java:73)
	at com.oracle.truffle.js.nodes.control.WhileNode$WhileDoRepeatingNode.executeRepeating(WhileNode.java:199)
	at org.graalvm.compiler.truffle.runtime.OptimizedOSRLoopNode.profilingLoop(OptimizedOSRLoopNode.java:141)
	at org.graalvm.compiler.truffle.runtime.OptimizedOSRLoopNode.executeLoop(OptimizedOSRLoopNode.java:118)
	at com.oracle.truffle.js.nodes.control.WhileNode.executeVoid(WhileNode.java:146)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.IfNode.execute(IfNode.java:149)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CallNode.execute(JSFunctionCallNode.java:255)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.executeVoid(VoidNodeGen.java:45)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.DirectBreakTargetNode.executeVoid(DirectBreakTargetNode.java:73)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.function.BlockScopeNode$FrameBlockScopeNode.executeVoid(BlockScopeNode.java:138)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:68)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.control.IfNode.execute(IfNode.java:149)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.control.SwitchNode.executeStatements(SwitchNode.java:151)
	at com.oracle.truffle.js.nodes.control.SwitchNode.execute(SwitchNode.java:132)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.DirectBreakTargetNode.executeVoid(DirectBreakTargetNode.java:73)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.function.BlockScopeNode$FrameBlockScopeNode.executeVoid(BlockScopeNode.java:138)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$BoundCallNode.executeCall(JSFunctionCallNode.java:904)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CallNode.execute(JSFunctionCallNode.java:255)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.binary.DualNode.executeVoid(DualNode.java:129)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:675)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:675)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltins$JSCallNode.call(FunctionPrototypeBuiltins.java:405)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltinsFactory$JSCallNodeGen.execute(FunctionPrototypeBuiltinsFactory.java:502)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.control.IfNode.execute(IfNode.java:143)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CallNode.execute(JSFunctionCallNode.java:255)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.executeVoid(VoidNodeGen.java:45)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.DirectBreakTargetNode.executeVoid(DirectBreakTargetNode.java:73)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.function.BlockScopeNode$FrameBlockScopeNode.executeVoid(BlockScopeNode.java:138)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:68)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.executeVoid(VoidNodeGen.java:45)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.BlockNode.resume(BlockNode.java:76)
	at com.oracle.truffle.js.nodes.control.GeneratorWrapperNode.execute(GeneratorWrapperNode.java:74)
	at com.oracle.truffle.js.nodes.function.BlockScopeNode$FrameBlockScopeNode.resume(BlockScopeNode.java:152)
	at com.oracle.truffle.js.nodes.control.GeneratorWrapperNode.execute(GeneratorWrapperNode.java:74)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractRepeatingNode.executeBody(AbstractRepeatingNode.java:73)
	at com.oracle.truffle.js.nodes.control.WhileNode$WhileDoRepeatingNode.resume(WhileNode.java:210)
	at com.oracle.truffle.js.nodes.control.GeneratorWrapperNode.execute(GeneratorWrapperNode.java:74)
	at com.oracle.truffle.js.nodes.control.GeneratorWrapperNode.executeRepeating(GeneratorWrapperNode.java:84)
	at org.graalvm.compiler.truffle.runtime.OptimizedOSRLoopNode.profilingLoop(OptimizedOSRLoopNode.java:141)
	at org.graalvm.compiler.truffle.runtime.OptimizedOSRLoopNode.executeLoop(OptimizedOSRLoopNode.java:118)
	at com.oracle.truffle.js.nodes.control.WhileNode.execute(WhileNode.java:140)
	at com.oracle.truffle.js.nodes.control.DirectBreakTargetNode.execute(DirectBreakTargetNode.java:64)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.GeneratorBodyNode$GeneratorRootNode.execute(GeneratorBodyNode.java:129)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.InternalCallNode.directCall(InternalCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.InternalCallNodeGen.execute(InternalCallNodeGen.java:39)
	at com.oracle.truffle.js.builtins.GeneratorPrototypeBuiltins$GeneratorResumeNode.resume(GeneratorPrototypeBuiltins.java:123)
	at com.oracle.truffle.js.builtins.GeneratorPrototypeBuiltinsFactory$GeneratorResumeNodeGen.execute(GeneratorPrototypeBuiltinsFactory.java:53)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.TryCatchNode.execute(TryCatchNode.java:144)
	at com.oracle.truffle.js.nodes.control.TryFinallyNode.execute(TryFinallyNode.java:75)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.AbstractRepeatingNode.executeBody(AbstractRepeatingNode.java:73)
	at com.oracle.truffle.js.nodes.control.WhileNode$WhileDoRepeatingNode.executeRepeating(WhileNode.java:199)
	at org.graalvm.compiler.truffle.runtime.OptimizedOSRLoopNode.profilingLoop(OptimizedOSRLoopNode.java:141)
	at org.graalvm.compiler.truffle.runtime.OptimizedOSRLoopNode.executeLoop(OptimizedOSRLoopNode.java:118)
	at com.oracle.truffle.js.nodes.control.WhileNode.executeVoid(WhileNode.java:146)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.IfNode.execute(IfNode.java:143)
	at com.oracle.truffle.js.nodes.binary.DualNode.execute(DualNode.java:106)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltins$JSCallNode.call(FunctionPrototypeBuiltins.java:405)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltinsFactory$JSCallNodeGen.executeAndSpecialize(FunctionPrototypeBuiltinsFactory.java:525)
	at com.oracle.truffle.js.builtins.FunctionPrototypeBuiltinsFactory$JSCallNodeGen.execute(FunctionPrototypeBuiltinsFactory.java:505)
	at com.oracle.truffle.js.nodes.function.JSBuiltinNode$LazyBuiltinNode.execute(JSBuiltinNode.java:167)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.control.IfNode.execute(IfNode.java:143)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CallNode.execute(JSFunctionCallNode.java:255)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.executeVoid(VoidNodeGen.java:45)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.DirectBreakTargetNode.executeVoid(DirectBreakTargetNode.java:73)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.function.BlockScopeNode$FrameBlockScopeNode.executeVoid(BlockScopeNode.java:138)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:68)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CallNode.execute(JSFunctionCallNode.java:255)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.execute(VoidNodeGen.java:35)
	at com.oracle.truffle.js.nodes.unary.VoidNodeGen.executeVoid(VoidNodeGen.java:45)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:164)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:68)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CallNode.execute(JSFunctionCallNode.java:255)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeBoolean(JavaScriptNode.java:151)
	at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.executeBoolean(JSWriteCurrentFrameSlotNodeGen.java:198)
	at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.executeVoid(JSWriteCurrentFrameSlotNodeGen.java:278)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.IfNode.executeVoid(IfNode.java:160)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute(ReturnTargetNode.java:121)
	at com.oracle.truffle.js.nodes.control.ExprBlockNode.execute(ExprBlockNode.java:70)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.call(OptimizedCallTarget.java:206)
	at com.oracle.truffle.js.runtime.builtins.JSFunction.call(JSFunction.java:324)
	at com.oracle.truffle.js.runtime.JSRuntime.call(JSRuntime.java:2228)
	at com.oracle.truffle.trufflenode.GraalJSAccess.functionCall(GraalJSAccess.java:1024)
	at com.oracle.truffle.trufflenode.GraalJSAccess.functionCall3(GraalJSAccess.java:1045)
	at com.oracle.truffle.trufflenode.NativeAccess.polyglotEngineEntered(Native Method)
	at com.oracle.truffle.trufflenode.GraalJSAccess$6.run(GraalJSAccess.java:2277)
	at com.oracle.truffle.trufflenode.RunnableInvoker$RunnableInvokeNode.access(RunnableInvoker.java:78)
	at com.oracle.truffle.trufflenode.RunnableInvokerForeign$RunnableInvokeSubNode.accessWithTarget(RunnableInvokerForeign.java:120)
	at com.oracle.truffle.trufflenode.RunnableInvokerForeignFactory$RunnableInvokeSubNodeGen.executeAndSpecialize(RunnableInvokerForeignFactory.java:57)
	at com.oracle.truffle.trufflenode.RunnableInvokerForeignFactory$RunnableInvokeSubNodeGen.executeWithTarget(RunnableInvokerForeignFactory.java:39)
	at com.oracle.truffle.trufflenode.RunnableInvokerForeign$RunnableInvokeSubNode$INVOKERootNode.execute(RunnableInvokerForeign.java:143)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.api.interop.InteropAccessNode.doCached(InteropAccessNode.java:186)
	at com.oracle.truffle.api.interop.InteropAccessNodeGen.executeAndSpecialize(InteropAccessNodeGen.java:82)
	at com.oracle.truffle.api.interop.InteropAccessNodeGen.executeImpl(InteropAccessNodeGen.java:45)
	at com.oracle.truffle.api.interop.InteropAccessNode.execute(InteropAccessNode.java:82)
	at com.oracle.truffle.api.interop.ForeignAccess.sendInvoke(ForeignAccess.java:496)
	at com.oracle.truffle.js.runtime.truffleinterop.JSInteropNodeUtil.invoke(JSInteropNodeUtil.java:271)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$ForeignInvokeNode.executeCallImpl(JSFunctionCallNode.java:1069)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$ForeignExecuteNode.executeCall(JSFunctionCallNode.java:1043)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute(JSFunctionCallNode.java:354)
	at com.oracle.truffle.js.nodes.JavaScriptNode.executeVoid(JavaScriptNode.java:212)
	at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid(AbstractBlockNode.java:74)
	at com.oracle.truffle.js.nodes.control.BlockNode.execute(BlockNode.java:62)
	at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute(FunctionBodyNode.java:66)
	at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:139)
	at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$DispatchedCallNode.executeCall(JSFunctionCallNode.java:1004)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$CacheNode.executeCall(JSFunctionCallNode.java:673)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UninitializedCacheNode.executeCall(JSFunctionCallNode.java:707)
	at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall(JSFunctionCallNode.java:217)
	at com.oracle.truffle.js.nodes.interop.JSInteropExecuteNode.execute(JSInteropExecuteNode.java:66)
	at com.oracle.truffle.js.parser.foreign.JSForeignAccessFactory$ExecuteNode.common(JSForeignAccessFactory.java:141)
	at com.oracle.truffle.js.parser.foreign.JSForeignAccessFactory$ExecuteNode.access(JSForeignAccessFactory.java:119)
	at com.oracle.truffle.js.parser.foreign.JSForeignAccessFactoryForeign$ExecuteSubNode.accessWithTarget(JSForeignAccessFactoryForeign.java:143)
	at com.oracle.truffle.js.parser.foreign.JSForeignAccessFactoryForeignFactory$ExecuteSubNodeGen.executeAndSpecialize(JSForeignAccessFactoryForeignFactory.java:82)
	at com.oracle.truffle.js.parser.foreign.JSForeignAccessFactoryForeignFactory$ExecuteSubNodeGen.executeWithTarget(JSForeignAccessFactoryForeignFactory.java:66)
	at com.oracle.truffle.js.parser.foreign.JSForeignAccessFactoryForeign$ExecuteSubNode$EXECUTERootNode.execute(JSForeignAccessFactoryForeign.java:169)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callDirect(OptimizedCallTarget.java:213)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.callProxy(OptimizedDirectCallNode.java:86)
	at org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode.call(OptimizedDirectCallNode.java:70)
	at com.oracle.truffle.api.interop.InteropAccessNode.doCached(InteropAccessNode.java:186)
	at com.oracle.truffle.api.interop.InteropAccessNodeGen.executeAndSpecialize(InteropAccessNodeGen.java:82)
	at com.oracle.truffle.api.interop.InteropAccessNodeGen.executeImpl(InteropAccessNodeGen.java:45)
	at com.oracle.truffle.api.interop.InteropAccessNode.execute(InteropAccessNode.java:67)
	at com.oracle.truffle.api.interop.ForeignAccess.sendExecute(ForeignAccess.java:420)
	at com.oracle.truffle.api.vm.PolyglotValue$Interop$AbstractExecuteNode.executeShared(PolyglotValue.java:2168)
	at com.oracle.truffle.api.vm.PolyglotValue$Interop$ExecuteNode.executeImpl(PolyglotValue.java:2248)
	at com.oracle.truffle.api.vm.PolyglotValue$PolyglotNode.execute(PolyglotValue.java:551)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:269)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:258)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:248)
	at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:230)
	at org.graalvm.compiler.truffle.runtime.GraalTVMCI.callProfiled(GraalTVMCI.java:86)
	at com.oracle.truffle.api.impl.Accessor.callProfiled(Accessor.java:750)
	at com.oracle.truffle.api.vm.VMAccessor.callProfiled(VMAccessor.java:93)
	at com.oracle.truffle.api.vm.PolyglotValue$Interop.execute(PolyglotValue.java:1410)
	at org.graalvm.polyglot.Value.execute(Value.java:312)
	at com.oracle.truffle.trufflenode.GraalJSAccess.isolateEnterPolyglotEngine(GraalJSAccess.java:2274)
Caused by: Attached Guest Language Frames (35)

Note that putting it in a file and running it via node --jvm test.js actually segfaults the JVM inside C2. I'll attach the crash log.

Random errors after running script many times

When running a script many times, random errors occur after a while.
This happens when using one Engine to create Contexts from. When not reusing the same engine, it seems to keep working fine.

The errors occur after on average 1500 executions, but this varies wildly.. just tried again and saw no error after 20000..
And they can be different each time:

error in iteration 1326
Exception in thread "main" ReferenceError: x is not defined
at :program(testme.js:3:23-27)

error in iteration 1341
Exception in thread "main" TypeError: undefined is not a function
at :program(testme.js:22:295-315)

error in iteration 1345
Exception in thread "main" ReferenceError: Person is not defined
at :program(testme.js:15-21:155-281)

This is on rc5.

Code to reproduce:

package example;

import java.io.File;
import java.io.IOException;

import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Engine;
import org.graalvm.polyglot.Source;

/**
 * ManyRuns - takes 2 args:
 * - number of times to run loop
 * - the file to run
 */
public class ManyRuns {


  public static void main(String[] args) throws IOException {

    int loops = Integer.parseInt(args[0]);
    int repeats = 200;

    Engine engine = Engine.create();
    Source source = Source.newBuilder("js", new File(args[1])).build();

    int iteration = 0;
    try {
      for (int i = 0; i < loops; i++) {
        long t1 = System.currentTimeMillis();
        for (int j = 0; j < repeats; j++) {
          iteration++;

          // Context context = Context.create("js");   <= no errors when using this
          Context context = Context.newBuilder("js").engine(engine).build();

          context.eval(source);
          context.close();
        }
        long t2 = System.currentTimeMillis();
        System.out.println((t2 - t1) + " ms");
      }
    } catch (Throwable t) {
      System.out.println("error in iteration " + iteration);
      throw t;
    }

  }

}

And the script I tried:

'use strict';

const x = 1;

var me = {
  name: "Hans",
  age: 52,
  calc: function(x,y,z) {
    var dummy = x + y + z;
  }
}
me.calc();
  
function Person(name,age) {
  this.name = name;
  this.age = age;
  this.stuff = function(p){
    var t = p + 1234;
  }
}
var john = new Person("John",47);
john.stuff(1);

Nashorn parser included in the artifact is broken

Reproducer:

$ cat jspart2.js 
load("nashorn:parser.js");
var json = parse("print('hello')");
print(JSON.stringify(json));

$ js --jvm jspart2.js 
ReferenceError: TestNashorn is not defined
    at <js> parse(nashorn:parser.js:24:734-744)
    at <js> :program(jspart2.js:2:38-60)

Cause:
https://github.com/graalvm/graaljs/blob/master/graal-js/src/com.oracle.truffle.js.runtime/src/com/oracle/truffle/js/runtime/resources/parser.js#L24

A reference to a test class which is not part of the distributed artifact.

Muiltithreading is not allowed

Graal (1.0.0-rc4) command:
js --js.nashorn-compat=true --jvm thread.js

Script (thread.js)
var _runnable = new Packages.java.lang.Runnable({
run: function() {
print("hello");
}
});

var _thread = new Packages.java.lang.Thread(_runnable);
_thread.start();
_thread.join();

Graal result:
Exception in thread "Thread-3" java.lang.IllegalStateException: Multi threaded access requested by thread Thread[Thread-3,5,main] but is not allowed for language(s) js.
at com.oracle.truffle.api.vm.PolyglotContextImpl.throwDeniedThreadAccess(PolyglotContextImpl.java:604)
at com.oracle.truffle.api.vm.PolyglotContextImpl.checkAllThreadAccesses(PolyglotContextImpl.java:522)
at com.oracle.truffle.api.vm.PolyglotContextImpl.enterThreadChanged(PolyglotContextImpl.java:443)
at com.oracle.truffle.api.vm.PolyglotContextImpl.enter(PolyglotContextImpl.java:403)
at com.oracle.truffle.api.vm.PolyglotValue$PolyglotNode.execute(PolyglotValue.java:542)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callProxy(OptimizedCallTarget.java:262)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callRoot(OptimizedCallTarget.java:251)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.callBoundary(OptimizedCallTarget.java:241)
at org.graalvm.compiler.truffle.runtime.OptimizedCallTarget.doInvoke(OptimizedCallTarget.java:226)
at org.graalvm.compiler.truffle.runtime.GraalTVMCI.callProfiled(GraalTVMCI.java:86)
at com.oracle.truffle.api.impl.Accessor.callProfiled(Accessor.java:733)
at com.oracle.truffle.api.vm.VMAccessor.callProfiled(VMAccessor.java:93)
at com.oracle.truffle.api.vm.PolyglotValue$Interop.executeVoid(PolyglotValue.java:1405)
at org.graalvm.polyglot.Value.executeVoid(Value.java:331)
at com.oracle.truffle.js.javaadapters.java.lang.Runnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)

Expected result (JVM jjs)
hello

allow multi thread access

JavaScript does not specify how it should behave in multi threading environments and for example "nashorn" would allow it, stating that the engine is thread safe but user code not. For certain environments (e.g.: vertx) that is not a big problem due to it's single thread/1 thread per cpu architecture.

So a script like:

vertx
  .createHttpServer()
  .requestHandler(function (req) {
    req.response().end("Hello!");
  })
  .listen(8080);

console.log('Server listening at: http://localhost:8080/');

Would behave the same as currently with nashorn. Sadly it's not the case see:

https://twitter.com/pml0pes/status/1006256574334107649

env.findLocalScopes(node, null) causes NPE

Calling findLocalScopes with frame=null causes a NPE, although null is a valid argument (Lexical scopes are returned when frame argument is null.)

Caused by: java.lang.NullPointerException
	at com.oracle.truffle.js.parser.JavaScriptLanguage.findLocalScopes(JavaScriptLanguage.java:606)
	at com.oracle.truffle.js.parser.JavaScriptLanguage.findLocalScopes(JavaScriptLanguage.java:1)
	at com.oracle.truffle.api.TruffleLanguage$Env.findLocalScopes(TruffleLanguage.java:1878)
	at com.oracle.truffle.api.TruffleLanguage$LanguageImpl.findLocalScopes(TruffleLanguage.java:2239)
	at com.oracle.truffle.api.instrumentation.TruffleInstrument$Env.findLocalScopes(TruffleInstrument.java:627)

Passing JS Arrays to Java object methods seem always to be returned as TruffleMap

Imagine the following Java class:

public class CallMe {
  public void call(Object name) {
    System.out.println(name);
    System.out.println(name.getClass());
  }
}

Bootstrap the JS engine and add an instance of this class to the context bindings:

Context ctx = Context.newBuilder("js").allowAllAccess(true).build();
ctx.getBindings("js").putMember("cb", new CallMe());

Now when working with this interop between JS and java I observe the following when passing a JS Object:

ctx.eval("js", "cb.call({'foo': 'bar'});");
    // prints:
    // {foo=bar}
    // class com.oracle.truffle.api.interop.java.TruffleMap

Which feels correct, the JS Object is mapped to a java.util.Map which resembles good enough to the original source JS type.

Then I execute the same test with an JS array:

ctx.eval("js", "cb.call(['foo', 'bar']);");
    // prints:
    // {0=foo, 1=bar}
    // class com.oracle.truffle.api.interop.java.TruffleMap

I understand that a JS Array by nature is a JS Object however I'd expect that in this case there would be some logic to wrap it in a type that implements java.util.List.

The issue of always having a Map is that on the java side there is no way to know what was the source original type, as for example, the keys on TruffleMap are always of type String so no distinction can be made there, as well there are no high level helpers like:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray

That could be used from the java side.

dynamic evaluation and node support

Hi,

Is it possible to dynamically invoke graaljs and allow the call to be processed by nodejs, or does this not make sense?

Specifically I am calling graaljs from Groovy via code that looks like this:

Context context = Context.create("js");
context.eval("js", nodeCode);

The content of the nodeCode variable above is the simple nodejs hello world code:
https://nodejs.org/en/docs/guides/getting-started-guide/

Of course when that runs I get an error because it doesn't recognize the function require.

I basically want to know if it is possible to seamlessly leverage nodejs modules and their functionality from within other JVM languages.

Not recognizing classes defined in nested evals

The following fails with ReferenceError: Animal is not defined.

Context context = Context.create( "js" );
context.getBindings( "js" ).putMember( "defineAnimal", new Runnable() {
    @Override
    public void run() {
        context.eval( "js", "class Animal{}" );
    }
} );
context.eval( "js", "defineAnimal(); class Dog extends Animal{}" );

But it works fine if "class Animal{}" is replaced with "class Animal2{} var Animal = Animal2;". In other words variables and functions are shared between nested evals, but classes are not. Is this something that can be fixed? This scenario is important to me. Thanks!

Missing node.js support from context library

We need the ability to call a node.js function from inside the jvm context library. It would be best if this could be called repeatedly. It is completely ok if Node is orphaned from the greater event loop and has no signal access.

AOT compiled JavaScript?

Hello! Is it possible that Graal's JavaScript partial evaluator can be used to AOT JavaScript code?

How to identify arguments object as Value?

I'm trying to migrate a big Nashorn application to GraalJS. One of the things the code does is convert a JavaScript value to a Scala/Java value. An Arguments object is detected and converted to an array in Nashorn like this:

case a: ScriptObjectMirror if a.getClassName == "Arguments" => extractArray(a)

I haven't succeeded in testing if a Value is Arguments. My test method looks like this:

public void acceptValue(Value v) {
    System.out.println("value = " + v);
    System.out.println("meta = " + v.getMetaObject());
    System.out.println("meta:type = " + v.getMetaObject().getMember("type"));
    System.out.println("meta:className = " + v.getMetaObject().getMember("className"));
    System.out.println("meta:description = " + v.getMetaObject().getMember("description"));
}

And I'm calling it like this:

context.eval("js", "(function () { main.acceptValue(arguments); })('a', 'b', 'c')");

This is the printout:

value = {0: "a", 1: "b", 2: "c", length: 3, callee: {...}, Symbol(Symbol.iterator): {...}}
meta = Object
meta:type = object
meta:className = Object
meta:description = {0: "a", 1: "b", 2: "c", length: 3, callee: {...}, Symbol(Symbol.iterator): {...}}

Sadly, neither type nor className are useful here.

Any suggestions?

Mx build js failed on top of java jdk 10.0.1 and mac os x

Hi,

I tried to build graaljs regarding building-graal.js.md.

During build a high number of jdk 1.8 not available and distribution ... was removed errors
are thrown.

After build mx js fails with

Distribution named GRAALS_LAUNCHER was not foud:
distribution GRAALS_LAUNCHER was removed as all its dependencies were removed

As prerequisites JDK 9 or later is named, so build should be possible on top of JDK 10.

/dehade

Is there a grammatically way to execute Node.js scripts via the Context API

Hey there

Is it possible to execute/eval a Node.js script from the Context API? I can execute a hello world script via the GraalVM node binary:

const http = require('http');

const name = 'node-hello-world';
const port = '8888';

const app = new http.Server();

app.on('request', (req, res) => {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.write('Hello World');
    res.end('\n');
});

app.listen(port, () => {
    console.log(`${name} is listening on port ${port}`);
});

But that doesn't work for the Java API:

import org.apache.commons.io.IOUtils;
import org.graalvm.polyglot.Context;

import java.io.InputStream;
import java.nio.charset.StandardCharsets;

public class NodeJsLauncher {

    public static void main(String[] args) throws Exception {
        new NodeJsLauncher();
    }

    public NodeJsLauncher() throws Exception {
        InputStream inputStream = getClass().getResourceAsStream("/HelloWorld.js");
        String helloWorldScript = IOUtils.toString(inputStream, StandardCharsets.UTF_8);

        Context context = Context.create();
        context.eval("js", helloWorldScript);
    }
}

Output:

Exception in thread "main" ReferenceError: require is not defined
	at <js> :program(Unnamed:1:13-19)
	at org.graalvm.polyglot.Context.eval(Context.java:336)
	at NodeJsLauncher.<init>(NodeJsLauncher.java:18)
	at NodeJsLauncher.main(NodeJsLauncher.java:10)

Process finished with exit code 1

Does the js language even support JavaScript with the Node.js module loading system? Or is it just not enabled:

Graal.js can execute Node.js applications. It provides high compatibility with existing npm packages, with high likelyhood that your application will run out of the box. This includes npm packages with native implementations. Note that you will need to re-compile from source with Graal.js if you want to run binaries that have beeen compiled for Node.js based on V8, or any other compatible engine.

Background: I am in the process of developing a Java solution that is able to server side render Angular SPA applications. The server side rendering requires some Node.js modules, so solutions like J2V8 (or maybe GraalVM) are required. For more information see https://github.com/swaechter/angularj-universal

Perf of warmed-up ClojureScript unit tests slow on Graal.JS relative to Nashorn

If you run the ClojureScript compiler's unit tests in a loop and allow things to warm up, they end up running more slowly in Graal.JS than under Nashorn.

dikeicwvaaiua-9

The numbers above were produced on a Mac, using GraalVM 1.0.0-rc4 (ee edition). Nashorn is 1.8.0_172-b11.

To reproduce using the actual ClojureScript compiler unit tests, the steps involve:

  1. Modify the ClojureScript compiler's tests so that they run in an infinite loop (optionally also capturing timing metrics)
  2. Build the tests (which involves producing a JavaScript file that can be executed in any engine)
  3. Run the tests, allowing some time (say 1/2 hour or so) for them to settle

To make things more convenient, I've attached a copy of the built tests, and attached them directly in the "Run the tests" section.

Modify the ClojureScript compiler's tests

The ClojureScript compiler is at https://github.com/clojure/clojurescript

Modifications are at mfikes/clojurescript@1c76cf6
and to make things easier, that branch could just be checked out and used as-is. Roughly, these modifications involve setting up some atoms (mutable state) to track timing information, and putting the tests themselves in an infinite loop ((while true ...) in ClojureScript), doing some accounting for timing, and printing out the timing with the string DELTA which can be grepped for.

Build the tests

To build the tests, run script/bootstrap and then script/test in the tree. This will cause it to build them and then after logging

Applying optimizations :advanced to 343 sources

it will automatically attempt to run them under various JavaScript engines if any are configured per https://clojurescript.org/community/running-tests. (No JavaScript engines need to be configured for this repro). If it starts running the tests in any engine, Ctrl-C them (because they are in an infinite loop).

This will result in a JavaScript file, builds/out-adv/core-advanced-test.js that can be run in any engine.

Run the tests

For convenience, here is a built copy of the test JavaScript file:
core-advanced-test.js.gz

Then to run the tests, say, using Graal.JS, do

/path/to/js builds/out-adv/core-advanced-test.js | grep DELTA

You will see output like this

DELTA 3204 #queue [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3204] 100
DELTA 2083 #queue [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3204 2083] 165
DELTA 2016 #queue [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3204 2083 2016] 228
DELTA 1932 #queue [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3204 2083 2016 1932] 288

The first number is the number of milliseconds to run that test loop, the queue is the last 32 timings, and the very last number is the average of the 32 timings. (So, definitely let it fill the queue with timings, and go well beyond that to let things settle completely.)

(If you run them in Node, the tests want print to be defined, so to do that, start node then var print = console.log; and then require("./path/to/core-advanced-test.js");

New object properties in rc5

Upgrading from rc2 to rc5, I note that a function that receives an object as a Map now gets Object.prototype properties as well. Consider the code:

public class GetObject {
    public static void main(String[] args) {
        Context context = Context.create("js");

        context.getBindings("js").putMember("main", new GetObject());

        context.eval("js", "main.printKeys({ 'foo': 'bar' });");
    }

    public void printKeys(Map<String, Object> map) {
        for (Map.Entry<String, Object> e : map.entrySet()) {
            System.out.println(e.getKey() + " -> " + e.getValue());
        }
    }
}

With rc2, it prints:

foo -> bar

With rc5:

foo -> bar
__proto__ -> [object Object]
constructor -> Executable
hasOwnProperty -> Executable
isPrototypeOf -> Executable
propertyIsEnumerable -> Executable
toLocaleString -> Executable
toString -> Executable
valueOf -> Executable
__defineGetter__ -> Executable
__defineSetter__ -> Executable
__lookupGetter__ -> Executable
__lookupSetter__ -> Executable

This is not really what I expected. I suppose I can exclude the extra properties by checking if they are indeed Object.prototype members, but this results in extra code. Is this intentional?

How to explicitly select a Java method overload?

When calling a Java method from JS, if multiple overloads are applicable, the runtime correctly complains that it can't choose (please forgive the nonsensical example):

$ js --jvm
> Graal
{language: "JavaScript", versionJS: "1.0", versionGraalVM: "1.0.0-rc5", isGraalRuntime: true}
> java.lang.Runtime.getRuntime().exec(null)
TypeError: INVOKE on JavaObject[java.lang.Runtime@799f10e1 (java.lang.Runtime)] failed due to: java.lang.IllegalArgumentException: Multiple applicable overloads found for method name exec (candidates: [Method[public java.lang.Process java.lang.Runtime.exec(java.lang.String[]) throws java.io.IOException], Method[public java.lang.Process java.lang.Runtime.exec(java.lang.String) throws java.io.IOException]], arguments: [DynamicObject<null>@18078bef (DynamicObjectBasic)])
	at <js> :program(<shell>:3:1:0-35)

This is in line with Nashorn:

$ jjs -version
nashorn 1.8.0_121
jjs> java.lang.Runtime.getRuntime().exec(null)
java.lang.RuntimeException: java.lang.NoSuchMethodException: Can't unambiguously select between fixed arity signatures [(java.lang.String), (java.lang.String[])] of the method java.lang.Runtime.exec for argument types [null]

However Nashorn lets us pick an overload to resolve the ambiguity:

jjs> java.lang.Runtime.getRuntime()["exec(java.lang.String)"](null)
java.lang.NullPointerException

Trying the same syntax in GraalJS doesn't work:

> java.lang.Runtime.getRuntime()["exec(java.lang.String)"](null)
TypeError: (intermediate value).lang.Runtime.getRuntime(...)["exec(java.lang.String)"] is not a function
	at <js> :program(<shell>:8:1:56-61)

The lookupOverloadByParamTypeString method:
https://github.com/graalvm/graaljs/blob/69bc58643bf77ed6eaaaffca3e79beb4b473a664/graal-js/src/com.oracle.truffle.js.runtime/src/com/oracle/truffle/js/runtime/interop/JavaMethod.java#L504

looks promising but I have no idea how to invoke it. Ideally, the Nashorn syntax would be supported…

Dynamic function names behaviour doesn't match V8

In V8:

> const dynamicName = "foo" + Math.floor(Math.random() * 1000);
undefined
> const obj = { [dynamicName]() { throw new Error(); } };
undefined
> dynamicName
'foo511'
> const f = obj[dynamicName]
undefined
> f()
Error
    at foo511 (repl:1:39)

Note that the function has the name we wanted. GraalJS accepts this syntax, but:

> f()
Error
    at dynamicName (repl:1:39)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.