diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-09-17 18:05:01 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-09-17 22:29:02 +0100 |
commit | fabaf7d6caf919ceaa05f2db4260fa897864d517 (patch) | |
tree | d50a81ea97725eee5abe8d4b881e265c04fd80c0 /gcc/rust/backend/rust-compile-base.h | |
parent | a6e15ff5f052801180b3e56c4579ea555f2f0c50 (diff) | |
download | gcc-fabaf7d6caf919ceaa05f2db4260fa897864d517.zip gcc-fabaf7d6caf919ceaa05f2db4260fa897864d517.tar.gz gcc-fabaf7d6caf919ceaa05f2db4260fa897864d517.tar.bz2 |
Initial Dynamic dispatch support
This is the first pass at implementing dynamic dispatch, it creates a
vtable object and trait object to store the vtable and reciever. The
method resolution during type checking acts the same as if it was a
generic type bound method call. This detects this case during code
generation to access the dynamic object appropriately to get the fnptr
and call it with the stored reciever.
Fixes: #197
Diffstat (limited to 'gcc/rust/backend/rust-compile-base.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-base.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-base.h b/gcc/rust/backend/rust-compile-base.h index 5a26862..4a81061 100644 --- a/gcc/rust/backend/rust-compile-base.h +++ b/gcc/rust/backend/rust-compile-base.h @@ -200,6 +200,19 @@ protected: bool compile_locals_for_block (Resolver::Rib &rib, Bfunction *fndecl, std::vector<Bvariable *> &locals); + + Bexpression *coercion_site (Bexpression *compiled_ref, TyTy::BaseType *actual, + TyTy::BaseType *expected, Location locus); + + Bexpression *coerce_to_dyn_object (Bexpression *compiled_ref, + TyTy::BaseType *actual, + TyTy::BaseType *expected, + TyTy::DynamicObjectType *ty, + Location locus); + + Bexpression * + compute_address_for_trait_item (const Resolver::TraitItemReference *ref, + TyTy::BaseType *receiver); }; } // namespace Compile |