mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-18 19:31:22 +00:00
Merge branch 'master' of github.com:wasmerio/wasmer into feature/llvm-nan-but-fast
This commit is contained in:
@ -44,6 +44,7 @@ Wasmer runtime can be used as a library embedded in different languages, so you
|
||||
|  | [**PHP**](https://github.com/wasmerio/php-ext-wasm) | Wasmer | actively developed | <a href="https://pecl.php.net/package/wasm" target="_blank"></a> |  |
|
||||
|  | [**Ruby**](https://github.com/wasmerio/ruby-ext-wasm) | Wasmer | actively developed | <a href="https://rubygems.org/gems/wasmer" target="_blank"></a> |  |
|
||||
|  | [**Postgres**](https://github.com/wasmerio/postgres-ext-wasm) | Wasmer | actively developed | <a href="https://github.com/wasmerio/postgres-ext-wasm" target="_blank"></a> |  |
|
||||
|  | [**JavaScript**](https://github.com/wasmerio/wasmer-js) | Wasmer | actively developed | <a href="https://www.npmjs.com/package/@wasmer/wasi" target="_blank"></a> |  |
|
||||
|  | [**C#/.Net**](https://github.com/migueldeicaza/WasmerSharp) | [Miguel de Icaza](https://github.com/migueldeicaza) | actively developed | <a href="https://www.nuget.org/packages/WasmerSharp/" target="_blank"></a> |  |
|
||||
|  | [**R**](https://github.com/dirkschumacher/wasmr) | [Dirk Schumacher](https://github.com/dirkschumacher) | actively developed | |  |
|
||||
|  | [**Swift**](https://github.com/markmals/swift-ext-wasm) | [Mark Malström](https://github.com/markmals/) | passively maintained | |  |
|
||||
|
8
docs/assets/languages/js.svg
Executable file
8
docs/assets/languages/js.svg
Executable file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<svg width="20" height="20" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
|
||||
<g>
|
||||
<path d="M0,0 L256,0 L256,256 L0,256 L0,0 Z" fill="#F7DF1E"></path>
|
||||
<path d="M67.311746,213.932292 L86.902654,202.076241 C90.6821079,208.777346 94.1202286,214.447137 102.367086,214.447137 C110.272203,214.447137 115.256076,211.354819 115.256076,199.326883 L115.256076,117.528787 L139.313575,117.528787 L139.313575,199.666997 C139.313575,224.58433 124.707759,235.925943 103.3984,235.925943 C84.1532952,235.925943 72.9819429,225.958603 67.3113397,213.93026" fill="#000000"></path>
|
||||
<path d="M152.380952,211.354413 L171.969422,200.0128 C177.125994,208.433981 183.827911,214.619835 195.684368,214.619835 C205.652521,214.619835 212.009041,209.635962 212.009041,202.762159 C212.009041,194.513676 205.479416,191.592025 194.481168,186.78207 L188.468419,184.202565 C171.111213,176.81473 159.597308,167.53534 159.597308,147.944838 C159.597308,129.901308 173.344508,116.153295 194.825752,116.153295 C210.119924,116.153295 221.117765,121.48094 229.021663,135.400432 L210.29059,147.428775 C206.166146,140.040127 201.699556,137.119289 194.826159,137.119289 C187.78047,137.119289 183.312254,141.587098 183.312254,147.428775 C183.312254,154.646349 187.78047,157.568406 198.089956,162.036622 L204.103924,164.614095 C224.553448,173.378641 236.067352,182.313448 236.067352,202.418387 C236.067352,224.071924 219.055137,235.927975 196.200432,235.927975 C173.860978,235.927975 159.425829,225.274311 152.381359,211.354413" fill="#000000"></path>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
@ -128,166 +128,6 @@ impl ModuleCodeGenerator<CraneliftFunctionCodeGenerator, Caller, CodegenError>
|
||||
.state
|
||||
.initialize(&builder.func.signature, exit_block);
|
||||
|
||||
#[cfg(feature = "debug")]
|
||||
{
|
||||
use cranelift_codegen::cursor::{Cursor, FuncCursor};
|
||||
use cranelift_codegen::ir::InstBuilder;
|
||||
let entry_ebb = func.layout.entry_block().unwrap();
|
||||
let ebb = func.dfg.make_ebb();
|
||||
func.layout.insert_ebb(ebb, entry_ebb);
|
||||
let mut pos = FuncCursor::new(&mut func).at_first_insertion_point(ebb);
|
||||
let params = pos.func.dfg.ebb_params(entry_ebb).to_vec();
|
||||
|
||||
let new_ebb_params: Vec<_> = params
|
||||
.iter()
|
||||
.map(|¶m| {
|
||||
pos.func
|
||||
.dfg
|
||||
.append_ebb_param(ebb, pos.func.dfg.value_type(param))
|
||||
})
|
||||
.collect();
|
||||
|
||||
let start_debug = {
|
||||
let signature = pos.func.import_signature(ir::Signature {
|
||||
call_conv: self.target_config().default_call_conv,
|
||||
params: vec![
|
||||
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
|
||||
ir::AbiParam::new(ir::types::I32),
|
||||
],
|
||||
returns: vec![],
|
||||
});
|
||||
|
||||
let name = ir::ExternalName::testcase("strtdbug");
|
||||
|
||||
pos.func.import_function(ir::ExtFuncData {
|
||||
name,
|
||||
signature,
|
||||
colocated: false,
|
||||
})
|
||||
};
|
||||
|
||||
let end_debug = {
|
||||
let signature = pos.func.import_signature(ir::Signature {
|
||||
call_conv: self.target_config().default_call_conv,
|
||||
params: vec![ir::AbiParam::special(
|
||||
ir::types::I64,
|
||||
ir::ArgumentPurpose::VMContext,
|
||||
)],
|
||||
returns: vec![],
|
||||
});
|
||||
|
||||
let name = ir::ExternalName::testcase("enddbug");
|
||||
|
||||
pos.func.import_function(ir::ExtFuncData {
|
||||
name,
|
||||
signature,
|
||||
colocated: false,
|
||||
})
|
||||
};
|
||||
|
||||
let i32_print = {
|
||||
let signature = pos.func.import_signature(ir::Signature {
|
||||
call_conv: self.target_config().default_call_conv,
|
||||
params: vec![
|
||||
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
|
||||
ir::AbiParam::new(ir::types::I32),
|
||||
],
|
||||
returns: vec![],
|
||||
});
|
||||
|
||||
let name = ir::ExternalName::testcase("i32print");
|
||||
|
||||
pos.func.import_function(ir::ExtFuncData {
|
||||
name,
|
||||
signature,
|
||||
colocated: false,
|
||||
})
|
||||
};
|
||||
|
||||
let i64_print = {
|
||||
let signature = pos.func.import_signature(ir::Signature {
|
||||
call_conv: self.target_config().default_call_conv,
|
||||
params: vec![
|
||||
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
|
||||
ir::AbiParam::new(ir::types::I64),
|
||||
],
|
||||
returns: vec![],
|
||||
});
|
||||
|
||||
let name = ir::ExternalName::testcase("i64print");
|
||||
|
||||
pos.func.import_function(ir::ExtFuncData {
|
||||
name,
|
||||
signature,
|
||||
colocated: false,
|
||||
})
|
||||
};
|
||||
|
||||
let f32_print = {
|
||||
let signature = pos.func.import_signature(ir::Signature {
|
||||
call_conv: self.target_config().default_call_conv,
|
||||
params: vec![
|
||||
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
|
||||
ir::AbiParam::new(ir::types::F32),
|
||||
],
|
||||
returns: vec![],
|
||||
});
|
||||
|
||||
let name = ir::ExternalName::testcase("f32print");
|
||||
|
||||
pos.func.import_function(ir::ExtFuncData {
|
||||
name,
|
||||
signature,
|
||||
colocated: false,
|
||||
})
|
||||
};
|
||||
|
||||
let f64_print = {
|
||||
let signature = pos.func.import_signature(ir::Signature {
|
||||
call_conv: self.target_config().default_call_conv,
|
||||
params: vec![
|
||||
ir::AbiParam::special(ir::types::I64, ir::ArgumentPurpose::VMContext),
|
||||
ir::AbiParam::new(ir::types::F64),
|
||||
],
|
||||
returns: vec![],
|
||||
});
|
||||
|
||||
let name = ir::ExternalName::testcase("f64print");
|
||||
|
||||
pos.func.import_function(ir::ExtFuncData {
|
||||
name,
|
||||
signature,
|
||||
colocated: false,
|
||||
})
|
||||
};
|
||||
|
||||
let vmctx = pos
|
||||
.func
|
||||
.special_param(ir::ArgumentPurpose::VMContext)
|
||||
.expect("missing vmctx parameter");
|
||||
|
||||
let func_index = pos.ins().iconst(
|
||||
ir::types::I32,
|
||||
func_index.index() as i64 + self.module.info.imported_functions.len() as i64,
|
||||
);
|
||||
|
||||
pos.ins().call(start_debug, &[vmctx, func_index]);
|
||||
|
||||
for param in new_ebb_params.iter().cloned() {
|
||||
match pos.func.dfg.value_type(param) {
|
||||
ir::types::I32 => pos.ins().call(i32_print, &[vmctx, param]),
|
||||
ir::types::I64 => pos.ins().call(i64_print, &[vmctx, param]),
|
||||
ir::types::F32 => pos.ins().call(f32_print, &[vmctx, param]),
|
||||
ir::types::F64 => pos.ins().call(f64_print, &[vmctx, param]),
|
||||
_ => unimplemented!(),
|
||||
};
|
||||
}
|
||||
|
||||
pos.ins().call(end_debug, &[vmctx]);
|
||||
|
||||
pos.ins().jump(entry_ebb, new_ebb_params.as_slice());
|
||||
}
|
||||
|
||||
self.functions.push(func_env);
|
||||
Ok(self.functions.last_mut().unwrap())
|
||||
}
|
||||
|
@ -1,32 +1,31 @@
|
||||
use crate::{cache::BackendCache, trampoline::Trampolines};
|
||||
use crate::{
|
||||
cache::BackendCache,
|
||||
libcalls,
|
||||
relocation::{
|
||||
ExternalRelocation, LibCall, LocalRelocation, LocalTrapSink, Reloc, RelocSink,
|
||||
RelocationType, TrapSink, VmCall, VmCallKind,
|
||||
},
|
||||
signal::HandlerData,
|
||||
trampoline::Trampolines,
|
||||
};
|
||||
use rayon::prelude::*;
|
||||
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
use cranelift_codegen::{
|
||||
binemit::{Stackmap, StackmapSink},
|
||||
ir, isa, Context,
|
||||
};
|
||||
use rayon::prelude::*;
|
||||
use std::{
|
||||
mem,
|
||||
ptr::{write_unaligned, NonNull},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use wasmer_runtime_core::cache::Error as CacheError;
|
||||
use wasmer_runtime_core::{
|
||||
self,
|
||||
backend::{
|
||||
sys::{Memory, Protect},
|
||||
SigRegistry,
|
||||
},
|
||||
cache::Error as CacheError,
|
||||
error::{CompileError, CompileResult},
|
||||
module::ModuleInfo,
|
||||
structures::{Map, SliceMap, TypedIndex},
|
||||
@ -250,17 +249,9 @@ impl FuncResolverBuilder {
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
LibCall::Probestack => __rust_probestack as isize,
|
||||
},
|
||||
RelocationType::Intrinsic(ref name) => match name.as_str() {
|
||||
"i32print" => i32_print as isize,
|
||||
"i64print" => i64_print as isize,
|
||||
"f32print" => f32_print as isize,
|
||||
"f64print" => f64_print as isize,
|
||||
"strtdbug" => start_debug as isize,
|
||||
"enddbug" => end_debug as isize,
|
||||
_ => Err(CompileError::InternalError {
|
||||
msg: format!("unexpected intrinsic: {}", name),
|
||||
})?,
|
||||
},
|
||||
RelocationType::Intrinsic(ref name) => Err(CompileError::InternalError {
|
||||
msg: format!("unexpected intrinsic: {}", name),
|
||||
})?,
|
||||
RelocationType::VmCall(vmcall) => match vmcall {
|
||||
VmCall::Local(kind) => match kind {
|
||||
VmCallKind::StaticMemoryGrow | VmCallKind::SharedStaticMemoryGrow => {
|
||||
@ -371,28 +362,3 @@ impl FuncResolver {
|
||||
fn round_up(n: usize, multiple: usize) -> usize {
|
||||
(n + multiple - 1) & !(multiple - 1)
|
||||
}
|
||||
|
||||
extern "C" fn i32_print(_ctx: &mut vm::Ctx, n: i32) {
|
||||
eprint!(" i32: {},", n);
|
||||
}
|
||||
extern "C" fn i64_print(_ctx: &mut vm::Ctx, n: i64) {
|
||||
eprint!(" i64: {},", n);
|
||||
}
|
||||
extern "C" fn f32_print(_ctx: &mut vm::Ctx, n: f32) {
|
||||
eprint!(" f32: {},", n);
|
||||
}
|
||||
extern "C" fn f64_print(_ctx: &mut vm::Ctx, n: f64) {
|
||||
eprint!(" f64: {},", n);
|
||||
}
|
||||
extern "C" fn start_debug(ctx: &mut vm::Ctx, func_index: u32) {
|
||||
if let Some(symbol_map) = unsafe { ctx.borrow_symbol_map() } {
|
||||
if let Some(fn_name) = symbol_map.get(&func_index) {
|
||||
eprint!("func ({} ({})), args: [", fn_name, func_index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
eprint!("func ({}), args: [", func_index);
|
||||
}
|
||||
extern "C" fn end_debug(_ctx: &mut vm::Ctx) {
|
||||
eprintln!(" ]");
|
||||
}
|
||||
|
@ -2778,7 +2778,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
}
|
||||
Operator::F32Min => {
|
||||
// This implements the same logic as LLVM's @llvm.minimum
|
||||
// intrinsic would, but x86 lowering of that intrinsics
|
||||
// intrinsic would, but x86 lowering of that intrinsic
|
||||
// encounters a fatal error in LLVM 8 and LLVM 9.
|
||||
let (v1, v2) = state.pop2()?;
|
||||
|
||||
@ -2832,7 +2832,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
}
|
||||
Operator::F64Min => {
|
||||
// This implements the same logic as LLVM's @llvm.minimum
|
||||
// intrinsic would, but x86 lowering of that intrinsics
|
||||
// intrinsic would, but x86 lowering of that intrinsic
|
||||
// encounters a fatal error in LLVM 8 and LLVM 9.
|
||||
let (v1, v2) = state.pop2()?;
|
||||
|
||||
@ -2886,7 +2886,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
}
|
||||
Operator::F32x4Min => {
|
||||
// This implements the same logic as LLVM's @llvm.minimum
|
||||
// intrinsic would, but x86 lowering of that intrinsics
|
||||
// intrinsic would, but x86 lowering of that intrinsic
|
||||
// encounters a fatal error in LLVM 8 and LLVM 9.
|
||||
let ((v1, i1), (v2, i2)) = state.pop2_extra()?;
|
||||
let v1 = v128_into_f32x4(builder, intrinsics, v1, i1);
|
||||
@ -2952,7 +2952,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
}
|
||||
Operator::F64x2Min => {
|
||||
// This implements the same logic as LLVM's @llvm.minimum
|
||||
// intrinsic would, but x86 lowering of that intrinsics
|
||||
// intrinsic would, but x86 lowering of that intrinsic
|
||||
// encounters a fatal error in LLVM 8 and LLVM 9.
|
||||
let ((v1, i1), (v2, i2)) = state.pop2_extra()?;
|
||||
let v1 = v128_into_f64x2(builder, intrinsics, v1, i1);
|
||||
@ -3017,8 +3017,8 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
state.push1(res);
|
||||
}
|
||||
Operator::F32Max => {
|
||||
// This implements the same logic as LLVM's @llvm.minimum
|
||||
// intrinsic would, but x86 lowering of that intrinsics
|
||||
// This implements the same logic as LLVM's @llvm.maximum
|
||||
// intrinsic would, but x86 lowering of that intrinsic
|
||||
// encounters a fatal error in LLVM 8 and LLVM 9.
|
||||
let (v1, v2) = state.pop2()?;
|
||||
|
||||
@ -3070,8 +3070,8 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
state.push1(res);
|
||||
}
|
||||
Operator::F64Max => {
|
||||
// This implements the same logic as LLVM's @llvm.minimum
|
||||
// intrinsic would, but x86 lowering of that intrinsics
|
||||
// This implements the same logic as LLVM's @llvm.maximum
|
||||
// intrinsic would, but x86 lowering of that intrinsic
|
||||
// encounters a fatal error in LLVM 8 and LLVM 9.
|
||||
let (v1, v2) = state.pop2()?;
|
||||
|
||||
@ -3124,7 +3124,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
}
|
||||
Operator::F32x4Max => {
|
||||
// This implements the same logic as LLVM's @llvm.maximum
|
||||
// intrinsic would, but x86 lowering of that intrinsics
|
||||
// intrinsic would, but x86 lowering of that intrinsic
|
||||
// encounters a fatal error in LLVM 8 and LLVM 9.
|
||||
let ((v1, i1), (v2, i2)) = state.pop2_extra()?;
|
||||
let v1 = v128_into_f32x4(builder, intrinsics, v1, i1);
|
||||
@ -3189,7 +3189,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
|
||||
}
|
||||
Operator::F64x2Max => {
|
||||
// This implements the same logic as LLVM's @llvm.maximum
|
||||
// intrinsic would, but x86 lowering of that intrinsics
|
||||
// intrinsic would, but x86 lowering of that intrinsic
|
||||
// encounters a fatal error in LLVM 8 and LLVM 9.
|
||||
let ((v1, i1), (v2, i2)) = state.pop2_extra()?;
|
||||
let v1 = v128_into_f64x2(builder, intrinsics, v1, i1);
|
||||
|
@ -29,7 +29,7 @@ pub struct ModuleInner {
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct ModuleInfo {
|
||||
// This are strictly local and the typsystem ensures that.
|
||||
// This are strictly local and the typesystem ensures that.
|
||||
pub memories: Map<LocalMemoryIndex, MemoryDescriptor>,
|
||||
pub globals: Map<LocalGlobalIndex, GlobalInit>,
|
||||
pub tables: Map<LocalTableIndex, TableDescriptor>,
|
||||
|
@ -10,7 +10,7 @@ use crate::{
|
||||
|
||||
// +*****************************+
|
||||
// | LOCAL MEMORIES |
|
||||
// +****************************+
|
||||
// +*****************************+
|
||||
|
||||
pub unsafe extern "C" fn local_static_memory_grow(
|
||||
ctx: &mut vm::Ctx,
|
||||
@ -72,7 +72,7 @@ pub unsafe extern "C" fn local_dynamic_memory_size(
|
||||
|
||||
// +*****************************+
|
||||
// | IMPORTED MEMORIES |
|
||||
// +****************************+
|
||||
// +*****************************+
|
||||
|
||||
pub unsafe extern "C" fn imported_static_memory_grow(
|
||||
ctx: &mut vm::Ctx,
|
||||
@ -140,7 +140,7 @@ pub unsafe extern "C" fn imported_dynamic_memory_size(
|
||||
|
||||
// +*****************************+
|
||||
// | LOCAL TABLES |
|
||||
// +****************************+
|
||||
// +*****************************+
|
||||
|
||||
pub unsafe extern "C" fn local_table_grow(
|
||||
ctx: &mut vm::Ctx,
|
||||
|
@ -32,7 +32,6 @@ clif:fail:linking.wast:147 # AssertTrap - expected trap, got Runtime:Error "unkn
|
||||
clif:fail:linking.wast:149 # AssertTrap - expected trap, got Runtime:Error "unknown trap at 0x106883037 - illegal instruction"
|
||||
clif:fail:linking.wast:185 # AssertTrap - expected trap, got Runtime:Error "unknown trap at 0x106883062 - illegal instruction"
|
||||
clif:fail:linking.wast:187 # AssertTrap - expected trap, got Runtime:Error "unknown trap at 0x106883062 - illegal instruction"
|
||||
clif:fail:linking.wast:387 # AssertReturn - result I32(0) ("0x0") does not match expected I32(104) ("0x68")
|
||||
clif:fail:linking.wast:388 # AssertReturn - Call failed RuntimeError: WebAssembly trap occurred during runtime: `call_indirect` out-of-bounds
|
||||
|
||||
# clif:skip:skip-stack-guard-page.wast:2 # Slow test
|
||||
@ -83,6 +82,7 @@ clif:fail:data.wast:227:windows # AssertUnlinkable - caught panic Any
|
||||
clif:fail:data.wast:258:windows # AssertUnlinkable - caught panic Any
|
||||
clif:fail:data.wast:273:windows # AssertUnlinkable - caught panic Any
|
||||
clif:fail:start.wast:92:windows # Module - caught panic Any
|
||||
clif:skip:start.wast:98:windows
|
||||
|
||||
clif:fail:align.wast:3:windows # Module - caught panic Any
|
||||
clif:fail:align.wast:4:windows # Module - caught panic Any
|
||||
@ -269,7 +269,6 @@ llvm:fail:f32.wast:1621 # AssertReturn - result F32(0) ("0x0") does not match ex
|
||||
llvm:fail:f32.wast:2020 # AssertReturn - result F32(2147483648) ("0x80000000") does not match expected F32(0) ("0x0")
|
||||
llvm:fail:f64.wast:1621 # AssertReturn - result F64(0) ("0x0") does not match expected F64(9223372036854775808) ("0x8000000000000000")
|
||||
llvm:fail:f64.wast:2020 # AssertReturn - result F64(9223372036854775808) ("0x8000000000000000") does not match expected F64(0) ("0x0")
|
||||
llvm:fail:linking.wast:387 # AssertReturn - result I32(0) ("0x0") does not match expected I32(104) ("0x68")
|
||||
llvm:fail:linking.wast:388 # AssertReturn - Call failed RuntimeError: WebAssembly trap occurred during runtime: incorrect `call_indirect` signature
|
||||
|
||||
# LLVM Windows
|
||||
@ -957,7 +956,6 @@ singlepass:fail:linking.wast:190 # AssertTrap - expected trap, got Runtime:Error
|
||||
singlepass:fail:linking.wast:225 # AssertTrap - expected trap, got Runtime:Error unknown error
|
||||
singlepass:fail:linking.wast:236 # AssertTrap - expected trap, got Runtime:Error unknown error
|
||||
singlepass:fail:linking.wast:248 # AssertTrap - expected trap, got Runtime:Error unknown error
|
||||
singlepass:fail:linking.wast:387 # AssertReturn - result I32(0) ("0x0") does not match expected I32(104) ("0x68")
|
||||
singlepass:fail:linking.wast:388 # AssertReturn - Call failed RuntimeError: unknown error
|
||||
singlepass:fail:memory_grow.wast:15 # AssertTrap - expected trap, got Runtime:Error unknown error
|
||||
singlepass:fail:memory_grow.wast:16 # AssertTrap - expected trap, got Runtime:Error unknown error
|
||||
|
@ -445,8 +445,9 @@ mod tests {
|
||||
"AssertReturnCanonicalNan"
|
||||
),
|
||||
message: format!(
|
||||
"value is not canonical nan {:?}",
|
||||
v
|
||||
"value is not canonical nan {:?} ({:?})",
|
||||
v,
|
||||
value_to_hex(v.clone()),
|
||||
),
|
||||
},
|
||||
&test_key,
|
||||
@ -512,8 +513,9 @@ mod tests {
|
||||
"AssertReturnArithmeticNan"
|
||||
),
|
||||
message: format!(
|
||||
"value is not arithmetic nan {:?}",
|
||||
v
|
||||
"value is not arithmetic nan {:?} ({:?})",
|
||||
v,
|
||||
value_to_hex(v.clone()),
|
||||
),
|
||||
},
|
||||
&test_key,
|
||||
@ -718,10 +720,44 @@ mod tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
CommandKind::AssertUninstantiable {
|
||||
module: _,
|
||||
message: _,
|
||||
} => println!("AssertUninstantiable not yet implmented "),
|
||||
CommandKind::AssertUninstantiable { module, message: _ } => {
|
||||
let spectest_import_object = get_spectest_import_object(®istered_modules);
|
||||
let config = CompilerConfig {
|
||||
features: Features {
|
||||
simd: true,
|
||||
threads: true,
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
let module = wasmer_runtime_core::compile_with_config(
|
||||
&module.into_vec(),
|
||||
&get_compiler(),
|
||||
config,
|
||||
)
|
||||
.expect("WASM can't be compiled");
|
||||
let result = panic::catch_unwind(AssertUnwindSafe(|| {
|
||||
module
|
||||
.instantiate(&spectest_import_object)
|
||||
.expect("WASM can't be instantiated");
|
||||
}));
|
||||
match result {
|
||||
Err(_) => test_report.count_passed(),
|
||||
Ok(_) => {
|
||||
test_report.add_failure(
|
||||
SpecFailure {
|
||||
file: filename.to_string(),
|
||||
line: line,
|
||||
kind: format!("{}", "AssertUninstantiable"),
|
||||
message: format!(
|
||||
"instantiate successful, expected uninstantiable"
|
||||
),
|
||||
},
|
||||
&test_key,
|
||||
excludes,
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
CommandKind::AssertExhaustion { action, message: _ } => {
|
||||
match action {
|
||||
Action::Invoke {
|
||||
@ -945,6 +981,16 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
fn value_to_hex(val: wasmer_runtime_core::types::Value) -> String {
|
||||
match val {
|
||||
wasmer_runtime_core::types::Value::I32(x) => format!("{:#x}", x),
|
||||
wasmer_runtime_core::types::Value::I64(x) => format!("{:#x}", x),
|
||||
wasmer_runtime_core::types::Value::F32(x) => format!("{:#x}", x.to_bits()),
|
||||
wasmer_runtime_core::types::Value::F64(x) => format!("{:#x}", x.to_bits()),
|
||||
wasmer_runtime_core::types::Value::V128(x) => format!("{:#x}", x),
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub enum SpectestValue {
|
||||
I32(i32),
|
||||
|
Reference in New Issue
Block a user