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

[WIP] Interpret tokio #603

Closed
wants to merge 6 commits into from
Closed

[WIP] Interpret tokio #603

wants to merge 6 commits into from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 25, 2019

fixes #602

@@ -15,7 +15,23 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
dest: Option<PlaceTy<'tcx, Borrow>>,
ret: Option<mir::BasicBlock>,
) -> EvalResult<'tcx, Option<&'mir mir::Mir<'tcx>>> {

// HACK: normal evaluation never sees `ReservedForIncrCompCache`, so we use it
// to signify a dlsym loaded thing
Copy link
Member

Choose a reason for hiding this comment

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

OMG WTF.^^

Okay so at the least could we wrap this awful hack into two functions dlsym_to_instance and instance_to_dlsym (or so)? Currently the other half of this hack is 200 lines away in the same file without any comment.

The better way, of course, would be to change create_fn_alloc such that it takes something like

enum MiriFunction {
  Instance(Instance),
  DlSym(String),
}

Then we'd need no hack.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know... but the compiler and const eval have zero profit from supporting this but would still have to live with the complexity.

Copy link
Member

Choose a reason for hiding this comment

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

Complexity seems fairly minimal? Unless of course there is a perf issue, but I don't expect one -- this is just for fn ptrs, after all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having a few months perspective on this: Indeed "OMG WTF what was I thinking?" I'll teach the engine about dlsyms

Copy link
Member

Choose a reason for hiding this comment

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

I am implementing this now. (Latest getrandom needs it on macOS.)

let this = self.eval_context_mut();
match id {
// epoll_create1
0 => {
Copy link
Member

Choose a reason for hiding this comment

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

No magic constants please. Seems like a C-like enum would be appropriate here, or so?

// Test if the ptr is in-bounds. Then it cannot be a small integer.
// Even dangling pointers cannot be small integers.
// The only exception is wasm and some embedded devices, but that's a different
// story: https://github.com/rust-lang/rust/issues/57897
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this. Enabling such platform-specific assumptions should be somehow, at the very least, tied to the platform -- as in, depending on the target we should do this or not. I think we should also have a flag ("strict mode" or so) to not make such assumptions.

For platforms where we make this assumption, probably it applies at least to bits < 4096, doesn't it?


[dependencies]
tokio = "0.1.14"
futures = "0.1.25"
Copy link
Member

Choose a reason for hiding this comment

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

Can we have these in a subdir or so? We are getting too many root dirs for my taste.

@RalfJung RalfJung added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Feb 6, 2019
@RalfJung
Copy link
Member

@oli-obk Is there any point in keeping this open? I'd rather keep the PR list clean, having only things in there that are actually being worked on, or that are blocked on things that will likely soon be resolved.

@oli-obk oli-obk closed this Aug 17, 2019
@oli-obk oli-obk deleted the tokio branch January 16, 2020 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: Waiting for the PR author to address review comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot run even basic Tokio programs
2 participants