changes for testing debugger
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 5 Jul 2022 14:23:55 +0000 (09:23 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 5 Jul 2022 14:23:55 +0000 (09:23 -0500)
build.sh
core/intrinsics/wasm.onyx
src/wasm_runtime.c
tests/aoc-2021/day15.onyx

index 6a3694fe753fee9aca04e724bf229cc9c50afb93..68bae2ff80a5bf024b2ea06f572bd98c9b803a46 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -16,6 +16,8 @@ CC='gcc'
 # The architecture of your system. If your not sure, leave this alone.
 ARCH="$(uname -m)"
 
+RUNTIME_LIBRARY="wasmer"
+
 # Comment this line if you do not want the Wamser libraries installed,
 # and do not with to have the Onyx runtime.
 ENABLE_BUNDLING_WASMER=1
@@ -58,17 +60,18 @@ fi
 if [ ! -z "$ENABLE_BUNDLING_WASMER" ]; then
     C_FILES="$C_FILES wasm_runtime"
     FLAGS="$FLAGS -DENABLE_RUN_WITH_WASMER"
-    LIBS="$LIBS -L$CORE_DIR/lib -lwasmer -Wl,-rpath=$CORE_DIR/lib:./ -lpthread -ldl"
+    LIBS="$LIBS -L$CORE_DIR/lib -l$RUNTIME_LIBRARY -Wl,-rpath=$CORE_DIR/lib:./ -lpthread -ldl -lm"
     INCLUDES="$INCLUDES -I$WASMER_INCLUDE_DIR"
 
-    if [ ! -f "$CORE_DIR/lib/libwasmer.so" ]; then
-        echo "Copying libwasmer to $CORE_DIR/lib (first install)"
+    if [ ! -f "$CORE_DIR/lib/lib$RUNTIME_LIBRARY.so" ] || true; then
+        echo "Copying lib$RUNTIME_LIBRARY to $CORE_DIR/lib (first install)"
 
         sudo mkdir -p "$CORE_DIR/lib"
         sudo mkdir -p "$CORE_DIR/include"
 
         # sudo cp "$WASMER_LIBRARY_DIR/libiwasm.so" "$CORE_DIR/lib/libiwasm.so"
-        sudo cp "$WASMER_LIBRARY_DIR/libwasmer.so" "$CORE_DIR/lib/libwasmer.so"
+        # sudo cp "$WASMER_LIBRARY_DIR/libwasmer.so" "$CORE_DIR/lib/libwasmer.so"
+        sudo cp "$WASMER_LIBRARY_DIR/lib$RUNTIME_LIBRARY.so" "$CORE_DIR/lib/lib$RUNTIME_LIBRARY.so"
 
         sudo cp "include/onyx_library.h" "$CORE_DIR/include/onyx_library.h"
         sudo cp "lib/common/include/wasm.h" "$CORE_DIR/include/wasm.h"
index 0d2d115d6e701a76d137db36d919555ac7f39479..c33ebf6a7035616181fb21aa56c56ea220fd3cd0 100644 (file)
@@ -1,7 +1,7 @@
 package core.intrinsics.wasm
 
-memory_size  :: () -> i32 #intrinsic ---
-memory_grow  :: (val: i32) -> i32 #intrinsic ---
+memory_size  :: () -> u32 #intrinsic ---
+memory_grow  :: (val: u32) -> i32 #intrinsic ---
 memory_copy  :: (dst: rawptr, src: rawptr, count: i32) -> void #intrinsic ---
 memory_fill  :: (dst: rawptr, byte: u8, count: i32) -> void #intrinsic ---
 
index 28cc229b46d6ea76194bcbe4579d8cbd377d8ee7..88ca522ba3a6eb34cf1e75669f8ec461832782b7 100644 (file)
@@ -228,9 +228,6 @@ b32 onyx_run_wasm(bh_buffer wasm_bytes, int argc, char *argv[]) {
     bh_arr_new(bh_heap_allocator(), linkable_functions, 4);
     onyx_lookup_and_load_custom_libraries(wasm_bytes);
 
-    // void wasm_runtime_init();
-    // wasm_runtime_init();
-
     wasmer_features_t* features = NULL;
     wasm_trap_t* run_trap = NULL;
 
index c7c0ed6c3f3ad5fcc9980efc858de01a5025a1b6..4fc704ab9ee345c19264a62ce1cc83f9958c2cf5 100644 (file)
@@ -86,4 +86,4 @@ main :: (args) => {
         printf("Part 2: {}\n", result);
 */
     }
-}
\ No newline at end of file
+}