Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add op_id throughout op API #2734

Merged
merged 8 commits into from
Aug 7, 2019
Merged

Add op_id throughout op API #2734

merged 8 commits into from
Aug 7, 2019

Conversation

ry
Copy link
Member

@ry ry commented Aug 6, 2019

Ref #2730

@ry ry changed the title WIP op_id Add op_id throughout op API Aug 6, 2019
Removes the magic number hack to switch between flatbuffers and the
minimal dispatcher.

Adds machinery to pass the op_id through the shared_queue.
@ry ry requested a review from piscisaureus August 6, 2019 14:10
@piscisaureus
Copy link
Member

I don't really understand what the purpose of moving the op_id out of the control buffer while leaving the other fields, (e.g. promise_id) in there.
Would it not be better to shed the control buffer entirely then?

@afinch7
Copy link
Contributor

afinch7 commented Aug 6, 2019

Is this prep for dynamic op dispatching?

@ry
Copy link
Member Author

ry commented Aug 7, 2019

@piscisaureus having the op_id put allows us to route to dispatcher - the control buffer contains all the parameters of the various ops - which is not something generally applicable to ops. Like the filename parameter of Deno.stat shouldn’t be visible to Isolate::poll. The name "controlBuf" is probably confusing - it should be called "paramsBuf".

promiseIds are something that all ops have (in addition to the op_id)... but it doesn't seem to be necessary.

@ry
Copy link
Member Author

ry commented Aug 7, 2019

@afinch7 In part, yes. This allows each op to choose its own serialization mechanism. Something the read/write ops do currently through a very terrible hack:

const DISPATCH_MINIMAL_TOKEN = 0xcafe;

In general this patch is a series of updates to the Op API outlined in #2730

core/isolate.rs Outdated
@@ -283,10 +287,12 @@ impl Isolate {
// return value.
// TODO(ry) check that if JSError thrown during respond(), that it will be
// picked up.
let _ = isolate.respond(Some(&buf));
let op_id = 0; // Sync messages ignore op_id.
let _ = isolate.respond(Some((op_id, &buf)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe panic here if respond() errors?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@piscisaureus piscisaureus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ry ry merged commit e438ac2 into denoland:master Aug 7, 2019
@ry ry deleted the op_id branch August 7, 2019 18:11
@ry ry mentioned this pull request Aug 26, 2019
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants