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

Sketch Linker implementation. #9

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Sketch Linker implementation. #9

wants to merge 12 commits into from

Conversation

evacchi
Copy link
Contributor

@evacchi evacchi commented Aug 19, 2024

I started looking at the Go implementation, and I think this is VERY ROUGHLY what happens there. In particular, take a look at
LinkedModules link() in Linker.

Essentially the flow is the same as before, except that, when a Plugin is created with the Plugin.Builder, on build() the Linker is instantiated and wires together all the Module.Builder instances. (Yes, this is very Java). I moved most of the logic from the Plugin constructor to this new Linker class.

Adding a bunch of folks as reviewer, feel free to add some comments if you have some time.

Will backfill the tests, hence why this is a Draft. Good thing the single-module version still works, meaning at least I am doing something right.

Signed-off-by: Edoardo Vacchi <[email protected]>
Signed-off-by: Edoardo Vacchi <[email protected]>
The latest SNAPSHOT on main includes a `Store` facility that
does not track direct dependencies between components; it does
not recursively instantiate required modules, it just assumes
that instantiating a given module at a given moment means
that all the requirements are satisfied at that time.

The missing bit to turning the Store into a linker
is a layer that tracks dependencies, linearizes them into
a sequence, and then instantiate them in order.
We also track cycles, introducing an indirection (a trampoline)
to break out of them.

Signed-off-by: Edoardo Vacchi <[email protected]>
@evacchi
Copy link
Contributor Author

evacchi commented Sep 5, 2024

The latest SNAPSHOT on main includes a Store facility that
does not track direct dependencies between components; it does
not recursively instantiate required modules, it just assumes
that instantiating a given module at a given moment means
that all the requirements are satisfied at that time.

The missing bit to turning the Store into a linker
is a layer that tracks dependencies, linearizes them into
a sequence, and then instantiate them in order.
We also track cycles, introducing an indirection (a trampoline)
to break out of them.

Signed-off-by: Edoardo Vacchi <[email protected]>
Signed-off-by: Edoardo Vacchi <[email protected]>
Signed-off-by: Edoardo Vacchi <[email protected]>
Signed-off-by: Edoardo Vacchi <[email protected]>

public class ChicoryModule {

static final boolean IS_NATIVE_IMAGE_AOT = Boolean.getBoolean("com.oracle.graalvm.isaot");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not strictly related to this PR, but it's necessary to compile this under graalvm native image. This flag is true when the native image builder it's running. We want to make sure that the code path below is pruned at build-time, because the AoT in its current state is not compatible with the way native image works.

Signed-off-by: Edoardo Vacchi <[email protected]>
@@ -18,23 +18,25 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>

<chicory.version>999-SNAPSHOT</chicory.version>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose we might want to wait for a release before merging

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.

3 participants