Class: Relaton::Un::Wasm::Interpreter

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton/un/wasm/interpreter.rb

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ Interpreter

Returns a new instance of Interpreter.



52
53
54
# File 'lib/relaton/un/wasm/interpreter.rb', line 52

def initialize(instance)
  @instance = instance
end

Instance Method Details

#invoke(func_idx, args) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/relaton/un/wasm/interpreter.rb', line 56

def invoke(func_idx, args)
  func = @instance.funcs[func_idx]
  if func.imported?
    return func.proc.call(Caller.new(@instance), *args)
  end

  run_function(func, args)
end