deno icon indicating copy to clipboard operation
deno copied to clipboard

[wip] feat(ops): reland V8 Fast Calls

Open littledivy opened this issue 2 years ago • 1 comments

Relands auto fast api template generation for ops.

This patch seems to be triggering a race condition in V8. Crashes occur at Context::new and Isolate::dispose. Seems related to https://github.com/denoland/rusty_v8/issues/714

littledivy avatar Jul 23 '22 17:07 littledivy

Any idea if this can be merged now or is it still flaking?

aapoalas avatar Jul 26 '22 10:07 aapoalas

Regarding the op_func.call(...args) usage: Would the normal calling convention of ops.op_func(...args) work if the ops object was created as an External from the OpCtx? (IIRC it's that pointer that we need for ops, right?) ie. Does the "this" object matter for Fast API data receiving?

I would presume it does not matter and I remember reading something about how there's a "Holder" object for Fast API functions which is not the same thing as the "this" argument which is sometimes called "holder" in V8 code. Anyway, there are two possibilities that I can see:

  1. Either the this argument is relevant, in which case ops should be created as a v8::External to retain the ops.op_func(...args) calling convention.
  2. Or (more likely) the this argument is irrelevant, in which case I would presume that Fast Calls get the data object anyway, and the ops.op_func.call(...args) calling convention is unnecessary.

@divy I presume you've tested that the .call() method usage is truly necessary? How hard would it be to test the ops as v8::External case?

aapoalas avatar Aug 05 '22 18:08 aapoalas

I finally managed to understand that the fast bindings are generated to an extra function bound into the original function but... Why? Does the references snapshotting somehow not work with direct binding to the normal op call function?

aapoalas avatar Aug 21 '22 07:08 aapoalas

This is awesome - great work @littledivy

ry avatar Aug 22 '22 00:08 ry