[K/N] Removed extra consition for C to Kotlin bridges because they have already needed annotation

This commit is contained in:
Elena Lepilkina
2021-10-25 17:16:44 +03:00
committed by Space
parent 23e5079391
commit 27490ca7ce
@@ -479,7 +479,6 @@ internal abstract class FunctionGenerationContext(
// because there is no guarantee of catching Kotlin exception in Kotlin code. // because there is no guarantee of catching Kotlin exception in Kotlin code.
protected open val needLeaveFrame: Boolean protected open val needLeaveFrame: Boolean
get() = irFunction?.annotations?.hasAnnotation(RuntimeNames.exportForCppRuntime) == true get() = irFunction?.annotations?.hasAnnotation(RuntimeNames.exportForCppRuntime) == true
|| irFunction?.origin == CBridgeOrigin.C_TO_KOTLIN_BRIDGE
private var setCurrentFrameIsCalled: Boolean = false private var setCurrentFrameIsCalled: Boolean = false
@@ -1427,14 +1426,14 @@ internal abstract class FunctionGenerationContext(
} }
internal fun epilogue() { internal fun epilogue() {
val needLeaveFrameInUnwindEpilogue = this.needLeaveFrame val needLeaveFrame = this.needLeaveFrame
appendingTo(prologueBb) { appendingTo(prologueBb) {
val slots = if (needSlotsPhi || needLeaveFrameInUnwindEpilogue) val slots = if (needSlotsPhi || needLeaveFrame)
LLVMBuildArrayAlloca(builder, kObjHeaderPtr, Int32(slotCount).llvm, "")!! LLVMBuildArrayAlloca(builder, kObjHeaderPtr, Int32(slotCount).llvm, "")!!
else else
kNullObjHeaderPtrPtr kNullObjHeaderPtrPtr
if (needSlots || needLeaveFrameInUnwindEpilogue) { if (needSlots || needLeaveFrame) {
check(!forbidRuntime) { "Attempt to start a frame where runtime usage is forbidden" } check(!forbidRuntime) { "Attempt to start a frame where runtime usage is forbidden" }
// Zero-init slots. // Zero-init slots.
val slotsMem = bitcast(kInt8Ptr, slots) val slotsMem = bitcast(kInt8Ptr, slots)
@@ -1478,7 +1477,7 @@ internal abstract class FunctionGenerationContext(
if (needStateSwitch) { if (needStateSwitch) {
switchThreadState(Runnable) switchThreadState(Runnable)
} }
if (needSlots || needLeaveFrameInUnwindEpilogue) { if (needSlots || needLeaveFrame) {
call(context.llvm.enterFrameFunction, listOf(slotsPhi!!, Int32(vars.skipSlots).llvm, Int32(slotCount).llvm)) call(context.llvm.enterFrameFunction, listOf(slotsPhi!!, Int32(vars.skipSlots).llvm, Int32(slotCount).llvm))
} else { } else {
check(!setCurrentFrameIsCalled) check(!setCurrentFrameIsCalled)
@@ -1489,7 +1488,7 @@ internal abstract class FunctionGenerationContext(
processReturns() processReturns()
val shouldHaveCleanupLandingpad = needLeaveFrameInUnwindEpilogue || val shouldHaveCleanupLandingpad = needLeaveFrame ||
(!stackLocalsManager.isEmpty() && context.memoryModel != MemoryModel.EXPERIMENTAL) || (!stackLocalsManager.isEmpty() && context.memoryModel != MemoryModel.EXPERIMENTAL) ||
(context.memoryModel == MemoryModel.EXPERIMENTAL && switchToRunnable) (context.memoryModel == MemoryModel.EXPERIMENTAL && switchToRunnable)