Add runtimeOnly option to pushCombinedFunctionEntryLabel

This commit is contained in:
Alex Beregszaszi 2018-03-27 03:39:37 +01:00
parent 0a58e57ceb
commit fab527c414
3 changed files with 8 additions and 8 deletions

View File

@ -585,7 +585,7 @@ void CompilerUtils::combineExternalFunctionType(bool _leftAligned)
leftShiftNumberOnStack(64); leftShiftNumberOnStack(64);
} }
void CompilerUtils::pushCombinedFunctionEntryLabel(Declaration const& _function) void CompilerUtils::pushCombinedFunctionEntryLabel(Declaration const& _function, bool _runtimeOnly)
{ {
m_context << m_context.functionEntryLabel(_function).pushTag(); m_context << m_context.functionEntryLabel(_function).pushTag();
// If there is a runtime context, we have to merge both labels into the same // If there is a runtime context, we have to merge both labels into the same
@ -593,6 +593,7 @@ void CompilerUtils::pushCombinedFunctionEntryLabel(Declaration const& _function)
if (CompilerContext* rtc = m_context.runtimeContext()) if (CompilerContext* rtc = m_context.runtimeContext())
{ {
leftShiftNumberOnStack(32); leftShiftNumberOnStack(32);
if (_runtimeOnly)
m_context << m_context <<
rtc->functionEntryLabel(_function).toSubAssemblyTag(m_context.runtimeSub()) << rtc->functionEntryLabel(_function).toSubAssemblyTag(m_context.runtimeSub()) <<
Instruction::OR; Instruction::OR;

View File

@ -188,7 +188,8 @@ public:
/// Appends code that combines the construction-time (if available) and runtime function /// Appends code that combines the construction-time (if available) and runtime function
/// entry label of the given function into a single stack slot. /// entry label of the given function into a single stack slot.
/// Note: This might cause the compilation queue of the runtime context to be extended. /// Note: This might cause the compilation queue of the runtime context to be extended.
void pushCombinedFunctionEntryLabel(Declaration const& _function); /// If @a _runtimeOnly, the entry label will include the runtime assembly tag.
void pushCombinedFunctionEntryLabel(Declaration const& _function, bool _runtimeOnly = true);
/// Appends code for an implicit or explicit type conversion. This includes erasing higher /// Appends code for an implicit or explicit type conversion. This includes erasing higher
/// order bits (@see appendHighBitCleanup) when widening integer but also copy to memory /// order bits (@see appendHighBitCleanup) when widening integer but also copy to memory

View File

@ -527,9 +527,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
// Do not directly visit the identifier, because this way, we can avoid // Do not directly visit the identifier, because this way, we can avoid
// the runtime entry label to be created at the creation time context. // the runtime entry label to be created at the creation time context.
CompilerContext::LocationSetter locationSetter2(m_context, *identifier); CompilerContext::LocationSetter locationSetter2(m_context, *identifier);
m_context << m_context.functionEntryLabel(m_context.resolveVirtualFunction(*functionDef)).pushTag(); utils().pushCombinedFunctionEntryLabel(m_context.resolveVirtualFunction(*functionDef), false);
if (m_context.runtimeContext())
utils().leftShiftNumberOnStack(32);
shortcutTaken = true; shortcutTaken = true;
} }