Uh oh!
There was an error while loading. Please reload this page.
Export WASM table by default - #53237
Conversation
rust-highfive
commented
Aug 9, 2018
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
nikomatsakis
commented
Aug 10, 2018
alexcrichton
commented
Aug 12, 2018
Thanks for the PR @overdrivenpotato! For these sorts of flags to LLD we tend to just want to make sure that it can be turned off as well. Is there something that can be passed via |
overdrivenpotato
commented
Aug 13, 2018
You can use |
alexcrichton
commented
Aug 14, 2018
Ah ok interesting! In that case we may not want to have this turned on by default (as it can't be turned off). While true that it doesn't affect the behavior of the binary it does make it a bit larger because the table section has to get exported. Note that it's also pretty easy to export the table section in an existing wasm binary, this is what |
If the only concern is binary size, it's worth noting that the It's also worth noting that the Test case: #![no_std]#![feature(lang_items, panic_implementation, core_intrinsics)]#[panic_implementation]pubfnpanic_fmt(_fmt:&core::panic::PanicInfo) -> ! {unsafe{ core::intrinsics::abort()}}#[lang = "eh_personality"]pubfneh_personality(){}extern{fntest(f:externfn() -> i32);}#[lang = "start"]pubfnmain(){externfncb() -> i32{123}unsafe{test(cb);}}With Without |
alexcrichton
commented
Aug 14, 2018
Ah good points! While it seems small people are definitely counting bytes when looking at Rust "hello world" use cases on wasm, but this seems like a handful of bytes that may not matter too much. @fitzgen can you think of any reason why this might cause problems? I'd be tempted to merge this myself now! |
fitzgen
commented
Aug 14, 2018
Is most of the bytes the name of the exported table? I'm fine with this so long as the bloat is not proportional to the size of the wasm binary, which I don't expect it to be, or else things have gone really wrong :-p |
alexcrichton
commented
Aug 14, 2018
@bors: r+ Ok! Sounds good! |
bors
commented
Aug 14, 2018
📌 Commit c7a39b1 has been approved by |
overdrivenpotato
commented
Aug 14, 2018
LLVM exports the table as |
bors
commented
Aug 15, 2018
…hton Export WASM table by default This allows loading a rust-generated `.wasm` binary in a host and using the exported table much like the `memory` export.
bors
commented
Aug 15, 2018
☀️ Test successful - status-appveyor, status-travis |
Because it was turned on by default in the recent nightlies. See rust-lang/rust#53237
Because it was turned on by default in the recent nightlies. See rust-lang/rust#53237
* Don't use --export-table anymore Because it was turned on by default in the recent nightlies. See rust-lang/rust#53237 * use_extern_macros stabilization With recent nightlies rustc produces a warning ``` the feature `use_extern_macros` has been stable since 1.30.0 and no longer requires an attribute to enable ```
…alexcrichton Don't export table by default in wasm Revert of rust-lang#53237 As per discussion here rustwasm/team#251
…alexcrichton Don't export table by default in wasm Revert of rust-lang#53237 As per discussion here rustwasm/team#251
This allows loading a rust-generated
.wasmbinary in a host and using the exported table much like thememoryexport.