From d865c52d36ba4a34d4f5bc082fbb46dda33fb3f4 Mon Sep 17 00:00:00 2001 From: Ezekiel Date: Sat, 18 Jan 2025 13:15:39 -0800 Subject: [PATCH 1/2] feat: add tracy support --- .bazelversion | 2 +- BUILD.bazel | 3 +++ MODULE.bazel | 4 +++- ecsact/wasm/detail/minst/minst.cc | 24 ++++++++++++++++++- ecsact/wasm/detail/tracy.hh | 15 ++++++++++++ ecsact/wasm/detail/wasi.cc | 9 +++++++ ecsact/wasm/detail/wasi_fs.cc | 20 ++++++++++++---- ecsact/wasm/detail/wasm.cc | 9 +++++++ .../detail/wasm_ecsact_system_execution.cc | 19 +++++++++++++++ test/.bazelversion | 1 + test/MODULE.bazel | 6 ++--- 11 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 ecsact/wasm/detail/tracy.hh create mode 100644 test/.bazelversion diff --git a/.bazelversion b/.bazelversion index 1502020..815da58 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.3.0 +7.4.1 diff --git a/BUILD.bazel b/BUILD.bazel index 2c10a26..926f98e 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -33,6 +33,7 @@ cc_library( "@wasmer", "@ecsact_runtime//:common", "@ecsact_runtime//:dynamic", + "@tracy", ], ) @@ -49,6 +50,7 @@ cc_library( "@wasmer", "@ecsact_runtime//:common", "@ecsact_runtime//:dynamic", + "@tracy", ], ) @@ -65,6 +67,7 @@ cc_library( ":cpp_util", "@ecsact_runtime//:common", "@wasmer", + "@tracy", ], ) diff --git a/MODULE.bazel b/MODULE.bazel index e918b71..094fdaa 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,7 +4,7 @@ module( compatibility_level = 1, ) -bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_cc", version = "0.0.17") bazel_dep(name = "bazel_skylib", version = "1.6.1") bazel_dep(name = "ecsact_runtime", version = "0.7.0") bazel_dep(name = "rules_ecsact", version = "0.5.9") @@ -13,9 +13,11 @@ bazel_dep(name = "magic_enum", version = "0.9.3") bazel_dep(name = "rules_wasmer", version = "0.1.2") bazel_dep(name = "ecsact_cli", version = "0.3.21") bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "tracy", version = "0.11.1.edr.2") bazel_dep(name = "toolchains_llvm", version = "1.0.0", dev_dependency = True) bazel_dep(name = "hedron_compile_commands", dev_dependency = True) + git_override( module_name = "hedron_compile_commands", commit = "204aa593e002cbd177d30f11f54cff3559110bb9", diff --git a/ecsact/wasm/detail/minst/minst.cc b/ecsact/wasm/detail/minst/minst.cc index 7c06c48..47157fd 100644 --- a/ecsact/wasm/detail/minst/minst.cc +++ b/ecsact/wasm/detail/minst/minst.cc @@ -4,7 +4,15 @@ #include #include #include -#include "ecsact/wasm/detail/cpp_util.hh" +#ifdef TRACY_ENABLE +# include +#endif + +#ifdef TRACY_ENABLE +# define ECSACT_SI_WASM_ZONE_SCOPED ZoneScoped +#else +# define ECSACT_SI_WASM_ZONE_SCOPED static_assert(true, "requires semi colon") +#endif using ecsact::wasm::detail::minst; using ecsact::wasm::detail::minst_export; @@ -14,6 +22,7 @@ using ecsact::wasm::detail::minst_trap; namespace { auto get_wasmer_last_error_message() -> std::string { + ECSACT_SI_WASM_ZONE_SCOPED; auto msg = std::string{}; msg.resize(wasmer_last_error_length()); wasmer_last_error_message(msg.data(), static_cast(msg.size())); @@ -22,6 +31,7 @@ auto get_wasmer_last_error_message() -> std::string { } // namespace auto minst_import::name() const -> std::string_view { + ECSACT_SI_WASM_ZONE_SCOPED; auto name = wasm_importtype_name(import_type); return std::string_view{ name->data, @@ -30,6 +40,7 @@ auto minst_import::name() const -> std::string_view { } auto minst_import::module() const -> std::string_view { + ECSACT_SI_WASM_ZONE_SCOPED; auto name = wasm_importtype_module(import_type); return std::string_view{ name->data, @@ -38,12 +49,14 @@ auto minst_import::module() const -> std::string_view { } auto minst_import::kind() const -> wasm_externkind_enum { + ECSACT_SI_WASM_ZONE_SCOPED; return static_cast( // wasm_externtype_kind(wasm_importtype_type(import_type)) ); } auto minst_export::name() const -> std::string_view { + ECSACT_SI_WASM_ZONE_SCOPED; auto name = wasm_exporttype_name(export_type); return std::string_view{ name->data, @@ -52,12 +65,14 @@ auto minst_export::name() const -> std::string_view { } auto minst_export::kind() const -> wasm_externkind_enum { + ECSACT_SI_WASM_ZONE_SCOPED; return static_cast( // wasm_externtype_kind(wasm_exporttype_type(export_type)) ); } auto minst_export::func_call() -> std::optional { + ECSACT_SI_WASM_ZONE_SCOPED; assert(kind() == WASM_EXTERN_FUNC); auto args = wasm_val_vec_t{}; @@ -72,6 +87,7 @@ auto minst_export::func_call() -> std::optional { } auto minst_export::func_call(int32_t p0) -> std::optional { + ECSACT_SI_WASM_ZONE_SCOPED; assert(kind() == WASM_EXTERN_FUNC); wasm_val_t args_val[] = {WASM_I32_VAL(p0)}; @@ -104,11 +120,13 @@ minst_trap::~minst_trap() { auto minst_import_resolve_func::as_extern( // wasm_store_t* store ) -> wasm_extern_t* { + ECSACT_SI_WASM_ZONE_SCOPED; auto func = wasm_func_new(store, func_type, func_callback); return wasm_func_as_extern(func); } auto minst_trap::message() const -> std::string { + ECSACT_SI_WASM_ZONE_SCOPED; auto trap_msg = wasm_message_t{}; wasm_trap_message(trap, &trap_msg); return std::string{trap_msg.data, trap_msg.size - 1}; @@ -119,6 +137,7 @@ auto minst::create( // std::span wasm_data, import_resolver_t import_resolver ) -> std::variant { + ECSACT_SI_WASM_ZONE_SCOPED; auto self = minst{}; auto wasm_bytes = wasm_byte_vec_t{ @@ -262,6 +281,7 @@ auto minst::exports() -> std::span { } auto minst::initialize() -> std::optional { + ECSACT_SI_WASM_ZONE_SCOPED; for(auto exp : exports()) { if(exp.name() == "_initialize") { return exp.func_call(); @@ -275,6 +295,7 @@ auto minst::find_import( // std::string_view module_name, std::string_view import_name ) -> std::optional { + ECSACT_SI_WASM_ZONE_SCOPED; for(auto imp : imports()) { if(imp.module() == module_name && imp.name() == import_name) { return imp; @@ -287,6 +308,7 @@ auto minst::find_import( // auto minst::find_export( // std::string_view export_name ) -> std::optional { + ECSACT_SI_WASM_ZONE_SCOPED; for(auto exp : exports()) { if(exp.name() == export_name) { return exp; diff --git a/ecsact/wasm/detail/tracy.hh b/ecsact/wasm/detail/tracy.hh new file mode 100644 index 0000000..e7b4615 --- /dev/null +++ b/ecsact/wasm/detail/tracy.hh @@ -0,0 +1,15 @@ +#pragma once + +// We only want to use tracy if its enabled in si_wasm. Some users of Ecsact do +// not have tracy available so we cannot rely on the tracy header being +// available. + +#ifdef TRACY_ENABLE +# include +#endif + +#ifdef TRACY_ENABLE +# define ECSACT_SI_WASM_ZONE_SCOPED ZoneScoped +#else +# define ECSACT_SI_WASM_ZONE_SCOPED static_assert(true, "requires semi colon") +#endif diff --git a/ecsact/wasm/detail/wasi.cc b/ecsact/wasm/detail/wasi.cc index 380977f..be3c63d 100644 --- a/ecsact/wasm/detail/wasi.cc +++ b/ecsact/wasm/detail/wasi.cc @@ -7,6 +7,7 @@ #include "ecsact/wasm/detail/logger.hh" #include "ecsact/wasm/detail/mem_stack.hh" #include "ecsact/wasm/detail/util.hh" +#include "ecsact/wasm/detail/tracy.hh" using ecsact::wasm::detail::call_mem_read; using ecsact::wasm::detail::debug_trace_method; @@ -20,6 +21,7 @@ wasm_trap_t* ecsactsi_wasi_proc_exit( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("proc_exit"); return nullptr; } @@ -28,6 +30,7 @@ wasm_trap_t* ecsactsi_wasi_fd_seek( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("fd_seek"); results->data[0].kind = WASM_I32; results->data[0].of.i32 = 0; @@ -39,6 +42,7 @@ wasm_trap_t* ecsactsi_wasi_fd_write( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("fd_write"); auto mem = call_mem_read(0); assert(args->data[0].kind == WASM_I32); @@ -87,6 +91,7 @@ wasm_trap_t* ecsactsi_wasi_fd_read( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("fd_read"); auto mem = call_mem_read(0); assert(args->data[0].kind == WASM_I32); @@ -126,6 +131,7 @@ wasm_trap_t* ecsactsi_wasi_fd_close( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("fd_close"); assert(args->data[0].kind == WASM_I32); auto fd = args->data[0].of.i32; @@ -146,6 +152,7 @@ wasm_trap_t* ecsactsi_wasi_environ_sizes_get( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("environ_sizes_get"); auto mem = call_mem_read(0); auto retptr0 = wasm_memory_cast(mem, args->data[0].of.i32); @@ -164,6 +171,7 @@ wasm_trap_t* ecsactsi_wasi_environ_get( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("environ_get"); auto mem = call_mem_read(0); auto environ_arg = wasm_memory_cast(mem, args->data[0].of.i32); @@ -184,6 +192,7 @@ wasm_trap_t* ecsactsi_wasi_fd_fdstat_get( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("fd_fdstat_get"); const auto default_fdstats = std::map{ { diff --git a/ecsact/wasm/detail/wasi_fs.cc b/ecsact/wasm/detail/wasi_fs.cc index 78813b5..b0bd6b3 100644 --- a/ecsact/wasm/detail/wasi_fs.cc +++ b/ecsact/wasm/detail/wasi_fs.cc @@ -4,6 +4,7 @@ #include #include #include +#include "ecsact/wasm/detail/tracy.hh" struct virtual_file_info { std::string virtual_path; @@ -33,6 +34,7 @@ auto ecsact::wasm::detail::wasi::fs::allow_file_read_access( std::string_view real_path, std::string_view virtual_path ) -> std::int32_t { + ECSACT_SI_WASM_ZONE_SCOPED; erase_virtual_if_exists(virtual_path); auto fd = ++last_file_descriptor; @@ -54,6 +56,7 @@ auto ecsact::wasm::detail::wasi::fs::allow_file_read_access( } auto ecsact::wasm::detail::wasi::fs::real_path(int32_t fd) -> std::string { + ECSACT_SI_WASM_ZONE_SCOPED; if(!virtual_files.contains(fd)) { return ""; } @@ -61,8 +64,10 @@ auto ecsact::wasm::detail::wasi::fs::real_path(int32_t fd) -> std::string { return virtual_files.at(fd).real_path; } -auto ecsact::wasm::detail::wasi::fs::real_path(std::string_view virtual_path +auto ecsact::wasm::detail::wasi::fs::real_path( // + std::string_view virtual_path ) -> std::string { + ECSACT_SI_WASM_ZONE_SCOPED; const auto virtual_path_s = std::string{virtual_path}; auto itr = virtual_file_map.find(virtual_path_s); @@ -74,8 +79,10 @@ auto ecsact::wasm::detail::wasi::fs::real_path(std::string_view virtual_path return ""; } -auto ecsact::wasm::detail::wasi::fs::fdstat(int32_t fd +auto ecsact::wasm::detail::wasi::fs::fdstat( // + int32_t fd ) -> ecsactsi_wasi_fdstat_t { + ECSACT_SI_WASM_ZONE_SCOPED; if(!virtual_files.contains(fd)) { return {}; } @@ -83,8 +90,10 @@ auto ecsact::wasm::detail::wasi::fs::fdstat(int32_t fd return virtual_files.at(fd).fdstat; } -auto ecsact::wasm::detail::wasi::fs::fdstat(std::string_view virtual_path +auto ecsact::wasm::detail::wasi::fs::fdstat( // + std::string_view virtual_path ) -> ecsactsi_wasi_fdstat_t { + ECSACT_SI_WASM_ZONE_SCOPED; const auto virtual_path_s = std::string{virtual_path}; auto itr = virtual_file_map.find(virtual_path_s); @@ -96,8 +105,10 @@ auto ecsact::wasm::detail::wasi::fs::fdstat(std::string_view virtual_path return {}; } -auto ecsact::wasm::detail::wasi::fs::ensure_open(int32_t pseudo_fd +auto ecsact::wasm::detail::wasi::fs::ensure_open( // + int32_t pseudo_fd ) -> std::FILE* { + ECSACT_SI_WASM_ZONE_SCOPED; auto& info = virtual_files.at(pseudo_fd); if(info.opened_file) { return *info.opened_file; @@ -109,6 +120,7 @@ auto ecsact::wasm::detail::wasi::fs::ensure_open(int32_t pseudo_fd } auto ecsact::wasm::detail::wasi::fs::close(int32_t pseudo_fd) -> void { + ECSACT_SI_WASM_ZONE_SCOPED; auto& info = virtual_files.at(pseudo_fd); if(info.opened_file) { std::fclose(*info.opened_file); diff --git a/ecsact/wasm/detail/wasm.cc b/ecsact/wasm/detail/wasm.cc index 7b3fad0..d39e8a1 100644 --- a/ecsact/wasm/detail/wasm.cc +++ b/ecsact/wasm/detail/wasm.cc @@ -29,6 +29,7 @@ #include "ecsact/wasm/detail/guest_imports/env.hh" #include "ecsact/wasm/detail/cpp_util.hh" #include "ecsact/wasm/detail/mem_stack.hh" +#include "ecsact/wasm/detail/tracy.hh" #include "mem_stack.hh" using namespace std::string_literals; @@ -77,6 +78,7 @@ auto next_available_minst_index = std::atomic_size_t{}; thread_local auto thread_minst = std::weak_ptr{}; auto ensure_minst() -> std::shared_ptr { + ECSACT_SI_WASM_ZONE_SCOPED; auto minst = thread_minst.lock(); if(!minst) { auto index = ++next_available_minst_index % all_minsts.size(); @@ -88,6 +90,7 @@ auto ensure_minst() -> std::shared_ptr { } void ecsact_si_wasm_system_impl(ecsact_system_execution_context* ctx) { + ECSACT_SI_WASM_ZONE_SCOPED; auto minst = ensure_minst(); auto system_id = ecsact_system_execution_context_id(ctx); auto itr = minst->sys_impl_exports.find(system_id); @@ -109,6 +112,7 @@ auto get_system_impl_exports( const char** wasm_exports, std::unordered_map& system_impl_exports ) -> ecsactsi_wasm_error { + ECSACT_SI_WASM_ZONE_SCOPED; system_impl_exports.clear(); system_impl_exports.reserve(systems_count); @@ -170,6 +174,8 @@ ecsactsi_wasm_error ecsactsi_wasm_load( using ecsact::wasm::detail::minst_error_code; using ecsact::wasm::detail::minst_export; + ECSACT_SI_WASM_ZONE_SCOPED; + #ifdef ECSACT_DYNAMIC_API_LOAD_AT_RUNTIME if(ecsact_set_system_execution_impl == nullptr) { return ECSACTSI_WASM_ERR_NO_SET_SYSTEM_EXECUTION; @@ -286,6 +292,7 @@ ecsactsi_wasm_error ecsactsi_wasm_load_file( ecsact_system_like_id* system_ids, const char** wasm_exports ) { + ECSACT_SI_WASM_ZONE_SCOPED; FILE* file = std::fopen(wasm_file_path, "rb"); if(!file) { return ECSACTSI_WASM_ERR_FILE_OPEN_FAIL; @@ -330,6 +337,7 @@ void ecsactsi_wasm_consume_logs( ecsactsi_wasm_log_consumer consumer, void* consumer_user_data ) { + ECSACT_SI_WASM_ZONE_SCOPED; auto t = start_transaction(); for(auto& entry : get_log_lines(t)) { consumer( @@ -358,6 +366,7 @@ int32_t ecsactsi_wasm_allow_file_read_access( const char* virtual_file_path, int32_t virtual_file_path_length ) { + ECSACT_SI_WASM_ZONE_SCOPED; return ecsact::wasm::detail::wasi::fs::allow_file_read_access( std::string_view{ real_file_path, diff --git a/ecsact/wasm/detail/wasm_ecsact_system_execution.cc b/ecsact/wasm/detail/wasm_ecsact_system_execution.cc index 658b7a0..4ca93e7 100644 --- a/ecsact/wasm/detail/wasm_ecsact_system_execution.cc +++ b/ecsact/wasm/detail/wasm_ecsact_system_execution.cc @@ -6,6 +6,7 @@ #include #include "ecsact/runtime/dynamic.h" #include "ecsact/wasm/detail/mem_stack.hh" +#include "ecsact/wasm/detail/tracy.hh" using ecsact::wasm::detail::call_mem_alloc; using ecsact::wasm::detail::debug_trace_method; @@ -15,6 +16,7 @@ namespace { auto get_execution_context( // const wasm_val_t& val ) -> ecsact_system_execution_context* { + ECSACT_SI_WASM_ZONE_SCOPED; assert(val.kind == WASM_I32); return ecsact::wasm::detail::call_mem_read( val.of.i32 @@ -24,6 +26,7 @@ auto get_execution_context( // auto get_const_execution_context( // const wasm_val_t& val ) -> const ecsact_system_execution_context* { + ECSACT_SI_WASM_ZONE_SCOPED; assert(val.kind == WASM_I32); return ecsact::wasm::detail::call_mem_read< const ecsact_system_execution_context*>(val.of.i32); @@ -32,6 +35,7 @@ auto get_const_execution_context( // auto get_execution_context_memory( // const wasm_val_t& val ) -> wasm_memory_t* { + ECSACT_SI_WASM_ZONE_SCOPED; assert(val.kind == WASM_I32); // wasm memory is always allocated right before the execution context return ecsact::wasm::detail::call_mem_read( @@ -42,11 +46,13 @@ auto get_execution_context_memory( // template EcsactID ecsact_id_from_wasm_i32(const wasm_val_t& val) { + ECSACT_SI_WASM_ZONE_SCOPED; assert(val.kind == WASM_I32); return static_cast(val.of.i32); } void* get_void_ptr(const wasm_val_t& val, wasm_memory_t* memory) { + ECSACT_SI_WASM_ZONE_SCOPED; assert(val.kind == WASM_I32); if(val.of.i32 == 0) { return nullptr; @@ -58,6 +64,7 @@ void* get_void_ptr(const wasm_val_t& val, wasm_memory_t* memory) { } const void* get_const_void_ptr(const wasm_val_t& val, wasm_memory_t* memory) { + ECSACT_SI_WASM_ZONE_SCOPED; assert(val.kind == WASM_I32); if(val.of.i32 == 0) { return nullptr; @@ -74,6 +81,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_action( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_action"); auto ctx = get_execution_context(args->data[0]); @@ -91,6 +99,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_add( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_add"); auto ctx = get_execution_context(args->data[0]); @@ -109,6 +118,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_remove( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_remove"); auto ctx = get_execution_context(args->data[0]); @@ -126,6 +136,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_get( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_get"); auto ctx = get_execution_context(args->data[0]); @@ -145,6 +156,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_update( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_update"); auto ctx = get_execution_context(args->data[0]); @@ -164,6 +176,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_has( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_has"); auto ctx = get_execution_context(args->data[0]); @@ -185,6 +198,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_generate( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_generate"); auto ctx = get_execution_context(args->data[0]); @@ -220,6 +234,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_parent( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_parent"); auto ctx = get_execution_context(args->data[0]); @@ -241,6 +256,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_same( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_same"); bool same = ecsact_system_execution_context_same( @@ -258,6 +274,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_other( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_other"); auto ctx = get_execution_context(args->data[0]); @@ -280,6 +297,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_entity( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_entity"); auto entity = ecsact_system_execution_context_entity( // @@ -295,6 +313,7 @@ wasm_trap_t* wasm_ecsact_system_execution_context_stream_toggle( const wasm_val_vec_t* args, wasm_val_vec_t* results ) { + ECSACT_SI_WASM_ZONE_SCOPED; debug_trace_method("ecsact_system_execution_context_stream_toggle"); auto ctx = get_execution_context(args->data[0]); diff --git a/test/.bazelversion b/test/.bazelversion new file mode 100644 index 0000000..815da58 --- /dev/null +++ b/test/.bazelversion @@ -0,0 +1 @@ +7.4.1 diff --git a/test/MODULE.bazel b/test/MODULE.bazel index a4e5766..e302338 100644 --- a/test/MODULE.bazel +++ b/test/MODULE.bazel @@ -1,8 +1,8 @@ module(name = "ecsact_si_wasm_test") -bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_cc", version = "0.0.17") bazel_dep(name = "ecsact_runtime", version = "0.7.0") -bazel_dep(name = "rules_wasmer", version = "0.1.1") +bazel_dep(name = "rules_wasmer", version = "0.1.2") bazel_dep(name = "ecsact_rt_entt", version = "0.3.8") bazel_dep(name = "ecsact_lang_cpp", version = "0.4.9") bazel_dep(name = "ecsact_parse", version = "0.5.4") @@ -13,7 +13,7 @@ bazel_dep(name = "boost.mp11", version = "1.83.0.bzl.1") bazel_dep(name = "boost.dll", version = "1.83.0.bzl.2") bazel_dep(name = "boost.process", version = "1.83.0.bzl.2") bazel_dep(name = "entt", version = "3.12.2") -bazel_dep(name = "ecsact_cli", version = "0.3.4") +bazel_dep(name = "ecsact_cli", version = "0.3.21") bazel_dep(name = "rules_ecsact", version = "0.5.1") bazel_dep(name = "xxhash", version = "0.8.2") bazel_dep(name = "ecsact_si_wasm") From 0b591214739867a860773ab609e1ebf74d34c4a8 Mon Sep 17 00:00:00 2001 From: Ezekiel Date: Sat, 18 Jan 2025 13:36:38 -0800 Subject: [PATCH 2/2] feat: scope more areas --- ecsact/wasm/detail/mem_stack.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ecsact/wasm/detail/mem_stack.cc b/ecsact/wasm/detail/mem_stack.cc index 16a8582..8435f3f 100644 --- a/ecsact/wasm/detail/mem_stack.cc +++ b/ecsact/wasm/detail/mem_stack.cc @@ -11,6 +11,7 @@ #include #include #include +#include "ecsact/wasm/detail/tracy.hh" namespace { struct call_mem_info_t { @@ -47,6 +48,7 @@ auto ecsact::wasm::detail::set_call_mem_data( // void* data, size_t max_size ) -> void { + ECSACT_SI_WASM_ZONE_SCOPED; if(data == nullptr) { call_mem_info = std::nullopt; return; @@ -62,6 +64,7 @@ auto ecsact::wasm::detail::call_mem_alloc_raw( // size_t data_size, const std::type_info& type ) -> std::int32_t { + ECSACT_SI_WASM_ZONE_SCOPED; assert(call_mem_info.has_value()); assert(data_size > 0); auto index = static_cast(call_mem_info->data_offset); @@ -75,6 +78,7 @@ auto ecsact::wasm::detail::call_mem_read_raw( // std::int32_t offset, const std::type_info& type ) -> void* { + ECSACT_SI_WASM_ZONE_SCOPED; assert(call_mem_info.has_value()); assert(offset < call_mem_info->data_offset); ASSERT_OFFSET_TYPE(offset, type); @@ -85,6 +89,7 @@ auto ecsact::wasm::detail::debug_trace_method( // [[maybe_unused]] const char* method_name ) -> void { #ifndef NDEBUG + ECSACT_SI_WASM_ZONE_SCOPED; assert(call_mem_info.has_value()); call_mem_info->method_trace.push_back(std::string_view{method_name}); #endif