fixes for -O gen-standalone-C++

This commit is contained in:
Vern Paxson 2021-12-12 12:36:08 -08:00
parent d5e7db1070
commit 3b3cea799b
2 changed files with 6 additions and 20 deletions

View file

@ -213,17 +213,11 @@ void CPPCompile::GenStandaloneActivation()
{
NL();
#if 0
Emit("void standalone_activation__CPP()");
StartBlock();
for ( auto& a : activations )
Emit(a);
EndBlock();
#endif
Emit("finish_init__CPP();");
NL();
Emit("void standalone_init__CPP()");
StartBlock();
// For events and hooks, we need to add each compiled body *unless*
// it's already there (which could be the case if the standalone
@ -283,10 +277,14 @@ void CPPCompile::GenStandaloneActivation()
GenTypeName(ft), hashes);
}
EndBlock();
NL();
Emit("void standalone_init__CPP()");
StartBlock();
Emit("init__CPP();");
Emit("CPP_activation_funcs.push_back(standalone_activation__CPP);");
Emit("CPP_activation_hook = activate__CPPs;");
EndBlock();
}
@ -300,15 +298,6 @@ void CPPCompile::GenLoad()
Emit("register_scripts__CPP(%s, standalone_init__CPP);", Fmt(total_hash));
// Spit out the placeholder script, and any associated module
// definitions.
for ( const auto& m : module_names )
if ( m != "GLOBAL" )
printf("module %s;\n", m.c_str());
if ( module_names.size() > 0 )
printf("module GLOBAL;\n\n");
printf("global init_CPP_%llu = load_CPP(%llu);\n", total_hash, total_hash);
}