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

cranelift: Implement pinned reg in interpreter #4375

Merged
merged 1 commit into from
Aug 10, 2022

Conversation

afonso360
Copy link
Contributor

👋 Hey,

This implements pinned reg instructions in the interpreter and adds some tests for it.

@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Jul 4, 2022
@cfallin
Copy link
Member

cfallin commented Jul 5, 2022

Happy to merge after merge-conflict is fixed!

@EdorianDark
Copy link

It looks like there have been again merge conflicts.

@afonso360
Copy link
Contributor Author

Thanks for the reminder!

@cfallin cfallin enabled auto-merge (squash) August 9, 2022 22:05
auto-merge was automatically disabled August 10, 2022 19:36

Head branch was pushed to by a user without write access

@jameysharp jameysharp enabled auto-merge (squash) August 10, 2022 20:24
@jameysharp jameysharp merged commit 268ddf2 into bytecodealliance:main Aug 10, 2022
abrown added a commit to abrown/wasmtime that referenced this pull request Aug 11, 2022
In bytecodealliance#4375 we introduced a code pattern that appears as a warning when
building the `cranelift-interpreter` crate:

```
warning: cannot borrow `*state` as mutable because it is also borrowed as immutable
   --> cranelift/interpreter/src/step.rs:412:13
    |
47  |     let arg = |index: usize| -> Result<V, StepError> {
    |               -------------------------------------- immutable borrow occurs here
48  |         let value_ref = inst_context.args()[index];
49  |         state
    |         ----- first borrow occurs due to use of `*state` in closure
...
412 |             state.set_pinned_reg(arg(0)?);
    |             ^^^^^^^^^^^^^^^^^^^^^---^^^^^
    |             |                    |
    |             |                    immutable borrow later used here
    |             mutable borrow occurs here
    |
    = note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
    = warning: this borrowing pattern was not meant to be accepted, and may become a hard error in the future
    = note: for more information, see issue #59159 <rust-lang/rust#59159>
```

This change fixes the warning.
jameysharp pushed a commit that referenced this pull request Aug 11, 2022
In #4375 we introduced a code pattern that appears as a warning when
building the `cranelift-interpreter` crate:

```
warning: cannot borrow `*state` as mutable because it is also borrowed as immutable
   --> cranelift/interpreter/src/step.rs:412:13
    |
47  |     let arg = |index: usize| -> Result<V, StepError> {
    |               -------------------------------------- immutable borrow occurs here
48  |         let value_ref = inst_context.args()[index];
49  |         state
    |         ----- first borrow occurs due to use of `*state` in closure
...
412 |             state.set_pinned_reg(arg(0)?);
    |             ^^^^^^^^^^^^^^^^^^^^^---^^^^^
    |             |                    |
    |             |                    immutable borrow later used here
    |             mutable borrow occurs here
    |
    = note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
    = warning: this borrowing pattern was not meant to be accepted, and may become a hard error in the future
    = note: for more information, see issue #59159 <rust-lang/rust#59159>
```

This change fixes the warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants