summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2018-12-11 15:28:23 -0800
committerAlon Zakai <alonzakai@gmail.com>2018-12-11 16:35:55 -0800
commit60b57973318faca7b5f42a25323209763980283c (patch)
tree44569acf7a38ebd0f08d65c9a699cfa5765dd0b5 /src/tools
parent8e19c94cf6c1d7609eaede0a30121bfbdc7efecc (diff)
downloadbinaryen-60b57973318faca7b5f42a25323209763980283c.tar.gz
binaryen-60b57973318faca7b5f42a25323209763980283c.tar.bz2
binaryen-60b57973318faca7b5f42a25323209763980283c.zip
constant refactoring for STACKTOP and STACK_MAX
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/wasm-ctor-eval.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp
index 38be8b7b4..53f33944e 100644
--- a/src/tools/wasm-ctor-eval.cpp
+++ b/src/tools/wasm-ctor-eval.cpp
@@ -131,9 +131,9 @@ public:
if (auto* get = global->init->dynCast<GetGlobal>()) {
auto name = get->name;
auto* import = wasm.getGlobal(name);
- if (import->module == Name("env") && (
- import->base == Name("STACKTOP") || // stack constants are special, we handle them
- import->base == Name("STACK_MAX")
+ if (import->module == Name(ENV) && (
+ import->base == STACKTOP || // stack constants are special, we handle them
+ import->base == STACK_MAX
)) {
return; // this is fine
}
@@ -175,15 +175,15 @@ struct CtorEvalExternalInterface : EvallingModuleInstance::ExternalInterface {
void importGlobals(EvallingGlobalManager& globals, Module& wasm_) override {
// fill usable values for stack imports, and globals initialized to them
ImportInfo imports(wasm_);
- if (auto* stackTop = imports.getImportedGlobal("env", "STACKTOP")) {
+ if (auto* stackTop = imports.getImportedGlobal(ENV, STACKTOP)) {
globals[stackTop->name] = Literal(int32_t(STACK_START));
- if (auto* stackTop = GlobalUtils::getGlobalInitializedToImport(wasm_, "env", "STACKTOP")) {
+ if (auto* stackTop = GlobalUtils::getGlobalInitializedToImport(wasm_, ENV, STACKTOP)) {
globals[stackTop->name] = Literal(int32_t(STACK_START));
}
}
- if (auto* stackMax = imports.getImportedGlobal("env", "STACK_MAX")) {
+ if (auto* stackMax = imports.getImportedGlobal(ENV, STACK_MAX)) {
globals[stackMax->name] = Literal(int32_t(STACK_START));
- if (auto* stackMax = GlobalUtils::getGlobalInitializedToImport(wasm_, "env", "STACK_MAX")) {
+ if (auto* stackMax = GlobalUtils::getGlobalInitializedToImport(wasm_, ENV, STACK_MAX)) {
globals[stackMax->name] = Literal(int32_t(STACK_START));
}
}
@@ -202,7 +202,7 @@ struct CtorEvalExternalInterface : EvallingModuleInstance::ExternalInterface {
Literal callImport(Function* import, LiteralList& arguments) override {
std::string extra;
- if (import->module == "env" && import->base == "___cxa_atexit") {
+ if (import->module == ENV && import->base == "___cxa_atexit") {
extra = "\nrecommendation: build with -s NO_EXIT_RUNTIME=1 so that calls to atexit are not emitted";
}
throw FailToEvalException(std::string("call import: ") + import->module.str + "." + import->base.str + extra);