Stream: git-wasmtime

Topic: wasmtime / PR #1931 Write ELF image and instantiate code_...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 26 2020 at 21:17):

yurydelendik opened PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring this crates yet. It is work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jun 26 2020 at 21:18):

yurydelendik edited PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 16:15):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 16:15):

alexcrichton created PR Review Comment:

Should this only happen if the symbol is actually referenced?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 16:15):

alexcrichton created PR Review Comment:

FWIW I've seen this prefix in a number of places. Is there a way that we can canonicalize what's going on here? Ideally the name of a function would be contextually defined on some sort of Module type as well to account for the name section, but that may be a bit of a larger refactoring.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 16:15):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 16:15):

alexcrichton created PR Review Comment:

This list shows up in a few places, could we perhaps have an "iterator macro" which does this for us? Something like:

macro_rules! add_libcall_symbol {
    // ...
}

for_each_libcall!(add_libcall_symbol);

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 16:15):

alexcrichton created PR Review Comment:

This has a similar branch above for normal code symbols, so could these two perhaps be unified with a helper function?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 16:37):

yurydelendik updated PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 19:37):

yurydelendik updated PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 19:41):

yurydelendik submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 19:41):

yurydelendik created PR Review Comment:

it is preferable, but not necessary. To detect which libcall is used we need to to prescan relocations or track which symbols exist. We can get away with dumping all at this moment.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 19:44):

yurydelendik submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 19:44):

yurydelendik created PR Review Comment:

In this case these names are just unique string identifier (which can be converted back into FuncIndex). We can maintain separate map of FuncIndex<->obj function somewhere else.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 29 2020 at 22:28):

yurydelendik updated PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 14:46):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 14:46):

alexcrichton created PR Review Comment:

I'm mostly just a bit worried about this conversion is open-coded in a number of places. Not the worst thing in the world but it'd be great if we could centralize/document this somehow.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 18:00):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 18:00):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 18:00):

pchickey created PR Review Comment:

It would be good to avoid these unwraps and instead make these functions fallible, which will allow the user to recover when loading a bad object.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 18:01):

pchickey submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 21:10):

yurydelendik updated PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 23:16):

yurydelendik updated PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 23:17):

yurydelendik submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 23:17):

yurydelendik created PR Review Comment:

It this moment we fully trust the generated image, but in the future it might change. I added TODO comment about that.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 23:18):

yurydelendik submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 30 2020 at 23:18):

yurydelendik created PR Review Comment:

centralized name handling (inside object.rs) and added more docs

view this post on Zulip Wasmtime GitHub notifications bot (Jul 01 2020 at 14:17):

yurydelendik updated PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2020 at 20:57):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2020 at 21:21):

yurydelendik updated PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 14:49):

yurydelendik updated PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 15:44):

yurydelendik edited PR #1931 from compiler-elf to main:

The following refactoring is a first step towards #1779 .

The main idea is to create object/ELF image as the result of the compilation (which can be saved/serialized in the future). The linker will work with this image directly after it is allocated in the CodeMemory. In the past, we did the similar thing with debug image created for GDB JIT interface. Now, we can use the ELF image created after compilation, and convert it to an loadable object.

There is somewhat common/duplicated code in cranelift-object and creates/obj, this PR is not refactoring these crates yet. It is a work for follow up PRs.

The changes:

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2020 at 17:51):

yurydelendik merged PR #1931.


Last updated: Nov 22 2024 at 17:03 UTC