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

Allow unwind support to work without a frame pointer #2838

Merged
merged 1 commit into from
Apr 14, 2021
Merged

Allow unwind support to work without a frame pointer #2838

merged 1 commit into from
Apr 14, 2021

Conversation

uweigand
Copy link
Member

The patch extends the unwinder to support targets that do not need
to use a dedicated frame pointer register. Specifically, the
changes include:

  • Change the "fp" routine in the RegisterMapper to return an
    optional frame pointer regsiter via Option.

  • On targets that choose to not define a FP register via the above
    routine, the UnwindInst::DefineNewFrame operation no longer switches
    the CFA to be defined in terms of the FP. (The operation still can
    be used to define the location of the clobber area.)

  • In addition, on targets that choose not to define a FP register, the
    UnwindInst::PushFrameRegs operation is not supported.

  • There is a new operation UnwindInst::StackAlloc that needs to be
    called on targets without FP whenever the stack pointer is updated.
    This caused the CFA offset to be adjusted accordingly. (On
    targets with FP this operation is a no-op.)

@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:area:x64 Issues related to x64 codegen labels Apr 14, 2021
The patch extends the unwinder to support targets that do not need
to use a dedicated frame pointer register.  Specifically, the
changes include:

- Change the "fp" routine in the RegisterMapper to return an
  *optional* frame pointer regsiter via Option<Register>.

- On targets that choose to not define a FP register via the above
  routine, the UnwindInst::DefineNewFrame operation no longer switches
  the CFA to be defined in terms of the FP.  (The operation still can
  be used to define the location of the clobber area.)

- In addition, on targets that choose not to define a FP register, the
  UnwindInst::PushFrameRegs operation is not supported.

- There is a new operation UnwindInst::StackAlloc that needs to be
  called on targets without FP whenever the stack pointer is updated.
  This caused the CFA offset to be adjusted accordingly.  (On
  targets with FP this operation is a no-op.)
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.

This is much cleaner than I had feared it would be -- thank you!

@cfallin cfallin merged commit 1f21b32 into bytecodealliance:main Apr 14, 2021
@uweigand uweigand deleted the optionalfp branch April 14, 2021 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift:area:aarch64 Issues related to AArch64 backend. cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants