Skip to content

Instantly share code, notes, and snippets.

[wasm-validator error in function $real_main] 1 != 0: function body type must match, if function returns, on
[none] [none] (block
[unreachable] (block $block$1$break
[none] (set_local $6
[i32] (i32.load
[i32] (i32.const 0)
)
)
[unreachable] [unreachable] (block
[unreachable] (br $block$1$break)
@eholk
eholk / gist:db6764473448099c128f7a9e1e664292
Created February 17, 2017 23:13
mir2wasm compile error
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> src/trans.rs:76:21
|
76 | let ref mut v = BinaryenModuleCtxt {
| ^^^^^^^^^^^^^^^^^^
|
help: consider using an explicit lifetime parameter as shown: fn trans_crate<'a>(tcx: &TyCtxt<'a, 'a, 'a>, entry_fn: Option<NodeId>,
options: &WasmTransOptions) -> Result<()>
--> src/trans.rs:65:1
|
(module
(type $rustfn-0-2 (func (param i32) (result i32)))
(type $rustfn-0-4 (func))
(type $rustfn-0-5 (func))
(type $__wasm_start (func))
(type $rustfn-0-19 (func (param i32 i32) (result i32)))
(type $rustfn-0-33 (func (param i32 i32) (result i32)))
(type $rustfn-0-44 (func (param i32 i32) (result i32)))
(type $rustfn-0-53 (func (param i32 i32)))
(memory $0 1024 1024)
// beginning a Binaryen API trace
#include <math.h>
#include <map>
#include "src/binaryen-c.h"
int main() {
std::map<size_t, BinaryenFunctionTypeRef> functionTypes;
std::map<size_t, BinaryenExpressionRef> expressions;
std::map<size_t, BinaryenFunctionRef> functions;
std::map<size_t, RelooperBlockRef> relooperBlocks;
BinaryenModuleRef the_module = NULL;
[binaryen] FAILED with exit code Some(101)
command: "/usr/local/google/home/eholk/wasm/mir2wasm/target/debug/mir2wasm" "tests/compile-pass/iterator.rs" "-Dwarnings" "--run" "-o" "/usr/local/google/home/eholk/wasm/mir2wasm/target/debug/tests/run-compile-pass/iterator.wasm"
stdout:
stderr:
[wasm-validator error in function $main] 1 != 0: set_local type must match function, on
[none] (set_local $12
[none] (get_local $0)
)
[wasm-validator error in function $main] 1 != 0: set_local type must match function, on
$ ./wasm-install/bin/emscripten/emcc hello-wasm.c -s BINARYEN=1
Unknown option '--total-memory'
Traceback (most recent call last):
File "./wasm-install/bin/emscripten/emcc", line 13, in <module>
emcc.run()
File "/usr/local/google/home/eholk/nacl/native_client/toolchain_build/src/subzero/wasm-install/bin/emscripten/emcc.py", line 1848, in run
subprocess.check_call(cmd, stdout=open(wasm_text_target, 'w'))
File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/google/home/eholk/wasm/binaryen/bin/asm2wasm', 'a.out.asm.js', '--mapped-globals=a.out.wast.mappedGlobals', '--total-memory=16777216']' returned non-zero exit status 1
define internal <4 x float> @testConstFloat4() {
; ASM-LABEL: testConstFloat4:
; DIS-LABEL: 00000000 <testConstFloat4>:
; IASM-LABEL: testConstFloat4:
entry:
ret <4 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00>
; ASM: vadd.f32 q10, q10, q11
; DIS: 1c: ee3aaa0b
@eholk
eholk / remove-closures.scm
Created May 5, 2015 19:26
Weird nanopass behavior
|(remove-closures
(closures
((lambda-type_802
dispatch_803
(closure lambda_233 (int) -> (adt point3f-t_164))
(lambda_801
(__153)
(let ([x_154 float
(call
(var (fn ((ptr FILE)) -> float) file-read-float)
@eholk
eholk / gist:2860c7a09b67170c637a
Created February 24, 2015 21:28
arbitrary array index with backpermute
(generate [3 3] (lambda (x y) (* (get A x) (get B y))))
<=>
(let ((As (backpermute [3 3] (lambda (x y) x) A))
(Bs (backpermute [3 3] (lambda (x y) y) B)))
(zipWith (*) As Bs))
@eholk
eholk / morse.js
Last active November 8, 2020 20:46
A Morse Code generator in Java Script
// Copyright 2014–2017, Eric Holk
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,