profile
viewpoint

PR opened denoland/deno

feat: top level namespace for ops registry

This isn't really needed, but I think that it's a nice feature, and should eliminate the need to worry about overlap in registered op names. I know something similar could be achieved with code like this

fn init(i: Isolate, n: &str) {
  i.register_op(format!({}_{}, n, "someOpName"), op_some_op_name);
}

but I think that it would be better if we standardized on something more like this

fn init(i: Isolate, n: &str) {
  i.register_op(n, "someOpName", op_some_op_name);
}

On the js side things are pretty simple. Deno.core.ops()["someOp"] becomes Deno.core.ops()["someNamespace"]["someOp"] and this should leave plenty of room for namespace aliases.

ns = Deno.core.ops()["someNamespace"]; 
someOpId = ns["someOp"]

cc @ry @bartlomieju

+33 -16

0 comment

4 changed files

pr created time in 15 days

push eventafinch7/deno

afinch7

commit sha b5a4c706f885799c2cb27c3ae9fa33f63fd98479

added namespace to ops registry

view details

push time in 15 days

create barnchafinch7/deno

branch : ops_registry_namespace

created branch time in 15 days

Pull request review commentdenoland/deno

WIP a prototype crate design for ops

+const OP_HELLO: number = Deno.ops.add("hello");

In hindsight I think that hash lookup is fine, and I think my testing was flawed when I originally tested performance with a similar api.

ry

comment created time in 17 days

Pull request review commentdenoland/deno

WIP a prototype crate design for ops

+// TODO  We need some way to import test modules.+// Attempt one:+//+//   import { test } from "../../js/test_util.ts";+//+// Here it is referencing files across crate boundaries, which will break+// 'cargo package' and means the crate is not useable outside the deno tree.+// This might be okay for a first pass, but it's not the best solution.+//+// Attempt two:+// we invent a new URL for referencing files in other crates.+// this is magic and not browser compatible.. Browser compatibility for+// ops is not so important.+import { test } from "crate://deno_std@0.19.0/testing/mod.ts";

This looks good. It's very nice that all the relevant info is encoded into standard elements of the url structure. No need to design fancy parsing.

ry

comment created time in 17 days

create barnchafinch7/deno_third_party

branch : add_dlopen_and_futures_preview

created branch time in 21 days

Pull request review commentbartlomieju/deno-specs

Dispatch and native plugins spec

-# Dispatch+# Deno op dispatch and native plugins++## Overview+Deno dispatch system is based on `Deno.core.send(opId: number, control: null | ArrayBufferView, data?: ArrayBufferView)` - a function that passes messages from JS to Rust and executes function described with `opId`. Message passing is done using so-called "shared queue", which for now has served it's purpose well. As of Deno v0.18.0 all ops dispatching logic is hardcoded.+The `opId` which identifies the op and its dispatcher is a number that is shared between TypeScript and Rust.++## Problem+This solution is very simple and quite efficient, however has several shortcomings that need to be addressed+to expose native plugins API to users;+1. `OpId` has to be manually synchronized between TS and Rust. For current situation where we have about 60 ops it's not+that bad, but surely we'll be cumbersome as number of ops grows.+2. There is no way to add new op programatically. Op has be to registered in code manually before compilation, which+prevents users from adding new ops from their' code.+3. Op and its dispatcher are very tightly coupled. There still be tight coupling between op and it's dispatcher (you can't easily write op that will work with both "minimal" and "json" dispatcher), but it should be done using a simple API instead of manually writing closures.+4. Code for ops lives in 2 different places. TS code for ops currently lives in `//js/` while Rust code lives in `//cli/ops/`. Ideally we'd like to have `//ops` directory that will contain both TS and Rust code (eg. `//ops/fs/main.ts` and `//ops/fs/mod.ts` as entry points).++## Nomenclature+- `dispatch` - main method used to call into Rust code from JS. See `Isolate::set_dispatch` method.+- `dispatcher` - an abstract construct that is called from `dispatch`. It's aware of serialization method ("minimal", "json") and sets contract for `op handler`.+- `op`/`op handler` - a function that performs some actual work, eg. "read"/"write"/"dial". `Op` has to be used with a `dispatcher` that knows how to transform result of that `op` into `CoreOp`.+- `CoreOp` - fundamental type that describes how Rust code can return value to JS.++## Requirements+1. Minimal or no changes to `Deno.core` and shared queue infrastructure.+1. New system must be FAST (at least as fast as current solution, preferably faster).+1. Ops should have access to permission APIs (TODO: can permissions be forced upon plugins/ops?)+1. Op handler signature shouldn't depend on `ThreadSafeState` because it's `deno_cli` concept.+1. Ability to register new `dispatcher` with custom serialization method (eg. "msgpack").+1. Ability to register new `op` statically (before build).+1. No hardcoded `opIds` - after registration of an op, during startup Rust sends an "op map" that is a dictonary mapping op names to op ids.+1. Ability to register new `op` dynamically (from JS code), loading some Rust code (as dynamic library?). This functionality can be exposed as another op - `op_register_new_op`.+1. Ability to register an `op` multiple times. Say I have some native plugin that requires "read" op, but I'm not sure that host will have "read" available. So I register the op in my library setup code (potentially with namespace of my plugin).+1. Both static and dynamic op registration should be as simple as possible.+++## Proposed implementation++#### @afinch7+In [#2840](https://github.com/denoland/deno/pull/2840) there's a complete solution.++Pros:+- elegant API for registration of ops in TS+```ts+const OP_CHDIR = new JsonOp(opNamespace, "chdir");++export function chdir(directory: string): void {+  OP_CHDIR.sendSync({ directory });+}+```++It might need a little tweaking as each op would create a closure, but that has to verified experimentally.++- nice code organization++All code (both Rust and TS) related to `fs` lives inside `//ops/fs` crate.  ++Cons:+- lazy double lookup for op

I guess it also prevents overlapping registrations, but if you look at dispatch_op we only reference op_dis_registry(https://github.com/denoland/deno/blob/9ee33c7a546fcc5af4121925396980897d49d218/core/op_dispatchers.rs#L165-L179). Js side gets notified of the new op id during register_op(https://github.com/denoland/deno/blob/9ee33c7a546fcc5af4121925396980897d49d218/core/op_dispatchers.rs#L157-L161).

bartlomieju

comment created time in a month

Pull request review commentbartlomieju/deno-specs

Dispatch and native plugins spec

-# Dispatch+# Deno op dispatch and native plugins++## Overview+Deno dispatch system is based on `Deno.core.send(opId: number, control: null | ArrayBufferView, data?: ArrayBufferView)` - a function that passes messages from JS to Rust and executes function described with `opId`. Message passing is done using so-called "shared queue", which for now has served it's purpose well. As of Deno v0.18.0 all ops dispatching logic is hardcoded.+The `opId` which identifies the op and its dispatcher is a number that is shared between TypeScript and Rust.++## Problem+This solution is very simple and quite efficient, however has several shortcomings that need to be addressed+to expose native plugins API to users;+1. `OpId` has to be manually synchronized between TS and Rust. For current situation where we have about 60 ops it's not+that bad, but surely we'll be cumbersome as number of ops grows.+2. There is no way to add new op programatically. Op has be to registered in code manually before compilation, which+prevents users from adding new ops from their' code.+3. Op and its dispatcher are very tightly coupled. There still be tight coupling between op and it's dispatcher (you can't easily write op that will work with both "minimal" and "json" dispatcher), but it should be done using a simple API instead of manually writing closures.+4. Code for ops lives in 2 different places. TS code for ops currently lives in `//js/` while Rust code lives in `//cli/ops/`. Ideally we'd like to have `//ops` directory that will contain both TS and Rust code (eg. `//ops/fs/main.ts` and `//ops/fs/mod.ts` as entry points).++## Nomenclature+- `dispatch` - main method used to call into Rust code from JS. See `Isolate::set_dispatch` method.+- `dispatcher` - an abstract construct that is called from `dispatch`. It's aware of serialization method ("minimal", "json") and sets contract for `op handler`.+- `op`/`op handler` - a function that performs some actual work, eg. "read"/"write"/"dial". `Op` has to be used with a `dispatcher` that knows how to transform result of that `op` into `CoreOp`.+- `CoreOp` - fundamental type that describes how Rust code can return value to JS.++## Requirements+1. Minimal or no changes to `Deno.core` and shared queue infrastructure.+1. New system must be FAST (at least as fast as current solution, preferably faster).+1. Ops should have access to permission APIs (TODO: can permissions be forced upon plugins/ops?)+1. Op handler signature shouldn't depend on `ThreadSafeState` because it's `deno_cli` concept.+1. Ability to register new `dispatcher` with custom serialization method (eg. "msgpack").+1. Ability to register new `op` statically (before build).+1. No hardcoded `opIds` - after registration of an op, during startup Rust sends an "op map" that is a dictonary mapping op names to op ids.+1. Ability to register new `op` dynamically (from JS code), loading some Rust code (as dynamic library?). This functionality can be exposed as another op - `op_register_new_op`.+1. Ability to register an `op` multiple times. Say I have some native plugin that requires "read" op, but I'm not sure that host will have "read" available. So I register the op in my library setup code (potentially with namespace of my plugin).+1. Both static and dynamic op registration should be as simple as possible.+++## Proposed implementation++#### @afinch7+In [#2840](https://github.com/denoland/deno/pull/2840) there's a complete solution.++Pros:+- elegant API for registration of ops in TS+```ts+const OP_CHDIR = new JsonOp(opNamespace, "chdir");++export function chdir(directory: string): void {+  OP_CHDIR.sendSync({ directory });+}+```++It might need a little tweaking as each op would create a closure, but that has to verified experimentally.++- nice code organization++All code (both Rust and TS) related to `fs` lives inside `//ops/fs` crate.  ++Cons:+- lazy double lookup for op++```rust+pub trait OpDispatcher: Send + Sync {+  fn dispatch(&self, args: &[u8], buf: Option<PinnedBuf>) -> CoreOp;+}++type OpDispatcherRegistry = Vec<Option<Arc<Box<dyn OpDispatcher>>>>;++pub struct OpDisReg {+  // Quick lookups by unique "op id"/"resource id"+  // The main goal of op_dis_registry is to perform lookups as fast+  // as possible at all times.+  op_dis_registry: RwLock<OpDispatcherRegistry>,+  next_op_dis_id: AtomicU32,+  // Serves as "phone book" for op_dis_registry+  // This should only be referenced for initial lookups. It isn't+  // possible to achieve the level of perfromance we want if we+  // have to query this for every dispatch, but it may be needed+  // to build caches for subseqent lookups.+  op_dis_id_registry: RwLock<HashMap<String, HashMap<&'static str, OpId>>>,+  notifier_reg: RwLock<NotifyerReg>,+}+```+There are essentialy two maps for ops, one for initial lookup to establish `dispatcher`/`op_handler` pair and put it into second registry, that is used for all subsequent calls (`OpDispatcherRegistry`).++- each op is a trait++This leads for a lot of boilerplate code, where we essentialy have an empty structure that must implement a trait.++```rust+pub struct OpChmod;++#[derive(Deserialize)]+#[serde(rename_all = "camelCase")]+struct ChmodArgs {+  promise_id: Option<u64>,+  path: String,+  mode: u32,+}++impl FsOpDispatcher for OpChmod {+  fn dispatch(+    &self,+    state: &TSFsOpsState,+    control: &[u8],+    buf: Option<PinnedBuf>,+  ) -> CoreOp {+    wrap_json_op(+      move |args, _zero_copy| {+        let args: ChmodArgs = serde_json::from_value(args)?;+        let (path, path_) = deno_fs::resolve_from_cwd(args.path.as_ref())?;++        state.check_write(&path_)?;++        let is_sync = args.promise_id.is_none();+        blocking_json(is_sync, move || {+          debug!("op_chmod {}", &path_);+          // Still check file/dir exists on windows+          let _metadata = fs::metadata(&path).map_err(FsOpError::from)?;+          #[cfg(any(unix))]+          {+            let mut permissions = _metadata.permissions();+            permissions.set_mode(args.mode);+            fs::set_permissions(&path, permissions).map_err(FsOpError::from)?;+          }+          Ok(json!({}))+        })+      },+      control,+      buf,+    )+  }++  const NAME: &'static str = "chmod";+}+```+- a bit magical loading of TS code++A concept of "import map" (not import maps we have implemented in Deno tho!) is used to map bare specifier to path of .ts file inside the crate. Eg. "deno_op_fs" is mapped to "bundle/main.ts" in "ops_fs" crate.++- "op listeners"++After registration of a new op a bunch of listener methods is called to reset the ids of all ops. I believe this can be refactored to encapsulate this logic in `JsonOp` (presented in "pros" section) and ultimately

Yes.

bartlomieju

comment created time in a month

Pull request review commentbartlomieju/deno-specs

Dispatch and native plugins spec

-# Dispatch+# Deno op dispatch and native plugins++## Overview+Deno dispatch system is based on `Deno.core.send(opId: number, control: null | ArrayBufferView, data?: ArrayBufferView)` - a function that passes messages from JS to Rust and executes function described with `opId`. Message passing is done using so-called "shared queue", which for now has served it's purpose well. As of Deno v0.18.0 all ops dispatching logic is hardcoded.+The `opId` which identifies the op and its dispatcher is a number that is shared between TypeScript and Rust.++## Problem+This solution is very simple and quite efficient, however has several shortcomings that need to be addressed+to expose native plugins API to users;+1. `OpId` has to be manually synchronized between TS and Rust. For current situation where we have about 60 ops it's not+that bad, but surely we'll be cumbersome as number of ops grows.+2. There is no way to add new op programatically. Op has be to registered in code manually before compilation, which+prevents users from adding new ops from their' code.+3. Op and its dispatcher are very tightly coupled. There still be tight coupling between op and it's dispatcher (you can't easily write op that will work with both "minimal" and "json" dispatcher), but it should be done using a simple API instead of manually writing closures.+4. Code for ops lives in 2 different places. TS code for ops currently lives in `//js/` while Rust code lives in `//cli/ops/`. Ideally we'd like to have `//ops` directory that will contain both TS and Rust code (eg. `//ops/fs/main.ts` and `//ops/fs/mod.ts` as entry points).++## Nomenclature+- `dispatch` - main method used to call into Rust code from JS. See `Isolate::set_dispatch` method.+- `dispatcher` - an abstract construct that is called from `dispatch`. It's aware of serialization method ("minimal", "json") and sets contract for `op handler`.+- `op`/`op handler` - a function that performs some actual work, eg. "read"/"write"/"dial". `Op` has to be used with a `dispatcher` that knows how to transform result of that `op` into `CoreOp`.+- `CoreOp` - fundamental type that describes how Rust code can return value to JS.++## Requirements+1. Minimal or no changes to `Deno.core` and shared queue infrastructure.+1. New system must be FAST (at least as fast as current solution, preferably faster).+1. Ops should have access to permission APIs (TODO: can permissions be forced upon plugins/ops?)+1. Op handler signature shouldn't depend on `ThreadSafeState` because it's `deno_cli` concept.+1. Ability to register new `dispatcher` with custom serialization method (eg. "msgpack").+1. Ability to register new `op` statically (before build).+1. No hardcoded `opIds` - after registration of an op, during startup Rust sends an "op map" that is a dictonary mapping op names to op ids.+1. Ability to register new `op` dynamically (from JS code), loading some Rust code (as dynamic library?). This functionality can be exposed as another op - `op_register_new_op`.+1. Ability to register an `op` multiple times. Say I have some native plugin that requires "read" op, but I'm not sure that host will have "read" available. So I register the op in my library setup code (potentially with namespace of my plugin).+1. Both static and dynamic op registration should be as simple as possible.+++## Proposed implementation++#### @afinch7+In [#2840](https://github.com/denoland/deno/pull/2840) there's a complete solution.++Pros:+- elegant API for registration of ops in TS+```ts+const OP_CHDIR = new JsonOp(opNamespace, "chdir");++export function chdir(directory: string): void {+  OP_CHDIR.sendSync({ directory });+}+```++It might need a little tweaking as each op would create a closure, but that has to verified experimentally.++- nice code organization++All code (both Rust and TS) related to `fs` lives inside `//ops/fs` crate.  ++Cons:+- lazy double lookup for op

Not sure what is meant here? op_dis_id_registry is just gives a way to do a manual lookup of the op id from the rust side. This isn't normally something that is used other than for testing.

bartlomieju

comment created time in a month

Pull request review commentbartlomieju/deno-specs

Dispatch and native plugins spec

-# Dispatch+# Deno op dispatch and native plugins++## Overview+Deno dispatch system is based on `Deno.core.send(opId: number, control: null | ArrayBufferView, data?: ArrayBufferView)` - a function that passes messages from JS to Rust and executes function described with `opId`. Message passing is done using so-called "shared queue", which for now has served it's purpose well. As of Deno v0.18.0 all ops dispatching logic is hardcoded.+The `opId` which identifies the op and its dispatcher is a number that is shared between TypeScript and Rust.++## Problem+This solution is very simple and quite efficient, however has several shortcomings that need to be addressed+to expose native plugins API to users;+1. `OpId` has to be manually synchronized between TS and Rust. For current situation where we have about 60 ops it's not+that bad, but surely we'll be cumbersome as number of ops grows.+2. There is no way to add new op programatically. Op has be to registered in code manually before compilation, which+prevents users from adding new ops from their' code.+3. Op and its dispatcher are very tightly coupled. There still be tight coupling between op and it's dispatcher (you can't easily write op that will work with both "minimal" and "json" dispatcher), but it should be done using a simple API instead of manually writing closures.+4. Code for ops lives in 2 different places. TS code for ops currently lives in `//js/` while Rust code lives in `//cli/ops/`. Ideally we'd like to have `//ops` directory that will contain both TS and Rust code (eg. `//ops/fs/main.ts` and `//ops/fs/mod.ts` as entry points).++## Nomenclature+- `dispatch` - main method used to call into Rust code from JS. See `Isolate::set_dispatch` method.+- `dispatcher` - an abstract construct that is called from `dispatch`. It's aware of serialization method ("minimal", "json") and sets contract for `op handler`.+- `op`/`op handler` - a function that performs some actual work, eg. "read"/"write"/"dial". `Op` has to be used with a `dispatcher` that knows how to transform result of that `op` into `CoreOp`.+- `CoreOp` - fundamental type that describes how Rust code can return value to JS.++## Requirements+1. Minimal or no changes to `Deno.core` and shared queue infrastructure.+1. New system must be FAST (at least as fast as current solution, preferably faster).+1. Ops should have access to permission APIs (TODO: can permissions be forced upon plugins/ops?)+1. Op handler signature shouldn't depend on `ThreadSafeState` because it's `deno_cli` concept.+1. Ability to register new `dispatcher` with custom serialization method (eg. "msgpack").+1. Ability to register new `op` statically (before build).+1. No hardcoded `opIds` - after registration of an op, during startup Rust sends an "op map" that is a dictonary mapping op names to op ids.+1. Ability to register new `op` dynamically (from JS code), loading some Rust code (as dynamic library?). This functionality can be exposed as another op - `op_register_new_op`.+1. Ability to register an `op` multiple times. Say I have some native plugin that requires "read" op, but I'm not sure that host will have "read" available. So I register the op in my library setup code (potentially with namespace of my plugin).+1. Both static and dynamic op registration should be as simple as possible.+++## Proposed implementation++#### @afinch7+In [#2840](https://github.com/denoland/deno/pull/2840) there's a complete solution.++Pros:+- elegant API for registration of ops in TS+```ts+const OP_CHDIR = new JsonOp(opNamespace, "chdir");++export function chdir(directory: string): void {+  OP_CHDIR.sendSync({ directory });+}+```++It might need a little tweaking as each op would create a closure, but that has to verified experimentally.++- nice code organization++All code (both Rust and TS) related to `fs` lives inside `//ops/fs` crate.  ++Cons:+- lazy double lookup for op++```rust+pub trait OpDispatcher: Send + Sync {+  fn dispatch(&self, args: &[u8], buf: Option<PinnedBuf>) -> CoreOp;+}++type OpDispatcherRegistry = Vec<Option<Arc<Box<dyn OpDispatcher>>>>;++pub struct OpDisReg {+  // Quick lookups by unique "op id"/"resource id"+  // The main goal of op_dis_registry is to perform lookups as fast+  // as possible at all times.+  op_dis_registry: RwLock<OpDispatcherRegistry>,+  next_op_dis_id: AtomicU32,+  // Serves as "phone book" for op_dis_registry+  // This should only be referenced for initial lookups. It isn't+  // possible to achieve the level of perfromance we want if we+  // have to query this for every dispatch, but it may be needed+  // to build caches for subseqent lookups.+  op_dis_id_registry: RwLock<HashMap<String, HashMap<&'static str, OpId>>>,+  notifier_reg: RwLock<NotifyerReg>,+}+```+There are essentialy two maps for ops, one for initial lookup to establish `dispatcher`/`op_handler` pair and put it into second registry, that is used for all subsequent calls (`OpDispatcherRegistry`).++- each op is a trait++This leads for a lot of boilerplate code, where we essentialy have an empty structure that must implement a trait.++```rust+pub struct OpChmod;++#[derive(Deserialize)]+#[serde(rename_all = "camelCase")]+struct ChmodArgs {+  promise_id: Option<u64>,+  path: String,+  mode: u32,+}++impl FsOpDispatcher for OpChmod {+  fn dispatch(+    &self,+    state: &TSFsOpsState,+    control: &[u8],+    buf: Option<PinnedBuf>,+  ) -> CoreOp {+    wrap_json_op(+      move |args, _zero_copy| {+        let args: ChmodArgs = serde_json::from_value(args)?;+        let (path, path_) = deno_fs::resolve_from_cwd(args.path.as_ref())?;++        state.check_write(&path_)?;++        let is_sync = args.promise_id.is_none();+        blocking_json(is_sync, move || {+          debug!("op_chmod {}", &path_);+          // Still check file/dir exists on windows+          let _metadata = fs::metadata(&path).map_err(FsOpError::from)?;+          #[cfg(any(unix))]+          {+            let mut permissions = _metadata.permissions();+            permissions.set_mode(args.mode);+            fs::set_permissions(&path, permissions).map_err(FsOpError::from)?;+          }+          Ok(json!({}))+        })+      },+      control,+      buf,+    )+  }++  const NAME: &'static str = "chmod";+}+```+- a bit magical loading of TS code++A concept of "import map" (not import maps we have implemented in Deno tho!) is used to map bare specifier to path of .ts file inside the crate. Eg. "deno_op_fs" is mapped to "bundle/main.ts" in "ops_fs" crate.++- "op listeners"++After registration of a new op a bunch of listener methods is called to reset the ids of all ops. I believe this can be refactored to encapsulate this logic in `JsonOp` (presented in "pros" section) and ultimately

"resets" only happen when replacing the dispatcher registry of the isolate by calling set_dispatcher_registry.

bartlomieju

comment created time in a month

push eventafinch7/deno

Ryan Dahl

commit sha 49aea7abbc6260cf1974233e96933bd306ce53c0

Minor fixes in tools/ (#2906) * Fix tools/docs.py * Remove dead code: sync_rust_crates.py

view details

Ryan Dahl

commit sha 8f171c101a69f63cacd74a08e31e976f958ad0df

Appveyor: Add target/release to cache, like travis (#2899)

view details

Ryan Dahl

commit sha dd70d8622b8d3fb2064a6540f89a3632941cf37e

Upgrade V8 to 7.9.8 (#2907) //build was updated and our patch rebased: https://github.com/denoland/chromium_build/tree/20190910_win_clang_depfile V8 has removed the binaries third_party/v8/buildtools/*/gn.sha1 and started using CIPD. In this patch, I've hacked in the original .sha1 files and continue to use download_from_google_storage instead of the new CIPD. This will be fixed in later work.

view details

Nayeem Rahman

commit sha 749ada608e23abb435e08f30667d3bd221c227a6

Don't test resolve_from_cwd_absolute() on Windows (#2911)

view details

Bert Belder

commit sha df5b6cdd7ff6ca3ee1814e5911fdae67b8b4fc60

Remove error message mentioning build.py

view details

Bartek Iwańczuk

commit sha a4e1d7d2e750831a1891b9267c8585a3e90083af

fix: type directives import (#2910)

view details

Bartek Iwańczuk

commit sha 85c51404aed21813df34c518a00c52a564d6fc69

feat: Set user agent for http client (#2916)

view details

Nayeem Rahman

commit sha a1976236d97c12ee2ba305d5a1cf435d16dd0c2e

Default 'this' to window in EventTarget (#2918)

view details

Luca Casonato

commit sha f38bd45bf98cf5a642e2b89b4b7369548025995d

Added normalized benchmark graphs (#2919)

view details

Nayeem Rahman

commit sha ad11f2ad6aae758e67734d60f068285fb5e10655

Default base URL path to '/' (#2921)

view details

Ryan Dahl

commit sha 82dc1b8e59891a7ca0f1a5e67a3db952b918561c

Upgrade pylint (#2917) depot_tools is removing pylint from its distribution so we must maintain our own copy.

view details

Bartek Iwańczuk

commit sha 945dc7b84bc1a05f80b3b4e0b152be38d9f8a9bf

fix: panic during fetch (#2925)

view details

Christian Moritz

commit sha 19cd8deaf211fde97b9755a8cf93987a74d813b0

tools: download gn from CIPD (#2912)

view details

Bartek Iwańczuk

commit sha 61231912e2c4f6cc671a061468b864f371a276a2

fix: panicking when can't create runtime for block_on (#2905)

view details

Bartek Iwańczuk

commit sha a8f44213ec6fdea338b50c3cd5bc035a80fc94a1

bump prettier revision (#2928)

view details

Bert Belder

commit sha c7db26cfec07cafb7b45770499a18359481956a5

Clean up and remove dead code from .appveyor.yml

view details

afinch7

commit sha 64906544fb2a9e3c2a0624b7a4d071a1783cbb1d

Refactor dispatcher system

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha baf24e1f54c00a1eabc14c7b16d0a9c1934bada1

Refactor dispatcher system

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha 03c07573ccba116f7a71aa131a953e060f54f493

remove macos for now

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha deb2e8eac59733514db864790fc107593fb4125a

rename workflow

view details

push time in a month

push eventafinch7/deno_in_deno

Andy Finch

commit sha eb7749fcac6e5f317936af4ec7330bc4a1a1fd50

Update rust.yml

view details

push time in a month

PR merged afinch7/deno_in_deno

Update rust.yml
+15 -0

0 comment

1 changed file

afinch7

pr closed time in a month

PR opened afinch7/deno_in_deno

Update rust.yml
+15 -0

0 comment

1 changed file

pr created time in a month

create barnchafinch7/deno_in_deno

branch : add-actions

created branch time in a month

push eventafinch7/deno

afinch7

commit sha 787e4f800c82d5b3dd3fc15200b6dbc6a37a8702

remove windows

view details

push time in a month

push eventafinch7/deno

Andy Finch

commit sha 2bef38a3943f0a674fc34e6a4cca63a495edcd7a

add build and test job

view details

push time in a month

push eventafinch7/deno

Andy Finch

commit sha bc0e41605d6d6ab7e15c3a2a0af61f2015347048

revert to using actions/checkout

view details

push time in a month

push eventafinch7/deno

Andy Finch

commit sha 3ea70d865f6795e9d9d0193d171a363d00a6e3f0

checkout submodules

view details

push time in a month

push eventafinch7/deno

Andy Finch

commit sha abae0d8f935326ba014c854af5dab5885f234b38

add setup

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha 01406ff4066cd5d7be45f6b2d26114e3159f1483

Refactor dispatcher system

view details

push time in a month

PR opened afinch7/deno

Change actions

<!-- Before submitting a PR read https://deno.land/manual.html#contributing -->

+2 -1

0 comment

1 changed file

pr created time in a month

create barnchafinch7/deno

branch : update-actions

created branch time in a month

push eventafinch7/deno

Andy Finch

commit sha 2ab6ebb5639b7d6ee480b3492f11f25b244498fb

Create actions workflows

view details

push time in a month

PR merged afinch7/deno

Create actions workflows

<!-- Before submitting a PR read https://deno.land/manual.html#contributing -->

+15 -0

0 comment

1 changed file

afinch7

pr closed time in a month

create barnchafinch7/deno

branch : actions-test

created branch time in a month

push eventafinch7/deno

Ryan Dahl

commit sha 99d3483291aa6fed14c0810a70ae6ce31df77362

Fix copyright header (#1832)

view details

Ryan Dahl

commit sha ce5d5c51331b49f2dd381737a8340433746276af

Upgrade deno_std (#1833)

view details

Kevin (Kun) "Kassimo" Qian

commit sha c66d043ac6318da99c2aa6f4a6a11db3a33f1c99

Fix console.table display of Map and move tests to unit test (#1839)

view details

William Fortin

commit sha d426d78ae71dd69d77d7354b515762fc7e0b8a4b

Fix broken link to API reference (#1838) Add missing trailing slash https://deno.land/typedoc/

view details

andy finch

commit sha 9ed413b318def875df134dddc1d0fee00a75913a

Updated some type assertions to work with other libc implementations. (#1837)

view details

Kevin (Kun) "Kassimo" Qian

commit sha 8dee6ea454deb05e69bfaed39a230950c9100c37

Add "Dino in the Rain" to manual page (#1840)

view details

Bartek Iwańczuk

commit sha 5dfbbbb07a8f484dca27bbe0d7a3bafb0bdb91fd

Add import.meta.main (#1835)

view details

Ryan Dahl

commit sha b8a537d020f5e4495572daa4d8a59f51fa3b20d1

deno_core (#1827) A new low-level crate with focus on speed. This doesn't yet hook into the existing code base.

view details

Bert Belder

commit sha 15831272bbda8e052760afcd8800f75e09a51a53

core: add Cargo.toml This aids development using Visual Studio Code. The http_bench can't be built with cargo yet because it needs to link with libdeno.

view details

Ryan Dahl

commit sha e7e4cb037d01bf9289e8467cb65f123e82a95c60

Use the SVG logo everywhere. Add logo links to manual. (#1841)

view details

Ryan Dahl

commit sha 33a6409db982d4ee9012cf7eede8f2fb8519f568

Add NO_COLOR to CLI usage (#1843)

view details

Bert Belder

commit sha d4e3bf945d388ab9e8e5c1eef431332170d27e1b

third_party: upgrade rust crates

view details

Ryan Dahl

commit sha 19d4ba70f7623422b49e1b6396c84275a63cbf8f

Upgrade Node to v10 on Travis (#1850)

view details

Ryan Dahl

commit sha 2afc877935eefb33c01992f855caf65fa62aa248

upgrade V8 to 7.4.238 (#1849)

view details

Ryan Dahl

commit sha b0c7b54f692ecc866d4f70bfa384631523bbf924

v0.3.1

view details

Ryan Dahl

commit sha b3b989ffdca61403cdd7ca94bd9256159864469e

Use deno_core::JSError in deno (#1855) src/js_errors.rs takes care of source maps and color while core/js_errors.rs is just the basic struct.

view details

Jon Jee

commit sha 1cc02a5d9d867f1a239ee4b69f587d8afac07b02

Add favicon.ico generated by deno_logo_3.svg and add link tag in every page (#1861)

view details

andy finch

commit sha 8c310d3d56c6b1bc67ee81d8c5ea9b20abee8088

Permissions refactor (#1864) Refactored permissions to be assignable on a per-isolate basis, and added a fix for #1858 to op_fetch_module_meta_data.

view details

Yoshiya Hinosawa

commit sha a7bb8ccce85c6e8bd619cce32d34a5d372ef85b7

Add Deno.version.gnArgs (#1845) To display specific build args passed to GN.

view details

Yoshiya Hinosawa

commit sha e6c51e615020f13ca4cd2492b53966b9ebeb3946

compiler_bundle should also depend on gn_args.txt (#1870)

view details

push time in a month

pull request commentdenoland/deno

New dispatcher infrastructure.

@ry I'm going to punt implementing this in json ops for now. I did at least implement for dispatch minimal ops. This should help keep the size a lot more manageable.

afinch7

comment created time in a month

push eventafinch7/deno

afinch7

commit sha cc6671411759ded2af8c9ccd437826d66dd6d324

Refactor dispatcher system

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha 660a0d52f87d92923a0951d35ea0a8040bce8469

Refactor dispatcher system

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha 9fa330b06379a8dd32961bc22cd85fd52bc2545a

Refactor dispatcher system

view details

push time in a month

PullRequestEvent

push eventafinch7/deno

afinch7

commit sha 660a0d52f87d92923a0951d35ea0a8040bce8469

Refactor dispatcher system

view details

push time in a month

push eventafinch7/deno

Andrew Hughes

commit sha de418868e8ee9ce16ed69dce760327685fa8cd17

minor manual edits (#2883)

view details

Ryan Dahl

commit sha 08799922187d91785ce336f10b880bc775b0b9c9

Fix Appveyor's sccache --stop-server problem (#2896) The problem is seen here: https://ci.appveyor.com/project/deno/deno/builds/27283032 ``` sccache --stop-server Stopping sccache server... sccache : error: couldn't connect to server At line:1 char:1 + sccache --stop-server + ~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (error: couldn't connect to server:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError caused by: No connection could be made because the target machine actively refused it. (os error 10061) Command executed with exception: (os error 10061) ```

view details

Ryan Dahl

commit sha 5e873bd0dabced71cf409fd16033fa0bc23ebcf6

Improve travis (#2892)

view details

Ryan Dahl

commit sha 35e3c06aed851f65ad0d561d73a447ab5765fc13

Revert "feat: use trust-dns-resolver in HTTP client" It caused the final executable to grow by 1.5 mb, and is not having any other benefit. This reverts commit 2b40fa065c8982482b268080e2e6c73ec1f64033.

view details

Yoshiya Hinosawa

commit sha 46cbc6e0e96750cd2e3ba7e0d80bb9c48b66caf2

refactor: remove Deno.platform (#2895)

view details

Kitson Kelly

commit sha 377966764636350c524b526da50c055243ab3005

Add JSDoc to deno_typescript (#2890)

view details

Bartek Iwańczuk

commit sha 2a83327a21e83180a21afd428b11aa03e3080346

fix: replace bad rid panics with errors (#2870)

view details

Nayeem Rahman

commit sha 0b757f37371474da63db341b831d83539df28df6

Expose the DOM Body interface globally (#2903)

view details

Bartek Iwańczuk

commit sha acee1944b9419e101f515a501b11653af8229258

feat: Make integration tests rust unit tests (#2884) Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>

view details

push time in a month

PR closed denoland/deno

New dispatcher infrastructure.

ref #2730

+0 -0

29 comments

0 changed file

afinch7

pr closed time in a month

push eventafinch7/deno

afinch7

commit sha f4b817e3a82ffcd709a890ac1528c52cb3883ba5

Refactor dispatcher system

view details

push time in a month

pull request commentdenoland/deno

[WIP] Move fs ops to standalone crate.

@ry 2/3 of the added lines of code are from #2785, but I still want to try to clean this up a lot.

afinch7

comment created time in a month

pull request commentdenoland/deno

[WIP] Move fs ops to standalone crate.

On the ts side it's more "lookup" than "register"? Perhaps I'm just not following, I'll reread.

Yes, sort of. Assignments assign a listener:

// This function will get called when rust side registers a
// op named "opName" in namespace "namespace", or
// immediately if the op has already been registered at 
// the time of assignment.
let someValue;
Deno.ops.namespace.opName =  (id) => { someValue = id };

Read/get performs a direct lookup(returns whatever value is available at the time):

// Gets current value. May be undefined.
const someValue = Deno.ops.namespace.opName;

The api uses a fancy set accessor to register "listener" functions that will be informed as soon as a op is registered on the rust side. https://github.com/afinch7/deno/blob/dbe541f37baa9d910989402ef5fb815e257fdbff/core/core_lib.js#L242-L274

Basically

Deno.ops.namespace.opName = (id) => { someValue = id };

is equivalent to something like this

Deno.on("registerOp", (e) => {
  if (e.namespace === "namespace" && e.name = "opName") {
    someValue = e.id;
  }
});

This seems unnecessary, but accessors are slow and we don't want to expose things directly to avoid tampering.

But couldn't that lookup be moved into the class constructor? Then it's only done once and avoids the accessor.

The op ids we need only exist at runtime, so preforming a direct lookup during snapshot creation would just give us a inaccurate or undefined value for each op id.

afinch7

comment created time in a month

push eventafinch7/deno

afinch7

commit sha 9ee33c7a546fcc5af4121925396980897d49d218

move fs ops to standalone crate

view details

push time in a month

pull request commentdenoland/deno

[WIP] Move fs ops to standalone crate.

One question: I don't understand why op registering is required at the ts level?

It's not you can just as easily use sendSync(Deno.ops.namespace.opName, data), but this will call a get accessor every time(slower). A lot of this is explained in the prerequisite PR(#2785).

afinch7

comment created time in a month

push eventafinch7/deno

Yoshiya Hinosawa

commit sha 249db0f7d91d5e895906078f92b7d31c76b96121

Handle typescript version in rust (#2855)

view details

Bartek Iwańczuk

commit sha 5c7c876a71bb15a2176b555d9d88621e26e9ab99

perf: less aggresive dyn import polling (#2858)

view details

Ryan Dahl

commit sha 82588ec09c199683cff88097e1b90649497239c7

v0.17.0

view details

Ryan Dahl

commit sha 9d62d77cfa98b5e741dbcf0c657b530fc2770b24

Run tests after "cargo build" on travis (#2854)

view details

Kevin (Kun) "Kassimo" Qian

commit sha 49ea932af8b30be7da109a3c0ba879ef6e3a3c41

Fix xeval chunk incorrect matching behavior (#2857)

view details

Nayeem Rahman

commit sha ca000392857b4c79a3609ddbc20073222498998b

Fix basing in URL constructor (#2867)

view details

Yoshiya Hinosawa

commit sha 595b4daa77771458457e178b6b590a044cd41ad0

Remove replacements hack in deno_typescript (#2864)

view details

Ryan Dahl

commit sha acaff6d05622ec54b37b7f378c2d2b2f723ba8d5

Remove tools/build.py (#2865) Testing regression: ASAN build removed.

view details

Bert Belder

commit sha 699d2ae4bb59babdbd73144635ed4a41869253ce

build: on windows, don't pass -glldb to clang (#2874)

view details

Nayeem Rahman

commit sha 8e3c879d1387d8b618904bf0bc8bc23e77a1114c

Add default-run (+ clean up old references) (#2876)

view details

Yoshiya Hinosawa

commit sha a205e8a3c2bf5ba72fe18bd7f224303338956c62

fetch: implement bodyUsed (#2877)

view details

Yoshiya Hinosawa

commit sha f12acdb50bd6afae21d8d033548c012d23ec2791

Update @typescript-eslint/* to v2.1.0 (#2878)

view details

Bartek Iwańczuk

commit sha 2b40fa065c8982482b268080e2e6c73ec1f64033

feat: use trust-dns-resolver in HTTP client (#2847)

view details

Nayeem Rahman

commit sha 718c8c4360b5c42d1c0bcd97d7348908d915212e

Fix path normalization in resolve_from_cwd() (#2875)

view details

afinch7

commit sha dbe541f37baa9d910989402ef5fb815e257fdbff

Refactor dispatcher system

view details

afinch7

commit sha 2c6d6c60e17922043fadd491c818c426e5360d31

move fs ops to standalone crate

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha dbe541f37baa9d910989402ef5fb815e257fdbff

Refactor dispatcher system

view details

push time in a month

push eventafinch7/deno

Yoshiya Hinosawa

commit sha 249db0f7d91d5e895906078f92b7d31c76b96121

Handle typescript version in rust (#2855)

view details

Bartek Iwańczuk

commit sha 5c7c876a71bb15a2176b555d9d88621e26e9ab99

perf: less aggresive dyn import polling (#2858)

view details

Ryan Dahl

commit sha 82588ec09c199683cff88097e1b90649497239c7

v0.17.0

view details

Ryan Dahl

commit sha 9d62d77cfa98b5e741dbcf0c657b530fc2770b24

Run tests after "cargo build" on travis (#2854)

view details

Kevin (Kun) "Kassimo" Qian

commit sha 49ea932af8b30be7da109a3c0ba879ef6e3a3c41

Fix xeval chunk incorrect matching behavior (#2857)

view details

Nayeem Rahman

commit sha ca000392857b4c79a3609ddbc20073222498998b

Fix basing in URL constructor (#2867)

view details

Yoshiya Hinosawa

commit sha 595b4daa77771458457e178b6b590a044cd41ad0

Remove replacements hack in deno_typescript (#2864)

view details

Ryan Dahl

commit sha acaff6d05622ec54b37b7f378c2d2b2f723ba8d5

Remove tools/build.py (#2865) Testing regression: ASAN build removed.

view details

Bert Belder

commit sha 699d2ae4bb59babdbd73144635ed4a41869253ce

build: on windows, don't pass -glldb to clang (#2874)

view details

Nayeem Rahman

commit sha 8e3c879d1387d8b618904bf0bc8bc23e77a1114c

Add default-run (+ clean up old references) (#2876)

view details

Yoshiya Hinosawa

commit sha a205e8a3c2bf5ba72fe18bd7f224303338956c62

fetch: implement bodyUsed (#2877)

view details

Yoshiya Hinosawa

commit sha f12acdb50bd6afae21d8d033548c012d23ec2791

Update @typescript-eslint/* to v2.1.0 (#2878)

view details

Bartek Iwańczuk

commit sha 2b40fa065c8982482b268080e2e6c73ec1f64033

feat: use trust-dns-resolver in HTTP client (#2847)

view details

Nayeem Rahman

commit sha 718c8c4360b5c42d1c0bcd97d7348908d915212e

Fix path normalization in resolve_from_cwd() (#2875)

view details

afinch7

commit sha 2598455b5159d2c328784edc33c1b1802b143db3

Refactor dispatcher system

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha 4b3f6d90d6512d756cc379df3248c321b493261b

use strings for ErrorKind

view details

push time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 mod resources; mod timers; mod workers; -// Warning! These values are duplicated in the TypeScript code (js/dispatch.ts),-// update with care.-pub const OP_READ: OpId = 1;-pub const OP_WRITE: OpId = 2;-pub const OP_EXIT: OpId = 3;-pub const OP_IS_TTY: OpId = 4;-pub const OP_ENV: OpId = 5;-pub const OP_EXEC_PATH: OpId = 6;-pub const OP_UTIME: OpId = 7;-pub const OP_SET_ENV: OpId = 8;-pub const OP_HOME_DIR: OpId = 9;-pub const OP_START: OpId = 10;-pub const OP_APPLY_SOURCE_MAP: OpId = 11;-pub const OP_FORMAT_ERROR: OpId = 12;-pub const OP_CACHE: OpId = 13;-pub const OP_FETCH_SOURCE_FILE: OpId = 14;-pub const OP_OPEN: OpId = 15;-pub const OP_CLOSE: OpId = 16;-pub const OP_SEEK: OpId = 17;-pub const OP_FETCH: OpId = 18;-pub const OP_METRICS: OpId = 19;-pub const OP_REPL_START: OpId = 20;-pub const OP_REPL_READLINE: OpId = 21;-pub const OP_ACCEPT: OpId = 22;-pub const OP_DIAL: OpId = 23;-pub const OP_SHUTDOWN: OpId = 24;-pub const OP_LISTEN: OpId = 25;-pub const OP_RESOURCES: OpId = 26;-pub const OP_GET_RANDOM_VALUES: OpId = 27;-pub const OP_GLOBAL_TIMER_STOP: OpId = 28;-pub const OP_GLOBAL_TIMER: OpId = 29;-pub const OP_NOW: OpId = 30;-pub const OP_PERMISSIONS: OpId = 31;-pub const OP_REVOKE_PERMISSION: OpId = 32;-pub const OP_CREATE_WORKER: OpId = 33;-pub const OP_HOST_GET_WORKER_CLOSED: OpId = 34;-pub const OP_HOST_POST_MESSAGE: OpId = 35;-pub const OP_HOST_GET_MESSAGE: OpId = 36;-pub const OP_WORKER_POST_MESSAGE: OpId = 37;-pub const OP_WORKER_GET_MESSAGE: OpId = 38;-pub const OP_RUN: OpId = 39;-pub const OP_RUN_STATUS: OpId = 40;-pub const OP_KILL: OpId = 41;-pub const OP_CHDIR: OpId = 42;-pub const OP_MKDIR: OpId = 43;-pub const OP_CHMOD: OpId = 44;-pub const OP_CHOWN: OpId = 45;-pub const OP_REMOVE: OpId = 46;-pub const OP_COPY_FILE: OpId = 47;-pub const OP_STAT: OpId = 48;-pub const OP_READ_DIR: OpId = 49;-pub const OP_RENAME: OpId = 50;-pub const OP_LINK: OpId = 51;-pub const OP_SYMLINK: OpId = 52;-pub const OP_READ_LINK: OpId = 53;-pub const OP_TRUNCATE: OpId = 54;-pub const OP_MAKE_TEMP_DIR: OpId = 55;-pub const OP_CWD: OpId = 56;-pub const OP_FETCH_ASSET: OpId = 57;+const OP_NAMESPACE: &str = "builtins"; -pub fn dispatch(-  state: &ThreadSafeState,-  op_id: OpId,-  control: &[u8],-  zero_copy: Option<PinnedBuf>,-) -> CoreOp {-  let bytes_sent_control = control.len();-  let bytes_sent_zero_copy = zero_copy.as_ref().map(|b| b.len()).unwrap_or(0);+pub fn setup_dispatcher_registry(state: ThreadSafeState) -> Arc<OpDisReg> {+  let registry = Arc::new(OpDisReg::new()); -  let op = match op_id {-    OP_READ => {-      dispatch_minimal::dispatch(io::op_read, state, control, zero_copy)-    }-    OP_WRITE => {-      dispatch_minimal::dispatch(io::op_write, state, control, zero_copy)-    }-    OP_EXIT => dispatch_json::dispatch(os::op_exit, state, control, zero_copy),-    OP_IS_TTY => {-      dispatch_json::dispatch(os::op_is_tty, state, control, zero_copy)-    }-    OP_ENV => dispatch_json::dispatch(os::op_env, state, control, zero_copy),-    OP_EXEC_PATH => {-      dispatch_json::dispatch(os::op_exec_path, state, control, zero_copy)-    }-    OP_HOME_DIR => {-      dispatch_json::dispatch(os::op_home_dir, state, control, zero_copy)-    }-    OP_UTIME => {-      dispatch_json::dispatch(fs::op_utime, state, control, zero_copy)-    }-    OP_SET_ENV => {-      dispatch_json::dispatch(os::op_set_env, state, control, zero_copy)-    }-    OP_START => {-      dispatch_json::dispatch(os::op_start, state, control, zero_copy)-    }-    OP_APPLY_SOURCE_MAP => dispatch_json::dispatch(-      errors::op_apply_source_map,-      state,-      control,-      zero_copy,-    ),-    OP_FORMAT_ERROR => dispatch_json::dispatch(-      errors::op_format_error,-      state,-      control,-      zero_copy,-    ),-    OP_CACHE => {-      dispatch_json::dispatch(compiler::op_cache, state, control, zero_copy)-    }-    OP_FETCH_SOURCE_FILE => dispatch_json::dispatch(-      compiler::op_fetch_source_file,-      state,-      control,-      zero_copy,-    ),-    OP_OPEN => {-      dispatch_json::dispatch(files::op_open, state, control, zero_copy)-    }-    OP_CLOSE => {-      dispatch_json::dispatch(files::op_close, state, control, zero_copy)-    }-    OP_SEEK => {-      dispatch_json::dispatch(files::op_seek, state, control, zero_copy)-    }-    OP_METRICS => {-      dispatch_json::dispatch(metrics::op_metrics, state, control, zero_copy)-    }-    OP_FETCH => {-      dispatch_json::dispatch(fetch::op_fetch, state, control, zero_copy)-    }-    OP_REPL_START => {-      dispatch_json::dispatch(repl::op_repl_start, state, control, zero_copy)-    }-    OP_REPL_READLINE => {-      dispatch_json::dispatch(repl::op_repl_readline, state, control, zero_copy)-    }-    OP_ACCEPT => {-      dispatch_json::dispatch(net::op_accept, state, control, zero_copy)-    }-    OP_DIAL => dispatch_json::dispatch(net::op_dial, state, control, zero_copy),-    OP_SHUTDOWN => {-      dispatch_json::dispatch(net::op_shutdown, state, control, zero_copy)-    }-    OP_LISTEN => {-      dispatch_json::dispatch(net::op_listen, state, control, zero_copy)-    }-    OP_RESOURCES => dispatch_json::dispatch(-      resources::op_resources,-      state,-      control,-      zero_copy,-    ),-    OP_GET_RANDOM_VALUES => dispatch_json::dispatch(-      random::op_get_random_values,-      state,-      control,-      zero_copy,-    ),-    OP_GLOBAL_TIMER_STOP => dispatch_json::dispatch(-      timers::op_global_timer_stop,-      state,-      control,-      zero_copy,-    ),-    OP_GLOBAL_TIMER => dispatch_json::dispatch(-      timers::op_global_timer,-      state,-      control,-      zero_copy,-    ),-    OP_NOW => {-      dispatch_json::dispatch(performance::op_now, state, control, zero_copy)-    }-    OP_PERMISSIONS => dispatch_json::dispatch(-      permissions::op_permissions,-      state,-      control,-      zero_copy,-    ),-    OP_REVOKE_PERMISSION => dispatch_json::dispatch(-      permissions::op_revoke_permission,-      state,-      control,-      zero_copy,-    ),-    OP_CREATE_WORKER => dispatch_json::dispatch(-      workers::op_create_worker,-      state,-      control,-      zero_copy,-    ),-    OP_HOST_GET_WORKER_CLOSED => dispatch_json::dispatch(-      workers::op_host_get_worker_closed,-      state,-      control,-      zero_copy,-    ),-    OP_HOST_POST_MESSAGE => dispatch_json::dispatch(-      workers::op_host_post_message,-      state,-      control,-      zero_copy,-    ),-    OP_HOST_GET_MESSAGE => dispatch_json::dispatch(-      workers::op_host_get_message,-      state,-      control,-      zero_copy,-    ),-    // TODO: make sure these two ops are only accessible to appropriate Workers-    OP_WORKER_POST_MESSAGE => dispatch_json::dispatch(-      workers::op_worker_post_message,-      state,-      control,-      zero_copy,-    ),-    OP_WORKER_GET_MESSAGE => dispatch_json::dispatch(-      workers::op_worker_get_message,-      state,-      control,-      zero_copy,-    ),-    OP_RUN => {-      dispatch_json::dispatch(process::op_run, state, control, zero_copy)-    }-    OP_RUN_STATUS => {-      dispatch_json::dispatch(process::op_run_status, state, control, zero_copy)-    }-    OP_KILL => {-      dispatch_json::dispatch(process::op_kill, state, control, zero_copy)-    }-    OP_CHDIR => {-      dispatch_json::dispatch(fs::op_chdir, state, control, zero_copy)-    }-    OP_MKDIR => {-      dispatch_json::dispatch(fs::op_mkdir, state, control, zero_copy)-    }-    OP_CHMOD => {-      dispatch_json::dispatch(fs::op_chmod, state, control, zero_copy)-    }-    OP_CHOWN => {-      dispatch_json::dispatch(fs::op_chown, state, control, zero_copy)-    }-    OP_REMOVE => {-      dispatch_json::dispatch(fs::op_remove, state, control, zero_copy)-    }-    OP_COPY_FILE => {-      dispatch_json::dispatch(fs::op_copy_file, state, control, zero_copy)-    }-    OP_STAT => dispatch_json::dispatch(fs::op_stat, state, control, zero_copy),-    OP_READ_DIR => {-      dispatch_json::dispatch(fs::op_read_dir, state, control, zero_copy)-    }-    OP_RENAME => {-      dispatch_json::dispatch(fs::op_rename, state, control, zero_copy)-    }-    OP_LINK => dispatch_json::dispatch(fs::op_link, state, control, zero_copy),-    OP_SYMLINK => {-      dispatch_json::dispatch(fs::op_symlink, state, control, zero_copy)-    }-    OP_READ_LINK => {-      dispatch_json::dispatch(fs::op_read_link, state, control, zero_copy)-    }-    OP_TRUNCATE => {-      dispatch_json::dispatch(fs::op_truncate, state, control, zero_copy)-    }-    OP_MAKE_TEMP_DIR => {-      dispatch_json::dispatch(fs::op_make_temp_dir, state, control, zero_copy)-    }-    OP_CWD => dispatch_json::dispatch(fs::op_cwd, state, control, zero_copy),-    OP_FETCH_ASSET => dispatch_json::dispatch(-      compiler::op_fetch_asset,-      state,-      control,-      zero_copy,-    ),-    _ => panic!("bad op_id"),-  };+  // Compiler+  registry.register_op(OP_NAMESPACE, state.wrap_op(compiler::OpCache));+  registry+    .register_op(OP_NAMESPACE, state.wrap_op(compiler::OpFetchSourceFile));+  registry.register_op(OP_NAMESPACE, state.wrap_op(compiler::OpFetchAsset)); -  state.metrics_op_dispatched(bytes_sent_control, bytes_sent_zero_copy);+  // Errors+  registry.register_op(OP_NAMESPACE, state.wrap_op(errors::OpFormatError));+  registry.register_op(OP_NAMESPACE, state.wrap_op(errors::OpApplySourceMap)); -  match op {-    Op::Sync(buf) => {-      state.metrics_op_completed(buf.len());-      Op::Sync(buf)-    }-    Op::Async(fut) => {-      use crate::futures::Future;-      let state = state.clone();-      let result_fut = Box::new(fut.map(move |buf: Buf| {-        state.clone().metrics_op_completed(buf.len());-        buf-      }));-      Op::Async(result_fut)-    }-  }+  // Fetch+  registry.register_op(OP_NAMESPACE, state.wrap_op(fetch::OpFetch));++  // Files+  registry.register_op(OP_NAMESPACE, state.wrap_op(files::OpOpen));+  registry.register_op(OP_NAMESPACE, state.wrap_op(files::OpClose));+  registry.register_op(OP_NAMESPACE, state.wrap_op(files::OpSeek));

This doesn't work. The rust compiler doesn't have a way to deduce a concrete type for each element in the array. This normally wouldn't be a problem, but it is when the trait used contains a const field. Here is a example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7bc6caa030b23a0bcdf43188d052c0cb

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.-use super::dispatch_json::{Deserialize, JsonOp, Value};+use super::dispatch_json::{wrap_json_op, Deserialize, JsonOp}; use crate::assets;+use crate::state::DenoOpDispatcher; use crate::state::ThreadSafeState; use crate::tokio_util; use deno::*; +// Cache

👍 They seemed helpful before I reduced the amount of code for each op.

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.-import { sendSync, sendAsync } from "./dispatch_json.ts";-import * as dispatch from "./dispatch.ts";+import { JsonOp } from "deno_dispatch_json";+import { opNamespace } from "./namespace.ts";++const OP_CHOWN = new JsonOp(opNamespace, "chown");

I'm going to make opNamespace configurable. If I wanted to include multiple versions/instances of the same ops in a project I should be able to.

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import * as minimal from "./dispatch_minimal.ts";-import * as json from "./dispatch_json.ts";+import * as json from "deno_dispatch_json";+import { core, ops } from "deno_util"; -// These consts are shared with Rust. Update with care.-export const OP_READ = 1;-export const OP_WRITE = 2;-export const OP_EXIT = 3;-export const OP_IS_TTY = 4;-export const OP_ENV = 5;-export const OP_EXEC_PATH = 6;-export const OP_UTIME = 7;-export const OP_SET_ENV = 8;-export const OP_HOME_DIR = 9;-export const OP_START = 10;-export const OP_APPLY_SOURCE_MAP = 11;-export const OP_FORMAT_ERROR = 12;-export const OP_CACHE = 13;-export const OP_FETCH_SOURCE_FILE = 14;-export const OP_OPEN = 15;-export const OP_CLOSE = 16;-export const OP_SEEK = 17;-export const OP_FETCH = 18;-export const OP_METRICS = 19;-export const OP_REPL_START = 20;-export const OP_REPL_READLINE = 21;-export const OP_ACCEPT = 22;-export const OP_DIAL = 23;-export const OP_SHUTDOWN = 24;-export const OP_LISTEN = 25;-export const OP_RESOURCES = 26;-export const OP_GET_RANDOM_VALUES = 27;-export const OP_GLOBAL_TIMER_STOP = 28;-export const OP_GLOBAL_TIMER = 29;-export const OP_NOW = 30;-export const OP_PERMISSIONS = 31;-export const OP_REVOKE_PERMISSION = 32;-export const OP_CREATE_WORKER = 33;-export const OP_HOST_GET_WORKER_CLOSED = 34;-export const OP_HOST_POST_MESSAGE = 35;-export const OP_HOST_GET_MESSAGE = 36;-export const OP_WORKER_POST_MESSAGE = 37;-export const OP_WORKER_GET_MESSAGE = 38;-export const OP_RUN = 39;-export const OP_RUN_STATUS = 40;-export const OP_KILL = 41;-export const OP_CHDIR = 42;-export const OP_MKDIR = 43;-export const OP_CHMOD = 44;-export const OP_CHOWN = 45;-export const OP_REMOVE = 46;-export const OP_COPY_FILE = 47;-export const OP_STAT = 48;-export const OP_READ_DIR = 49;-export const OP_RENAME = 50;-export const OP_LINK = 51;-export const OP_SYMLINK = 52;-export const OP_READ_LINK = 53;-export const OP_TRUNCATE = 54;-export const OP_MAKE_TEMP_DIR = 55;-export const OP_CWD = 56;-export const OP_FETCH_ASSET = 57;+const opNamespace = ops.builtins;++type MaybeOpId = number | undefined; -export function asyncMsgFromRust(opId: number, ui8: Uint8Array): void {-  switch (opId) {-    case OP_WRITE:-    case OP_READ:-      minimal.asyncMsgFromRust(opId, ui8);-      break;-    case OP_EXIT:-    case OP_IS_TTY:-    case OP_ENV:-    case OP_EXEC_PATH:-    case OP_UTIME:-    case OP_OPEN:-    case OP_SEEK:-    case OP_FETCH:-    case OP_REPL_START:-    case OP_REPL_READLINE:-    case OP_ACCEPT:-    case OP_DIAL:-    case OP_GLOBAL_TIMER:-    case OP_HOST_GET_WORKER_CLOSED:-    case OP_HOST_GET_MESSAGE:-    case OP_WORKER_GET_MESSAGE:-    case OP_RUN_STATUS:-    case OP_MKDIR:-    case OP_CHMOD:-    case OP_CHOWN:-    case OP_REMOVE:-    case OP_COPY_FILE:-    case OP_STAT:-    case OP_READ_DIR:-    case OP_RENAME:-    case OP_LINK:-    case OP_SYMLINK:-    case OP_READ_LINK:-    case OP_TRUNCATE:-    case OP_MAKE_TEMP_DIR:-      json.asyncMsgFromRust(opId, ui8);-      break;-    default:-      throw Error("bad async opId");-  }-}+type OpId = number;++// These consts are shared with Rust. Update with care.+export let OP_READ: OpId;+opNamespace.read = (id: MaybeOpId): void => {+  OP_READ = id!;+  core.setAsyncHandler(+    id!,+    (buf: Uint8Array): void => minimal.asyncMsgFromRust(id!, buf)+  );+};+export let OP_WRITE: OpId;+opNamespace.write = (id: MaybeOpId): void => {+  OP_WRITE = id!;+  core.setAsyncHandler(+    id!,+    (buf: Uint8Array): void => minimal.asyncMsgFromRust(id!, buf)+  );+};+export let OP_EXIT: OpId;+opNamespace.exit = (id: MaybeOpId): void => {+  OP_EXIT = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_IS_TTY: OpId;+opNamespace.isTty = (id: MaybeOpId): void => {+  OP_IS_TTY = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_ENV: OpId;+opNamespace.env = (id: MaybeOpId): void => {+  OP_ENV = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_EXEC_PATH: OpId;+opNamespace.execPath = (id: MaybeOpId): void => {+  OP_EXEC_PATH = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_SET_ENV: OpId;+opNamespace.setEnv = (id: MaybeOpId): void => {+  OP_SET_ENV = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_HOME_DIR: OpId;+opNamespace.homeDir = (id: MaybeOpId): void => {+  OP_HOME_DIR = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);+};+export let OP_START: OpId;+opNamespace.start = (id: MaybeOpId): void => {+  OP_START = id!;+  core.setAsyncHandler(id!, json.asyncMsgFromRust);

I'm using a class based API like the one you suggested in all new implementations. Consider this depreciated.

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 export async function sendAsync(   const res = await promise;   return unwrapResponse(res); }++export class JsonOp {++  private opId?: number; +  +  constructor(+    private readonly opNamespace: string,+    private readonly opName: string,+  ) {+    ops[this.opNamespace][this.opName] = (id?: number): void => {+      this.opId = id;+      if (id !== undefined) {

undefined is used to signal a "reset" to listeners, since I can't really unsetAsyncHandler currently we just ignore. The only time a "reset" happens is when you call Isolate::set_dispatcher_registry(only when creating a new worker in our case). setAsyncHandler has no way to "correctly" handle a opId value that isn't a number, thus passing undefined will throw a error.

afinch7

comment created time in a month

Pull request review commentdenoland/deno

[WIP] Move fs ops to standalone crate.

 fn main() {   let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());   let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());   let js_dir = c.join("../js");+  let import_maps = vec![+    deno_ops_fs_bundle::get_import_map(),+    deno_bundle_util::get_import_map(),+    deno_dispatch_json_bundle::get_import_map(),

It should't be necessary for deno cli, but I'm trying to keep deno core embedding in mind here. No matter where deno_ops_fs_bundle is in relation to the project it's being used in, if I include the import maps deno_ops_fs will always resolve to the absolute path to the library entry point.

afinch7

comment created time in a month

push eventafinch7/deno

afinch7

commit sha 50bde53c154f42964cb71e332e2df185579858d1

move more ts code

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha 2e32bd981cc562975df96b66d3fd01949c77c5b2

Refactor dispatcher system

view details

afinch7

commit sha d7e0ec43e35481fcbccd4ee8dc9855a39fe79114

move fs ops to standalone crate Still a couple of things to figure out here 1. I would like to standardize providing permissions access to standalone ops. 2. We need a way to pass error kind that is outwardly extensible. Maybe just strings, since we are using json?

view details

afinch7

commit sha 397174f607ec34153692765eced1566a18d9e5da

move ts code into bundle crate I don't really like the way this turned out. I feel like it's far to complicated, but it works and I don't really see any other good way of doing this.

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha 2e32bd981cc562975df96b66d3fd01949c77c5b2

Refactor dispatcher system

view details

push time in a month

push eventafinch7/deno

Bert Belder

commit sha 840c4aa2b23cad129a16b9a57eeb9dcb50083c62

third_party: add 'reqwest' crate and dependencies

view details

Bartek Iwańczuk

commit sha 723284fd20bb320fc1c5c1c53d0617c1d4169c25

Use 'reqwest' to implement HTTP client (#2822) Closes #2720

view details

Josh Pullen

commit sha 54a3b54138df607585061854ca27282a6cf15c07

Fix small typo (effects -> affects) (#2841)

view details

Kevin (Kun) "Kassimo" Qian

commit sha 07c3c76d0d7585dc49ffde79d38c406ca9f6e7ca

Save last execution result in for REPL (#2843)

view details

Kevin (Kun) "Kassimo" Qian

commit sha fdd4252d49ceb022761b92d953d24672ab67ab91

Add window.queueMicrotask (#2844)

view details

Nayeem Rahman

commit sha df2f54b2a66fa71012c5d263009652c98085b5ed

Fix REPL '_' assignment, support '_error' (#2845)

view details

Nayeem Rahman

commit sha 0ce15f08c76f075948a132dd0f9f27855bd00a1d

Remove DenoSubcommand::Install (#2846)

view details

Yoshiya Hinosawa

commit sha 56508f113d9fe61ffcce4cbbb85e3d6961888e1d

ops/fetch: add statusText (#2851)

view details

Ryan Dahl

commit sha d43b43ca781b025b9a6a54827ea3ef193972ef24

Refactor snapshot build (#2825) Instead of using core/snapshot_creator.rs, instead two crates are introduced which allow building the snapshot during build.rs. Rollup is removed and replaced with our own bundler. This removes the Node build dependency. Modules in //js now use Deno-style imports with file extensions, rather than Node style extensionless imports. This improves incremental build time when changes are made to //js files by about 40 seconds.

view details

迷渡

commit sha 91ba3410a30376dd0226380959ef76d27f42432b

fix list style (#2842)

view details

迷渡

commit sha e9908453df970b1cdf90483892bc9e794382fccc

do not export `isConsoleInstance` (#2850)

view details

afinch7

commit sha 3e4c3f45e6ee99aa38ffe5e9720ce85626e1c0a9

Refactor dispatcher system

view details

afinch7

commit sha da3e91ce31c769675730947f1a95b4b9823fee13

move fs ops to standalone crate Still a couple of things to figure out here 1. I would like to standardize providing permissions access to standalone ops. 2. We need a way to pass error kind that is outwardly extensible. Maybe just strings, since we are using json?

view details

afinch7

commit sha cba256cac77ba278790128e76dbcd9b78fcb3d4c

move ts code into bundle crate I don't really like the way this turned out. I feel like it's far to complicated, but it works and I don't really see any other good way of doing this.

view details

push time in a month

push eventafinch7/deno

Bert Belder

commit sha 840c4aa2b23cad129a16b9a57eeb9dcb50083c62

third_party: add 'reqwest' crate and dependencies

view details

Bartek Iwańczuk

commit sha 723284fd20bb320fc1c5c1c53d0617c1d4169c25

Use 'reqwest' to implement HTTP client (#2822) Closes #2720

view details

Josh Pullen

commit sha 54a3b54138df607585061854ca27282a6cf15c07

Fix small typo (effects -> affects) (#2841)

view details

Kevin (Kun) "Kassimo" Qian

commit sha 07c3c76d0d7585dc49ffde79d38c406ca9f6e7ca

Save last execution result in for REPL (#2843)

view details

Kevin (Kun) "Kassimo" Qian

commit sha fdd4252d49ceb022761b92d953d24672ab67ab91

Add window.queueMicrotask (#2844)

view details

Nayeem Rahman

commit sha df2f54b2a66fa71012c5d263009652c98085b5ed

Fix REPL '_' assignment, support '_error' (#2845)

view details

Nayeem Rahman

commit sha 0ce15f08c76f075948a132dd0f9f27855bd00a1d

Remove DenoSubcommand::Install (#2846)

view details

Yoshiya Hinosawa

commit sha 56508f113d9fe61ffcce4cbbb85e3d6961888e1d

ops/fetch: add statusText (#2851)

view details

Ryan Dahl

commit sha d43b43ca781b025b9a6a54827ea3ef193972ef24

Refactor snapshot build (#2825) Instead of using core/snapshot_creator.rs, instead two crates are introduced which allow building the snapshot during build.rs. Rollup is removed and replaced with our own bundler. This removes the Node build dependency. Modules in //js now use Deno-style imports with file extensions, rather than Node style extensionless imports. This improves incremental build time when changes are made to //js files by about 40 seconds.

view details

迷渡

commit sha 91ba3410a30376dd0226380959ef76d27f42432b

fix list style (#2842)

view details

迷渡

commit sha e9908453df970b1cdf90483892bc9e794382fccc

do not export `isConsoleInstance` (#2850)

view details

afinch7

commit sha 3e4c3f45e6ee99aa38ffe5e9720ce85626e1c0a9

Refactor dispatcher system

view details

push time in a month

push eventafinch7/deno

afinch7

commit sha 9f660f8268884dc41e319b8d0d5652c196e6f480

Refactor dispatcher system

view details

push time in a month

Pull request review commentdenoland/deno

Refactor snapshot build

+[package]+name = "deno_cli_snapshots"+version = "0.0.3"+license = "MIT"+authors = ["Ryan Dahl <ry@tinyclouds.org>"]+edition = "2018"+description = "Provides snapshots for the deno CLI"+repository = "https://github.com/ry/deno_typescript"+readme = "../README.md"++[lib]+path = "lib.rs"++[dev-dependencies]+deno = "0.15.0"

path = "../core"?

ry

comment created time in 2 months

Pull request review commentdenoland/deno

Refactor snapshot build

+extern crate deno;+extern crate serde;+extern crate serde_json;++mod ops;+use deno::deno_mod;+use deno::js_check;+pub use deno::v8_set_flags;+use deno::ErrBox;+use deno::Isolate;+use deno::ModuleSpecifier;+use deno::StartupData;+pub use ops::EmitResult;+use ops::WrittenFile;+use std::collections::HashMap;+use std::fs;+use std::path::Path;+use std::path::PathBuf;+use std::sync::Arc;+use std::sync::Mutex;++/// Sets the --trace-serializer V8 flag for debugging snapshots.+pub fn trace_serializer() {+  let dummy = "foo".to_string();+  let r =+    deno::v8_set_flags(vec![dummy.clone(), "--trace-serializer".to_string()]);+  assert_eq!(r, vec![dummy]);+}++#[derive(Debug)]+pub struct TSState {+  bundle: bool,+  exit_code: i32,++  emit_result: Option<EmitResult>,+  // (url, corresponding_module, source_code)+  written_files: Vec<WrittenFile>,+}++pub struct TSIsolate {+  isolate: Isolate,+  state: Arc<Mutex<TSState>>,+}++static TYPESCRIPT_CODE: &str =+  include_str!("../third_party/node_modules/typescript/lib/typescript.js");++fn preprocessor_replacements_json() -> String {+  /// BUILD_OS and BUILD_ARCH match the values in Deno.build. See js/build.ts.+  #[cfg(target_os = "macos")]+  static BUILD_OS: &str = "mac";+  #[cfg(target_os = "linux")]+  static BUILD_OS: &str = "linux";+  #[cfg(target_os = "windows")]+  static BUILD_OS: &str = "win";+  #[cfg(target_arch = "x86_64")]+  static BUILD_ARCH: &str = "x64";++  let mut replacements = HashMap::new();+  replacements.insert("DENO_REPLACE_OS", BUILD_OS);+  replacements.insert("DENO_REPLACE_ARCH", BUILD_ARCH);+  serde_json::json!(replacements).to_string()+}++impl TSIsolate {+  fn new(bundle: bool) -> TSIsolate {+    let mut isolate = Isolate::new(StartupData::None, false);+    let main_code = include_str!("compiler_main.js");+    js_check(isolate.execute("assets/typescript.js", TYPESCRIPT_CODE));+    js_check(isolate.execute("compiler_main.js", main_code));++    let state = Arc::new(Mutex::new(TSState {+      bundle,+      exit_code: 0,+      emit_result: None,+      written_files: Vec::new(),+    }));+    let state_ = state.clone();+    isolate.set_dispatch(move |op_id, control_buf, zero_copy_buf| {+      assert!(zero_copy_buf.is_none()); // zero_copy_buf unused in compiler.+      let mut s = state_.lock().unwrap();+      ops::dispatch_op(&mut s, op_id, control_buf)+    });+    TSIsolate { isolate, state }+  }++  // TODO(ry) Instead of Result<Arc<Mutex<TSState>>, ErrBox>, return something+  // like Result<TSState, ErrBox>. I think it would be nicer if this function+  // consumes TSIsolate.+  /// Compiles each module to ESM. Doesn't write any files to disk.+  /// Passes all output via state.+  fn compile(+    mut self,+    config_json: &serde_json::Value,+    root_names: Vec<String>,+  ) -> Result<Arc<Mutex<TSState>>, ErrBox> {+    let root_names_json = serde_json::json!(root_names).to_string();+    let source = &format!(+      "main({:?}, {}, {})",+      config_json.to_string(),+      root_names_json,+      preprocessor_replacements_json()+    );+    self.isolate.execute("<anon>", source)?;+    Ok(self.state.clone())+  }+}++// TODO(ry) Instead of Result<Arc<Mutex<TSState>>, ErrBox>, return something+// like Result<TSState, ErrBox>+pub fn compile(+  root_names: Vec<PathBuf>,+) -> Result<Arc<Mutex<TSState>>, ErrBox> {+  let ts_isolate = TSIsolate::new(false);++  let config_json = serde_json::json!({+    "compilerOptions": {+      "declaration": true,+      "lib": ["esnext"],+      "module": "esnext",+      "target": "esnext",+      "listFiles": true,+      "listEmittedFiles": true,+      // Emit the source alongside the sourcemaps within a single file;+      // requires --inlineSourceMap or --sourceMap to be set.+      // "inlineSources": true,+      "sourceMap": true,+    },+  });++  let mut root_names_str: Vec<String> = root_names+    .iter()+    .map(|p| {+      assert!(p.exists());+      p.to_string_lossy().to_string()+    })+    .collect();+  root_names_str.push("$asset$/lib.deno_core.d.ts".to_string());++  // TODO lift js_check to caller?+  let state = js_check(ts_isolate.compile(&config_json, root_names_str));++  Ok(state)+}++pub fn compile_bundle(+  bundle: &Path,+  root_names: Vec<PathBuf>,+) -> Result<Arc<Mutex<TSState>>, ErrBox> {+  let ts_isolate = TSIsolate::new(true);++  let config_json = serde_json::json!({+    "compilerOptions": {+      "declaration": true,+      "lib": ["esnext"],+      "module": "amd",+      "target": "esnext",+      "listFiles": true,+      "listEmittedFiles": true,+      // "types" : ["typescript.d.ts"],+      "typeRoots" : ["$typeRoots$"],+      // Emit the source alongside the sourcemaps within a single file;+      // requires --inlineSourceMap or --sourceMap to be set.+      // "inlineSources": true,+      "sourceMap": true,+      "outFile": bundle,+    },+  });++  let mut root_names_str: Vec<String> = root_names+    .iter()+    .map(|p| {+      if !p.exists() {+        panic!("File not found {}", p.display());+      }++      let module_specifier =+        ModuleSpecifier::resolve_url_or_path(&p.to_string_lossy()).unwrap();+      module_specifier.as_str().to_string()+      // p.to_string_lossy().to_string()+    })+    .collect();+  root_names_str.push("$asset$/lib.deno_core.d.ts".to_string());++  // TODO lift js_check to caller?+  let state = js_check(ts_isolate.compile(&config_json, root_names_str));++  Ok(state)+}++#[allow(dead_code)]+fn print_source_code(code: &str) {+  let mut i = 1;+  for line in code.lines() {+    println!("{:3}  {}", i, line);+    i += 1;+  }+}++pub fn mksnapshot_bundle(+  bundle: &Path,+  env_var: &str,+  state: Arc<Mutex<TSState>>,+) -> Result<(), ErrBox> {+  let mut runtime_isolate = Isolate::new(StartupData::None, true);+  let source_code_vec = std::fs::read(bundle)?;+  let source_code = std::str::from_utf8(&source_code_vec)?;++  js_check(+    runtime_isolate.execute("amd_runtime.js", include_str!("amd_runtime.js")),+  );++  js_check(runtime_isolate.execute(&bundle.to_string_lossy(), &source_code));++  // execute main.++  let state = state.lock().unwrap();+  let main = state.written_files.last().unwrap().module_name.clone();+  // let main = "file:///Users/rld/src/deno_typescript/cli_snapshots/js/main.ts";+  js_check(runtime_isolate.execute("anon", &format!("require('{}')", main)));++  snapshot_to_env(runtime_isolate, env_var)?;++  Ok(())+}++pub fn mksnapshot_bundle_ts(

Maybe add a triple slash doc, so we know that mksnapshot_bundle_ts includes typescript in the snapshot.

ry

comment created time in 2 months

Pull request review commentdenoland/deno

Refactor snapshot build

+extern crate deno;+extern crate serde;+extern crate serde_json;++mod ops;+use deno::deno_mod;+use deno::js_check;+pub use deno::v8_set_flags;+use deno::ErrBox;+use deno::Isolate;+use deno::ModuleSpecifier;+use deno::StartupData;+pub use ops::EmitResult;+use ops::WrittenFile;+use std::collections::HashMap;+use std::fs;+use std::path::Path;+use std::path::PathBuf;+use std::sync::Arc;+use std::sync::Mutex;++/// Sets the --trace-serializer V8 flag for debugging snapshots.+pub fn trace_serializer() {+  let dummy = "foo".to_string();+  let r =+    deno::v8_set_flags(vec![dummy.clone(), "--trace-serializer".to_string()]);+  assert_eq!(r, vec![dummy]);+}++#[derive(Debug)]+pub struct TSState {+  bundle: bool,+  exit_code: i32,++  emit_result: Option<EmitResult>,+  // (url, corresponding_module, source_code)+  written_files: Vec<WrittenFile>,+}++pub struct TSIsolate {+  isolate: Isolate,+  state: Arc<Mutex<TSState>>,+}++static TYPESCRIPT_CODE: &str =+  include_str!("../third_party/node_modules/typescript/lib/typescript.js");++fn preprocessor_replacements_json() -> String {+  /// BUILD_OS and BUILD_ARCH match the values in Deno.build. See js/build.ts.+  #[cfg(target_os = "macos")]+  static BUILD_OS: &str = "mac";+  #[cfg(target_os = "linux")]+  static BUILD_OS: &str = "linux";+  #[cfg(target_os = "windows")]+  static BUILD_OS: &str = "win";+  #[cfg(target_arch = "x86_64")]+  static BUILD_ARCH: &str = "x64";++  let mut replacements = HashMap::new();+  replacements.insert("DENO_REPLACE_OS", BUILD_OS);+  replacements.insert("DENO_REPLACE_ARCH", BUILD_ARCH);+  serde_json::json!(replacements).to_string()+}++impl TSIsolate {+  fn new(bundle: bool) -> TSIsolate {+    let mut isolate = Isolate::new(StartupData::None, false);+    let main_code = include_str!("compiler_main.js");+    js_check(isolate.execute("assets/typescript.js", TYPESCRIPT_CODE));+    js_check(isolate.execute("compiler_main.js", main_code));++    let state = Arc::new(Mutex::new(TSState {+      bundle,+      exit_code: 0,+      emit_result: None,+      written_files: Vec::new(),+    }));+    let state_ = state.clone();+    isolate.set_dispatch(move |op_id, control_buf, zero_copy_buf| {+      assert!(zero_copy_buf.is_none()); // zero_copy_buf unused in compiler.+      let mut s = state_.lock().unwrap();+      ops::dispatch_op(&mut s, op_id, control_buf)+    });+    TSIsolate { isolate, state }+  }++  // TODO(ry) Instead of Result<Arc<Mutex<TSState>>, ErrBox>, return something+  // like Result<TSState, ErrBox>. I think it would be nicer if this function+  // consumes TSIsolate.+  /// Compiles each module to ESM. Doesn't write any files to disk.+  /// Passes all output via state.+  fn compile(+    mut self,+    config_json: &serde_json::Value,+    root_names: Vec<String>,+  ) -> Result<Arc<Mutex<TSState>>, ErrBox> {+    let root_names_json = serde_json::json!(root_names).to_string();+    let source = &format!(+      "main({:?}, {}, {})",+      config_json.to_string(),+      root_names_json,+      preprocessor_replacements_json()+    );+    self.isolate.execute("<anon>", source)?;+    Ok(self.state.clone())+  }+}++// TODO(ry) Instead of Result<Arc<Mutex<TSState>>, ErrBox>, return something+// like Result<TSState, ErrBox>+pub fn compile(+  root_names: Vec<PathBuf>,+) -> Result<Arc<Mutex<TSState>>, ErrBox> {+  let ts_isolate = TSIsolate::new(false);++  let config_json = serde_json::json!({+    "compilerOptions": {+      "declaration": true,+      "lib": ["esnext"],+      "module": "esnext",+      "target": "esnext",+      "listFiles": true,+      "listEmittedFiles": true,+      // Emit the source alongside the sourcemaps within a single file;+      // requires --inlineSourceMap or --sourceMap to be set.+      // "inlineSources": true,+      "sourceMap": true,+    },+  });++  let mut root_names_str: Vec<String> = root_names+    .iter()+    .map(|p| {+      assert!(p.exists());+      p.to_string_lossy().to_string()+    })+    .collect();+  root_names_str.push("$asset$/lib.deno_core.d.ts".to_string());++  // TODO lift js_check to caller?+  let state = js_check(ts_isolate.compile(&config_json, root_names_str));++  Ok(state)+}++pub fn compile_bundle(+  bundle: &Path,+  root_names: Vec<PathBuf>,+) -> Result<Arc<Mutex<TSState>>, ErrBox> {+  let ts_isolate = TSIsolate::new(true);++  let config_json = serde_json::json!({+    "compilerOptions": {+      "declaration": true,+      "lib": ["esnext"],+      "module": "amd",+      "target": "esnext",+      "listFiles": true,+      "listEmittedFiles": true,+      // "types" : ["typescript.d.ts"],+      "typeRoots" : ["$typeRoots$"],+      // Emit the source alongside the sourcemaps within a single file;+      // requires --inlineSourceMap or --sourceMap to be set.+      // "inlineSources": true,+      "sourceMap": true,+      "outFile": bundle,+    },+  });++  let mut root_names_str: Vec<String> = root_names+    .iter()+    .map(|p| {+      if !p.exists() {+        panic!("File not found {}", p.display());+      }++      let module_specifier =+        ModuleSpecifier::resolve_url_or_path(&p.to_string_lossy()).unwrap();+      module_specifier.as_str().to_string()+      // p.to_string_lossy().to_string()+    })+    .collect();+  root_names_str.push("$asset$/lib.deno_core.d.ts".to_string());++  // TODO lift js_check to caller?+  let state = js_check(ts_isolate.compile(&config_json, root_names_str));++  Ok(state)+}++#[allow(dead_code)]+fn print_source_code(code: &str) {+  let mut i = 1;+  for line in code.lines() {+    println!("{:3}  {}", i, line);+    i += 1;+  }+}++pub fn mksnapshot_bundle(+  bundle: &Path,+  env_var: &str,+  state: Arc<Mutex<TSState>>,+) -> Result<(), ErrBox> {+  let mut runtime_isolate = Isolate::new(StartupData::None, true);+  let source_code_vec = std::fs::read(bundle)?;+  let source_code = std::str::from_utf8(&source_code_vec)?;++  js_check(+    runtime_isolate.execute("amd_runtime.js", include_str!("amd_runtime.js")),+  );++  js_check(runtime_isolate.execute(&bundle.to_string_lossy(), &source_code));++  // execute main.++  let state = state.lock().unwrap();+  let main = state.written_files.last().unwrap().module_name.clone();+  // let main = "file:///Users/rld/src/deno_typescript/cli_snapshots/js/main.ts";

rm?

ry

comment created time in 2 months

Pull request review commentdenoland/deno

Refactor snapshot build

+export function printHello(): void {

Is this file still needed?

ry

comment created time in 2 months

Pull request review commentdenoland/deno

Refactor snapshot build

+extern crate deno;+extern crate serde;+extern crate serde_json;++mod ops;+use deno::deno_mod;+use deno::js_check;+pub use deno::v8_set_flags;+use deno::ErrBox;+use deno::Isolate;+use deno::ModuleSpecifier;+use deno::StartupData;+pub use ops::EmitResult;+use ops::WrittenFile;+use std::collections::HashMap;+use std::fs;+use std::path::Path;+use std::path::PathBuf;+use std::sync::Arc;+use std::sync::Mutex;++/// Sets the --trace-serializer V8 flag for debugging snapshots.+pub fn trace_serializer() {+  let dummy = "foo".to_string();+  let r =+    deno::v8_set_flags(vec![dummy.clone(), "--trace-serializer".to_string()]);+  assert_eq!(r, vec![dummy]);+}++#[derive(Debug)]+pub struct TSState {+  bundle: bool,+  exit_code: i32,++  emit_result: Option<EmitResult>,+  // (url, corresponding_module, source_code)+  written_files: Vec<WrittenFile>,+}++pub struct TSIsolate {+  isolate: Isolate,+  state: Arc<Mutex<TSState>>,+}++static TYPESCRIPT_CODE: &str =+  include_str!("../third_party/node_modules/typescript/lib/typescript.js");++fn preprocessor_replacements_json() -> String {+  /// BUILD_OS and BUILD_ARCH match the values in Deno.build. See js/build.ts.+  #[cfg(target_os = "macos")]+  static BUILD_OS: &str = "mac";+  #[cfg(target_os = "linux")]+  static BUILD_OS: &str = "linux";+  #[cfg(target_os = "windows")]+  static BUILD_OS: &str = "win";+  #[cfg(target_arch = "x86_64")]+  static BUILD_ARCH: &str = "x64";++  let mut replacements = HashMap::new();+  replacements.insert("DENO_REPLACE_OS", BUILD_OS);+  replacements.insert("DENO_REPLACE_ARCH", BUILD_ARCH);+  serde_json::json!(replacements).to_string()+}++impl TSIsolate {+  fn new(bundle: bool) -> TSIsolate {+    let mut isolate = Isolate::new(StartupData::None, false);+    let main_code = include_str!("compiler_main.js");+    js_check(isolate.execute("assets/typescript.js", TYPESCRIPT_CODE));+    js_check(isolate.execute("compiler_main.js", main_code));++    let state = Arc::new(Mutex::new(TSState {+      bundle,+      exit_code: 0,+      emit_result: None,+      written_files: Vec::new(),+    }));+    let state_ = state.clone();+    isolate.set_dispatch(move |op_id, control_buf, zero_copy_buf| {+      assert!(zero_copy_buf.is_none()); // zero_copy_buf unused in compiler.+      let mut s = state_.lock().unwrap();+      ops::dispatch_op(&mut s, op_id, control_buf)+    });+    TSIsolate { isolate, state }+  }++  // TODO(ry) Instead of Result<Arc<Mutex<TSState>>, ErrBox>, return something+  // like Result<TSState, ErrBox>. I think it would be nicer if this function+  // consumes TSIsolate.+  /// Compiles each module to ESM. Doesn't write any files to disk.+  /// Passes all output via state.+  fn compile(+    mut self,+    config_json: &serde_json::Value,+    root_names: Vec<String>,+  ) -> Result<Arc<Mutex<TSState>>, ErrBox> {+    let root_names_json = serde_json::json!(root_names).to_string();+    let source = &format!(+      "main({:?}, {}, {})",+      config_json.to_string(),+      root_names_json,+      preprocessor_replacements_json()+    );+    self.isolate.execute("<anon>", source)?;+    Ok(self.state.clone())+  }+}++// TODO(ry) Instead of Result<Arc<Mutex<TSState>>, ErrBox>, return something+// like Result<TSState, ErrBox>+pub fn compile(+  root_names: Vec<PathBuf>,+) -> Result<Arc<Mutex<TSState>>, ErrBox> {+  let ts_isolate = TSIsolate::new(false);++  let config_json = serde_json::json!({+    "compilerOptions": {+      "declaration": true,+      "lib": ["esnext"],+      "module": "esnext",+      "target": "esnext",+      "listFiles": true,+      "listEmittedFiles": true,+      // Emit the source alongside the sourcemaps within a single file;+      // requires --inlineSourceMap or --sourceMap to be set.+      // "inlineSources": true,+      "sourceMap": true,+    },+  });++  let mut root_names_str: Vec<String> = root_names+    .iter()+    .map(|p| {+      assert!(p.exists());+      p.to_string_lossy().to_string()+    })+    .collect();+  root_names_str.push("$asset$/lib.deno_core.d.ts".to_string());++  // TODO lift js_check to caller?+  let state = js_check(ts_isolate.compile(&config_json, root_names_str));++  Ok(state)+}++pub fn compile_bundle(+  bundle: &Path,+  root_names: Vec<PathBuf>,+) -> Result<Arc<Mutex<TSState>>, ErrBox> {+  let ts_isolate = TSIsolate::new(true);++  let config_json = serde_json::json!({+    "compilerOptions": {+      "declaration": true,+      "lib": ["esnext"],+      "module": "amd",+      "target": "esnext",+      "listFiles": true,+      "listEmittedFiles": true,+      // "types" : ["typescript.d.ts"],+      "typeRoots" : ["$typeRoots$"],+      // Emit the source alongside the sourcemaps within a single file;+      // requires --inlineSourceMap or --sourceMap to be set.+      // "inlineSources": true,+      "sourceMap": true,+      "outFile": bundle,+    },+  });++  let mut root_names_str: Vec<String> = root_names+    .iter()+    .map(|p| {+      if !p.exists() {+        panic!("File not found {}", p.display());+      }++      let module_specifier =+        ModuleSpecifier::resolve_url_or_path(&p.to_string_lossy()).unwrap();+      module_specifier.as_str().to_string()+      // p.to_string_lossy().to_string()+    })+    .collect();+  root_names_str.push("$asset$/lib.deno_core.d.ts".to_string());++  // TODO lift js_check to caller?+  let state = js_check(ts_isolate.compile(&config_json, root_names_str));++  Ok(state)+}++#[allow(dead_code)]+fn print_source_code(code: &str) {+  let mut i = 1;+  for line in code.lines() {+    println!("{:3}  {}", i, line);+    i += 1;+  }+}++pub fn mksnapshot_bundle(+  bundle: &Path,+  env_var: &str,+  state: Arc<Mutex<TSState>>,+) -> Result<(), ErrBox> {+  let mut runtime_isolate = Isolate::new(StartupData::None, true);+  let source_code_vec = std::fs::read(bundle)?;+  let source_code = std::str::from_utf8(&source_code_vec)?;++  js_check(+    runtime_isolate.execute("amd_runtime.js", include_str!("amd_runtime.js")),+  );++  js_check(runtime_isolate.execute(&bundle.to_string_lossy(), &source_code));++  // execute main.++  let state = state.lock().unwrap();+  let main = state.written_files.last().unwrap().module_name.clone();+  // let main = "file:///Users/rld/src/deno_typescript/cli_snapshots/js/main.ts";+  js_check(runtime_isolate.execute("anon", &format!("require('{}')", main)));++  snapshot_to_env(runtime_isolate, env_var)?;++  Ok(())+}++pub fn mksnapshot_bundle_ts(+  bundle: &Path,+  env_var: &str,+  state: Arc<Mutex<TSState>>,+) -> Result<(), ErrBox> {+  let mut runtime_isolate = Isolate::new(StartupData::None, true);+  let source_code_vec = std::fs::read(bundle)?;+  let source_code = std::str::from_utf8(&source_code_vec)?;++  js_check(+    runtime_isolate.execute("amd_runtime.js", include_str!("amd_runtime.js")),+  );+  js_check(runtime_isolate.execute(&bundle.to_string_lossy(), &source_code));++  let state = state.lock().unwrap();+  let main = state.written_files.last().unwrap().module_name.clone();++  js_check(runtime_isolate.execute("typescript.js", TYPESCRIPT_CODE));+  js_check(runtime_isolate.execute("anon", &format!("require('{}')", main)));++  snapshot_to_env(runtime_isolate, env_var)?;++  Ok(())+}++// TODO(ry) Instead of state: Arc<Mutex<TSState>>, take something like state:+// &TSState+pub fn mksnapshot(

What does this do?

ry

comment created time in 2 months

pull request commentdenoland/deno

[WIP] Move fs ops to standalone crate.

@ry I want to tackle that next. I figure it's best to wait for you to sort out #2825 first.

afinch7

comment created time in 2 months

push eventafinch7/deno

Ryan Dahl

commit sha 45ddff14b2ce22c86c7ae499be212f3c8a7912bd

Remove unused GN action

view details

Ryan Dahl

commit sha 2b79552dd1d3936c015e3bb07bef8fab09b62a40

Internalize base64-js, convert to TypeScript

view details

Ryan Dahl

commit sha 8f919465b09e0338148d22459fac70fd5d5c9089

Remove @stardazed/streams This is a regression on several some features in the fetch API. To bring these back @stardazed/streams simply needs to be ported to TS and included in the //js directory. Towards #2608

view details

dev-nicolaos

commit sha cb70397e3c207c59127127c824bbb2f29338f93c

Update 0.16 release notes Adds note about colors module location change in deno_std

view details

迷渡

commit sha 23215a83498d27f632b61686f64998ec48fd9943

update `deno help` output (#2832)

view details

Bartek Iwańczuk

commit sha b5a5e973842fed271210ce919a309745b9bfa30a

add console.dirxml (#2835)

view details

迷渡

commit sha 590463bd4a8d71330ab808774b63dd6b366bba1f

setTimeout's params should not be bigint (#2834)

view details

Bert Belder

commit sha 89794d5d347d1358ec32ed42e1f0faa6e0ac6abe

build: make it possible to pass arbitrary env vars to rustc

view details

Bert Belder

commit sha 177727d730d786c71ba3afbc02f023f4b40c27a8

third_party: downgrade 'url' crate to version 1.7.2

view details

Bert Belder

commit sha e939ec0f21d7af5da6186258993cebd1ee349a9e

third_party: upgrade 'rustls' and related crates

view details

Bert Belder

commit sha 5401cb76304ae8d3e8896f6020ba4ef25bac0bba

Revert "Use -O3 instead of -O (#2070)" It didn't deliver the expected performance improvements, so let's go back and use Rust defaults again. This reverts commit 4232c89c9eb18b32a6e87bfbb46c8d5862f52fb3.

view details

Ryan Dahl

commit sha c370f749b2260cc1d8970b1dcdc63ff00008e26d

Remove ts_library_builder, maintain lib.deno_runtime.d.ts by hand (#2827)

view details

迷渡

commit sha 65fa2b810b9e22f6eda6c11945e27ba21dff7a1c

clearTimeout's params should not be bigint (#2838)

view details

afinch7

commit sha 39186307ab1950c731d0026470b11646c3576336

add dispatcher registry and remove set_dispatch

view details

afinch7

commit sha 72282a64707cdccb8fd4fb9e87fa8a63f6b1a365

move dispatcher registry to another file and get core working

view details

afinch7

commit sha 3817fa190dcf6c750d97ee2032134dc37cac6026

replace BTreeMap with vec

view details

afinch7

commit sha b4267a96805780a286242262e81c95308f0bee6d

remove this debug print

view details

afinch7

commit sha b755bf8bb2d4fbf917d1b8d22ab55c5ca5ef7021

optimizations

view details

afinch7

commit sha 8a0dd3084619ab3c6a1103987db88e6d4b1fd2af

added op registration notification system for isolates.

view details

afinch7

commit sha 8a90218cd96b296f343f8a3fc25c4e7dbc098155

improve js registry Added a notify system. Any valid namespace + name combination will no longer error even if not set. More robust backing supports aliasing for namespaces.

view details

push time in 2 months

push eventafinch7/deno

Ryan Dahl

commit sha 5b2baa5c990fbeae747e952c5dcd7a5369e950b1

Port rest of os ops to JSON (#2802)

view details

Bartek Iwańczuk

commit sha 79f82cf10ed1dbf91346994250d7311a4d74377a

port ops to JSON: compiler, errors, fetch, files (#2804)

view details

Bartek Iwańczuk

commit sha 137f33733d365026903d40e7cde6e34ac6c36dcf

port more ops to JSON (#2809)

view details

Trivikram Kamat

commit sha bdc0a13261deaa3748f51d9948b4e7b92864c324

doc: add CONTRIBUTING.md (#2813) Similar to React's CONTRIBUTING.md https://github.com/facebook/react/blob/master/CONTRIBUTING.md

view details

Ryan Dahl

commit sha 2235dd795d3cc6c24ff1bdd1bbdcd110b4b0bdfc

Revert json ops (#2814) * Revert "port more ops to JSON (#2809)" This reverts commit 137f33733d365026903d40e7cde6e34ac6c36dcf. * Revert "port ops to JSON: compiler, errors, fetch, files (#2804)" This reverts commit 79f82cf10ed1dbf91346994250d7311a4d74377a. * Revert "Port rest of os ops to JSON (#2802)" This reverts commit 5b2baa5c990fbeae747e952c5dcd7a5369e950b1.

view details

Bartek Iwańczuk

commit sha 017f88ee99b0fe40221e6af92e0b6a976fbaf2ad

fix: shared queue requires aligned buffer (#2816)

view details

Bartek Iwańczuk

commit sha 520f9631e09aa720fd8c03513ee8ea967f5ed4b2

bring back json ops (#2815)

view details

Bartek Iwańczuk

commit sha a6f6209f5277f2737bc67efad5c91ab168aff6b5

port fs ops to JSON (#2812)

view details

Ryan Dahl

commit sha 7ff67017f2153eeed393da670777ff85df2801ca

Move TestFmt to the end of tests, because slow

view details

Ryan Dahl

commit sha d8ada4d3fcc5dfe7f76103399a1d765fbab2ee45

Port readSync/writeSync ops to minimal This removes dispatch_flatbuffers as it is now unused. There are still a few places where msg_generated is used: ErrorKind and MediaType. These will be dealt with later.

view details

Ryan Dahl

commit sha f94900406d52a9d0a432ae9ebef65d46092afb41

Remove flatbuffers (#2818)

view details

Ryan Dahl

commit sha 725eb9810590e8237df68ec5580daaf0fa77e7d3

Clean up various flatbuffer references (#2819)

view details

Nayeem Rahman

commit sha b6a4ec7d163810d52750f04ec2073b13f8943991

Improve error stacks for async ops (#2820)

view details

Bartek Iwańczuk

commit sha 20739a8111658c088e291503866110117e117792

feat: implement Addr interface (#2821)

view details

迷渡

commit sha 1d34f11a873d640ac2611bcabee5875a27f43a2e

doc: fix list style (#2823)

view details

Ryan Dahl

commit sha 45ddff14b2ce22c86c7ae499be212f3c8a7912bd

Remove unused GN action

view details

Ryan Dahl

commit sha 2b79552dd1d3936c015e3bb07bef8fab09b62a40

Internalize base64-js, convert to TypeScript

view details

Ryan Dahl

commit sha 8f919465b09e0338148d22459fac70fd5d5c9089

Remove @stardazed/streams This is a regression on several some features in the fetch API. To bring these back @stardazed/streams simply needs to be ported to TS and included in the //js directory. Towards #2608

view details

dev-nicolaos

commit sha cb70397e3c207c59127127c824bbb2f29338f93c

Update 0.16 release notes Adds note about colors module location change in deno_std

view details

迷渡

commit sha 23215a83498d27f632b61686f64998ec48fd9943

update `deno help` output (#2832)

view details

push time in 2 months

push eventafinch7/deno

Ryan Dahl

commit sha 45ddff14b2ce22c86c7ae499be212f3c8a7912bd

Remove unused GN action

view details

Ryan Dahl

commit sha 2b79552dd1d3936c015e3bb07bef8fab09b62a40

Internalize base64-js, convert to TypeScript

view details

Ryan Dahl

commit sha 8f919465b09e0338148d22459fac70fd5d5c9089

Remove @stardazed/streams This is a regression on several some features in the fetch API. To bring these back @stardazed/streams simply needs to be ported to TS and included in the //js directory. Towards #2608

view details

dev-nicolaos

commit sha cb70397e3c207c59127127c824bbb2f29338f93c

Update 0.16 release notes Adds note about colors module location change in deno_std

view details

迷渡

commit sha 23215a83498d27f632b61686f64998ec48fd9943

update `deno help` output (#2832)

view details

Bartek Iwańczuk

commit sha b5a5e973842fed271210ce919a309745b9bfa30a

add console.dirxml (#2835)

view details

迷渡

commit sha 590463bd4a8d71330ab808774b63dd6b366bba1f

setTimeout's params should not be bigint (#2834)

view details

Bert Belder

commit sha 89794d5d347d1358ec32ed42e1f0faa6e0ac6abe

build: make it possible to pass arbitrary env vars to rustc

view details

Bert Belder

commit sha 177727d730d786c71ba3afbc02f023f4b40c27a8

third_party: downgrade 'url' crate to version 1.7.2

view details

Bert Belder

commit sha e939ec0f21d7af5da6186258993cebd1ee349a9e

third_party: upgrade 'rustls' and related crates

view details

Bert Belder

commit sha 5401cb76304ae8d3e8896f6020ba4ef25bac0bba

Revert "Use -O3 instead of -O (#2070)" It didn't deliver the expected performance improvements, so let's go back and use Rust defaults again. This reverts commit 4232c89c9eb18b32a6e87bfbb46c8d5862f52fb3.

view details

Ryan Dahl

commit sha c370f749b2260cc1d8970b1dcdc63ff00008e26d

Remove ts_library_builder, maintain lib.deno_runtime.d.ts by hand (#2827)

view details

迷渡

commit sha 65fa2b810b9e22f6eda6c11945e27ba21dff7a1c

clearTimeout's params should not be bigint (#2838)

view details

afinch7

commit sha 39186307ab1950c731d0026470b11646c3576336

add dispatcher registry and remove set_dispatch

view details

afinch7

commit sha 72282a64707cdccb8fd4fb9e87fa8a63f6b1a365

move dispatcher registry to another file and get core working

view details

afinch7

commit sha 3817fa190dcf6c750d97ee2032134dc37cac6026

replace BTreeMap with vec

view details

afinch7

commit sha b4267a96805780a286242262e81c95308f0bee6d

remove this debug print

view details

afinch7

commit sha b755bf8bb2d4fbf917d1b8d22ab55c5ca5ef7021

optimizations

view details

afinch7

commit sha 8a0dd3084619ab3c6a1103987db88e6d4b1fd2af

added op registration notification system for isolates.

view details

afinch7

commit sha 8a90218cd96b296f343f8a3fc25c4e7dbc098155

improve js registry Added a notify system. Any valid namespace + name combination will no longer error even if not set. More robust backing supports aliasing for namespaces.

view details

push time in 2 months

PR opened denoland/deno

[WIP] Move fs ops to standalone crate.

depends on #2785 part of #2180 soft depends on switch to cargo for builds and snapshot gen refactors

Primary reasons for moving ops to standalone crates:

  • The complexity of cli can be divided into more manageable chunks.
  • Rebuilds should be faster in most cases, since we don't have to rebuild the code for every op always.
  • These new crates can be readily used in third party deno core implementations. This should remove a lot of the boilerplate for embedding.

Main goals in this PR:

  • Move fs ops to standalone crate that can be readily used in deno core implementations.
  • Provide some framework for other standalone ops in the future.
  • Avoid adding complexity to cli.
  • Test the versatility of my dispatcher system from #2785

TODOs:

  • [ ] Standardize permissions checks for standalone ops like this. This can be deferred for now, but still something to think on.
  • [ ] Make error kind system outwardly extensible. Maybe just use strings, since we are using json now?
  • [ ] Move TypeScript code for fs ops to this new standalone crate, and come up with a way to integrate this with the changes to snapshot generation(#2825).
+4799 -2284

0 comment

59 changed files

pr created time in 2 months

push eventafinch7/deno

afinch7

commit sha 511d14d9975ddb93bb9f03b38bd284a520fcee90

move fs ops to standalone crate Still a couple of things to figure out here 1. I would like to standardize providing permissions access to standalone ops. 2. We need a way to pass error kind that is outwardly extensible. Maybe just strings, since we are using json?

view details

push time in 2 months

create barnchafinch7/deno

branch : move_fs_to_crate

created branch time in 2 months

push eventafinch7/deno

afinch7

commit sha d60e95a18be605107923d85e24f1846653498207

add NAME to DenoOpDispatcher trait

view details

push time in 2 months

pull request commentdenoland/deno

New dispatcher infrastructure.

This latest commit removed a lot of the complexity in the cli implementation. Op implementations looked like this:

pub struct OpMetrics {
  state: ThreadSafeState,
}

impl OpMetrics {
  pub fn new(state: ThreadSafeState) -> Self {
    Self { state }
  }
}

impl OpDispatcher for OpMetrics {
  fn dispatch(&self, control: &[u8], buf: Option<PinnedBuf>) -> CoreOp {
    wrap_json_op(
      move |_args, _zero_copy| {
        let m = &self.state.metrics;

        Ok(JsonOp::Sync(json!({
          "opsDispatched": m.ops_dispatched.load(Ordering::SeqCst) as u64,
          "opsCompleted": m.ops_completed.load(Ordering::SeqCst) as u64,
          "bytesSentControl": m.bytes_sent_control.load(Ordering::SeqCst) as u64,
          "bytesSentData": m.bytes_sent_data.load(Ordering::SeqCst) as u64,
          "bytesReceived": m.bytes_received.load(Ordering::SeqCst) as u64
        })))
      },
      &self.state,
      control,
      buf,
    )
  }
}

impl Named for OpMetrics {
  const NAME: &'static str = "metrics";
}

Now the same op looks like this:

pub struct OpMetrics;

impl DenoOpDispatcher for OpMetrics {
  fn dispatch(
    &self,
    state: &ThreadSafeState,
    control: &[u8],
    buf: Option<PinnedBuf>,
  ) -> CoreOp {
    wrap_json_op(
      move |_args, _zero_copy| {
        let m = &state.metrics;

        Ok(JsonOp::Sync(json!({
          "opsDispatched": m.ops_dispatched.load(Ordering::SeqCst) as u64,
          "opsCompleted": m.ops_completed.load(Ordering::SeqCst) as u64,
          "bytesSentControl": m.bytes_sent_control.load(Ordering::SeqCst) as u64,
          "bytesSentData": m.bytes_sent_data.load(Ordering::SeqCst) as u64,
          "bytesReceived": m.bytes_received.load(Ordering::SeqCst) as u64
        })))
      },
      control,
      buf,
    )
  }
}

impl Named for OpMetrics {
  const NAME: &'static str = "metrics";
}
afinch7

comment created time in 2 months

push eventafinch7/deno

afinch7

commit sha 447d07acfd2d57708d1ef7347d67ee078cef4606

simplify cli implementation a lot

view details

push time in 2 months

pull request commentdenoland/deno

New dispatcher infrastructure.

@ry I'm a little bothered by that too, but I think the ability to split our ops into standalone crates is worth this cost. I'm going to work on the cli implementation a bit here, and maybe come up with a way to reduce the boilerplate.

afinch7

comment created time in 2 months

push eventafinch7/deno

afinch7

commit sha 51a7c58cfda58c229333f4dd5d44306cc4ec10af

simplify cli implementation a bit

view details

push time in 2 months

push eventafinch7/deno

afinch7

commit sha 25de6681b27a3a87e4ff2876981dfb23017c2e47

implement in cli

view details

push time in 2 months

push eventafinch7/deno

afinch7

commit sha a27894718c213eae6e3f6468e063045e0a1501b2

implement in cli

view details

push time in 2 months

push eventafinch7/deno

afinch7

commit sha 9512b2fd2d486b5d0238d977acebedf035853673

core fixes

view details

afinch7

commit sha 11f0905d2e1cbe4f551db608f498d95704eca9e3

implement in cli

view details

push time in 2 months

push eventafinch7/deno

Ryan Dahl

commit sha 5b2baa5c990fbeae747e952c5dcd7a5369e950b1

Port rest of os ops to JSON (#2802)

view details

Bartek Iwańczuk

commit sha 79f82cf10ed1dbf91346994250d7311a4d74377a

port ops to JSON: compiler, errors, fetch, files (#2804)

view details

Bartek Iwańczuk

commit sha 137f33733d365026903d40e7cde6e34ac6c36dcf

port more ops to JSON (#2809)

view details

Trivikram Kamat

commit sha bdc0a13261deaa3748f51d9948b4e7b92864c324

doc: add CONTRIBUTING.md (#2813) Similar to React's CONTRIBUTING.md https://github.com/facebook/react/blob/master/CONTRIBUTING.md

view details

Ryan Dahl

commit sha 2235dd795d3cc6c24ff1bdd1bbdcd110b4b0bdfc

Revert json ops (#2814) * Revert "port more ops to JSON (#2809)" This reverts commit 137f33733d365026903d40e7cde6e34ac6c36dcf. * Revert "port ops to JSON: compiler, errors, fetch, files (#2804)" This reverts commit 79f82cf10ed1dbf91346994250d7311a4d74377a. * Revert "Port rest of os ops to JSON (#2802)" This reverts commit 5b2baa5c990fbeae747e952c5dcd7a5369e950b1.

view details

Bartek Iwańczuk

commit sha 017f88ee99b0fe40221e6af92e0b6a976fbaf2ad

fix: shared queue requires aligned buffer (#2816)

view details

Bartek Iwańczuk

commit sha 520f9631e09aa720fd8c03513ee8ea967f5ed4b2

bring back json ops (#2815)

view details

Bartek Iwańczuk

commit sha a6f6209f5277f2737bc67efad5c91ab168aff6b5

port fs ops to JSON (#2812)

view details

Ryan Dahl

commit sha 7ff67017f2153eeed393da670777ff85df2801ca

Move TestFmt to the end of tests, because slow

view details

Ryan Dahl

commit sha d8ada4d3fcc5dfe7f76103399a1d765fbab2ee45

Port readSync/writeSync ops to minimal This removes dispatch_flatbuffers as it is now unused. There are still a few places where msg_generated is used: ErrorKind and MediaType. These will be dealt with later.

view details

Ryan Dahl

commit sha f94900406d52a9d0a432ae9ebef65d46092afb41

Remove flatbuffers (#2818)

view details

Ryan Dahl

commit sha 725eb9810590e8237df68ec5580daaf0fa77e7d3

Clean up various flatbuffer references (#2819)

view details

Nayeem Rahman

commit sha b6a4ec7d163810d52750f04ec2073b13f8943991

Improve error stacks for async ops (#2820)

view details

Bartek Iwańczuk

commit sha 20739a8111658c088e291503866110117e117792

feat: implement Addr interface (#2821)

view details

迷渡

commit sha 1d34f11a873d640ac2611bcabee5875a27f43a2e

doc: fix list style (#2823)

view details

afinch7

commit sha a030efd9830aae80964931a715c770f4629cd492

add dispatcher registry and remove set_dispatch

view details

afinch7

commit sha f1d9c371faf5127660a642f46d68f45dd935d52f

move dispatcher registry to another file and get core working

view details

afinch7

commit sha 43a18c001ef76facf7f19bc1b0c9744b246cdce4

replace BTreeMap with vec

view details

afinch7

commit sha 7ab9d6183ad9d253d8e15f70c06f43b703f82d25

remove this debug print

view details

afinch7

commit sha ed2fb04de274bdff806aac035c534ac65ae8263a

optimizations

view details

push time in 2 months

pull request commentdenoland/deno

New core example

Performance is lower than http_bench right now, but I think it's because all the connections are being accepted by one worker(same as http_bench).

afinch7

comment created time in 2 months

push eventafinch7/deno

afinch7

commit sha 38147408072187cf6379cfae30de9d024f8ea7b7

updated gn build and fixes

view details

push time in 2 months

push eventafinch7/deno

afinch7

commit sha f23645a27899b1d895719b0f3262b679b4d6f5c0

improvements Something is still causing this to run very slowly. I think the connections are all being accepted by one isolate.

view details

push time in 2 months

PR opened denoland/deno

New core example

depends on #2785

+2927 -665

0 comment

31 changed files

pr created time in 2 months

PR closed afinch7/deno

New core example
+1213 -0

0 comment

15 changed files

afinch7

pr closed time in 2 months

push eventafinch7/deno

Kitson Kelly

commit sha f0a235563e1eb748f4030d19af3f9a5ac59d2550

Support custom inspection of objects (#2791)

view details

Bartek Iwańczuk

commit sha 389763c04e3102d5b8261a10bb7514ba046fe373

bump test runner revision (#2800)

view details

Bartek Iwańczuk

commit sha b764d1b8ffc4bf5e2ab89bdbd978d708a6da0f24

fix: dynamic import panic (#2792)

view details

Ryan Dahl

commit sha bdc97b3976786bb744a27e59b0f4f28554a682df

Organize dispatch a bit (#2796) Just some clean up reorganization around flatbuffer/minimal dispatch code. This is prep for adding a JSON dispatcher.

view details

Kitson Kelly

commit sha 6c7d337960b3745a7b614a18150862279ef1c942

Support .d.ts files (#2746) Fixes #1432

view details

Bert Belder

commit sha 31aa7c1a5d8a27c720b6255dc3eceda3707b1826

build: support rust crates that generate sources in their build script

view details

Bert Belder

commit sha e0c1ed96e22dc9a94cb5457c8b3eb2f2cd1af831

build: remove per-crate 'treat_warnings_as_errors' gn flag

view details

Bert Belder

commit sha 7a902fed04e23c2be6133024f7ad8fdebb641c60

build: add 'cap_lints' flag for rust crates Using a specialized flag rather than the generic 'args' option makes build_extra/rust/BUILD.gn shorter and more readable.

view details

Bert Belder

commit sha 7f9c6decc8982dc9dec762d6f2cc77c6bdd3f817

third_party: upgrade rust crates

view details

Ryan Dahl

commit sha 0809b06a3938868f364f1343b0de4d5d9686495d

v0.16.0

view details

Bert Belder

commit sha 47c216317f8eb5bf277663a732a79f6b07ba79ef

build: enable 'derive' feature of 'serde' crate

view details

Ryan Dahl

commit sha bc467b265fbe06ace24f5d9536bd8eb36ae4a601

introduce JSON serialization for ops (#2799) Converts env(), exit(), execPath(), utime() and utimeSync() to use JSON instead of flatbuffers.

view details

afinch7

commit sha 704cc4e4cebf105605c99921ed1b74b73e256b0a

add dispatcher registry and remove set_dispatch

view details

afinch7

commit sha a21bf51b6eae3c291a5714334af2768b0800bb51

move dispatcher registry to another file and get core working

view details

afinch7

commit sha a56c5c84cc178c99e9dcffa8cf3f3d2617b8c80b

replace BTreeMap with vec

view details

afinch7

commit sha fb4756977453d9614174a7a4caa9dc3ff44a0165

remove this debug print

view details

afinch7

commit sha 0d9a1d363a6aa71931a71cadfd380682d2c7b8eb

optimizations

view details

afinch7

commit sha 280ea0540216222481e8fdad58b023387c3eb854

added op registration notification system for isolates.

view details

afinch7

commit sha 3dcbdcb8b4586e7274b0c425f797f3c3d02ef72a

improve js registry Added a notify system. Any valid namespace + name combination will no longer error even if not set. More robust backing supports aliasing for namespaces.

view details

afinch7

commit sha 5bf777f7282e73b6d9ae6eba5bfbebba70737993

fixes fixed will_snapshot test renamed core_lib_init to core_lib_load(loads the core lib) and added core_lib_init(calls Deno.core.maybeInit)

view details

push time in 2 months

push eventafinch7/deno

Kitson Kelly

commit sha f0a235563e1eb748f4030d19af3f9a5ac59d2550

Support custom inspection of objects (#2791)

view details

Bartek Iwańczuk

commit sha 389763c04e3102d5b8261a10bb7514ba046fe373

bump test runner revision (#2800)

view details

Bartek Iwańczuk

commit sha b764d1b8ffc4bf5e2ab89bdbd978d708a6da0f24

fix: dynamic import panic (#2792)

view details

Ryan Dahl

commit sha bdc97b3976786bb744a27e59b0f4f28554a682df

Organize dispatch a bit (#2796) Just some clean up reorganization around flatbuffer/minimal dispatch code. This is prep for adding a JSON dispatcher.

view details

Kitson Kelly

commit sha 6c7d337960b3745a7b614a18150862279ef1c942

Support .d.ts files (#2746) Fixes #1432

view details

Bert Belder

commit sha 31aa7c1a5d8a27c720b6255dc3eceda3707b1826

build: support rust crates that generate sources in their build script

view details

Bert Belder

commit sha e0c1ed96e22dc9a94cb5457c8b3eb2f2cd1af831

build: remove per-crate 'treat_warnings_as_errors' gn flag

view details

Bert Belder

commit sha 7a902fed04e23c2be6133024f7ad8fdebb641c60

build: add 'cap_lints' flag for rust crates Using a specialized flag rather than the generic 'args' option makes build_extra/rust/BUILD.gn shorter and more readable.

view details

Bert Belder

commit sha 7f9c6decc8982dc9dec762d6f2cc77c6bdd3f817

third_party: upgrade rust crates

view details

Ryan Dahl

commit sha 0809b06a3938868f364f1343b0de4d5d9686495d

v0.16.0

view details

Bert Belder

commit sha 47c216317f8eb5bf277663a732a79f6b07ba79ef

build: enable 'derive' feature of 'serde' crate

view details

Ryan Dahl

commit sha bc467b265fbe06ace24f5d9536bd8eb36ae4a601

introduce JSON serialization for ops (#2799) Converts env(), exit(), execPath(), utime() and utimeSync() to use JSON instead of flatbuffers.

view details

afinch7

commit sha 704cc4e4cebf105605c99921ed1b74b73e256b0a

add dispatcher registry and remove set_dispatch

view details

afinch7

commit sha a21bf51b6eae3c291a5714334af2768b0800bb51

move dispatcher registry to another file and get core working

view details

afinch7

commit sha a56c5c84cc178c99e9dcffa8cf3f3d2617b8c80b

replace BTreeMap with vec

view details

afinch7

commit sha fb4756977453d9614174a7a4caa9dc3ff44a0165

remove this debug print

view details

afinch7

commit sha 0d9a1d363a6aa71931a71cadfd380682d2c7b8eb

optimizations

view details

afinch7

commit sha 280ea0540216222481e8fdad58b023387c3eb854

added op registration notification system for isolates.

view details

afinch7

commit sha 3dcbdcb8b4586e7274b0c425f797f3c3d02ef72a

improve js registry Added a notify system. Any valid namespace + name combination will no longer error even if not set. More robust backing supports aliasing for namespaces.

view details

afinch7

commit sha 5bf777f7282e73b6d9ae6eba5bfbebba70737993

fixes fixed will_snapshot test renamed core_lib_init to core_lib_load(loads the core lib) and added core_lib_init(calls Deno.core.maybeInit)

view details

push time in 2 months

push eventafinch7/deno

afinch7

commit sha 8f06dcbb071c395a01941867f84fd1f7a71f57e8

clippy fix

view details

afinch7

commit sha b90979e35da15a027df95a66a170f99bd5d6dc9e

add multithreaded shared registry dynamic op register test This new test should represent a worst case scenario with dynamic op registration. My main intent here is to provide a test case that would catch a problem with using IsolateHandle(and it's libdeno::isolate pointer) in notify calls from other threads when registering new ops. I also added a TODO for UserDataScope problem with notifiers(see isolate.rs).

view details

afinch7

commit sha 74af65387cf05d4afb137353dce889aa9019ab01

assign async handler for each op id

view details

push time in 2 months

PR opened afinch7/deno

New core example
+1216 -0

0 comment

15 changed files

pr created time in 2 months

push eventafinch7/deno

afinch7

commit sha 115e82fdd66f12409097b0062b76cf6968aee656

improvements Something is still causing this to run very slowly. I think the connections are all being accepted by one isolate.

view details

push time in 2 months

create barnchafinch7/deno

branch : new_core_example

created branch time in 2 months

pull request commentdenoland/deno

[WIP] Refactor to use new futures api

Here is a list of dependencies, and their respective statuses.

Think most of the stuff can be checked except hyper-rustls (Perhaps use hyper-tls)?

Yes I think most of the dependencies are ready, but async/await has been delayed to 1.39.0 that's really the only thing I'm still waiting on here.

afinch7

comment created time in 2 months

pull request commentdenoland/deno

New dispatcher infrastructure.

I don't think I'm going to bother keeping anything outside of core(just going to start fresh). I had to rebase most of my changes to //cli and //js over #2788, and I really don't like how some of it turned out. Long story short I think this is for the better. I just need to know when you are ready to land this, so I avoid mixing in reverted/removed stuff.

I figure now is a good time for a preliminary review of my changes to core, since I don't plan on changing much in core anymore.

I've also been working on more in depth embedding example for core. It's a multi worker tcp server using work stealing. I have a feeling that the main speed limit in deno right now, is the speed of a single v8 isolate. This should give us a better understanding of the speed limiters on the rust side.

afinch7

comment created time in 2 months

pull request commentdenoland/deno

New dispatcher infrastructure.

@ry I see there are already a half a dozen or more already in the works(#2801). It might be easier to land this first(after you land the first json op #2799), and build these refactored ops ontop of the new dispatch system to begin with. I'm not sure what you want to happen first though.

afinch7

comment created time in 2 months

pull request commentdenoland/deno

New dispatcher infrastructure.

I'm now pretty sure this weird segfault has something to do with the addition of sendSyncMinimal, but I don't really have a good way to test that theory. I changed most of the rust side of things, and the issue still came up.

afinch7

comment created time in 2 months

Pull request review commentdenoland/deno

feat: use v8::MicrotaskPolicy::kExplicit

 void deno_terminate_execution(Deno* d_) {   deno::DenoIsolate* d = reinterpret_cast<deno::DenoIsolate*>(d_);   d->isolate_->TerminateExecution(); }++void deno_run_microtasks(Deno* d_) {

Just tested, and this does fix most of the tests.

diff --git a/core/isolate.rs b/core/isolate.rs
index 99c3ee06..d555ce7b 100644
--- a/core/isolate.rs
+++ b/core/isolate.rs
@@ -390,7 +390,7 @@ impl Isolate {
   }
 
   fn run_microtasks(&self) -> Result<(), ErrBox> {
-    unsafe { libdeno::deno_run_microtasks(self.libdeno_isolate) };
+    unsafe { libdeno::deno_run_microtasks(self.libdeno_isolate, self.as_raw_ptr()) };
     self.check_last_exception()
   }
 
diff --git a/core/libdeno.rs b/core/libdeno.rs
index d8a6d771..65d4cc28 100644
--- a/core/libdeno.rs
+++ b/core/libdeno.rs
@@ -280,7 +280,7 @@ extern "C" {
     js_source: *const c_char,
   );
   pub fn deno_terminate_execution(i: *const isolate);
-  pub fn deno_run_microtasks(i: *const isolate);
+  pub fn deno_run_microtasks(i: *const isolate, user_data: *const c_void);
 
   // Modules
 
diff --git a/core/libdeno/api.cc b/core/libdeno/api.cc
index 2df40b21..2e926f79 100644
--- a/core/libdeno/api.cc
+++ b/core/libdeno/api.cc
@@ -234,8 +234,10 @@ void deno_terminate_execution(Deno* d_) {
   d->isolate_->TerminateExecution();
 }
 
-void deno_run_microtasks(Deno* d_) {
+void deno_run_microtasks(Deno* d_, void* user_data) {
   deno::DenoIsolate* d = reinterpret_cast<deno::DenoIsolate*>(d_);
+
+  deno::UserDataScope user_data_scope(d, user_data);
   v8::Locker locker(d->isolate_);
   v8::Isolate::Scope isolate_scope(d->isolate_);
   d->isolate_->RunMicrotasks();
diff --git a/core/libdeno/deno.h b/core/libdeno/deno.h
index bccb4b57..0bdd31f5 100644
--- a/core/libdeno/deno.h
+++ b/core/libdeno/deno.h
@@ -119,7 +119,7 @@ const char* deno_last_exception(Deno* d);
 
 void deno_terminate_execution(Deno* d);
 
-void deno_run_microtasks(Deno* d);
+void deno_run_microtasks(Deno* d, void* user_data);
 // Module API
 
 typedef int deno_mod;

Still a few others to figure out though mainly in libdeno_test. I ran a quick benchmark, and if the intent was to improve performance you might be a little disappointed with this one.

bartlomieju

comment created time in 2 months

Pull request review commentdenoland/deno

feat: use v8::MicrotaskPolicy::kExplicit

 void deno_terminate_execution(Deno* d_) {   deno::DenoIsolate* d = reinterpret_cast<deno::DenoIsolate*>(d_);   d->isolate_->TerminateExecution(); }++void deno_run_microtasks(Deno* d_) {

We may need a user_data here and a UserDataScope within this function.

bartlomieju

comment created time in 2 months

Pull request review commentdenoland/deno

feat: use v8::MicrotaskPolicy::kExplicit

 impl Future for Isolate {       drop(locker);     } +    self.run_microtasks()?;

It shouldn't. Lock is being acquired already within libdeno::deno_run_microtasks. We only need it on respond, because we don't create a lock in libdeno::deno_respond. It might make sense to remove LockerScope, and just add a lock to the async part of libdeno::deno_respond(We shouldn't need it for sync responses).

bartlomieju

comment created time in 2 months

Pull request review commentdenoland/deno

feat: use v8::MicrotaskPolicy::kExplicit

 impl Future for Isolate {       drop(locker);     } +    self.run_microtasks()?;

It shouldn't. Lock is being acquired already within libdeno::deno_run_microtasks. We only need it on respond, because we don't create a lock in libdeno::deno_respond. It might make sense to remove LockerScope, and just add a lock to the async part of libdeno::deno_respond(We shouldn't need it for sync responses).

bartlomieju

comment created time in 2 months

push eventafinch7/deno

afinch7

commit sha 09c0eafcadba60a90448cdff2f4a5a094ed31e39

add debug message and make slight changes to dispatch_minimal.ts

view details

push time in 2 months

more