Skip to content

Comments

Simplify some s390x inline assembly in unwinder#10973

Merged
cfallin merged 1 commit intobytecodealliance:mainfrom
alexcrichton:test-s390x
Jul 11, 2025
Merged

Simplify some s390x inline assembly in unwinder#10973
cfallin merged 1 commit intobytecodealliance:mainfrom
alexcrichton:test-s390x

Conversation

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Jun 6, 2025

Extracted from #10960 with an extra bugfix

prtest:linux-s390x

@cfallin
Copy link
Member

cfallin commented Jun 6, 2025

I'm pretty perplexed staring at this one too -- for reference here are Godbolt links for before (working) and after (apparently segfaulting). The clobber-saves come in different order wrt loading values into payload (r6/r7) but the dataflow from arguments to PC/SP (r15)/payload (r6, r7) looks completely equivalent...

@alexcrichton
Copy link
Member Author

cc @uweigand would you be able to help dig in to what's going on here? (we can provide more background context if necessary, but the general gist is that this PR in theory is a refactoring that shouldn't do anything but it causes tests to segfault)

alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Jun 9, 2025
This was split out of bytecodealliance#10960 after some CI issues. The simplification of
s390x is split to bytecodealliance#10973 to show its failure but otherwise these changes
aren't expected to cause any issues (yet). Part of enabling this was in bytecodealliance#10974
where ASAN showed some issues as well.

prtest:full
github-merge-queue bot pushed a commit that referenced this pull request Jun 9, 2025
This was split out of #10960 after some CI issues. The simplification of
s390x is split to #10973 to show its failure but otherwise these changes
aren't expected to cause any issues (yet). Part of enabling this was in #10974
where ASAN showed some issues as well.

prtest:full
@uweigand
Copy link
Member

uweigand commented Jul 2, 2025

I was finally able to reproduce this. Turns out the crash only happens when building with CARGO_INCREMENTAL=0.

in(reg) payload1,
in(reg) payload2,
in(reg) sp,
in(reg) pc,
Copy link
Member

Choose a reason for hiding this comment

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

Here's the problem. The br instruction requires an address register operand (i.e. GPR 1-15, but not GPR 0). In the failing case, the compiler chose to use GPR 0 to hold pc. To fix this, you'll need to use the reg_addr register class instead of reg for pc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice thanks so much for helping to track this down! Changing to reg_addr looks to fix it indeed!

Extracted from bytecodealliance#10960 with a bugfix.

prtest:linux-s390x
@alexcrichton alexcrichton changed the title Test out s390x inline assembly change in isolation Simplify some s390x inline assembly in unwinder Jul 2, 2025
@alexcrichton alexcrichton marked this pull request as ready for review July 2, 2025 20:36
@alexcrichton alexcrichton requested a review from a team as a code owner July 2, 2025 20:36
@alexcrichton alexcrichton requested review from pchickey and removed request for a team July 2, 2025 20:36
@alexcrichton
Copy link
Member Author

Ok this should be good to go now, thanks again @uweigand!

@alexcrichton
Copy link
Member Author

ping @pchickey, mind taking a look at this? (I can also reassign if you'd like too)

Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

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

Happy to give a quick r+ since I wrote the original snippet; thanks!

@cfallin cfallin added this pull request to the merge queue Jul 11, 2025
Merged via the queue into bytecodealliance:main with commit da0eb2c Jul 11, 2025
42 checks passed
@alexcrichton alexcrichton deleted the test-s390x branch July 11, 2025 16:58
bongjunj pushed a commit to prosyslab/wasmtime that referenced this pull request Oct 20, 2025
This was split out of bytecodealliance#10960 after some CI issues. The simplification of
s390x is split to bytecodealliance#10973 to show its failure but otherwise these changes
aren't expected to cause any issues (yet). Part of enabling this was in bytecodealliance#10974
where ASAN showed some issues as well.

prtest:full
bongjunj pushed a commit to prosyslab/wasmtime that referenced this pull request Oct 20, 2025
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.

3 participants