forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: migrate wee8 to genrule_repository. (#45)
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
- Loading branch information
1 parent
3b41f40
commit 96c49d5
Showing
11 changed files
with
141 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
licenses(["notice"]) # Apache 2 | ||
|
||
load(":genrule_cmd.bzl", "genrule_cmd") | ||
|
||
cc_library( | ||
name = "wee8", | ||
srcs = select({ | ||
"@envoy//bazel:windows_x86_64": ["WINDOWS_IS_NOT_SUPPORTED_YET"], | ||
"//conditions:default": [ | ||
"libwee8.a", | ||
], | ||
}), | ||
hdrs = [ | ||
"wee8/third_party/wasm-api/wasm.hh", | ||
], | ||
includes = ["wee8/third_party"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
genrule( | ||
name = "build", | ||
srcs = glob(["wee8/**"]), | ||
outs = [ | ||
"libwee8.a", | ||
], | ||
cmd = genrule_cmd("@envoy//bazel/external:wee8.genrule_cmd"), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# This works only on Linux-x86_64 and macOS-x86_64. | ||
if [[ ( `uname` != "Linux" && `uname` != "Darwin" ) || `uname -m` != "x86_64" ]]; then | ||
echo "ERROR: wee8 is currently supported only on Linux-x86_64 and macOS-x86_64." | ||
exit 1 | ||
fi | ||
|
||
# Bazel magic. | ||
ROOT=$$(dirname $(rootpath wee8/BUILD.gn))/.. | ||
pushd $$ROOT/wee8 | ||
|
||
# Clean after previous build. | ||
rm -rf out/wee8 | ||
|
||
# Build wee8. | ||
third_party/depot_tools/gn gen out/wee8 --args="v8_use_external_startup_data=false v8_enable_i18n_support=false v8_enable_gdbjit=false v8_expose_symbols=true is_component_build=false is_debug=false use_sysroot=false use_custom_libcxx=false" | ||
third_party/depot_tools/ninja -C out/wee8 wee8 | ||
|
||
# Move compiled library to the expected destinations. | ||
popd | ||
mv $$ROOT/wee8/out/wee8/obj/libwee8.a $(execpath libwee8.a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# 1. Fix handling of f64 globals. | ||
# 2. Force full GC when destroying VMs. | ||
# 3. Fix build with -DDEBUG. | ||
--- a/wee8/src/wasm/c-api.cc | ||
+++ b/wee8/src/wasm/c-api.cc | ||
@@ -825,7 +825,7 @@ void global_set_f32(v8::Local<v8::Object> global, float val) { | ||
void global_set_f64(v8::Local<v8::Object> global, double val) { | ||
auto v8_object = v8::Utils::OpenHandle<v8::Object, i::JSReceiver>(global); | ||
auto v8_global = i::Handle<i::WasmGlobalObject>::cast(v8_object); | ||
- v8_global->SetF32(val); | ||
+ v8_global->SetF64(val); | ||
} | ||
|
||
// Tables | ||
@@ -1107,7 +1107,7 @@ class StoreImpl { | ||
StoreImpl() {} | ||
|
||
~StoreImpl() { | ||
-#ifdef DEBUG | ||
+#if 1 | ||
reinterpret_cast<i::Isolate*>(isolate_)->heap()->PreciseCollectAllGarbage( | ||
i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting, | ||
v8::kGCCallbackFlagForced); | ||
--- a/wee8/third_party/wasm-api/wasm.hh | ||
+++ b/wee8/third_party/wasm-api/wasm.hh | ||
@@ -111,7 +111,7 @@ class vec { | ||
size_t size_; | ||
std::unique_ptr<T[]> data_; | ||
|
||
-#ifdef DEBUG | ||
+#if 0 | ||
void make_data(); | ||
void free_data(); | ||
#else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters