|
|
|
CHAPTER 4 Execution 4.1 Conventions WebAssembly code is executed when a module or an function on the resulting module Execution behavior is defined in terms of an abstract machine that models the program state . It includes a stack , which records operand values and control constructs, and an abstract store containing global state. For each instruction, there is a rule that specifies the effect of its execution on the program state. Furthermore, there are rules describing the instantiation of a module. As with , all rules are given in two equivalent forms: 1. In prose , describing the execution in intuitive form. 2. In formal notation , describing the rule in mathematical form. Note: As with validation, the prose and formal rules are equivalent, so that understanding of the formal notation is not required to read this specification. The formalism offers a more concise description in notation that is used widely in programming languages semantics and is readily amenable to mathematical proof. 4.1.1 Prose Notation Execution is specified by stylised, step-wise rules for each of the . The following con- ventions are adopted in stating these rules. • The execution rules implicitly assume a given 𝑆 . • The execution rules also assume the presence of an implicit that is modified by pushing or popping , and • Certain rules require the stack to contain at least one frame. The most recent frame is referred to as the current frame. 17 The semantics is derived from the following article: Andreas Haas, Andreas Rossberg, Derek Schuff, Ben Titzer, Dan Gohman, Luke Wagner, Alon Zakai, JF Bastien, Michael Holman. Bringing the Web up to Speed with WebAssembly . Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). ACM 2017. 18 https://dl.acm.org/citation.cfm?doid=3062341.3062363 55 |