-
-
Notifications
You must be signed in to change notification settings - Fork 114
Catch type2 #615
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
Open
jianlingzhong
wants to merge
97
commits into
jank-lang:main
Choose a base branch
from
jianlingzhong:catch_type2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Catch type2 #615
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This currently doesn't work with ASan, but I have an open issue for this here: bdwgc/bdwgc#772
It leaks, leads to premature GC, takes too long to compile, and doesn't support runtime sorting functions. We'll need a new solution. For now, we're deep copying standard containers, which isn't going to last us very long.
This addresses a GC crash we were seeing, as documented here: bdwgc/bdwgc#800 (comment)
It's blocked on this Clang bug: llvm/llvm-project#146956
This change updates the try special form to support multiple, typed catch clauses, enabling more granular exception handling and C++ interop. Key changes: Syntax: catch clauses now require an explicit type argument (e.g., (catch cpp/jank.runtime.object_ref e ...)). Parser: Updated parse_try to handle multiple catch clauses with their corresponding types. Codegen: Extended LLVM IR generation to support multiple catch blocks. Tests: Updated existing tests to use the new explicit catch syntax and added new tests for multiple catches, nested try-catch-finally blocks, etc..
**Object Slicing Prevention (lines 2766-2783)** - Added automatic promotion of C++ class/struct catch types to lvalue references - Prevents object slicing when catching derived classes by base type - Preserves polymorphic behavior (virtual methods work correctly) - Exception: jank::runtime types (like object_ref) remain by-value (needs to figure out why) **Duplicate Catch Detection (lines 2785-2796)** - Added compile-time validation to detect duplicate catch clauses **Fixed Pointer Exception Handling (lines 1797-1826)** - Corrected exception value extraction for pointer types - Pointer exceptions: Use caught_ptr directly (it IS the pointer value) - Non-pointer exceptions: Dereference caught_ptr to get the value - Fixes crashes when catching void*, int*, and other pointer types - Added support for reference types and class/struct types **Enhanced Load Detection (line 543)** - Extended auto-load logic to handle pointer and reference types - Ensures proper value extraction from alloca instructions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ignore this pull request. i'm just using this one to test CI.