Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport: Set dynamic import callback #17823

Closed
wants to merge 5 commits into from

Conversation

jkrems
Copy link
Contributor

@jkrems jkrems commented Dec 22, 2017

  • Original PR: module: Set dynamic import callback #15713
  • This includes cherry picks of the following commits:
  • I went for the nuclear option and backed out everything connected to host defined options. This feature isn't used in our current implementation of dynamic import (or modules in general).
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

deps, module

/cc @nodejs/v8 @bmeck @MylesBorins

@jkrems jkrems added backported-to-v9.x wip Issues and PRs that are still a work in progress. labels Dec 22, 2017
@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. v9.x labels Dec 22, 2017
@jkrems jkrems mentioned this pull request Dec 22, 2017
9 tasks
@jkrems
Copy link
Contributor Author

jkrems commented Dec 22, 2017

Looking what V8 CI thinks of this: https://ci.nodejs.org/job/node-test-commit-v8-linux/1133/

@jkrems
Copy link
Contributor Author

jkrems commented Dec 22, 2017

Guess I forgot to add some detail but I'd like to get some feedback on the overall direction before I bother figuring out how to run the V8 tests from inside of the node tree.

stderr:
#
# Fatal error in v8::HandleScope::CreateHandle()
# Cannot create a handle without a HandleScope
#

Received signal 6

==== C stack trace ===============================

 [0x0000011880ef]
 [0x2b16a2911330]
 [0x2b16a2b55c37]
 [0x2b16a2b59028]
 [0x00000085c01f]
 [0x00000090dfb1]
 [0x000000b7aa99]
 [0x000000b4d768]
 [0x000000b4da95]
 [0x00000092e129]
 [0x000000610854]
 [0x000000508870]
 [0x000000509398]
 [0x2b16a2b40f45]
 [0x00000044b540]
[end of stack trace]
Command: /home/iojs/build/workspace/node-test-commit-v8-linux/nodes/benchmark/v8test/v8test/deps/v8/out/x64.release/cctest --random-seed=-262725084 test-api/ScriptOrigin --nohard-abort

@MylesBorins MylesBorins force-pushed the v9.x-staging branch 2 times, most recently from 7177a88 to ffc2659 Compare January 10, 2018 06:45
@MylesBorins
Copy link
Contributor

Can you please include 11ebaff

@MylesBorins MylesBorins mentioned this pull request Jan 14, 2018
2 tasks
@jkrems
Copy link
Contributor Author

jkrems commented Jan 15, 2018

@MylesBorins Tried to pick but it looks like it's already there: https://github.com/nodejs/node/blob/v9.x-staging/doc/api/esm.md#supported

@jkrems
Copy link
Contributor Author

jkrems commented Jan 15, 2018

Started another test-commit-v8 run just in case the previous failures vanished for some reason. Still mystified by the error itself. :(

https://ci.nodejs.org/job/node-test-commit-v8-linux/1161/

@targos
Copy link
Member

targos commented Jan 17, 2018

@jkrems is that ready for a new CI run?

@jkrems
Copy link
Contributor Author

jkrems commented Jan 17, 2018 via email

@detrohutt
Copy link

Any chance of this making it into the next release? I'm currently having to use the nightly build which is causing me to have to do several workarounds in my workflow. Is there anything I could do to help, with no knowledge of the node codebase (like just general debugging)?

@jkrems
Copy link
Contributor Author

jkrems commented Jan 31, 2018

I'm about to be out all weekend so the earliest I can continue looking into this would be next week. But the last two times I kinda ran out of ideas and I don't have a working setup to recreate it locally yet. :(

@detrohutt
Copy link

Ok no problem thanks for the quick response.

@MylesBorins
Copy link
Contributor

@jkrems could you include #18387
specifically ba3d55a

Jan Krems and others added 4 commits February 1, 2018 10:39
Original commit message:

    Introduce ScriptOrModule and HostDefinedOptions

    This patch introduces a new container type ScriptOrModule which
    provides the name and the host defined options of the script/module.

    This patch also introduces a new PrimitivesArray that can hold
    Primitive values, which the embedder can use to store metadata.

    The HostDefinedOptions is passed to V8 through the ScriptOrigin, and
    passed back to the embedder through HostImportModuleDynamically for
    module loading.

    Bug: v8:5785, v8:6658, v8:6683
    Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
    Change-Id: I56c26fc9a680b273ac0a6691e5ad75f15b8dc80a
    Reviewed-on: https://chromium-review.googlesource.com/622158
    Reviewed-by: Adam Klein <[email protected]>
    Reviewed-by: Georg Neis <[email protected]>
    Commit-Queue: Sathya Gunasekaran <[email protected]>
    Cr-Commit-Position: refs/heads/master@{nodejs#47724}

PR-URL: nodejs#16889
Refs: v8/v8@dbfe4a4
Refs: nodejs#15713
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
This is an initial implementation to support dynamic import in
both scripts and modules. It's off by default since support for
dynamic import is still flagged in V8. Without setting the V8 flag,
this code won't be executed.

This initial version does not support importing into vm contexts.

PR-URL: nodejs#15713
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
currently if you want to use dynamic import you must use both the
`--experimental-modules` and the `--harmony-dynamic-imports` flags.
Chrome is currently shipping dynamic import unflagged, the flag
only remains in V8 to guard embedders who have not set the appropriate
callback from throwing an unhandled rejection when the feature is used.

As such it is reasonable to enable the flag by default for
`--experimental-modules`

PR-URL: nodejs#18387
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jan Krems <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@jkrems
Copy link
Contributor Author

jkrems commented Feb 1, 2018

Added ba3d55a and rebased.

@jkrems
Copy link
Contributor Author

jkrems commented Feb 1, 2018

Had one last idea of what could have gone wrong when patching up the V8 commit: https://ci.nodejs.org/job/node-test-commit-v8-linux/1192/

@jkrems
Copy link
Contributor Author

jkrems commented Feb 1, 2018

test-commit-v8 passes now! 🎉

Regular CI: https://ci.nodejs.org/job/node-test-pull-request/12895/

@MylesBorins Afaict this is good to go now.

@detrohutt
Copy link

@jkrems good work! I see 9.5.0 was just released yesterday. I’ve looked at the node release history and can’t see a pattern to minor releases. Any idea when this may get released now?

@jkrems
Copy link
Contributor Author

jkrems commented Feb 1, 2018

Looks like there's been 9.x release about twice a month. I would suspect that minor releases happen when there "happens" to be semver-minor changes. So, my best guess is that this could be part of a 9.x release in the next 2-3 weeks.

@jkrems jkrems removed the wip Issues and PRs that are still a work in progress. label Feb 7, 2018
MylesBorins pushed a commit that referenced this pull request Feb 20, 2018
Original commit message:

    Introduce ScriptOrModule and HostDefinedOptions

    This patch introduces a new container type ScriptOrModule which
    provides the name and the host defined options of the script/module.

    This patch also introduces a new PrimitivesArray that can hold
    Primitive values, which the embedder can use to store metadata.

    The HostDefinedOptions is passed to V8 through the ScriptOrigin, and
    passed back to the embedder through HostImportModuleDynamically for
    module loading.

    Bug: v8:5785, v8:6658, v8:6683
    Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
    Change-Id: I56c26fc9a680b273ac0a6691e5ad75f15b8dc80a
    Reviewed-on: https://chromium-review.googlesource.com/622158
    Reviewed-by: Adam Klein <[email protected]>
    Reviewed-by: Georg Neis <[email protected]>
    Commit-Queue: Sathya Gunasekaran <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#47724}

Backport-PR-URL: #17823
PR-URL: #16889
Refs: v8/v8@dbfe4a4
Refs: #15713
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 20, 2018
This is an initial implementation to support dynamic import in
both scripts and modules. It's off by default since support for
dynamic import is still flagged in V8. Without setting the V8 flag,
this code won't be executed.

This initial version does not support importing into vm contexts.

Backport-PR-URL: #17823
PR-URL: #15713
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
MylesBorins added a commit that referenced this pull request Feb 20, 2018
currently if you want to use dynamic import you must use both the
`--experimental-modules` and the `--harmony-dynamic-imports` flags.
Chrome is currently shipping dynamic import unflagged, the flag
only remains in V8 to guard embedders who have not set the appropriate
callback from throwing an unhandled rejection when the feature is used.

As such it is reasonable to enable the flag by default for
`--experimental-modules`

Backport-PR-URL: #17823
PR-URL: #18387
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jan Krems <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
@MylesBorins
Copy link
Contributor

landed in 3725d4c...d89f310

@jkrems jkrems deleted the jk-backport-dynamic-import branch February 20, 2018 22:37
MylesBorins pushed a commit that referenced this pull request May 23, 2018
Original commit message:

    Introduce ScriptOrModule and HostDefinedOptions

    This patch introduces a new container type ScriptOrModule which
    provides the name and the host defined options of the script/module.

    This patch also introduces a new PrimitivesArray that can hold
    Primitive values, which the embedder can use to store metadata.

    The HostDefinedOptions is passed to V8 through the ScriptOrigin, and
    passed back to the embedder through HostImportModuleDynamically for
    module loading.

    Bug: v8:5785, v8:6658, v8:6683
    Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
    Change-Id: I56c26fc9a680b273ac0a6691e5ad75f15b8dc80a
    Reviewed-on: https://chromium-review.googlesource.com/622158
    Reviewed-by: Adam Klein <[email protected]>
    Reviewed-by: Georg Neis <[email protected]>
    Commit-Queue: Sathya Gunasekaran <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#47724}

Backport-PR-URL: #17823
PR-URL: #16889
Refs: v8/v8@dbfe4a4
Refs: #15713
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
MylesBorins pushed a commit that referenced this pull request May 23, 2018
This is an initial implementation to support dynamic import in
both scripts and modules. It's off by default since support for
dynamic import is still flagged in V8. Without setting the V8 flag,
this code won't be executed.

This initial version does not support importing into vm contexts.

Backport-PR-URL: #17823
PR-URL: #15713
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
MylesBorins added a commit that referenced this pull request May 23, 2018
currently if you want to use dynamic import you must use both the
`--experimental-modules` and the `--harmony-dynamic-imports` flags.
Chrome is currently shipping dynamic import unflagged, the flag
only remains in V8 to guard embedders who have not set the appropriate
callback from throwing an unhandled rejection when the feature is used.

As such it is reasonable to enable the flag by default for
`--experimental-modules`

Backport-PR-URL: #17823
PR-URL: #18387
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jan Krems <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jun 14, 2018
Original commit message:

    Introduce ScriptOrModule and HostDefinedOptions

    This patch introduces a new container type ScriptOrModule which
    provides the name and the host defined options of the script/module.

    This patch also introduces a new PrimitivesArray that can hold
    Primitive values, which the embedder can use to store metadata.

    The HostDefinedOptions is passed to V8 through the ScriptOrigin, and
    passed back to the embedder through HostImportModuleDynamically for
    module loading.

    Bug: v8:5785, v8:6658, v8:6683
    Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
    Change-Id: I56c26fc9a680b273ac0a6691e5ad75f15b8dc80a
    Reviewed-on: https://chromium-review.googlesource.com/622158
    Reviewed-by: Adam Klein <[email protected]>
    Reviewed-by: Georg Neis <[email protected]>
    Commit-Queue: Sathya Gunasekaran <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#47724}

Backport-PR-URL: #17823
PR-URL: #16889
Refs: v8/v8@dbfe4a4
Refs: #15713
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jun 14, 2018
This is an initial implementation to support dynamic import in
both scripts and modules. It's off by default since support for
dynamic import is still flagged in V8. Without setting the V8 flag,
this code won't be executed.

This initial version does not support importing into vm contexts.

Backport-PR-URL: #17823
PR-URL: #15713
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
MylesBorins added a commit that referenced this pull request Jun 14, 2018
currently if you want to use dynamic import you must use both the
`--experimental-modules` and the `--harmony-dynamic-imports` flags.
Chrome is currently shipping dynamic import unflagged, the flag
only remains in V8 to guard embedders who have not set the appropriate
callback from throwing an unhandled rejection when the feature is used.

As such it is reasonable to enable the flag by default for
`--experimental-modules`

Backport-PR-URL: #17823
PR-URL: #18387
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jan Krems <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
rvagg pushed a commit that referenced this pull request Aug 16, 2018
Original commit message:

    Introduce ScriptOrModule and HostDefinedOptions

    This patch introduces a new container type ScriptOrModule which
    provides the name and the host defined options of the script/module.

    This patch also introduces a new PrimitivesArray that can hold
    Primitive values, which the embedder can use to store metadata.

    The HostDefinedOptions is passed to V8 through the ScriptOrigin, and
    passed back to the embedder through HostImportModuleDynamically for
    module loading.

    Bug: v8:5785, v8:6658, v8:6683
    Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
    Change-Id: I56c26fc9a680b273ac0a6691e5ad75f15b8dc80a
    Reviewed-on: https://chromium-review.googlesource.com/622158
    Reviewed-by: Adam Klein <[email protected]>
    Reviewed-by: Georg Neis <[email protected]>
    Commit-Queue: Sathya Gunasekaran <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#47724}

Backport-PR-URL: #17823
PR-URL: #16889
Refs: v8/v8@dbfe4a4
Refs: #15713
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
rvagg pushed a commit that referenced this pull request Aug 16, 2018
This is an initial implementation to support dynamic import in
both scripts and modules. It's off by default since support for
dynamic import is still flagged in V8. Without setting the V8 flag,
this code won't be executed.

This initial version does not support importing into vm contexts.

Backport-PR-URL: #17823
PR-URL: #15713
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
rvagg pushed a commit that referenced this pull request Aug 16, 2018
currently if you want to use dynamic import you must use both the
`--experimental-modules` and the `--harmony-dynamic-imports` flags.
Chrome is currently shipping dynamic import unflagged, the flag
only remains in V8 to guard embedders who have not set the appropriate
callback from throwing an unhandled rejection when the feature is used.

As such it is reasonable to enable the flag by default for
`--experimental-modules`

Backport-PR-URL: #17823
PR-URL: #18387
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jan Krems <[email protected]>
Reviewed-By: Bradley Farias <[email protected]>
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants