You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by di...@apache.org on 2020/04/23 00:48:46 UTC

[incubator-teaclave-sgx-sdk] branch v1.1.2-testing updated: Fix wabt-rs 0.9 on app side

This is an automated email from the ASF dual-hosted git repository.

dingyu pushed a commit to branch v1.1.2-testing
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git


The following commit(s) were added to refs/heads/v1.1.2-testing by this push:
     new b4c1fd5  Fix wabt-rs 0.9 on app side
b4c1fd5 is described below

commit b4c1fd5edd58df0c09e24370601d430d29d72111
Author: Yu Ding <di...@gmail.com>
AuthorDate: Wed Apr 22 17:48:32 2020 -0700

    Fix wabt-rs 0.9 on app side
---
 samplecode/wasmi/app/src/main.rs            | 5 +++++
 samplecode/wasmi/app/src/wasm_def.rs        | 7 +++++++
 samplecode/wasmi/enclave/sgxwasm/src/lib.rs | 3 +++
 3 files changed, 15 insertions(+)

diff --git a/samplecode/wasmi/app/src/main.rs b/samplecode/wasmi/app/src/main.rs
index 8991cdd..e06580b 100644
--- a/samplecode/wasmi/app/src/main.rs
+++ b/samplecode/wasmi/app/src/main.rs
@@ -76,6 +76,7 @@ pub enum BoundaryValue {
     I64(i64),
     F32(u32),
     F64(u64),
+    V128(u128),
 }
 
 fn wabt_runtime_value_to_boundary_value(wabt_rv : &wabt::script::Value) -> BoundaryValue {
@@ -84,6 +85,7 @@ fn wabt_runtime_value_to_boundary_value(wabt_rv : &wabt::script::Value) -> Bound
         &wabt::script::Value::I64(wabt_rv) => BoundaryValue::I64(wabt_rv),
         &wabt::script::Value::F32(wabt_rv) => BoundaryValue::F32(wabt_rv.to_bits()),
         &wabt::script::Value::F64(wabt_rv) => BoundaryValue::F64(wabt_rv.to_bits()),
+        &wabt::script::Value::V128(wabt_rv) => BoundaryValue::V128(wabt_rv),
     }
 }
 
@@ -94,6 +96,7 @@ fn runtime_value_to_boundary_value(rv: RuntimeValue) -> BoundaryValue {
         RuntimeValue::I64(rv) => BoundaryValue::I64(rv),
         RuntimeValue::F32(rv) => BoundaryValue::F32(rv.to_bits()),
         RuntimeValue::F64(rv) => BoundaryValue::F64(rv.to_bits()),
+        RuntimeValue::V128(rv) => BoundaryValue::V128(rv),
     }
 }
 
@@ -103,6 +106,7 @@ fn boundary_value_to_runtime_value(rv: BoundaryValue) -> RuntimeValue {
         BoundaryValue::I64(bv) => RuntimeValue::I64(bv),
         BoundaryValue::F32(bv) => RuntimeValue::F32(bv.into()),
         BoundaryValue::F64(bv) => RuntimeValue::F64(bv.into()),
+        BoundaryValue::V128(bv) => RuntimeValue::V128(bv.into()),
     }
 }
 
@@ -122,6 +126,7 @@ fn spec_to_runtime_value(value: Value) -> RuntimeValue {
         Value::I64(v) => RuntimeValue::I64(v),
         Value::F32(v) => RuntimeValue::F32(v.into()),
         Value::F64(v) => RuntimeValue::F64(v.into()),
+        Value::V128(v) => RuntimeValue::V128(v.into()),
     }
 }
 
diff --git a/samplecode/wasmi/app/src/wasm_def.rs b/samplecode/wasmi/app/src/wasm_def.rs
index 30b1232..dec97f6 100644
--- a/samplecode/wasmi/app/src/wasm_def.rs
+++ b/samplecode/wasmi/app/src/wasm_def.rs
@@ -206,6 +206,8 @@ pub enum ValueType {
     F32,
     /// 64-bit IEEE 754-2008 floating point number.
     F64,
+	/// 128-bit SIMD register
+	V128,
 }
 
 /// Runtime representation of a value.
@@ -225,6 +227,8 @@ pub enum RuntimeValue {
     F32(F32),
     /// Value of 64-bit IEEE 754-2008 floating point number.
     F64(F64),
+	/// 128-bit SIMD register
+	V128(u128),
 }
 
 impl RuntimeValue {
@@ -234,6 +238,7 @@ impl RuntimeValue {
             RuntimeValue::I64(_) => ValueType::I64,
             RuntimeValue::F32(_) => ValueType::F32,
             RuntimeValue::F64(_) => ValueType::F64,
+            RuntimeValue::V128(_) => ValueType::V128,
         }
     }
 }
@@ -248,5 +253,7 @@ pub enum Value {
     F32(f32),
     /// Value of 64-bit IEEE 754-2008 floating point number.
     F64(f64),
+	/// 128-bit SIMD register
+	V128(u128),
 }
 
diff --git a/samplecode/wasmi/enclave/sgxwasm/src/lib.rs b/samplecode/wasmi/enclave/sgxwasm/src/lib.rs
index 0a5ed71..a17687a 100644
--- a/samplecode/wasmi/enclave/sgxwasm/src/lib.rs
+++ b/samplecode/wasmi/enclave/sgxwasm/src/lib.rs
@@ -96,6 +96,7 @@ pub enum BoundaryValue {
     I64(i64),
     F32(u32),
     F64(u64),
+    V128(u128),
 }
 
 pub fn runtime_value_to_boundary_value(rv: RuntimeValue) -> BoundaryValue {
@@ -104,6 +105,7 @@ pub fn runtime_value_to_boundary_value(rv: RuntimeValue) -> BoundaryValue {
         RuntimeValue::I64(rv) => BoundaryValue::I64(rv),
         RuntimeValue::F32(rv) => BoundaryValue::F32(rv.to_bits()),
         RuntimeValue::F64(rv) => BoundaryValue::F64(rv.to_bits()),
+        //RuntimeValue::V128(rv) => BoundaryValue::V128(rv),
     }
 }
 
@@ -113,6 +115,7 @@ pub fn boundary_value_to_runtime_value(rv: BoundaryValue) -> RuntimeValue {
         BoundaryValue::I64(bv) => RuntimeValue::I64(bv),
         BoundaryValue::F32(bv) => RuntimeValue::F32(f32::from_bits(bv).into()),
         BoundaryValue::F64(bv) => RuntimeValue::F64(f64::from_bits(bv).into()),
+        BoundaryValue::V128(bv) => panic!("Not supported yet!"),
     }
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org