-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
refactor: remove TypeInfo and StructInfo from StructRef #109
Conversation
crates/mun_runtime/src/struct.rs
Outdated
let runtime_ref = self.runtime.borrow(); | ||
let type_info = unsafe { &*runtime_ref.gc().ptr_type(self.handle.handle()).inner() }; | ||
type_info.name() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This in particular worries me, because there is a significant performance overhead to retrieving a struct's type information. This change affects StructRef::get
, StructRef::replace
, and invoke_fn!
.
It would already be a lot better if we didn't still have to borrow
the Runtime
. That means passing the &Runtime
as an additional parameter to the ArgumentReflection
trait's type_name
and type_guid
functions, though.
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
==========================================
+ Coverage 78.25% 78.87% +0.61%
==========================================
Files 141 141
Lines 8949 8724 -225
==========================================
- Hits 7003 6881 -122
+ Misses 1946 1843 -103
Continue to review full report at Codecov.
|
28e2057
to
8a1c25c
Compare
@baszalmstra I pushed a fix for the discussion about the runtime overhead of borrowing a |
Instead we collect the most recent TypeInfo pointer from the Runtime's GcRuntime. This allows us to maintain the StructRef even after hot reloads
This prevents duplicate storage as the struct's name is already stored in the TypeInfo
8a1c25c
to
69ee4e2
Compare
Instead we collect the most recent
TypeInfo
pointer from theRuntime
'sGcRuntime
. This allows us to maintain theStructRef
even after hotreloads.