Add anothr variant of abort

This commit is contained in:
Sergey Pepyakin
2017-11-27 20:28:54 +03:00
parent 4e0ab2d5f9
commit e99779c9df

View File

@ -59,7 +59,7 @@ impl<'a> UserFunctionExecutor for EmscriptenFunctionExecutor {
context: CallerContext, context: CallerContext,
) -> Result<Option<RuntimeValue>, Error> { ) -> Result<Option<RuntimeValue>, Error> {
match name { match name {
"_abort" => { "_abort" | "abort" => {
self.abort_global.set(RuntimeValue::I32(1))?; self.abort_global.set(RuntimeValue::I32(1))?;
Err(Error::Trap("abort".into()).into()) Err(Error::Trap("abort".into()).into())
} }
@ -134,6 +134,7 @@ pub fn env_module(params: EnvParams) -> Result<Arc<ModuleInstanceInterface>, Err
const SIGNATURES: &'static [UserFunctionDescriptor] = &[ const SIGNATURES: &'static [UserFunctionDescriptor] = &[
UserFunctionDescriptor::Static("_abort", &[], None), UserFunctionDescriptor::Static("_abort", &[], None),
UserFunctionDescriptor::Static("abort", &[], None),
UserFunctionDescriptor::Static("assert", &[ValueType::I32], None), UserFunctionDescriptor::Static("assert", &[ValueType::I32], None),
UserFunctionDescriptor::Static("enlargeMemory", &[], Some(ValueType::I32)), UserFunctionDescriptor::Static("enlargeMemory", &[], Some(ValueType::I32)),
UserFunctionDescriptor::Static("getTotalMemory", &[], Some(ValueType::I32)), UserFunctionDescriptor::Static("getTotalMemory", &[], Some(ValueType::I32)),