Skip to content

Commit

Permalink
Generate INTERCEPT_INJECTION_ALWAYS for dynamicInvoke functions
Browse files Browse the repository at this point in the history
This means we can avoid compiling with ENABLE_INTERCEPTS, which
significantly reduces the size of the binary.
  • Loading branch information
mwilliams authored and sgolemon committed Sep 14, 2012
1 parent 6a4aede commit 993a33b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/compiler/statement/method_statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,10 +1142,14 @@ void MethodStatement::outputCPPArgInjections(CodeGenerator &cg,
ClassScopePtr cls,
FunctionScopePtr funcScope) {
if (cg.getOutput() != CodeGenerator::SystemCPP) {
if (funcScope->isDynamicInvoke()) {
cg_printf("INTERCEPT_INJECTION_ALWAYS(\"%s\", \"%s\", ", name, name);
} else {
cg_printf("INTERCEPT_INJECTION(\"%s\", ", name);
}
if (m_params) {
int n = m_params->getCount();
ASSERT(n >= 0);
cg_printf("INTERCEPT_INJECTION(\"%s\", ", name);
if (Option::GenArrayCreate && !hasRefParam()) {
if (ar->m_arrayIntegerKeyMaxSize < n) ar->m_arrayIntegerKeyMaxSize = n;
outputParamArrayCreate(cg, true);
Expand All @@ -1162,7 +1166,7 @@ void MethodStatement::outputCPPArgInjections(CodeGenerator &cg,
cg_printf(".create()))");
}
} else {
cg_printf("INTERCEPT_INJECTION(\"%s\", null_array", name);
cg_printf("null_array");
}
TypePtr t = funcScope->getReturnType();
bool refRet = funcScope->isRefReturn() && t && Type::IsMappedToVariant(t);
Expand Down

0 comments on commit 993a33b

Please sign in to comment.