• Home
  • Raw
  • Download

Lines Matching full:and

5 This document sets up some context about bytecode design principles and provides rationales for
14 somewhere in memory and executes corresponding _operations_ on operation's arguments,
19 is used for storing local variables along with function arguments and doing function calls.
23 that the number and purpose of registers differs, too. Some nuances of working with stack may also
24 vary across CPUs and/or different operating systems.
29 commands (or bytecode) and execute them. Of course, this implies additional performance overhead
31 abstract from CPU limitations and run our program wherever our interpreter runs. Tooling
36 hardware world: the terms "operations", "operands", "registers" and "stack" have the same meaning.
37 In case there is a chance for ambiguity, the terms "virtual registers" and "virtual stack" are used
38 to distinguish between an abstract system and the hardware.
41 building bytecode. Following sections explain advantages and disadvantages of various approaches.
54 add ; remove two top-most values from the stack, add them and put the result at the top
72 operates with smaller instructions. Indeed, each instruction `push_arg1`, `push_arg1`, and `add`
78 each bytecode instruction, execute it and move to the next one, running more instruction results in
118 are popular) and for increment/decrement instructions (when loop variable is only read in a loop
121 longer than accumulator value (otherwise calls will be accompanied with moves from and to
122 accumulator, reducing performance and increasing encoding size).
123 * The same goes with object and array loads and stores.
125 To address the risk of producing inefficient bytecode with redundant moves from and to
129 which also saves us encoding space and improves performance
148 It easy to see that to address virtual registers 4 and 5 we need just 3 bits which allows to encode
166 that most of operations inside a function happen on local and/or temporary variables, while
169 and/or variables.
177 (acc-reg-reg, acc-reg, acc-imm) and integer-based jumps, but not for floating-point arithmetic
178 (which is rare) and which is supposed to have only acc-reg form. Another good candidates for
179 overloads are calls (different number of operands) and calls are the most popular instructions in
189 numbers and store the result into accumulator, we will need a dedicated `adda_d ...`, etc.
192 all kinds of addition (for short and long integers, for signed and unsigned integers, for
193 single- and double-precision numbers, etc.).
196 and compact. The second approach keeps the instruction set small, but bloats the semantics of
201 Consider a simple example: what is the result of the expression `4 + "2"` in JavaScript and, say,
205 and Python-style addition within a single instruction, which would eventually lead us to an
208 Thus, as we are required to support multiple languages (both statically and dynamically typed),
218 and `reg2` **must** hold only integer values throughout the function? Fortunately, the answer is
220 which do not distinguish between integers and pointers on many platforms). The key constraint is
222 must be of this very type, unless the virtual register is redefined. Language compilers and