Corresponds to a function or method call whose parameters are read from zero or more operand registers. If a return value is required, this is written to a target register afterwards. For example, the following Whiley code:
function g(int x, int y, int z) => int: return x * y * z function f(int x, int y) => int: r = g(x,y,3) return r + 1
can be translated into the following WyIL code:
function g(int x, int y, int z) => int: body: mul %3 = %0, %1 : int mul %3 = %3, %2 : int return %3 : int function f(int x, int y) => int: body: const %2 = 3 : int invoke %2 = (%0, %1, %2) test:g : int(int,int,int) const %3 = 1 : int add %2 = (%2, %3) : int return %2 : int
Here, we see that arguments to the
invoke
bytecode are supplied in the order they are given in the function or method's declaration.
@author David J. Pearce