[RTS] Add getObjectLoadStatus
ClosedPublic

Authored by niteria on Sep 14 2017, 10:54 AM.

Details

Summary

This adds a function to the RTS linker API which lets the
user check the status of dynamically linked objects.

It was initially proposed by @afarmer in D2068.
It's useful for testing the linker and also for detecting retention
problems in production.

It takes a path, because it's easier to use path as key instead of producing
some stable handle.

It returns an enum instead of bool, because I see no reason for destroying
information. All the complexity is already out in the open, so there's
nothing to save the users from.

Test Plan

./validate

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
niteria created this revision.Sep 14 2017, 10:54 AM
niteria added inline comments.Sep 14 2017, 10:57 AM
rts/Linker.c
1287

We may want to do something about this. I don't know what's supposed to happen on UNLOAD_PENDING -> LOADED transition.

bgamari accepted this revision.Sep 14 2017, 11:18 AM

Looks reasonable to me.

This revision is now accepted and ready to land.Sep 14 2017, 11:18 AM
Phyx edited edge metadata.Sep 14 2017, 11:26 AM

Any reason you can't use the status field of the ObjectCode?

OStatus would be a much more accurate reflection of the state of the object file.
In particular there may be an entry in objects but the ObjectCode not have been initialized.
So in that case the ObjectCode is not really loaded as it can't be used.

niteria updated this revision to Diff 13900.Sep 15 2017, 6:03 AM

Use @Phyx's suggestion

I'm happy with this version, I will land it on Monday if no one objects.

Phyx accepted this revision.Sep 15 2017, 6:58 AM

Looks good to me

This revision was automatically updated to reflect the committed changes.