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

Nuke the rest of middleware code #126

Merged
merged 1 commit into from
May 9, 2022
Merged

Conversation

nagisa
Copy link
Collaborator

@nagisa nagisa commented May 3, 2022

In an effort to make the code a little more straightforward1 I once again am
removing code. This time it is remaining cleanup from the middleware removal.
This ended up also requiring me to take a second look at how we parse the module
data during codegen, since previously that code was wrapped by the middleware
code.

Footnotes

  1. …to modify…

In an effort to make the code a little more straightforward I once again am
removing code. This time it is remaining cleanup from the middleware removal.
This ended up also requiring me to take a second look at how we parse the module
data during codegen, since previously that code was wrapped by the middleware
code.
@nagisa nagisa requested review from Ekleog and matklad May 3, 2022 16:45
for _ in 0..local_count {
builder.set_srcloc(cur_srcloc(reader));
let (count, ty) = reader.read_local_decl()?;
builder.set_srcloc(ir::SourceLoc::new(local_reader.original_position() as u32));
Copy link
Collaborator Author

@nagisa nagisa May 3, 2022

Choose a reason for hiding this comment

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

TODO: This is actually incorrect as it will assign all locals to the byte offset at which the locals reader started reading.

On the other hand… I'm not sure if we emit debug info in any meaningful capacity right now and this is preexisting anyway.

@matklad
Copy link
Contributor

matklad commented May 9, 2022

Makes sense to me!

My overall feelings here are:

  • we probably don't need WASM->WASM middlewares in wasmer -- our instrumentation which happens completely outside is more flexible and engine independent. It does incur an extra copy of WASM, but, given that it happens once during compilation, that's probably not too bad.
  • at some point, we might want to add WASM->Machine Code style middlewares, to generalize our intrinsification and otherwise tweak codegen. But we don't use middleware infra for that today (its mostly just hard-coded) and, anyway, this sounds like something we want to design once we have a specific need.

Comment on lines 79 to +80
let _tt = timing::wasm_translate_function();
info!(
"translate({} bytes, {}{})",
reader.bytes_remaining(),
func.name,
func.signature
);
let _span = tracing::info_span!(
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should rip out the timing module and just use spans? Still not sure about general applicability of tracing for profiling -- rust-analyzer still uses hand-rolled infra.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The timing module is cranelift's, not part of this codebase. Will definitely be punting on either decision for the time being. Unlike R-A this project is intended to be embedded, so making it use something off-shelf has significant benefits.

@nagisa nagisa merged commit 7b897f5 into near-main May 9, 2022
@nagisa nagisa deleted the nagisa/kill-middleware branch May 9, 2022 11:04
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