Skip to content
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

Move loading of initial dynamic libraries to before run. NFC #19450

Merged
merged 1 commit into from
May 25, 2023

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented May 25, 2023

Previously we were calling loadDylibs in the run function but we can call it earlier as soon as the main module is instantiated. This saves a little on code size since it relies on the existing runDependencies mechanism.

Split out from #19390

@sbc100 sbc100 requested a review from kripken May 25, 2023 20:00
@sbc100 sbc100 changed the title Move loading of initial dynamic libraries to before run Move loading of initial dynamic libraries to before run. NFC May 25, 2023
@sbc100 sbc100 force-pushed the move_loadDylibs branch 2 times, most recently from 51912b9 to e9db663 Compare May 25, 2023 20:09
Previously we were calling `loadDylibs` in the `run` function but
we can call it earlier as soon as the main module is instantiated.  This
saves a little on code size since it relies on the existing
`runDependencies` mechanism.

Split out from #19390
@sbc100 sbc100 force-pushed the move_loadDylibs branch from e9db663 to 48ac5fe Compare May 25, 2023 20:11
@sbc100 sbc100 requested a review from dschuff May 25, 2023 21:10
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am slightly fuzzy on the big picture here, but this looks simpler and better.

@@ -21,6 +21,7 @@
// new function with an '_', it will not be found.

mergeInto(LibraryManager.library, {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

if (!ENVIRONMENT_IS_PTHREAD || runtimeInitialized)
#endif
// If the runtime has already been initialized we set the stack limits
// now. Othwerwise this is delayed until `setDylinkStackLimits` is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// now. Othwerwise this is delayed until `setDylinkStackLimits` is
// now. Otherwise this is delayed until `setDylinkStackLimits` is

@sbc100
Copy link
Collaborator Author

sbc100 commented May 25, 2023

I am slightly fuzzy on the big picture here, but this looks simpler and better.

Indeed, there are some subtle timing/ordering details here, but I'm really glad your pushed me to factor this PR out of the other once, since it helped me understand them better and make this PR into something that is good to land regardless.

@sbc100 sbc100 merged commit b56605e into main May 25, 2023
@sbc100 sbc100 deleted the move_loadDylibs branch May 25, 2023 22:37
sbc100 added a commit that referenced this pull request May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants