Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions src/asmjs/shared-constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ IString MAX("max");
IString F64_REM("f64-rem");
IString F64_TO_INT("f64-to-int");
IString F64_TO_UINT("f64-to-uint");
IString F64_TO_INT64("f64-to-int64");
IString F64_TO_UINT64("f64-to-uint64");
IString F32_TO_INT("f32-to-int");
IString F32_TO_UINT("f32-to-uint");
IString F32_TO_INT64("f32-to-int64");
IString F32_TO_UINT64("f32-to-uint64");
IString I32S_DIV("i32s-div");
IString I32U_DIV("i32u-div");
IString I32S_REM("i32s-rem");
Expand Down Expand Up @@ -72,27 +68,10 @@ IString MATH_TRUNC("Math_trunc");
IString MATH_SQRT("Math_sqrt");
IString MATH_MIN("Math_min");
IString MATH_MAX("Math_max");
IString WASM_CTZ32("__wasm_ctz_i32");
IString WASM_CTZ64("__wasm_ctz_i64");
IString WASM_CLZ32("__wasm_clz_i32");
IString WASM_CLZ64("__wasm_clz_i64");
IString WASM_POPCNT32("__wasm_popcnt_i32");
IString WASM_POPCNT64("__wasm_popcnt_i64");
IString WASM_ROTL32("__wasm_rotl_i32");
IString WASM_ROTL64("__wasm_rotl_i64");
IString WASM_ROTR32("__wasm_rotr_i32");
IString WASM_ROTR64("__wasm_rotr_i64");
IString WASM_MEMORY_GROW("__wasm_memory_grow");
IString WASM_MEMORY_SIZE("__wasm_memory_size");
IString WASM_FETCH_HIGH_BITS("__wasm_fetch_high_bits");
IString INT64_TO_32_HIGH_BITS("i64toi32_i32$HIGH_BITS");
IString WASM_NEAREST_F32("__wasm_nearest_f32");
IString WASM_NEAREST_F64("__wasm_nearest_f64");
IString WASM_I64_MUL("__wasm_i64_mul");
IString WASM_I64_SDIV("__wasm_i64_sdiv");
IString WASM_I64_UDIV("__wasm_i64_udiv");
IString WASM_I64_SREM("__wasm_i64_srem");
IString WASM_I64_UREM("__wasm_i64_urem");

IString ASM_FUNC("asmFunc");
IString FUNCTION_TABLE("FUNCTION_TABLE");
Expand Down
21 changes: 0 additions & 21 deletions src/asmjs/shared-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,8 @@ extern IString MAX;
extern IString F64_REM;
extern IString F64_TO_INT;
extern IString F64_TO_UINT;
extern IString F64_TO_INT64;
extern IString F64_TO_UINT64;
extern IString F32_TO_INT;
extern IString F32_TO_UINT;
extern IString F32_TO_INT64;
extern IString F32_TO_UINT64;
extern IString I32S_DIV;
extern IString I32U_DIV;
extern IString I32S_REM;
Expand Down Expand Up @@ -75,27 +71,10 @@ extern IString MATH_TRUNC;
extern IString MATH_SQRT;
extern IString MATH_MIN;
extern IString MATH_MAX;
extern IString WASM_CTZ32;
extern IString WASM_CTZ64;
extern IString WASM_CLZ32;
extern IString WASM_CLZ64;
extern IString WASM_POPCNT32;
extern IString WASM_POPCNT64;
extern IString WASM_ROTL32;
extern IString WASM_ROTL64;
extern IString WASM_ROTR32;
extern IString WASM_ROTR64;
extern IString WASM_MEMORY_GROW;
extern IString WASM_MEMORY_SIZE;
extern IString WASM_FETCH_HIGH_BITS;
extern IString INT64_TO_32_HIGH_BITS;
extern IString WASM_NEAREST_F32;
extern IString WASM_NEAREST_F64;
extern IString WASM_I64_MUL;
extern IString WASM_I64_SDIV;
extern IString WASM_I64_UDIV;
extern IString WASM_I64_SREM;
extern IString WASM_I64_UREM;
// wasm2js constants
extern IString ASM_FUNC;
extern IString FUNCTION_TABLE;
Expand Down
30 changes: 15 additions & 15 deletions src/passes/Asyncify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,21 +363,21 @@ namespace wasm {

namespace {

static const Name ASYNCIFY_STATE = "__asyncify_state";
static const Name ASYNCIFY_GET_STATE = "asyncify_get_state";
static const Name ASYNCIFY_DATA = "__asyncify_data";
static const Name ASYNCIFY_START_UNWIND = "asyncify_start_unwind";
static const Name ASYNCIFY_STOP_UNWIND = "asyncify_stop_unwind";
static const Name ASYNCIFY_START_REWIND = "asyncify_start_rewind";
static const Name ASYNCIFY_STOP_REWIND = "asyncify_stop_rewind";
static const Name ASYNCIFY_UNWIND = "__asyncify_unwind";
static const Name ASYNCIFY = "asyncify";
static const Name START_UNWIND = "start_unwind";
static const Name STOP_UNWIND = "stop_unwind";
static const Name START_REWIND = "start_rewind";
static const Name STOP_REWIND = "stop_rewind";
static const Name ASYNCIFY_GET_CALL_INDEX = "__asyncify_get_call_index";
static const Name ASYNCIFY_CHECK_CALL_INDEX = "__asyncify_check_call_index";
static const Name ASYNCIFY_STATE("__asyncify_state");
static const Name ASYNCIFY_GET_STATE("asyncify_get_state");
static const Name ASYNCIFY_DATA("__asyncify_data");
static const Name ASYNCIFY_START_UNWIND("asyncify_start_unwind");
static const Name ASYNCIFY_STOP_UNWIND("asyncify_stop_unwind");
static const Name ASYNCIFY_START_REWIND("asyncify_start_rewind");
static const Name ASYNCIFY_STOP_REWIND("asyncify_stop_rewind");
static const Name ASYNCIFY_UNWIND("__asyncify_unwind");
static const Name ASYNCIFY("asyncify");
static const Name START_UNWIND("start_unwind");
static const Name STOP_UNWIND("stop_unwind");
static const Name START_REWIND("start_rewind");
static const Name STOP_REWIND("stop_rewind");
static const Name ASYNCIFY_GET_CALL_INDEX("__asyncify_get_call_index");
static const Name ASYNCIFY_CHECK_CALL_INDEX("__asyncify_check_call_index");

// TODO: having just normal/unwind_or_rewind would decrease code
// size, but make debugging harder
Expand Down
4 changes: 2 additions & 2 deletions src/passes/InstrumentBranchHints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ namespace wasm {
namespace {

// The module and base names of our import.
const Name MODULE = "fuzzing-support";
const Name BASE = "log-branch";
static const Name MODULE("fuzzing-support");
static const Name BASE("log-branch");

// Finds our import, if it exists.
Name getLogBranchImport(Module* module) {
Expand Down
30 changes: 15 additions & 15 deletions src/passes/InstrumentLocals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@

namespace wasm {

Name get_i32("get_i32");
Name get_i64("get_i64");
Name get_f32("get_f32");
Name get_f64("get_f64");
Name get_v128("get_v128");
Name get_funcref("get_funcref");
Name get_externref("get_externref");

Name set_i32("set_i32");
Name set_i64("set_i64");
Name set_f32("set_f32");
Name set_f64("set_f64");
Name set_v128("set_v128");
Name set_funcref("set_funcref");
Name set_externref("set_externref");
static const Name get_i32("get_i32");
static const Name get_i64("get_i64");
static const Name get_f32("get_f32");
static const Name get_f64("get_f64");
static const Name get_v128("get_v128");
static const Name get_funcref("get_funcref");
static const Name get_externref("get_externref");

static const Name set_i32("set_i32");
static const Name set_i64("set_i64");
static const Name set_f32("set_f32");
static const Name set_f64("set_f64");
static const Name set_v128("set_v128");
static const Name set_funcref("set_funcref");
static const Name set_externref("set_externref");

struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
// Adds calls to new imports.
Expand Down
60 changes: 30 additions & 30 deletions src/passes/InstrumentMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,36 +66,36 @@

namespace wasm {

static Name load_ptr("load_ptr");
static Name load_val_i32("load_val_i32");
static Name load_val_i64("load_val_i64");
static Name load_val_f32("load_val_f32");
static Name load_val_f64("load_val_f64");
static Name store_ptr("store_ptr");
static Name store_val_i32("store_val_i32");
static Name store_val_i64("store_val_i64");
static Name store_val_f32("store_val_f32");
static Name store_val_f64("store_val_f64");
static Name struct_get_val_i32("struct_get_val_i32");
static Name struct_get_val_i64("struct_get_val_i64");
static Name struct_get_val_f32("struct_get_val_f32");
static Name struct_get_val_f64("struct_get_val_f64");
static Name struct_set_val_i32("struct_set_val_i32");
static Name struct_set_val_i64("struct_set_val_i64");
static Name struct_set_val_f32("struct_set_val_f32");
static Name struct_set_val_f64("struct_set_val_f64");
static Name array_get_val_i32("array_get_val_i32");
static Name array_get_val_i64("array_get_val_i64");
static Name array_get_val_f32("array_get_val_f32");
static Name array_get_val_f64("array_get_val_f64");
static Name array_set_val_i32("array_set_val_i32");
static Name array_set_val_i64("array_set_val_i64");
static Name array_set_val_f32("array_set_val_f32");
static Name array_set_val_f64("array_set_val_f64");
static Name array_get_index("array_get_index");
static Name array_set_index("array_set_index");
static Name memory_grow_pre("memory_grow_pre");
static Name memory_grow_post("memory_grow_post");
static const Name load_ptr("load_ptr");
static const Name load_val_i32("load_val_i32");
static const Name load_val_i64("load_val_i64");
static const Name load_val_f32("load_val_f32");
static const Name load_val_f64("load_val_f64");
static const Name store_ptr("store_ptr");
static const Name store_val_i32("store_val_i32");
static const Name store_val_i64("store_val_i64");
static const Name store_val_f32("store_val_f32");
static const Name store_val_f64("store_val_f64");
static const Name struct_get_val_i32("struct_get_val_i32");
static const Name struct_get_val_i64("struct_get_val_i64");
static const Name struct_get_val_f32("struct_get_val_f32");
static const Name struct_get_val_f64("struct_get_val_f64");
static const Name struct_set_val_i32("struct_set_val_i32");
static const Name struct_set_val_i64("struct_set_val_i64");
static const Name struct_set_val_f32("struct_set_val_f32");
static const Name struct_set_val_f64("struct_set_val_f64");
static const Name array_get_val_i32("array_get_val_i32");
static const Name array_get_val_i64("array_get_val_i64");
static const Name array_get_val_f32("array_get_val_f32");
static const Name array_get_val_f64("array_get_val_f64");
static const Name array_set_val_i32("array_set_val_i32");
static const Name array_set_val_i64("array_set_val_i64");
static const Name array_set_val_f32("array_set_val_f32");
static const Name array_set_val_f64("array_set_val_f64");
static const Name array_get_index("array_get_index");
static const Name array_set_index("array_set_index");
static const Name memory_grow_pre("memory_grow_pre");
static const Name memory_grow_post("memory_grow_post");

// TODO: Add support for atomicRMW/cmpxchg

Expand Down
8 changes: 4 additions & 4 deletions src/passes/LegalizeJSInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ namespace {

// These are aliases for getTempRet0/setTempRet0 which emscripten defines in
// compiler-rt and exports under these names.
static Name GET_TEMP_RET_EXPORT("__get_temp_ret");
static Name SET_TEMP_RET_EXPORT("__set_temp_ret");
static const Name GET_TEMP_RET_EXPORT("__get_temp_ret");
static const Name SET_TEMP_RET_EXPORT("__set_temp_ret");

// For non-emscripten module we expect the host to define these functions so
// and we import them under these names.
static Name GET_TEMP_RET_IMPORT("getTempRet0");
static Name SET_TEMP_RET_IMPORT("setTempRet0");
static const Name GET_TEMP_RET_IMPORT("getTempRet0");
static const Name SET_TEMP_RET_IMPORT("setTempRet0");

struct LegalizeJSInterface : public Pass {
// Adds calls to new imports.
Expand Down
2 changes: 1 addition & 1 deletion src/passes/LogExecution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

namespace wasm {

Name LOGGER("log_execution");
static const Name LOGGER("log_execution");

struct LogExecution : public WalkerPass<PostWalker<LogExecution>> {
// The module name the logger function is imported from.
Expand Down
16 changes: 16 additions & 0 deletions src/passes/RemoveNonJSOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@

namespace wasm {

static const Name WASM_CTZ32("__wasm_ctz_i32");
static const Name WASM_CTZ64("__wasm_ctz_i64");
static const Name WASM_POPCNT32("__wasm_popcnt_i32");
static const Name WASM_POPCNT64("__wasm_popcnt_i64");
static const Name WASM_ROTL32("__wasm_rotl_i32");
static const Name WASM_ROTL64("__wasm_rotl_i64");
static const Name WASM_ROTR32("__wasm_rotr_i32");
static const Name WASM_ROTR64("__wasm_rotr_i64");
static const Name WASM_NEAREST_F32("__wasm_nearest_f32");
static const Name WASM_NEAREST_F64("__wasm_nearest_f64");
static const Name WASM_I64_MUL("__wasm_i64_mul");
static const Name WASM_I64_SDIV("__wasm_i64_sdiv");
static const Name WASM_I64_UDIV("__wasm_i64_udiv");
static const Name WASM_I64_SREM("__wasm_i64_srem");
static const Name WASM_I64_UREM("__wasm_i64_urem");

struct RemoveNonJSOpsPass : public WalkerPass<PostWalker<RemoveNonJSOpsPass>> {
std::unique_ptr<Builder> builder;
std::unordered_set<Name> neededIntrinsics;
Expand Down
12 changes: 8 additions & 4 deletions src/passes/TrapMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@

namespace wasm {

Name I64S_REM("i64s-rem");
Name I64U_REM("i64u-rem");
Name I64S_DIV("i64s-div");
Name I64U_DIV("i64u-div");
static const Name I64S_REM("i64s-rem");
static const Name I64U_REM("i64u-rem");
static const Name I64S_DIV("i64s-div");
static const Name I64U_DIV("i64u-div");
static const Name F64_TO_INT64("f64-to-int64");
static const Name F64_TO_UINT64("f64-to-uint64");
static const Name F32_TO_INT64("f32-to-int64");
static const Name F32_TO_UINT64("f32-to-uint64");

static Expression* ensureDouble(Expression* expr, MixedArena& allocator) {
if (expr->type == Type::f32) {
Expand Down
8 changes: 0 additions & 8 deletions src/shared-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

namespace wasm {

extern Name STACK_POINTER;
extern Name MODULE;
extern Name START;
extern Name FUNC;
Expand All @@ -41,20 +40,13 @@ extern Name TYPE;
extern Name REF;
extern Name NULL_;
extern Name CALL;
extern Name CALL_IMPORT;
extern Name CALL_INDIRECT;
extern Name BLOCK;
extern Name BR_IF;
extern Name THEN;
extern Name ELSE;
extern Name _NAN;
extern Name _INFINITY;
extern Name NEG_INFINITY;
extern Name NEG_NAN;
extern Name CASE;
extern Name BR;
extern Name FUNCREF;
extern Name FAKE_RETURN;
extern Name DELEGATE_CALLER_TARGET;
extern Name MUT;
extern Name SPECTEST;
Expand Down
2 changes: 2 additions & 0 deletions src/wasm/wasm-emscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

namespace wasm {

static const Name STACK_POINTER("__stack_pointer");

void addExportedFunction(Module& wasm, Function* function) {
wasm.addFunction(function);
wasm.addExport(
Expand Down
7 changes: 0 additions & 7 deletions src/wasm/wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ const Name ToolchainInlineHint = "binaryen.inline";

} // namespace Annotations

Name STACK_POINTER("__stack_pointer");
Name MODULE("module");
Name START("start");
Name GLOBAL("global");
Expand All @@ -120,17 +119,11 @@ Name NULL_("null");
Name CALL("call");
Name CALL_INDIRECT("call_indirect");
Name BLOCK("block");
Name BR_IF("br_if");
Name THEN("then");
Name ELSE("else");
Name _NAN("NaN");
Name _INFINITY("Infinity");
Name NEG_INFINITY("-infinity");
Name NEG_NAN("-nan");
Name CASE("case");
Name BR("br");
Name FUNCREF("funcref");
Name FAKE_RETURN("__binaryen_fake_return");
Name DELEGATE_CALLER_TARGET("__binaryen_delegate_caller_target");
Name MUT("mut");
Name SPECTEST("spectest");
Expand Down
Loading