Allows creating a temporary global variable with a random name which will only live until the execution context of the instance of this class ends.
More...
Allows creating a temporary global variable with a random name which will only live until the execution context of the instance of this class ends.
The reason this is needed is because in graal, non primitive values originating from guest languages (like JS) are not sharable, this means:
- A guest language specific object is not mappable to C++ equivalent, i.e. (i.e. undefined, ArrayBuffer)
- There's no way we can generate a guest language specific object from C++ (i.e. undefined, ArrayBuffer or Exception Objects)
The way this problem is addressed, is by creating a temporary object in the global context, to create the object in the guest language and then if needed, storing it to create a reference so the object can be deleted from the main context (to avoid pollution) without actually losing the object, then the reference is provided to the guest language.
Additional Information: https://github.com/oracle/graaljs/issues/70#issuecomment-436257058 https://github.com/oracle/graal/blob/master/sdk/CHANGELOG.md#version-10-rc9