summaryrefslogtreecommitdiff
path: root/test/wasm2c
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm2c')
-rw-r--r--test/wasm2c/add.txt8
-rw-r--r--test/wasm2c/check-imports.txt12
-rw-r--r--test/wasm2c/export-names.txt32
-rw-r--r--test/wasm2c/hello.txt16
-rw-r--r--test/wasm2c/minimal.txt8
-rw-r--r--test/wasm2c/tail-calls.txt8
6 files changed, 75 insertions, 9 deletions
diff --git a/test/wasm2c/add.txt b/test/wasm2c/add.txt
index 7a576d9c..db581f49 100644
--- a/test/wasm2c/add.txt
+++ b/test/wasm2c/add.txt
@@ -125,6 +125,14 @@ static inline void* wasm_rt_segue_read_base() {
}
}
static inline void wasm_rt_segue_write_base(void* base) {
+#if WASM_RT_SEGUE_FREE_SEGMENT
+ if (wasm_rt_last_segment_val == base) {
+ return;
+ }
+
+ wasm_rt_last_segment_val = base;
+#endif
+
if (wasm_rt_fsgsbase_inst_supported) {
__builtin_ia32_wrgsbase64((uintptr_t)base);
} else {
diff --git a/test/wasm2c/check-imports.txt b/test/wasm2c/check-imports.txt
index a5d3ae61..f2fe508e 100644
--- a/test/wasm2c/check-imports.txt
+++ b/test/wasm2c/check-imports.txt
@@ -149,6 +149,14 @@ static inline void* wasm_rt_segue_read_base() {
}
}
static inline void wasm_rt_segue_write_base(void* base) {
+#if WASM_RT_SEGUE_FREE_SEGMENT
+ if (wasm_rt_last_segment_val == base) {
+ return;
+ }
+
+ wasm_rt_last_segment_val = base;
+#endif
+
if (wasm_rt_fsgsbase_inst_supported) {
__builtin_ia32_wrgsbase64((uintptr_t)base);
} else {
@@ -825,11 +833,13 @@ void wasm2c_test_instantiate(w2c_test* instance, struct w2c_env* w2c_env_instanc
init_tables(instance);
init_memories(instance);
#if WASM_RT_USE_SEGUE
+#if !WASM_RT_SEGUE_FREE_SEGMENT
void* segue_saved_base = wasm_rt_segue_read_base();
+#endif
wasm_rt_segue_write_base((*instance->w2c_env_0x5F_linear_memory).data);
#endif
init_elem_instances(instance);
-#if WASM_RT_USE_SEGUE
+#if WASM_RT_USE_SEGUE && !WASM_RT_SEGUE_FREE_SEGMENT
wasm_rt_segue_write_base(segue_saved_base);
#endif
}
diff --git a/test/wasm2c/export-names.txt b/test/wasm2c/export-names.txt
index f5762a19..a58bee0a 100644
--- a/test/wasm2c/export-names.txt
+++ b/test/wasm2c/export-names.txt
@@ -149,6 +149,14 @@ static inline void* wasm_rt_segue_read_base() {
}
}
static inline void wasm_rt_segue_write_base(void* base) {
+#if WASM_RT_SEGUE_FREE_SEGMENT
+ if (wasm_rt_last_segment_val == base) {
+ return;
+ }
+
+ wasm_rt_last_segment_val = base;
+#endif
+
if (wasm_rt_fsgsbase_inst_supported) {
__builtin_ia32_wrgsbase64((uintptr_t)base);
} else {
@@ -796,11 +804,13 @@ static void init_memories(w2c_test* instance) {
/* export: '' */
void w2c_test_(w2c_test* instance) {
#if WASM_RT_USE_SEGUE
+#if !WASM_RT_SEGUE_FREE_SEGMENT
void* segue_saved_base = wasm_rt_segue_read_base();
+#endif
wasm_rt_segue_write_base((*instance->w2c_0x5Cmodule_import0x200x2A0x2F).data);
#endif
w2c_test__0(instance);
-#if WASM_RT_USE_SEGUE
+#if WASM_RT_USE_SEGUE && !WASM_RT_SEGUE_FREE_SEGMENT
wasm_rt_segue_write_base(segue_saved_base);
#endif
}
@@ -808,11 +818,13 @@ void w2c_test_(w2c_test* instance) {
/* export: '*\2F' */
void w2c_test_0x2A0x2F(w2c_test* instance) {
#if WASM_RT_USE_SEGUE
+#if !WASM_RT_SEGUE_FREE_SEGMENT
void* segue_saved_base = wasm_rt_segue_read_base();
+#endif
wasm_rt_segue_write_base((*instance->w2c_0x5Cmodule_import0x200x2A0x2F).data);
#endif
w2c_test__0(instance);
-#if WASM_RT_USE_SEGUE
+#if WASM_RT_USE_SEGUE && !WASM_RT_SEGUE_FREE_SEGMENT
wasm_rt_segue_write_base(segue_saved_base);
#endif
}
@@ -820,11 +832,13 @@ void w2c_test_0x2A0x2F(w2c_test* instance) {
/* export: '\3F\3F\2F' */
void w2c_test_0x3F0x3F0x2F(w2c_test* instance) {
#if WASM_RT_USE_SEGUE
+#if !WASM_RT_SEGUE_FREE_SEGMENT
void* segue_saved_base = wasm_rt_segue_read_base();
+#endif
wasm_rt_segue_write_base((*instance->w2c_0x5Cmodule_import0x200x2A0x2F).data);
#endif
w2c_test__0(instance);
-#if WASM_RT_USE_SEGUE
+#if WASM_RT_USE_SEGUE && !WASM_RT_SEGUE_FREE_SEGMENT
wasm_rt_segue_write_base(segue_saved_base);
#endif
}
@@ -832,11 +846,13 @@ void w2c_test_0x3F0x3F0x2F(w2c_test* instance) {
/* export: '\0A' */
void w2c_test_0x0A(w2c_test* instance) {
#if WASM_RT_USE_SEGUE
+#if !WASM_RT_SEGUE_FREE_SEGMENT
void* segue_saved_base = wasm_rt_segue_read_base();
+#endif
wasm_rt_segue_write_base((*instance->w2c_0x5Cmodule_import0x200x2A0x2F).data);
#endif
w2c_test__0(instance);
-#if WASM_RT_USE_SEGUE
+#if WASM_RT_USE_SEGUE && !WASM_RT_SEGUE_FREE_SEGMENT
wasm_rt_segue_write_base(segue_saved_base);
#endif
}
@@ -844,11 +860,13 @@ void w2c_test_0x0A(w2c_test* instance) {
/* export: '\E2\9D\A4\EF\B8\8F' */
void w2c_test_0xE20x9D0xA40xEF0xB80x8F(w2c_test* instance) {
#if WASM_RT_USE_SEGUE
+#if !WASM_RT_SEGUE_FREE_SEGMENT
void* segue_saved_base = wasm_rt_segue_read_base();
+#endif
wasm_rt_segue_write_base((*instance->w2c_0x5Cmodule_import0x200x2A0x2F).data);
#endif
w2c_test__0(instance);
-#if WASM_RT_USE_SEGUE
+#if WASM_RT_USE_SEGUE && !WASM_RT_SEGUE_FREE_SEGMENT
wasm_rt_segue_write_base(segue_saved_base);
#endif
}
@@ -866,10 +884,12 @@ void wasm2c_test_instantiate(w2c_test* instance, struct w2c_0x5Cmodule* w2c_0x5C
init_instance_import(instance, w2c_0x5Cmodule_instance);
init_memories(instance);
#if WASM_RT_USE_SEGUE
+#if !WASM_RT_SEGUE_FREE_SEGMENT
void* segue_saved_base = wasm_rt_segue_read_base();
+#endif
wasm_rt_segue_write_base((*instance->w2c_0x5Cmodule_import0x200x2A0x2F).data);
#endif
-#if WASM_RT_USE_SEGUE
+#if WASM_RT_USE_SEGUE && !WASM_RT_SEGUE_FREE_SEGMENT
wasm_rt_segue_write_base(segue_saved_base);
#endif
}
diff --git a/test/wasm2c/hello.txt b/test/wasm2c/hello.txt
index a9beeede..2a0d79f0 100644
--- a/test/wasm2c/hello.txt
+++ b/test/wasm2c/hello.txt
@@ -157,6 +157,14 @@ static inline void* wasm_rt_segue_read_base() {
}
}
static inline void wasm_rt_segue_write_base(void* base) {
+#if WASM_RT_SEGUE_FREE_SEGMENT
+ if (wasm_rt_last_segment_val == base) {
+ return;
+ }
+
+ wasm_rt_last_segment_val = base;
+#endif
+
if (wasm_rt_fsgsbase_inst_supported) {
__builtin_ia32_wrgsbase64((uintptr_t)base);
} else {
@@ -833,11 +841,13 @@ wasm_rt_memory_t* w2c_test_memory(w2c_test* instance) {
/* export: '_start' */
void w2c_test_0x5Fstart(w2c_test* instance) {
#if WASM_RT_USE_SEGUE
+#if !WASM_RT_SEGUE_FREE_SEGMENT
void* segue_saved_base = wasm_rt_segue_read_base();
+#endif
wasm_rt_segue_write_base(instance->w2c_memory.data);
#endif
w2c_test_0x5Fstart_0(instance);
-#if WASM_RT_USE_SEGUE
+#if WASM_RT_USE_SEGUE && !WASM_RT_SEGUE_FREE_SEGMENT
wasm_rt_segue_write_base(segue_saved_base);
#endif
}
@@ -852,12 +862,14 @@ void wasm2c_test_instantiate(w2c_test* instance, struct w2c_wasi__snapshot__prev
init_tables(instance);
init_memories(instance);
#if WASM_RT_USE_SEGUE
+#if !WASM_RT_SEGUE_FREE_SEGMENT
void* segue_saved_base = wasm_rt_segue_read_base();
+#endif
wasm_rt_segue_write_base(instance->w2c_memory.data);
#endif
init_elem_instances(instance);
init_data_instances(instance);
-#if WASM_RT_USE_SEGUE
+#if WASM_RT_USE_SEGUE && !WASM_RT_SEGUE_FREE_SEGMENT
wasm_rt_segue_write_base(segue_saved_base);
#endif
}
diff --git a/test/wasm2c/minimal.txt b/test/wasm2c/minimal.txt
index 3fb8ad8b..7ffa3bca 100644
--- a/test/wasm2c/minimal.txt
+++ b/test/wasm2c/minimal.txt
@@ -119,6 +119,14 @@ static inline void* wasm_rt_segue_read_base() {
}
}
static inline void wasm_rt_segue_write_base(void* base) {
+#if WASM_RT_SEGUE_FREE_SEGMENT
+ if (wasm_rt_last_segment_val == base) {
+ return;
+ }
+
+ wasm_rt_last_segment_val = base;
+#endif
+
if (wasm_rt_fsgsbase_inst_supported) {
__builtin_ia32_wrgsbase64((uintptr_t)base);
} else {
diff --git a/test/wasm2c/tail-calls.txt b/test/wasm2c/tail-calls.txt
index c0e940f4..b27d7417 100644
--- a/test/wasm2c/tail-calls.txt
+++ b/test/wasm2c/tail-calls.txt
@@ -149,6 +149,14 @@ static inline void* wasm_rt_segue_read_base() {
}
}
static inline void wasm_rt_segue_write_base(void* base) {
+#if WASM_RT_SEGUE_FREE_SEGMENT
+ if (wasm_rt_last_segment_val == base) {
+ return;
+ }
+
+ wasm_rt_last_segment_val = base;
+#endif
+
if (wasm_rt_fsgsbase_inst_supported) {
__builtin_ia32_wrgsbase64((uintptr_t)base);
} else {