| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
Sorry, something went wrong.
|
It seems like the build failure on v22.x-staging branch is caused by #59960 |
Sorry, something went wrong.
There are two phases in module linking: link, and instantiate. These two operations are required to be separated to allow cyclic dependencies. `v8::Module::InstantiateModule` is only required to be invoked on the root module. The global references created by `ModuleWrap::Link` are only cleared at `ModuleWrap::Instantiate`. So the global references created for depended modules are usually not cleared because `ModuleWrap::Instantiate` is not invoked for each of depended modules, and caused memory leak. The change references the linked modules in an object internal slot. This is not an issue for Node.js ESM support as these modules can not be off-loaded. However, this could be outstanding for `vm.Module`. PR-URL: nodejs#59117 Fixes: nodejs#50113 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This allows overriding linked requests for a `ModuleWrap`. The `statusOverride` in `vm.SourceTextModule` could call `moduleWrap.link` a second time when `statusOverride` of `linking` is set to undefined. Overriding of linked requests should be no harm but better to be avoided. However, this will require a follow-up fix on `statusOverride` in `vm.SourceTextModule`. PR-URL: nodejs#59527 Fixes: nodejs#59480 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Split `module.link(linker)` into two synchronous step `sourceTextModule.linkRequests()` and `sourceTextModule.instantiate()`. This allows creating vm modules and resolving the dependencies in a complete synchronous procedure. This also makes `syntheticModule.link()` redundant. The link step for a SyntheticModule is no-op and is already taken care in the constructor by initializing the binding slots with the given export names. PR-URL: nodejs#59000 Refs: nodejs#37648 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Sorry, something went wrong.
There are two phases in module linking: link, and instantiate. These two operations are required to be separated to allow cyclic dependencies. `v8::Module::InstantiateModule` is only required to be invoked on the root module. The global references created by `ModuleWrap::Link` are only cleared at `ModuleWrap::Instantiate`. So the global references created for depended modules are usually not cleared because `ModuleWrap::Instantiate` is not invoked for each of depended modules, and caused memory leak. The change references the linked modules in an object internal slot. This is not an issue for Node.js ESM support as these modules can not be off-loaded. However, this could be outstanding for `vm.Module`. PR-URL: #59117 Backport-PR-URL: #60152 Fixes: #50113 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This allows overriding linked requests for a `ModuleWrap`. The `statusOverride` in `vm.SourceTextModule` could call `moduleWrap.link` a second time when `statusOverride` of `linking` is set to undefined. Overriding of linked requests should be no harm but better to be avoided. However, this will require a follow-up fix on `statusOverride` in `vm.SourceTextModule`. PR-URL: #59527 Backport-PR-URL: #60152 Fixes: #59480 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Split `module.link(linker)` into two synchronous step `sourceTextModule.linkRequests()` and `sourceTextModule.instantiate()`. This allows creating vm modules and resolving the dependencies in a complete synchronous procedure. This also makes `syntheticModule.link()` redundant. The link step for a SyntheticModule is no-op and is already taken care in the constructor by initializing the binding slots with the given export names. PR-URL: #59000 Backport-PR-URL: #60152 Refs: #37648 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
| Back | FazBrowse Home | New Git URL |
src: clear all linked module caches once instantiated
There are two phases in module linking: link, and instantiate. These
two operations are required to be separated to allow cyclic
dependencies.
v8::Module::InstantiateModule is only required to be invoked on the
root module. The global references created by ModuleWrap::Link are
only cleared at ModuleWrap::Instantiate. So the global references
created for depended modules are usually not cleared because
ModuleWrap::Instantiate is not invoked for each of depended modules,
and caused memory leak.
The change references the linked modules in an object internal slot.
This is not an issue for Node.js ESM support as these modules can not be
off-loaded. However, this could be outstanding for vm.Module.
PR-URL: #59117
Fixes: #50113
Reviewed-By: Joyee Cheung joyeec9h3@gmail.com
Reviewed-By: Matteo Collina matteo.collina@gmail.com
module: allow overriding linked requests for a ModuleWrap
This allows overriding linked requests for a ModuleWrap. The
statusOverride in vm.SourceTextModule could call moduleWrap.link
a second time when statusOverride of linking is set to undefined.
Overriding of linked requests should be no harm but better to be
avoided. However, this will require a follow-up fix on statusOverride
in vm.SourceTextModule.
PR-URL: #59527
Fixes: #59480
Reviewed-By: Joyee Cheung joyeec9h3@gmail.com
Reviewed-By: Marco Ippolito marcoippolito54@gmail.com
vm: sync-ify SourceTextModule linkage
Split module.link(linker) into two synchronous step
sourceTextModule.linkRequests() and
sourceTextModule.instantiate(). This allows creating vm modules and
resolving the dependencies in a complete synchronous procedure.
This also makes syntheticModule.link() redundant. The link step for a
SyntheticModule is no-op and is already taken care in the constructor
by initializing the binding slots with the given export names.
PR-URL: #59000
Refs: #37648
Reviewed-By: Joyee Cheung joyeec9h3@gmail.com