summaryrefslogtreecommitdiff
path: root/core/runtime.rs
AgeCommit message (Collapse)Author
2021-05-19refactor(core): move ModuleMap to separate RefCell (#10656)Bartek Iwańczuk
This commit moves bulk of the logic related to module loading from "JsRuntime" to "ModuleMap". Next steps are to rewrite the actual loading logic (represented by "RecursiveModuleLoad") to be a part of "ModuleMap" as well -- that way we will be able to track multiple module loads from within the map which should help me solve the problem of concurrent loads (since all info about currently loading/loaded modules will be contained in the ModuleMap, so we'll be able to know if actually all required modules have been loaded).
2021-05-06refactor(ops): replace `ZeroCopyBuf` arg by 2nd generic deserializable arg ↵Aaron O'Mullan
(#10448)
2021-05-03fix(core): error registration could pollute constructors (#10422)Aaron O'Mullan
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-04-30refactor(core): provide builtins as an Extension (#10449)Aaron O'Mullan
2021-04-30cleanup(core): replace OpResponse with OpResult (#10434)Aaron O'Mullan
Drop the Value/Buffer enum since #10432 allows buffers to be serialized rust => v8
2021-04-30refactor(core): initialize extensions in runtime constructor (#10421)Aaron O'Mullan
This ensures that provided extensions are all correctly setup and ready to use once the JsRuntime constructor returns Note: this will also initialize ops for to-be-snapshotted runtimes
2021-04-28enable error-on-warning (#10410)Ryan Dahl
Only on linux and osx. Fixes one warning.
2021-04-28core: introduce extensions (#9800)Aaron O'Mullan
Extensions allow declarative extensions to "JsRuntime" (ops, state, JS or middleware). This allows for: - `op_crates` to be plug-and-play & self-contained, reducing complexity leaked to consumers - op middleware (like metrics_op) to be opt-in and for new middleware (unstable, tracing,...) - `MainWorker` and `WebWorker` to be composable, allowing users to extend workers with their ops whilst benefiting from the other infrastructure (inspector, etc...) In short extensions improve deno's modularity, reducing complexity and leaky abstractions for embedders and the internal codebase.
2021-04-28refactor(core): simplify module loading code (#10385)Bartek Iwańczuk
General cleanup of module loading code, tried to reduce indentation in various methods on "JsRuntime" to improve readability. Added "JsRuntime::handle_scope" helper function, which returns a "v8::HandleScope". This was done to reduce a code pattern that happens all over the "deno_core". Additionally if event loop hangs during loading of dynamic modules a list of currently pending dynamic imports is printed.
2021-04-26feat(core): enable wasm threading support (#10116)Casper Beyer
2021-04-26remove #![deny(warnings)] (#10376)Ryan Dahl
Prefer RUSTFLAGS="-D warnings" to prevent warnings, but cannot enable yet due to #10378.
2021-04-25refactor(core): move op cache sync responsibility to rust space (#10340)Aaron O'Mullan
Even if bootstrapping the JS runtime is low level, it's an abstraction leak of core to require users to call `Deno.core.ops()` in JS space. So instead we're introducing a `JsRuntime::sync_ops_cache()` method, once we have runtime extensions a new runtime will ensure the ops cache is setup (for the provided extensions) and then loading/unloading plugins should be the only operations that require op cache syncs
2021-04-25feat(core): allow async opcalls in snapshots (#10308)Aaron O'Mullan
2021-04-23refactor(core): rename send() to opcall() (#10307)Aaron O'Mullan
I think it's a better fit since recv() was killed and opcall <> syscall (send/recv was too reminiscent of request/response and custom payloads)
2021-04-23chore: remove dead code (#10321)Ryan Dahl
2021-04-21refactor(core): kill recv() and init() (#10299)Aaron O'Mullan
`init()` was previously needed to init the shared queue, but now that it's gone `init()` only registers the async msg handler which is snapshot safe and constant since the op layer refactor.
2021-04-13fix(core): remove wasm-test-streaming flag (#10158)Casper Beyer
2021-04-12perf(core/ops): avoid allocs when returning primitives (#10149)Aaron O'Mullan
2021-04-12core: remove some unnecessary heap allocationsBen Noordhuis
2021-04-12core: let embedders plug in their own V8 platformBen Noordhuis
Fixes #9912.
2021-04-12refactor(deno): remove concept of bin & json ops (#10145)Aaron O'Mullan
2021-04-11core: avoid async op future reboxing to bundle PromiseId (#10123)Aaron O'Mullan
2021-04-04fix: Properly await already evaluating dynamic imports (#9984)Nayeem Rahman
2021-04-04perf(serde_v8): introduce Serializable boxable object (#9983)Aaron O'Mullan
2021-04-03refactor: don't call Context::Global in async_op_response (#9971)Ryan Dahl
2021-03-31refactor: new optimized op-layer using serde_v8 (#9843)Aaron O'Mullan
- Improves op performance. - Handle op-metadata (errors, promise IDs) explicitly in the op-layer vs per op-encoding (aka: out-of-payload). - Remove shared queue & custom "asyncHandlers", all async values are returned in batches via js_recv_cb. - The op-layer should be thought of as simple function calls with little indirection or translation besides the conceptually straightforward serde_v8 bijections. - Preserve concepts of json/bin/min as semantic groups of their inputs/outputs instead of their op-encoding strategy, preserving these groups will also facilitate partial transitions over to v8 Fast API for the "min" and "bin" groups
2021-03-26remove macro_use (#9884)Ryan Dahl
2021-03-25upgrade: Rust 1.51.0 (#9895)Yusuke Tanaka
2021-03-12refactor: simplify icu data alignment (#9766)Ben Noordhuis
2021-03-10upgrade: rusty_v8 0.21.0 (#9725)Ryan Dahl
2021-03-08fix(core): shared queue assertion failure in case of js error (#9721)Inteon
In case JavaScript throws an unhandled error, part of the "shared_queue" could be still unprocessed. If this is the case; throw the js runtime error instead of asserting on the queue size not being 0.
2021-03-04fix(runtime/web_worker): Don't block self.onmessage with TLA (#9619)Nayeem Rahman
This commit rewrites implementation of "JsRuntime::mod_evaluate". Event loop is no longer polled automatically and users must manually drive event loop forward after calling "mod_evaluate". Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-02-23refactor(core): cleanup module implementation (#9580)Bartek Iwańczuk
* remove "ModuleNameMap", instead define that map inline inside "Modules" struct * remove "dyn_import_id" argument from "mod_instantiate" * rename "Modules" struct to "ModuleMap" * rename "JsRuntime::modules" to "JsRuntime::module_map"
2021-02-23refactor(core): Allow multiple overflown responses in single poll (#9433)Inteon
This commit rewrites "JsRuntime::poll" function to fix a corner case that might caused "overflown_response" to be overwritten by other overflown response. The logic has been changed to allow returning multiple overflown response alongside responses from shared queue.
2021-02-20fix(core/runtime): Fix dynamic imports for already rejected modules (#9559)Nayeem Rahman
2021-02-19fix(core): Make dynamic import async errors catchable (#9505)Nayeem Rahman
Fixes #6259
2021-02-17Make ModuleSpecifier a type alias, not wrapper struct (#9531)Ryan Dahl
2021-02-16feat: add structured cloning to Deno.core (#9458)Inteon
This commit adds two new "Deno.core" APIs: - "Deno.core.serialize" - "Deno.core.deserialize" These APIs are used to provide structured cloning of values and will be used for further web worker implementation. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-02-15upgrade: rusty_v8 0.19.0 (#9466)Bartek Iwańczuk
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2021-02-09chore: add flag to v8 (#9456)Bartek Iwańczuk
2021-01-11chore: Move comment to correct place (#9086)Ryan Dahl
2021-01-10update copyright to 2021 (#9081)Ryan Dahl
2021-01-07 ignore "use asm" (#9019)Anonymous
Preventing V8 from logging erroneous line numbers. Use wasm.
2021-01-05refactor(core): simplify Deno.core initialisation, remove stale TODO (#8847)Bartek Iwańczuk
This commit rewrites initialisation of the "shared queue" and in effect prevents from double execution of "core/core.js" and "core/error.js". Previously both of these files were executed every time a "JsRuntime" was created. That lead to a situation where one copy of each script was included in the snapshot and then another copy would be executed after loading the snapshot. Effectively "JsRuntime::shared_init" was removed; instead execution of those scripts and actual initialisation of shared queue was split into two helper functions: "JsRuntime::js_init" and "JsRuntime::share_queue_init". Additionally stale TODO comments were removed.
2020-12-28upgrade: rusty_v8 0.15.0, v8 8.8.294 (#8898)Bartek Iwańczuk
2020-12-20Revert "fix: TLA in web worker (#8809)" (#8839)Bartek Iwańczuk
This reverts commit e924bbdf3606e83ff9eef3a8ed640c4ecc34444f.
2020-12-20fix: TLA in web worker (#8809)Bartek Iwańczuk
Implementors of `deno_core::JsRuntime` might want to do additional actions during each turn of event loop, eg. `deno_runtime::Worker` polls inspector, `deno_runtime::WebWorker` receives/dispatches messages from/to worker host. Previously `JsRuntime::mod_evaluate` was implemented in such fashion that it only polled `JsRuntime`'s event loop. This behavior turned out to be wrong in the example of `WebWorker` which couldn't receive/dispatch messages because its implementation of event loop was never called. This commit rewrites "mod_evaluate" to return a handle to receiver that resolves when module's promise resolves. It is now implementors responsibility to poll event loop after calling `mod_evaluate`.
2020-12-11refactor(cli): decouple ops from ProgramState and Flags (#8659)Bartek Iwańczuk
This commit does major refactor of "Worker" and "WebWorker", in order to decouple them from "ProgramState" and "Flags". The main points of interest are "create_main_worker()" and "create_web_worker_callback()" functions which are responsible for creating "Worker" and "WebWorker" in CLI context. As a result it is now possible to factor out common "runtime" functionality into a separate crate.
2020-12-10refactor(core): stack trace mapping (#8660)Bartek Iwańczuk
This commit adds "Deno.core.createPrepareStackTrace". This function was moved from "cli/rt/40_error_stack.js" to unify handling of stack frames in core (before this PR there was implicit dependency on logic in "core/error.rs::JsError"). Unfortunately formatting logic must still be duplicated in "cli/error.js::PrettyJsError" to provide coloring, but currently there's no solution to this problem. "createPrepareStackTrace" can accept a single argument; a function that takes a location and provides source mapped location back.
2020-12-08refactor(core): change script name for core.js (#8650)Bartek Iwańczuk
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>