[2/2] [MooreToCore] Lower vtable method loads and vptr init#10130
Draft
[2/2] [MooreToCore] Lower vtable method loads and vptr init#10130
Conversation
73588f9 to
e127cd8
Compare
Contributor
|
Results of circt-tests run for e127cd8 compared to results for 1696571: sv-testsChanges in emitted diagnostics:
|
Materialize Moore vtables as LLVM globals and convert referenced method bodies to LLVM-addressable functions on demand while keeping `func.func` functions for any methods not involved in virtual dispatch. This adds cached vtable metadata, flattens nested `moore.vtable` hierarchies into a concrete slot order, and emits one LLVM global per class vtable with real function-pointer entries. When a slot target is still a `func.func`, convert it to `llvm.func` before taking its address so the vtable initializer contains valid LLVM function pointers. [MooreToCore] Narrow vtable lowering integration
16df605 to
b2b80b7
Compare
b2b80b7 to
40f69ac
Compare
Extend class allocation and dispatch lowering to use the concrete vtable ABI introduced in earlier steps. This factors out vtable lookup, initializes the object header's vptr when allocating classes that have a symbolic vtable, and lowers moore.vtable.load_method into header access, vtable load, slot GEP, and function-pointer load. Upcasted dispatch remains pointer-preserving and reuses the concrete object's vptr. Refine the header GEP sequence to first step through the object header and then index within the header struct, matching the canonical layout explicitly. Update MooreToCore tests to check vptr initialization during class.new, dynamic method slot lookup, indirect dispatch, and dispatch through an upcasted receiver.
40f69ac to
73f6ff4
Compare
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
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.
Extend class allocation and dispatch lowering to use the concrete vtable
ABI introduced in earlier steps.
This factors out vtable lookup, initializes the object header's vptr when
allocating classes that have a symbolic vtable, and lowers
moore.vtable.load_methodinto header access, vtable load, slot GEP, andfunction-pointer load. Upcasted dispatch remains pointer-preserving and
reuses the concrete object's vptr.
Refine the header GEP sequence to first step through the object header and
then index within the header struct, matching the canonical layout explicitly.
Update MooreToCore tests to check vptr initialization during
class.new,dynamic method slot lookup, indirect dispatch, and dispatch through an
upcasted receiver.
Also fixes a previous issue that would try to call a
func.func malloc;newnow usesllvm.func mallocto avoid later linkage issues.