dylibso / dylibso/chicory

Move host import mapping out of `Instance.Builder`

Open
#608 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.1k
Forks
71
PR merge metrics
No merged PRs in 30d

Description

the `build()` method of the `Instance.Builder()` includes a lot of logic to map declared imports to the provided imported values (in particular, see `mapHostImports()`. This causes some idiosyncrasies such as having a "strange" signature for the main `Instance` constructor:

```java

public Instance(
Module module,
Global[] globalInitializers,
int importedGlobalsOffset, // these offsets should not be really handled at this point
int importedFunctionsOffset,
int importedTablesOffset,
Memory memory,

```

the mapping between imports of a `Module` and the provided `ImportValues` could be handled externally; in particular, in the light of having an externalized "Linking" mechanism, the `Linker`, might provide a strategy to resolve such mappings.

In the current state, even without a `Linker` it might be even possible that `Store` (or a related, new class) could be a better place to handle such a logic.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.