Skip to content

Commit

Permalink
Rename kSymbolPrefix to kGlobalSymbolPrefix. Delete out-of-date comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhdengh committed Mar 15, 2023
1 parent 2838078 commit ce882d6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/c-writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ static constexpr char kParamSuffix =
'a' + static_cast<char>(ModuleFieldType::Tag) + 1;
static constexpr char kLabelSuffix = kParamSuffix + 1;

static constexpr char kSymbolPrefix[] = "w2c_";
static constexpr char kGlobalSymbolPrefix[] = "w2c_";
static constexpr char kLocalSymbolPrefix[] = "var_";
static constexpr char kAdminSymbolPrefix[] = "wasm2c_";

Expand Down Expand Up @@ -568,26 +568,26 @@ std::string CWriter::MangleTagTypes(const TypeVector& types) {

/* The C symbol for an export from this module. */
std::string CWriter::ExportName(std::string_view export_name) {
return kSymbolPrefix + module_prefix_ + '_' + MangleName(export_name);
return kGlobalSymbolPrefix + module_prefix_ + '_' + MangleName(export_name);
}

/* The C symbol for an export from an arbitrary module. */
// static
std::string CWriter::ExportName(std::string_view module_name,
std::string_view export_name) {
return kSymbolPrefix + MangleModuleName(module_name) + '_' +
return kGlobalSymbolPrefix + MangleModuleName(module_name) + '_' +
MangleName(export_name);
}

/* The type name of an instance of this module. */
std::string CWriter::ModuleInstanceTypeName() const {
return kSymbolPrefix + module_prefix_;
return kGlobalSymbolPrefix + module_prefix_;
}

/* The type name of an instance of an arbitrary module. */
// static
std::string CWriter::ModuleInstanceTypeName(std::string_view module_name) {
return kSymbolPrefix + MangleModuleName(module_name);
return kGlobalSymbolPrefix + MangleModuleName(module_name);
}

/*
Expand Down Expand Up @@ -862,8 +862,9 @@ std::string CWriter::DefineStackVarName(Index index,
*/
std::string CWriter::DefineInstanceMemberName(ModuleFieldType type,
std::string_view name) {
return ClaimUniqueName(global_syms_, global_sym_map_, MangleField(type), name,
kSymbolPrefix + MangleName(StripLeadingDollar(name)));
return ClaimUniqueName(
global_syms_, global_sym_map_, MangleField(type), name,
kGlobalSymbolPrefix + MangleName(StripLeadingDollar(name)));
}

/*
Expand Down Expand Up @@ -2360,7 +2361,6 @@ void CWriter::PushFuncSection(std::string_view include_condition) {

void CWriter::Write(const Func& func) {
func_ = &func;
// Copy symbols from global symbol table so we don't shadow them.
local_syms_.clear();
local_sym_map_.clear();
stack_var_sym_map_.clear();
Expand Down

0 comments on commit ce882d6

Please sign in to comment.