Skip to content

pulley: Implement get_frame_pointer#9658

Merged
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:pulley-get-fp
Dec 3, 2024
Merged

pulley: Implement get_frame_pointer#9658
alexcrichton merged 2 commits into
bytecodealliance:mainfrom
alexcrichton:pulley-get-fp

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit implements the CLIF get_frame_pointer instruction which will be needed by trampolines in Wasmtime. This is implemented by generalizing the preexisting GetSp MInst into a "get special". This the additionally removes the extended get_sp opcode in Pulley as it's not necessary as xmov can operate on this register.

@alexcrichton alexcrichton requested review from a team as code owners November 22, 2024 20:27
@alexcrichton alexcrichton requested review from cfallin and removed request for a team November 22, 2024 20:27
@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language pulley Issues related to the Pulley interpreter labels Nov 22, 2024
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @cfallin, @fitzgen

Details This issue or pull request has been labeled: "cranelift", "isle", "pulley"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle, pulley

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

Learn more.

@alexcrichton alexcrichton force-pushed the pulley-get-fp branch 2 times, most recently from 35a0761 to 93a7c06 Compare November 26, 2024 01:10
This commit implements the CLIF `get_frame_pointer` instruction which
will be needed by trampolines in Wasmtime. This is implemented by
generalizing the preexisting `GetSp` `MInst` into a "get special". This
the additionally removes the extended `get_sp` opcode in Pulley as it's
not necessary as `xmov` can operate on this register.
@alexcrichton
Copy link
Copy Markdown
Member Author

ping @cfallin, mind taking a look at this?

Copy link
Copy Markdown
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.

Sorry, missed this review request! LGTM with a few minor bits below.

Comment thread cranelift/codegen/src/isa/pulley_shared/inst.isle Outdated
Comment thread cranelift/codegen/src/isa/pulley_shared/inst/mod.rs Outdated
Comment thread cranelift/codegen/src/isa/pulley_shared/inst/mod.rs Outdated
@alexcrichton alexcrichton added this pull request to the merge queue Dec 3, 2024
Merged via the queue into bytecodealliance:main with commit 75a4d27 Dec 3, 2024
@alexcrichton alexcrichton deleted the pulley-get-fp branch December 3, 2024 18:49
Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

FWIW, I kind of wanted to have the special registers not accessible by regular xmov/xadd/etc... so we could have 32 regular x registers (and the compact 5 bit representaton for all regular x registers) and then for our handful of special registers we would just have special instructions for manipulating.

This would trade using additional (presumably extended) opcodes for gaining more GPRs, which should help us avoid that many more regalloc spills. Spills result in more instructions, which means more turns of the interpreter loop, which is (expected to be) the most expensive part of wasm execution under pulley.

Not something we need to do now but it's something to think about as we design the instruction set, and maybe we should avoid similar changes as those included in this PR which move us away from that vision in the future where we can.

@alexcrichton alexcrichton mentioned this pull request Dec 5, 2024
13 tasks
@alexcrichton
Copy link
Copy Markdown
Member Author

Yeah I've been thinking similarly that I'd prefer to take these registers out of the gpr set, I've opened #9747 and added this there.

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 isle Related to the ISLE domain-specific language pulley Issues related to the Pulley interpreter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants