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

Snapshot improvements #2052

Merged
merged 7 commits into from
Apr 8, 2019
Merged

Snapshot improvements #2052

merged 7 commits into from
Apr 8, 2019

Conversation

ry
Copy link
Member

@ry ry commented Apr 4, 2019

First pass at simplifying the snapshot interfaces

  • Moves how snapshots are supplied to the Isolate. Previously they were given by Behavior::startup_data() but it was only called once at startup. It makes more sense (and simplifies Behavior) to pass it to the constructor of Isolate.
  • Adds new libdeno type deno_snapshot instead of overloading deno_buf.
  • Adds new libdeno method to delete snapshot deno_snapshot_delete
  • Renames deno_get_snapshot to deno_snapshot_new
  • Makes StartupData hold references to snapshots. This was implicit when it previously held a deno_buf but is made explicit now. Note that include_bytes!() returns a &'static [u8] and we want to avoid copying that.

@ry ry requested a review from piscisaureus April 4, 2019 15:48
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.

The Snapshot1/Snapshot2 thing is not so pretty but I can see that maybe this is necessary.
That said, I'm not sure I have enough detail to really understand where the lifetime issues strike.

Personally I'd try to keep the snapshot ownership in Rust, and wrap it for something like this:

enum SnapShot {
  None,
  Static<&'static [u8]>,
  Owned<Vec<u8>>
}

But I can't tell if that even works when you make the changes you have in mind.
I'd suggest you land it as-is, and i'll look at the complete implementation and tweak it if necessary.

@ry ry force-pushed the snapshot_improvements branch from 9a92f86 to 1003090 Compare April 8, 2019 13:48
@ry
Copy link
Member Author

ry commented Apr 8, 2019

@piscisaureus I agree. I really don't want to keep Snapshot1 / Snapshot2 names. I've added a comment that says that. This entire thing is very much incomplete, but since this PR is changing Behavior, I want to go ahead and land it despite the incompleteness.

@ry ry merged commit f7fdb90 into denoland:master Apr 8, 2019
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.

2 participants