Procházet zdrojové kódy

[GC] Remove unused normalize API (#2182)

Xu Jun před 2 roky
rodič
revize
9bf0999e26
2 změnil soubory, kde provedl 41 přidání a 44 odebrání
  1. 37 37
      core/iwasm/common/gc/gc_common.c
  2. 4 7
      core/iwasm/include/gc_export.h

+ 37 - 37
core/iwasm/common/gc/gc_common.c

@@ -12,6 +12,43 @@
 #include "../aot/aot_runtime.h"
 #include "../aot/aot_runtime.h"
 #endif
 #endif
 
 
+static bool
+wasm_ref_type_normalize(wasm_ref_type_t *ref_type)
+{
+    wasm_value_type_t value_type = ref_type->value_type;
+    int32 heap_type = ref_type->heap_type;
+
+    if (!((value_type >= VALUE_TYPE_V128 && value_type <= VALUE_TYPE_I32)
+          || (value_type >= VALUE_TYPE_NULLREF
+              && value_type <= VALUE_TYPE_FUNCREF))) {
+        return false;
+    }
+    if (value_type == VALUE_TYPE_HT_NULLABLE_REF
+        || value_type == VALUE_TYPE_HT_NON_NULLABLE_REF) {
+        if (heap_type < 0
+            && (heap_type < HEAP_TYPE_NONE || heap_type > HEAP_TYPE_FUNC)) {
+            return false;
+        }
+    }
+
+    if (value_type != REF_TYPE_HT_NULLABLE) {
+        ref_type->nullable = false;
+    }
+    else {
+        if (heap_type >= HEAP_TYPE_NONE && heap_type <= HEAP_TYPE_FUNC) {
+            ref_type->value_type =
+                (uint8)(REF_TYPE_NULLREF + heap_type - HEAP_TYPE_NONE);
+            ref_type->nullable = false;
+            ref_type->heap_type = 0;
+        }
+        else {
+            ref_type->nullable = true;
+        }
+    }
+
+    return true;
+}
+
 uint32
 uint32
 wasm_get_defined_type_count(WASMModuleCommon *const module)
 wasm_get_defined_type_count(WASMModuleCommon *const module)
 {
 {
@@ -117,43 +154,6 @@ wasm_func_type_get_param_count(WASMFuncType *const func_type)
     return 0;
     return 0;
 }
 }
 
 
-bool
-wasm_ref_type_normalize(wasm_ref_type_t *ref_type)
-{
-    wasm_value_type_t value_type = ref_type->value_type;
-    int32 heap_type = ref_type->heap_type;
-
-    if (!((value_type >= VALUE_TYPE_V128 && value_type <= VALUE_TYPE_I32)
-          || (value_type >= VALUE_TYPE_NULLREF
-              && value_type <= VALUE_TYPE_FUNCREF))) {
-        return false;
-    }
-    if (value_type == VALUE_TYPE_HT_NULLABLE_REF
-        || value_type == VALUE_TYPE_HT_NON_NULLABLE_REF) {
-        if (heap_type < 0
-            && (heap_type < HEAP_TYPE_NONE || heap_type > HEAP_TYPE_FUNC)) {
-            return false;
-        }
-    }
-
-    if (value_type != REF_TYPE_HT_NULLABLE) {
-        ref_type->nullable = false;
-    }
-    else {
-        if (heap_type >= HEAP_TYPE_NONE && heap_type <= HEAP_TYPE_FUNC) {
-            ref_type->value_type =
-                (uint8)(REF_TYPE_NULLREF + heap_type - HEAP_TYPE_NONE);
-            ref_type->nullable = false;
-            ref_type->heap_type = 0;
-        }
-        else {
-            ref_type->nullable = true;
-        }
-    }
-
-    return true;
-}
-
 wasm_ref_type_t
 wasm_ref_type_t
 wasm_func_type_get_param_type(WASMFuncType *const func_type, uint32 param_idx)
 wasm_func_type_get_param_type(WASMFuncType *const func_type, uint32 param_idx)
 {
 {

+ 4 - 7
core/iwasm/include/gc_export.h

@@ -84,7 +84,10 @@ typedef union WASMValue {
 
 
 typedef union WASMValue wasm_value_t;
 typedef union WASMValue wasm_value_t;
 
 
-/* Reference type, the layout is same as WasmRefType in wasm.h */
+/* Reference type, the layout is same as WasmRefType in wasm.h
+ * use wasm_ref_type_set_type_idx to initialize as concrete ref type
+ * use wasm_ref_type_set_heap_type to initialize as abstract ref type
+ */
 typedef struct wasm_ref_type_t {
 typedef struct wasm_ref_type_t {
     wasm_value_type_t value_type;
     wasm_value_type_t value_type;
     bool nullable;
     bool nullable;
@@ -190,12 +193,6 @@ wasm_defined_type_is_array_type(const wasm_defined_type_t def_type);
 WASM_RUNTIME_API_EXTERN uint32_t
 WASM_RUNTIME_API_EXTERN uint32_t
 wasm_func_type_get_param_count(const wasm_func_type_t func_type);
 wasm_func_type_get_param_count(const wasm_func_type_t func_type);
 
 
-/**
- * Normalize reference type
- */
-WASM_RUNTIME_API_EXTERN bool
-wasm_ref_type_normalize(wasm_ref_type_t *ref_type);
-
 /**
 /**
  * Get type of a specified parameter of a function type
  * Get type of a specified parameter of a function type
  */
  */