-
Notifications
You must be signed in to change notification settings - Fork 426
"all native function values should be intrinsics" - what does it mean? #1285
Comments
An invariant violation means that something that we thought is impossible has actually happened. I.e. you've run into a programming bug and the onus is on the Prepack developers to fix the problem. As always, if there is a simple way to reproduce this failure it will be a great help to the developers and speed up the resolution of this problem. |
Oh OK! I will try to make a minimal case |
I just ran into this too. It's very difficult to reduce down to a test case given the nature of running prepack on a generated bundle. My bundle isn't too big, it's ~1500 lines, and here it is: https://gist.github.com/jlongster/85c2f8f313bf52af1e7996b285273587 FWIW here's the screenshot of the error: Any tips for how to make a reduced test case? If you hit this yourself how would you do it? I suppose I can try to invoke smaller parts of the system and see what happens. |
I figured it out - it's promises. How well are promises supported? I install a global function in my VM which returns a promise: https://gist.github.com/jlongster/85c2f8f313bf52af1e7996b285273587#file-interpreter-output-js-L257-L263. This function is available to the code my VM is interpreting. At the point where my VM implements the CALL operator which calls functions, it checks the return type to see if it's a promise, and if so, it suspends the VM: https://gist.github.com/jlongster/85c2f8f313bf52af1e7996b285273587#file-interpreter-output-js-L348-L350 If I remove these two pieces of code (make Maybe this issue is known and promises aren't well-supported yet. |
Evaluating Promises should work but there might be bugs in the serializer, which this looks like it might be. It is likely that Promises needs to be serialized using a special case branch here since they have to use a built-in constructor (similar to Date). https://github.com/facebook/prepack/blob/master/src/serializer/ResidualHeapSerializer.js#L1204-L1268 |
Here's a small repro: global.d = Object.getOwnPropertyDescriptor(Map.prototype, "size"); |
I'm currently working on this, fixing native properties (such as |
Actually, prepack should not (?) replace
After making
|
Setting This produces non-optimal code. E.g: Input:
Output:
I'm pretty sure there's a better approach but I cannot unearth it. |
Release notes: fixes an issue where usage native accessor descriptors would crash Closes facebookarchive#1285
Release notes: fixes an issue where usage native accessor descriptors would crash Closes facebookarchive#1285
I am trying to run prepack on an existing code, I get this error
It doesn't show me where exactly is the error in the code, so I am asking here. What does it mean, and how can I find where the error comes from?
The text was updated successfully, but these errors were encountered: