mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
script_opt: Use Func::GetName()
This commit is contained in:
parent
89127722ea
commit
71e9c8d436
16 changed files with 49 additions and 48 deletions
|
@ -19,7 +19,7 @@ void CPPCompile::DeclareFunc(const FuncInfo& func) {
|
||||||
CreateFunction(f->GetType(), pf, fname, body, priority, nullptr, f->Flavor());
|
CreateFunction(f->GetType(), pf, fname, body, priority, nullptr, f->Flavor());
|
||||||
|
|
||||||
if ( f->GetBodies().size() == 1 )
|
if ( f->GetBodies().size() == 1 )
|
||||||
compiled_simple_funcs[f->Name()] = fname;
|
compiled_simple_funcs[f->GetName()] = fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPCompile::DeclareLambda(const LambdaExpr* l, const ProfileFunc* pf) {
|
void CPPCompile::DeclareLambda(const LambdaExpr* l, const ProfileFunc* pf) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ void CPPCompile::Compile(bool report_uncompilable) {
|
||||||
if ( ! allow_cond && ! func.ShouldSkip() && ! ofiles.empty() && files_with_conditionals.count(fn) > 0 ) {
|
if ( ! allow_cond && ! func.ShouldSkip() && ! ofiles.empty() && files_with_conditionals.count(fn) > 0 ) {
|
||||||
if ( report_uncompilable )
|
if ( report_uncompilable )
|
||||||
reporter->Warning("%s cannot be compiled to C++ due to source file %s having conditional code",
|
reporter->Warning("%s cannot be compiled to C++ due to source file %s having conditional code",
|
||||||
f->Name(), fn.c_str());
|
f->GetName().c_str(), fn.c_str());
|
||||||
|
|
||||||
else if ( filenames_reported_as_skipped.count(fn) == 0 ) {
|
else if ( filenames_reported_as_skipped.count(fn) == 0 ) {
|
||||||
reporter->Warning("skipping compilation of files in %s due to presence of conditional code",
|
reporter->Warning("skipping compilation of files in %s due to presence of conditional code",
|
||||||
|
@ -60,7 +60,7 @@ void CPPCompile::Compile(bool report_uncompilable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( func.ShouldSkip() ) {
|
if ( func.ShouldSkip() ) {
|
||||||
not_fully_compilable.insert(f->Name());
|
not_fully_compilable.insert(f->GetName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,10 +79,10 @@ void CPPCompile::Compile(bool report_uncompilable) {
|
||||||
else {
|
else {
|
||||||
if ( reason && report_uncompilable ) {
|
if ( reason && report_uncompilable ) {
|
||||||
had_to_skip = true;
|
had_to_skip = true;
|
||||||
reporter->Warning("%s cannot be compiled to C++ due to %s", f->Name(), reason);
|
reporter->Warning("%s cannot be compiled to C++ due to %s", f->GetName().c_str(), reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
not_fully_compilable.insert(f->Name());
|
not_fully_compilable.insert(f->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ void CPPCompile::DeclareLocals(const ProfileFunc* pf, const IDPList* lambda_ids)
|
||||||
string CPPCompile::BodyName(const FuncInfo& func) {
|
string CPPCompile::BodyName(const FuncInfo& func) {
|
||||||
const auto& f = func.Func();
|
const auto& f = func.Func();
|
||||||
const auto& body = func.Body();
|
const auto& body = func.Body();
|
||||||
string fname = f->Name();
|
auto fname = f->GetName();
|
||||||
|
|
||||||
// Extend name with location information.
|
// Extend name with location information.
|
||||||
auto loc = body->GetLocationInfo();
|
auto loc = body->GetLocationInfo();
|
||||||
|
|
|
@ -282,15 +282,15 @@ void CPPCompile::GenStandaloneActivation() {
|
||||||
hashes = "{" + hashes + "}";
|
hashes = "{" + hashes + "}";
|
||||||
|
|
||||||
auto f = fb.first;
|
auto f = fb.first;
|
||||||
auto fn = f->Name();
|
const auto& fn = f->GetName();
|
||||||
const auto& ft = f->GetType();
|
const auto& ft = f->GetType();
|
||||||
|
|
||||||
auto var = extract_var_name(fn);
|
auto var = extract_var_name(fn.c_str());
|
||||||
auto mod = extract_module_name(fn);
|
auto mod = extract_module_name(fn.c_str());
|
||||||
|
|
||||||
auto fid = lookup_ID(var.c_str(), mod.c_str(), false, true, false);
|
auto fid = lookup_ID(var.c_str(), mod.c_str(), false, true, false);
|
||||||
if ( ! fid )
|
if ( ! fid )
|
||||||
reporter->InternalError("can't find identifier %s", fn);
|
reporter->InternalError("can't find identifier %s", fn.c_str());
|
||||||
|
|
||||||
auto exported = fid->IsExport() ? "true" : "false";
|
auto exported = fid->IsExport() ? "true" : "false";
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@ FuncConstInfo::FuncConstInfo(CPPCompile* _c, ValPtr v) : CompoundItemInfo(_c, v)
|
||||||
|
|
||||||
void FuncConstInfo::InitializerVals(std::vector<std::string>& ivs) const {
|
void FuncConstInfo::InitializerVals(std::vector<std::string>& ivs) const {
|
||||||
auto f = fv->AsFunc();
|
auto f = fv->AsFunc();
|
||||||
const auto& fn = f->Name();
|
const auto& fn = f->GetName();
|
||||||
const auto& bodies = f->GetBodies();
|
const auto& bodies = f->GetBodies();
|
||||||
|
|
||||||
ivs.emplace_back(Fmt(type));
|
ivs.emplace_back(Fmt(type));
|
||||||
|
|
|
@ -32,12 +32,12 @@ void Inliner::Analyze() {
|
||||||
//
|
//
|
||||||
// We deal with cases where these defaults are overridden to refer
|
// We deal with cases where these defaults are overridden to refer
|
||||||
// to some other function below, when we go through indirect functions.
|
// to some other function below, when we go through indirect functions.
|
||||||
if ( is_special_script_func(f.Func()->Name()) )
|
if ( is_special_script_func(f.Func()->GetName()) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If ZAM can replace the script, don't inline it, so its usage
|
// If ZAM can replace the script, don't inline it, so its usage
|
||||||
// remains visible during the AST reduction process.
|
// remains visible during the AST reduction process.
|
||||||
if ( is_ZAM_replaceable_script_func(f.Func()->Name()) )
|
if ( is_ZAM_replaceable_script_func(f.Func()->GetName()) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::unordered_set<const Func*> cs;
|
std::unordered_set<const Func*> cs;
|
||||||
|
@ -50,7 +50,7 @@ void Inliner::Analyze() {
|
||||||
|
|
||||||
if ( func == f.Func() ) {
|
if ( func == f.Func() ) {
|
||||||
if ( report_recursive )
|
if ( report_recursive )
|
||||||
printf("%s is directly recursive\n", func->Name());
|
printf("%s is directly recursive\n", func->GetName().c_str());
|
||||||
|
|
||||||
non_recursive_funcs.erase(func);
|
non_recursive_funcs.erase(func);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ void Inliner::Analyze() {
|
||||||
// for cutting down noise from the following recursion report.
|
// for cutting down noise from the following recursion report.
|
||||||
|
|
||||||
if ( report_recursive )
|
if ( report_recursive )
|
||||||
printf("%s is used indirectly, and thus potentially recursively\n", sf->Name());
|
printf("%s is used indirectly, and thus potentially recursively\n", sf->GetName().c_str());
|
||||||
|
|
||||||
non_recursive_funcs.erase(sf);
|
non_recursive_funcs.erase(sf);
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,8 @@ void Inliner::Analyze() {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( report_recursive )
|
if ( report_recursive )
|
||||||
printf("%s is indirectly recursive, called by %s\n", c.first->Name(), cc->Name());
|
printf("%s is indirectly recursive, called by %s\n", c.first->GetName().c_str(),
|
||||||
|
cc->GetName().c_str());
|
||||||
|
|
||||||
non_recursive_funcs.erase(c.first);
|
non_recursive_funcs.erase(c.first);
|
||||||
non_recursive_funcs.erase(cc);
|
non_recursive_funcs.erase(cc);
|
||||||
|
@ -193,7 +194,7 @@ void Inliner::CoalesceEventHandlers() {
|
||||||
// it takes more time to compile it than to just run it via the
|
// it takes more time to compile it than to just run it via the
|
||||||
// interpreter, it's a lose.
|
// interpreter, it's a lose.
|
||||||
static std::string zeek_init_name = "zeek_init";
|
static std::string zeek_init_name = "zeek_init";
|
||||||
if ( func->Name() == zeek_init_name )
|
if ( func->GetName() == zeek_init_name )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto& body = f.Body();
|
const auto& body = f.Body();
|
||||||
|
@ -286,12 +287,12 @@ void Inliner::CoalesceEventHandlers(ScriptFuncPtr func, const std::vector<Func::
|
||||||
inlined_func->SetScope(new_scope);
|
inlined_func->SetScope(new_scope);
|
||||||
|
|
||||||
// Replace the function for that EventHandler with the delegating one.
|
// Replace the function for that EventHandler with the delegating one.
|
||||||
auto* eh = event_registry->Lookup(func->Name());
|
auto* eh = event_registry->Lookup(func->GetName());
|
||||||
ASSERT(eh);
|
ASSERT(eh);
|
||||||
eh->SetFunc(inlined_func);
|
eh->SetFunc(inlined_func);
|
||||||
|
|
||||||
// Likewise, replace the value of the identifier.
|
// Likewise, replace the value of the identifier.
|
||||||
auto fid = lookup_ID(func->Name(), GLOBAL_MODULE_NAME, false, false, false);
|
auto fid = lookup_ID(func->GetName().c_str(), GLOBAL_MODULE_NAME, false, false, false);
|
||||||
ASSERT(fid);
|
ASSERT(fid);
|
||||||
fid->SetVal(make_intrusive<FuncVal>(inlined_func));
|
fid->SetVal(make_intrusive<FuncVal>(inlined_func));
|
||||||
|
|
||||||
|
|
|
@ -656,7 +656,7 @@ bool ProfileFuncs::GetCallSideEffects(const NameExpr* n, IDSet& non_local_ids, T
|
||||||
|
|
||||||
auto func = fv->AsFunc();
|
auto func = fv->AsFunc();
|
||||||
if ( func->GetKind() == Func::BUILTIN_FUNC ) {
|
if ( func->GetKind() == Func::BUILTIN_FUNC ) {
|
||||||
if ( has_script_side_effects(func->Name()) )
|
if ( has_script_side_effects(func->GetName()) )
|
||||||
is_unknown = true;
|
is_unknown = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1392,8 +1392,8 @@ bool ProfileFuncs::AssessSideEffects(const SideEffectsOp* se, SideEffectsOp::Acc
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SideEffectsOp> ProfileFuncs::GetCallSideEffects(const ScriptFunc* sf) {
|
std::shared_ptr<SideEffectsOp> ProfileFuncs::GetCallSideEffects(const ScriptFunc* sf) {
|
||||||
if ( lambda_primaries.count(sf->Name()) > 0 )
|
if ( lambda_primaries.count(sf->GetName()) > 0 )
|
||||||
sf = lambda_primaries[sf->Name()];
|
sf = lambda_primaries[sf->GetName()];
|
||||||
|
|
||||||
auto sf_se = func_side_effects.find(sf);
|
auto sf_se = func_side_effects.find(sf);
|
||||||
if ( sf_se != func_side_effects.end() )
|
if ( sf_se != func_side_effects.end() )
|
||||||
|
@ -1502,7 +1502,7 @@ ASTBlockAnalyzer::ASTBlockAnalyzer(std::vector<FuncInfo>& funcs) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto func = f.Func();
|
auto func = f.Func();
|
||||||
std::string fn = func->Name();
|
auto fn = func->GetName();
|
||||||
auto body = f.Body();
|
auto body = f.Body();
|
||||||
|
|
||||||
// First get the line numbers all sorted out.
|
// First get the line numbers all sorted out.
|
||||||
|
|
|
@ -110,7 +110,7 @@ bool should_analyze(const ScriptFuncPtr& f, const StmtPtr& body) {
|
||||||
if ( ofiles.empty() && ofuncs.empty() )
|
if ( ofiles.empty() && ofuncs.empty() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto fun = f->Name();
|
const auto& fun = f->GetName();
|
||||||
|
|
||||||
for ( auto& o : ofuncs )
|
for ( auto& o : ofuncs )
|
||||||
if ( std::regex_match(fun, o) )
|
if ( std::regex_match(fun, o) )
|
||||||
|
@ -165,7 +165,7 @@ static void optimize_func(ScriptFuncPtr f, std::shared_ptr<ProfileFunc> pf, std:
|
||||||
const char* reason;
|
const char* reason;
|
||||||
if ( ! is_ZAM_compilable(pf.get(), &reason) ) {
|
if ( ! is_ZAM_compilable(pf.get(), &reason) ) {
|
||||||
if ( analysis_options.report_uncompilable )
|
if ( analysis_options.report_uncompilable )
|
||||||
printf("Skipping compilation of %s due to %s\n", f->Name(), reason);
|
printf("Skipping compilation of %s due to %s\n", f->GetName().c_str(), reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,10 +184,10 @@ static void optimize_func(ScriptFuncPtr f, std::shared_ptr<ProfileFunc> pf, std:
|
||||||
|
|
||||||
if ( ! new_body->IsReduced(rc.get()) ) {
|
if ( ! new_body->IsReduced(rc.get()) ) {
|
||||||
if ( non_reduced_perp )
|
if ( non_reduced_perp )
|
||||||
reporter->InternalError("Reduction inconsistency for %s: %s\n", f->Name(),
|
reporter->InternalError("Reduction inconsistency for %s: %s\n", f->GetName().c_str(),
|
||||||
obj_desc(non_reduced_perp).c_str());
|
obj_desc(non_reduced_perp).c_str());
|
||||||
else
|
else
|
||||||
reporter->InternalError("Reduction inconsistency for %s\n", f->Name());
|
reporter->InternalError("Reduction inconsistency for %s\n", f->GetName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
checking_reduction = false;
|
checking_reduction = false;
|
||||||
|
@ -365,11 +365,11 @@ static void report_CPP() {
|
||||||
std::unordered_set<unsigned long long> already_reported;
|
std::unordered_set<unsigned long long> already_reported;
|
||||||
|
|
||||||
for ( auto& f : funcs ) {
|
for ( auto& f : funcs ) {
|
||||||
auto name = f.Func()->Name();
|
const auto& name = f.Func()->GetName();
|
||||||
auto hash = f.Profile()->HashVal();
|
auto hash = f.Profile()->HashVal();
|
||||||
bool have = compiled_scripts.count(hash) > 0;
|
bool have = compiled_scripts.count(hash) > 0;
|
||||||
|
|
||||||
printf("script function %s (hash %llu): %s\n", name, hash, have ? "yes" : "no");
|
printf("script function %s (hash %llu): %s\n", name.c_str(), hash, have ? "yes" : "no");
|
||||||
|
|
||||||
if ( have )
|
if ( have )
|
||||||
already_reported.insert(hash);
|
already_reported.insert(hash);
|
||||||
|
@ -409,7 +409,7 @@ static void use_CPP() {
|
||||||
// we're using code compiled for standalone.
|
// we're using code compiled for standalone.
|
||||||
if ( f.Body()->Tag() != STMT_CPP ) {
|
if ( f.Body()->Tag() != STMT_CPP ) {
|
||||||
auto func = f.Func();
|
auto func = f.Func();
|
||||||
if ( added_bodies[func->Name()].count(hash) > 0 )
|
if ( added_bodies[func->GetName()].count(hash) > 0 )
|
||||||
// We've already added the
|
// We've already added the
|
||||||
// replacement. Delete orig.
|
// replacement. Delete orig.
|
||||||
func->ReplaceBody(f.Body(), nullptr);
|
func->ReplaceBody(f.Body(), nullptr);
|
||||||
|
|
|
@ -187,7 +187,7 @@ protected:
|
||||||
class CoalescedScriptFunc : public ScriptFunc {
|
class CoalescedScriptFunc : public ScriptFunc {
|
||||||
public:
|
public:
|
||||||
CoalescedScriptFunc(StmtPtr merged_body, ScopePtr scope, ScriptFuncPtr orig_func)
|
CoalescedScriptFunc(StmtPtr merged_body, ScopePtr scope, ScriptFuncPtr orig_func)
|
||||||
: ScriptFunc(orig_func->Name(), orig_func->GetType(), {std::move(merged_body)}, {0}), orig_func(orig_func) {
|
: ScriptFunc(orig_func->GetName(), orig_func->GetType(), {std::move(merged_body)}, {0}), orig_func(orig_func) {
|
||||||
SetScope(std::move(scope));
|
SetScope(std::move(scope));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ void UsageAnalyzer::FindSeeds(IDSet& seeds) const {
|
||||||
auto f = GetFuncIfAny(id);
|
auto f = GetFuncIfAny(id);
|
||||||
|
|
||||||
if ( f && id->GetType<FuncType>()->Flavor() == FUNC_FLAVOR_EVENT ) {
|
if ( f && id->GetType<FuncType>()->Flavor() == FUNC_FLAVOR_EVENT ) {
|
||||||
if ( script_events.count(f->Name()) == 0 )
|
if ( script_events.count(f->GetName()) == 0 )
|
||||||
seeds.insert(id.get());
|
seeds.insert(id.get());
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -81,7 +81,7 @@ void ZAMCompiler::OptimizeInsts() {
|
||||||
KillInst(i);
|
KillInst(i);
|
||||||
|
|
||||||
if ( analysis_options.dump_ZAM ) {
|
if ( analysis_options.dump_ZAM ) {
|
||||||
printf("Original ZAM code for %s:\n", func->Name());
|
printf("Original ZAM code for %s:\n", func->GetName().c_str());
|
||||||
DumpInsts1(nullptr);
|
DumpInsts1(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -915,7 +915,7 @@ zeek_uint_t ZAMCompiler::FirstLiveInst(zeek_uint_t i, bool follow_gotos) {
|
||||||
if ( i0->live ) {
|
if ( i0->live ) {
|
||||||
if ( follow_gotos && i0->IsUnconditionalBranch() ) {
|
if ( follow_gotos && i0->IsUnconditionalBranch() ) {
|
||||||
if ( ++num_inspected > insts1.size() ) {
|
if ( ++num_inspected > insts1.size() ) {
|
||||||
reporter->Error("%s contains an infinite loop", func->Name());
|
reporter->Error("%s contains an infinite loop", func->GetName().c_str());
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -573,7 +573,7 @@ bool IsZAM_BuiltIn(ZAMCompiler* zam, const Expr* e) {
|
||||||
if ( ! func )
|
if ( ! func )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string fn = func->Name();
|
auto fn = func->GetName();
|
||||||
|
|
||||||
// It's useful to intercept any lingering calls to the script-level
|
// It's useful to intercept any lingering calls to the script-level
|
||||||
// Log::write as well as the Log::__write BiF. When inlining there can
|
// Log::write as well as the Log::__write BiF. When inlining there can
|
||||||
|
@ -619,7 +619,7 @@ bool IsZAM_BuiltInCond(ZAMCompiler* zam, const CallExpr* c, int& branch_v) {
|
||||||
if ( ! func )
|
if ( ! func )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto b = builtins.find(func->Name());
|
auto b = builtins.find(func->GetName());
|
||||||
if ( b == builtins.end() )
|
if ( b == builtins.end() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ ZAMCompiler::ZAMCompiler(ScriptFuncPtr f, std::shared_ptr<ProfileFuncs> _pfs, st
|
||||||
ASSERT(loc->first_line != 0 || body->Tag() == STMT_NULL);
|
ASSERT(loc->first_line != 0 || body->Tag() == STMT_NULL);
|
||||||
auto loc_copy =
|
auto loc_copy =
|
||||||
std::make_shared<Location>(loc->filename, loc->first_line, loc->last_line, loc->first_column, loc->last_column);
|
std::make_shared<Location>(loc->filename, loc->first_line, loc->last_line, loc->first_column, loc->last_column);
|
||||||
ZAM::curr_func = func->Name();
|
ZAM::curr_func = func->GetName();
|
||||||
ZAM::curr_loc = std::make_shared<ZAMLocInfo>(ZAM::curr_func, std::move(loc_copy), nullptr);
|
ZAM::curr_loc = std::make_shared<ZAMLocInfo>(ZAM::curr_func, std::move(loc_copy), nullptr);
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
@ -196,7 +196,7 @@ StmtPtr ZAMCompiler::CompileBody() {
|
||||||
|
|
||||||
ConcretizeSwitches();
|
ConcretizeSwitches();
|
||||||
|
|
||||||
std::string fname = func->Name();
|
auto fname = func->GetName();
|
||||||
|
|
||||||
if ( func->Flavor() == FUNC_FLAVOR_FUNCTION )
|
if ( func->Flavor() == FUNC_FLAVOR_FUNCTION )
|
||||||
fname = func_name_at_loc(fname, body->GetLocationInfo());
|
fname = func_name_at_loc(fname, body->GetLocationInfo());
|
||||||
|
@ -357,13 +357,13 @@ void ZAMCompiler::Dump() {
|
||||||
bool remapped_frame = ! analysis_options.no_ZAM_opt;
|
bool remapped_frame = ! analysis_options.no_ZAM_opt;
|
||||||
|
|
||||||
if ( remapped_frame )
|
if ( remapped_frame )
|
||||||
printf("Original frame for %s:\n", func->Name());
|
printf("Original frame for %s:\n", func->GetName().c_str());
|
||||||
|
|
||||||
for ( const auto& elem : frame_layout1 )
|
for ( const auto& elem : frame_layout1 )
|
||||||
printf("frame[%d] = %s\n", elem.second, elem.first->Name());
|
printf("frame[%d] = %s\n", elem.second, elem.first->Name());
|
||||||
|
|
||||||
if ( remapped_frame ) {
|
if ( remapped_frame ) {
|
||||||
printf("Final frame for %s:\n", func->Name());
|
printf("Final frame for %s:\n", func->GetName().c_str());
|
||||||
|
|
||||||
for ( auto i = 0U; i < shared_frame_denizens.size(); ++i ) {
|
for ( auto i = 0U; i < shared_frame_denizens.size(); ++i ) {
|
||||||
printf("frame2[%d] =", i);
|
printf("frame2[%d] =", i);
|
||||||
|
@ -374,14 +374,14 @@ void ZAMCompiler::Dump() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! insts2.empty() )
|
if ( ! insts2.empty() )
|
||||||
printf("Pre-removal of dead code for %s:\n", func->Name());
|
printf("Pre-removal of dead code for %s:\n", func->GetName().c_str());
|
||||||
|
|
||||||
auto remappings = remapped_frame ? &shared_frame_denizens : nullptr;
|
auto remappings = remapped_frame ? &shared_frame_denizens : nullptr;
|
||||||
|
|
||||||
DumpInsts1(remappings);
|
DumpInsts1(remappings);
|
||||||
|
|
||||||
if ( ! insts2.empty() )
|
if ( ! insts2.empty() )
|
||||||
printf("Final intermediary code for %s:\n", func->Name());
|
printf("Final intermediary code for %s:\n", func->GetName().c_str());
|
||||||
|
|
||||||
remappings = remapped_frame ? &shared_frame_denizens_final : nullptr;
|
remappings = remapped_frame ? &shared_frame_denizens_final : nullptr;
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ void ZAMCompiler::Dump() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! insts2.empty() )
|
if ( ! insts2.empty() )
|
||||||
printf("Final code for %s:\n", func->Name());
|
printf("Final code for %s:\n", func->GetName().c_str());
|
||||||
|
|
||||||
for ( auto i = 0U; i < insts2.size(); ++i ) {
|
for ( auto i = 0U; i < insts2.size(); ++i ) {
|
||||||
auto& inst = insts2[i];
|
auto& inst = insts2[i];
|
||||||
|
|
|
@ -24,7 +24,7 @@ eval-type S Bstr_cmp($1->AsString(), $2->AsString()) == 0
|
||||||
eval-type T $1->EqualTo(*$2)
|
eval-type T $1->EqualTo(*$2)
|
||||||
eval-type A $1->AsAddr() == $2->AsAddr()
|
eval-type A $1->AsAddr() == $2->AsAddr()
|
||||||
eval-type N $1->AsSubNet() == $2->AsSubNet()
|
eval-type N $1->AsSubNet() == $2->AsSubNet()
|
||||||
eval-type F util::streq($1->Name(), $2->Name())
|
eval-type F $1->GetName() == $2->GetName()
|
||||||
eval-mixed P S $1->MatchExactly($2->AsString())
|
eval-mixed P S $1->MatchExactly($2->AsString())
|
||||||
|
|
||||||
rel-expr-op NE
|
rel-expr-op NE
|
||||||
|
@ -35,7 +35,7 @@ eval-type S Bstr_cmp($1->AsString(), $2->AsString()) != 0
|
||||||
eval-type T ! $1->EqualTo(*$2)
|
eval-type T ! $1->EqualTo(*$2)
|
||||||
eval-type A $1->AsAddr() != $2->AsAddr()
|
eval-type A $1->AsAddr() != $2->AsAddr()
|
||||||
eval-type N $1->AsSubNet() != $2->AsSubNet()
|
eval-type N $1->AsSubNet() != $2->AsSubNet()
|
||||||
eval-type F ! util::streq($1->Name(), $2->Name())
|
eval-type F $1->GetName() != $2->GetName()
|
||||||
eval-mixed P S ! $1->MatchExactly($2->AsString())
|
eval-mixed P S ! $1->MatchExactly($2->AsString())
|
||||||
|
|
||||||
# Note, canonicalization means that GE and GT shouldn't occur
|
# Note, canonicalization means that GE and GT shouldn't occur
|
||||||
|
|
|
@ -932,7 +932,7 @@ const ZAMStmt ZAMCompiler::CompileCatchReturn(const CatchReturnStmt* cr) {
|
||||||
auto hold_func = ZAM::curr_func;
|
auto hold_func = ZAM::curr_func;
|
||||||
auto hold_loc = ZAM::curr_loc;
|
auto hold_loc = ZAM::curr_loc;
|
||||||
|
|
||||||
ZAM::curr_func = cr->Func()->Name();
|
ZAM::curr_func = cr->Func()->GetName();
|
||||||
|
|
||||||
bool is_event_inline = (hold_func == ZAM::curr_func);
|
bool is_event_inline = (hold_func == ZAM::curr_func);
|
||||||
|
|
||||||
|
|
|
@ -80,12 +80,12 @@ void ZInst::Dump(FILE* f, const string& prefix, const string& id1, const string&
|
||||||
auto func = aux ? aux->func : nullptr;
|
auto func = aux ? aux->func : nullptr;
|
||||||
|
|
||||||
if ( func )
|
if ( func )
|
||||||
fprintf(f, " (func %s)", func->Name());
|
fprintf(f, " (func %s)", func->GetName().c_str());
|
||||||
|
|
||||||
if ( loc ) {
|
if ( loc ) {
|
||||||
auto l = loc->Describe(true);
|
auto l = loc->Describe(true);
|
||||||
if ( func && (func->GetBodies().empty() || func->GetBodies()[0].stmts->Tag() != STMT_ZAM) )
|
if ( func && (func->GetBodies().empty() || func->GetBodies()[0].stmts->Tag() != STMT_ZAM) )
|
||||||
l = l + ";" + func->Name();
|
l = l + ";" + func->GetName();
|
||||||
if ( ! prefix.empty() )
|
if ( ! prefix.empty() )
|
||||||
l = prefix + l;
|
l = prefix + l;
|
||||||
fprintf(f, " // %s", l.c_str());
|
fprintf(f, " // %s", l.c_str());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue