Skip to content

fix: clear last_Java_sp/last_Java_pc on exception path in call_VM stub - #558

Open
aminuoshi-378 wants to merge 1 commit into
jeandle:mainfrom
aminuoshi-378:fix/clear-last-Java-sp-on-exception-path
Open

fix: clear last_Java_sp/last_Java_pc on exception path in call_VM stub#558
aminuoshi-378 wants to merge 1 commit into
jeandle:mainfrom
aminuoshi-378:fix/clear-last-Java-sp-on-exception-path

Conversation

@aminuoshi-378

Copy link
Copy Markdown

Related issue

Fixes #483

Summary

Move the clearing of last_Java_sp and last_Java_pc from no_exception_block to before the exception check in JeandleCallVM::generate_call_VM, so both the exception and no-exception paths clear these values. This prevents stale last_Java_sp from causing invalid stack walks during GC.

Changes

  • Move last_Java_sp/last_Java_pc clearing before the exception check (refer to C2's GraphKit::gen_stub).
  • No functional change to the no-exception path; the exception path now also clears these values.

Testing

Build verified on macOS aarch64. Full jeandle testing requires Linux environment with jeandle feature enabled.

Move the clearing of last_Java_sp and last_Java_pc from no_exception_block
to before the exception check, so both the exception and no-exception paths
clear these values. This prevents stale last_Java_sp from causing invalid
stack walks during GC.

Fixes jeandle#483
@mergify

mergify Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 2 protections blocking · waiting on 👀 reviews

Protection Waiting on
🔴 Require a review from a maintainer. 👀 reviews
🟢 Pull request title format.

🔴 Require a review from a maintainer.

Waiting for

  • approved-reviews-by = @Maintainer
This rule is failing.
  • approved-reviews-by = @Maintainer

Show 1 satisfied protection

🟢 Pull request title format.

  • title ~= ^(fix|feat|docs|style|refactor|enhance|test|build|ci|chore|revert):

@aminuoshi-378

Copy link
Copy Markdown
Author

Fix: Move the clearing of last_Java_sp and last_Java_pc to before the exception check, so both paths execute the clearing. This follows the same pattern as C2's GraphKit::gen_stub (see generateOptoStub.cpp:223-226), where the clearing is done unconditionally before the exception branch.

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.

last_Java_sp not cleared on exception path in call_VM stub

1 participant