only 4 failing test cases now
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 10 Jan 2023 20:56:57 +0000 (14:56 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 10 Jan 2023 20:56:57 +0000 (14:56 -0600)
compiler/src/types.c
compiler/src/wasm_emit.c
core/container/heap.onyx
interpreter/build.sh
scripts/run_tests.onyx
shared/lib/linux_x86_64/lib/libovmwasm.so
tests/parallel_for [deleted file]

index 6a560376c2585edb737810497c0dc433659fb71e..db6d5b705a980b6097aaf4fdedd1aacbb5b838d5 100644 (file)
@@ -919,6 +919,14 @@ void build_linear_types_with_offset(Type* type, bh_arr(TypeWithOffset)* pdest, u
             build_linear_types_with_offset(type->Compound.types[i], pdest, offset + elem_offset);
             elem_offset += bh_max(type_size_of(type->Compound.types[i]), 4);
         }
+        
+    } else if (type->kind == Type_Kind_Slice || type->kind == Type_Kind_VarArgs) {
+        u32 mem_count = type_structlike_mem_count(type);
+        StructMember smem = { 0 };
+        fori (i, 0, mem_count) {
+            type_lookup_member_by_idx(type, i, &smem);
+            build_linear_types_with_offset(smem.type, pdest, offset + smem.offset);
+        }
 
     } else {
         bh_arr(TypeWithOffset) dest = *pdest;
index e4cf230e4bd3bfac4bc3a502816c8273c7c5f421..1855cdc6d15b1c5ab164a91d38243f36b0772d57 100644 (file)
@@ -3964,11 +3964,7 @@ static i32 generate_type_idx(OnyxWasmModule* mod, Type* ft) {
     i32 params_left = param_count;
 
     while (params_left-- > 0) {
-        if ((*param_type)->kind == Type_Kind_Struct) {
-            *(t++) = (char) onyx_type_to_wasm_type(*param_type);
-        }
-
-        else if (type_get_param_pass(*param_type) == Param_Pass_By_Implicit_Pointer) {
+        if (type_get_param_pass(*param_type) == Param_Pass_By_Implicit_Pointer) {
             *(t++) = (char) onyx_type_to_wasm_type(&basic_types[Basic_Kind_Rawptr]);
 
         }
index d05e6ac3020c58afd1189bf30da937644a619574..2dcecc08b116ffa621fedda346a88a4bd73f8da8 100644 (file)
@@ -56,7 +56,9 @@ remove_top :: (use heap: ^Heap) -> heap.T {
             }
 
             if idx != min_index {
-                data[min_index], data[idx] = data[idx], data[min_index];
+                tmp := data[idx];
+                data[idx] = data[min_index];
+                data[min_index] = tmp;
                 idx = min_index;
                 continue;
             }
@@ -70,7 +72,9 @@ remove_top :: (use heap: ^Heap) -> heap.T {
             parent := heap_parent(idx);
             if compare(data[parent], data[idx]) <= 0 do break;
 
-            data[parent], data[idx] = data[idx], data[parent];
+            tmp := data[parent];
+            data[parent] = data[idx];
+            data[idx] = tmp;
             idx = parent;
         }
     }
index d311e432f24069a4f109be01600d2519f91154a6..c58d91f53094ff7388c2423b63f182de8d9717c6 100755 (executable)
@@ -2,9 +2,9 @@
 
 . ../settings.sh
 
-FLAGS="-g3 -O2 -DOVM_DEBUG=1"
+FLAGS="-g3 -O2 -DOVM_DEBUG=1"
 # FLAGS="-g3 -DOVM_VERBOSE=1"
-FLAGS="-Ofast -fno-stack-protector"
+FLAGS="-Ofast -fno-stack-protector"
 LIBS="-pthread"
 TARGET="../shared/lib/linux_$(uname -m)/lib/libovmwasm.so"
 C_FILES="src/wasm.c src/vm/*.c src/wasm/*.c src/debug/*.c"
index 20771beef801e0eaf6ea2e8aac21a0e990163ff2..60790cfbfdce1c07da048ddb2cbf67c6a9495803 100644 (file)
@@ -96,10 +96,17 @@ main :: (args) => {
         onyx_cmd: str;
         at_least_one_test_failed := false;
         compile_only := false;   // @Bug // why is this necessary? why is settings.compile_only false when in the thread code?
+
+        failed_tests: ^[..] str;
+        failed_tests_mutex: sync.Mutex;
     }
     exec_context := init(Execution_Context);
     exec_context.compile_only = settings.compile_only;
 
+    failed_tests := make([..] str);
+    exec_context.failed_tests = ^failed_tests;
+    sync.mutex_init(^exec_context.failed_tests_mutex);
+
     switch runtime.compiler_os {
         case .Linux {
             exec_context.onyx_cmd = "./bin/onyx";
@@ -150,12 +157,21 @@ main :: (args) => {
                 printf("Expected:\n{}\n", expected_output);
                 printf("Got:\n{}\n", output);
                 thread_data.at_least_one_test_failed = true;
+
+                sync.critical_section(^thread_data.failed_tests_mutex) {
+                    array.push(thread_data.failed_tests, it.source_file);
+                }
             }
         }
     }
 
     if exec_context.at_least_one_test_failed {
         print_color(.Red, "FAILED\n");
+
+        for failed_tests {
+            printf("  {}\n", it);
+        }
+        
         os.exit(-1);
 
     } else {
index 23b9203abd121fcf2a05b22811e9e11b4f83de80..9368eae74de37c5ae3881b88ef51afc83c84d371 100755 (executable)
Binary files a/shared/lib/linux_x86_64/lib/libovmwasm.so and b/shared/lib/linux_x86_64/lib/libovmwasm.so differ
diff --git a/tests/parallel_for b/tests/parallel_for
deleted file mode 100644 (file)
index fbdf932..0000000
+++ /dev/null
@@ -1 +0,0 @@
-49995000