WebAssembly / custom-page-sizes

Other
3 stars 1 forks source link

A question about page size relocation #21

Closed yamt closed 3 months ago

yamt commented 4 months ago

the overview states it's ideal to use a relocation for page size. why do you prefer a relocation over eg. an immutable global?

fitzgen commented 4 months ago

Six of one, half a dozen of another. Both approaches should enable const-folding/-propagation and avoids accessing memory, which tends to inhibit compiler optimization.

yamt commented 4 months ago

if there is little differences, i guess it's simpler to use a global instead.

fitzgen commented 4 months ago

I would say "simpler" is a matter of opinion. I personally find an i32.const to be "simpler" but it looks like wasm-ld will probably use a global instead. Again either way works fine.

Happy to accept a PR to the overview clarifying that either an i32.const or a global and global.get would satisfy the constraints, if you want to make one.

fitzgen commented 3 months ago

This was addressed in #22.