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

fix: do not panic on ref types while safepoint disabled #1196

Closed
wants to merge 1 commit into from

Conversation

csmoe
Copy link
Contributor

@csmoe csmoe commented Feb 29, 2020

Closes #1156
r? @bnjbvr

Copy link
Contributor

@bjorn3 bjorn3 left a comment

Choose a reason for hiding this comment

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

Please add a ; error: directive to check for the error message.

jump block2(v1)
block2(v3: r64):
return v3
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing trailing newline

@csmoe
Copy link
Contributor Author

csmoe commented Feb 29, 2020

@bjorn3 where should I expect an error with ; error: ...? Here is the test output and I tried to append ; error: ... to each line, but they always passed without an expectation.
image

@bjorn3
Copy link
Contributor

bjorn3 commented Feb 29, 2020

I think you should remove the test safepoint line.

@csmoe
Copy link
Contributor Author

csmoe commented Mar 4, 2020

I think you should remove the test safepoint line.

But no error triggered after removing.

@bnjbvr bnjbvr self-requested a review March 5, 2020 15:22
@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Mar 11, 2020
@github-actions
Copy link

Subscribe to Label Action

This issue or pull request has been labeled: "c", "r", "a", "n", "e", "l", "i", "f", "t"

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

2 similar comments
@github-actions
Copy link

Subscribe to Label Action

This issue or pull request has been labeled: "c", "r", "a", "n", "e", "l", "i", "f", "t"

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@github-actions
Copy link

Subscribe to Label Action

This issue or pull request has been labeled: "c", "r", "a", "n", "e", "l", "i", "f", "t"

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@github-actions
Copy link

Subscribe to Label Action

This issue or pull request has been labeled: "cranelift"

Users Subscribed to "cranelift"

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

Agreed that the test safepoint ought to be removed in theory.

So this issue is just a bit more complicated than I imagined. Right now the code that checks for unused reference types iterates over all the values; while this is a correct test, there's no right place where it puts an error message, since it's not tied to a particular instruction. In fact, if we iterated over all the instructions, and we'd put the error on the first instruction result type that's a ref type, then we'd have a place where to put the error message. And then we could add the error: annotation in the clif test case. Does it make sense?

let ty = func.dfg.value_type(val);
if ty.lane_type().is_ref() {
panic!("reference types were found but safepoints were not enabled.");
for block in func.layout.blocks() {
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using references as function parameters, but not using them anywhere? This would skip them.

Copy link
Member

Choose a reason for hiding this comment

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

Good point! I think a few tests actually need to be added:

  • for function parameters
  • for EBB params
  • for value types in signature refs

Can you add the code and tests for this, please? Thanks!

@@ -0,0 +1,12 @@
test verifier
Copy link
Contributor

Choose a reason for hiding this comment

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

The error is reported during regalloc, not during the verifier pass.

function %test(r64) -> r64 {
block0(v0: r64):
v1 = null.r64
v2 = is_null v0
Copy link
Member

Choose a reason for hiding this comment

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

There should be an error annotation in this test, so it'd check that the verifier asserts because a ref type is used yet ref types aren't enabled, right?

@alexcrichton alexcrichton changed the base branch from master to main June 25, 2020 18:46
@bjorn3
Copy link
Contributor

bjorn3 commented Oct 11, 2021

This PR depends on the old x86 backend. Should it be closed or updated?

@cfallin
Copy link
Member

cfallin commented Oct 11, 2021

It looks like this is a fix to the old regalloc, which is now deleted, so I think we can close. Thanks!

@cfallin cfallin closed this Oct 11, 2021
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.

[panic] panic! called when "reference types found but safepoints not enabled"
4 participants