От: | vdimas | ||
Дата: | 24.11.19 13:32 | ||
Оценка: |
Conversely, non-address taken values which are usually on the stack are instead represented as locals inside functions. This effectively means that WebAssembly has an infinite set of registers, and can choose to spill values as it sees fit in a manner unobservable to the hosted code. This implies that there's a separate stack, unaddressable from hosted code, which is also used to spill return values. This allows strong security properties to be enforced, but does mean that two stacks are maintained (one by the VM, the other by the compiler which targets WebAssembly)
struct SomeStruct { /* a lot of fields */};
SomeStruct getSomeStruct() {...}
void processSomeStruct(const SomeStruct & value) {...}
...
processSomeStruct(getSomeStruct());