go-ethereum/vendor/github.com/go-interpreter/wagon/exec/reinterp.go
Guillaume Ballet 9927596822 core/vm: Add wagon/wasm as an interpreter
* Implement the ewasm module and the EEI.
 * Add an ewasm standalone binary to test standalone files
 * use reflection to declare EEI module exports
 * check the module name when importing EEI functions
 * make eeiFuncs a function to avoid an init loop issue in call
 * Add a reference to the ewasm tests
 * wagon implementation of the Interpreter interface
 * update to wagon's PR #59 and uses the Process structure
 * Adapt to endianness change
 * All tests but 1 passing
 * CanRun only checks for the header
 * Add a "debug" module to support "printHex" in contracts

Notes:
  * There are very little checks, e.g. of
     the call depths and so on.
2018-10-05 15:15:41 +02:00

29 lines
720 B
Go

// Copyright 2017 The go-interpreter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package exec
import (
"math"
)
// these operations are essentially no-ops.
// TODO(vibhavp): Add optimisations to package compiles that
// removes them from the original bytecode.
func (vm *VM) i32ReinterpretF32() {
vm.pushUint32(math.Float32bits(vm.popFloat32()))
}
func (vm *VM) i64ReinterpretF64() {
vm.pushUint64(math.Float64bits(vm.popFloat64()))
}
func (vm *VM) f32ReinterpretI32() {
vm.pushFloat32(math.Float32frombits(vm.popUint32()))
}
func (vm *VM) f64ReinterpretI64() {
vm.pushFloat64(math.Float64frombits(vm.popUint64()))
}