Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Peekable define function #651

Merged
merged 3 commits into from
Jan 16, 2019

Conversation

bjorn3
Copy link
Contributor

@bjorn3 bjorn3 commented Jan 12, 2019

This is the least intrusive way I could find to get the necessary things for bjorn3/rustc_codegen_cranelift#166.

@sunfishcode
Copy link
Member

Is it necessary to call the peek_compiled function before doing the self.backend.define_function?

@bjorn3
Copy link
Contributor Author

bjorn3 commented Jan 15, 2019

No, calling it later simplified it a lot.

@sunfishcode
Copy link
Member

Now that the call is at the end, would it be possible for the caller of define_function_peek_compiled to instead call the function itself after define_function_peek_compiled returns, rather than passing in a function to be called at the end?

@bjorn3
Copy link
Contributor Author

bjorn3 commented Jan 16, 2019

Hadn't thought about that yet. It will require exposing code_size and isa though.

@sunfishcode
Copy link
Member

We could have define_function return the code_size instead of (). And Module can provide an accessor to its isa if needed, although do you need the whole isa or just the TargetFrontendConfig? The latter is already available as module.target_config().

@bjorn3
Copy link
Contributor Author

bjorn3 commented Jan 16, 2019

I need the whole isa to get the encoding_info.

@sunfishcode
Copy link
Member

Ok. This PR feels somewhat specialized, and I'd ideally like Cranelift's API to make this kind of thing easier in a more general way, though I don't have any specific ideas at the moment. So let's merge the PR, but keep an eye out for ideas to refactor this :-).

@sunfishcode sunfishcode merged commit 78b2535 into bytecodealliance:master Jan 16, 2019
@bjorn3 bjorn3 deleted the peekable_define_function branch January 16, 2019 15:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants