diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 93eabfe1..7a13a16e 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -52,14 +52,6 @@ def proxy_wasm_cpp_host_repositories(): url = "https://github.com/WebAssembly/wasm-c-api/archive/d9a80099d496b5cdba6f3fe8fc77586e0e505ddc.tar.gz", ) - http_archive( - name = "com_google_absl", - sha256 = "19391fb4882601a65cb648d638c11aa301ce5f525ef02da1a9eafd22f72d7c59", - strip_prefix = "abseil-cpp-37dd2562ec830d547a1524bb306be313ac3f2556", - # 2020-01-29 - urls = ["https://github.com/abseil/abseil-cpp/archive/37dd2562ec830d547a1524bb306be313ac3f2556.tar.gz"], - ) - http_archive( name = "io_bazel_rules_rust", sha256 = "442a102e2a6f6c75e10d43f21c0c30218947a3e827d91529ced7380c5fec05f0", diff --git a/src/v8/v8.cc b/src/v8/v8.cc index 9078999c..c43bfb77 100644 --- a/src/v8/v8.cc +++ b/src/v8/v8.cc @@ -20,15 +20,13 @@ #include #include #include +#include #include #include #include "v8-version.h" #include "wasm-api/wasm.hh" -// TODO remove absl dependency -#include "absl/container/flat_hash_map.h" - namespace proxy_wasm { namespace { @@ -114,10 +112,10 @@ class V8 : public WasmVm { wasm::own memory_; wasm::own table_; - absl::flat_hash_map host_functions_; - absl::flat_hash_map> module_functions_; + std::unordered_map host_functions_; + std::unordered_map> module_functions_; - absl::flat_hash_map function_names_index_; + std::unordered_map function_names_index_; }; // Helper functions. @@ -235,17 +233,17 @@ template <> constexpr auto convertArgToValKind() { return wasm::I64; } template <> constexpr auto convertArgToValKind() { return wasm::F64; }; template -constexpr auto convertArgsTupleToValTypesImpl(absl::index_sequence) { +constexpr auto convertArgsTupleToValTypesImpl(std::index_sequence) { return wasm::ownvec::make( wasm::ValType::make(convertArgToValKind::type>())...); } template constexpr auto convertArgsTupleToValTypes() { - return convertArgsTupleToValTypesImpl(absl::make_index_sequence::value>()); + return convertArgsTupleToValTypesImpl(std::make_index_sequence::value>()); } template -constexpr T convertValTypesToArgsTupleImpl(const U &arr, absl::index_sequence) { +constexpr T convertValTypesToArgsTupleImpl(const U &arr, std::index_sequence) { return std::make_tuple( (arr[I] .template get< @@ -254,7 +252,7 @@ constexpr T convertValTypesToArgsTupleImpl(const U &arr, absl::index_sequence constexpr T convertValTypesToArgsTuple(const U &arr) { return convertValTypesToArgsTupleImpl(arr, - absl::make_index_sequence::value>()); + std::make_index_sequence::value>()); } // V8 implementation. @@ -568,7 +566,7 @@ bool V8::link(std::string_view debug_name) { case wasm::EXTERN_FUNC: { assert(export_item->func() != nullptr); - module_functions_.insert_or_assign(name, export_item->func()->copy()); + module_functions_.insert_or_assign(std::string(name), export_item->func()->copy()); } break; case wasm::EXTERN_GLOBAL: { @@ -648,7 +646,7 @@ void V8::registerHostFunctionImpl(std::string_view module_name, std::string_view auto args_tuple = convertValTypesToArgsTuple>(params); auto args = std::tuple_cat(std::make_tuple(current_context_), args_tuple); auto function = reinterpret_cast(func_data->raw_func_); - absl::apply(function, args); + std::apply(function, args); if (func_data->vm_->cmpLogLevel(LogLevel::trace)) { func_data->vm_->integration()->trace("[vm<-host] " + func_data->name_ + " return: void"); } @@ -681,7 +679,7 @@ void V8::registerHostFunctionImpl(std::string_view module_name, std::string_view auto args_tuple = convertValTypesToArgsTuple>(params); auto args = std::tuple_cat(std::make_tuple(current_context_), args_tuple); auto function = reinterpret_cast(func_data->raw_func_); - R rvalue = absl::apply(function, args); + R rvalue = std::apply(function, args); results[0] = makeVal(rvalue); if (func_data->vm_->cmpLogLevel(LogLevel::trace)) { func_data->vm_->integration()->trace("[vm<-host] " + func_data->name_ +