Revert "[K/N] Replace SymbolName with GCUnsafeCall in interop"

This reverts commit ca9ec76c08.
This commit is contained in:
Svyatoslav Scherbina
2021-11-18 12:18:01 +03:00
committed by Space
parent 7042d01271
commit 6e0a152f39
5 changed files with 4 additions and 8 deletions
@@ -123,8 +123,7 @@ class SimpleBridgeGeneratorImpl(
val externCPrefix = if (libraryForCStubs.language == Language.CPP) "extern \"C\" " else ""
val functionName = pkgName.replace(INVALID_CLANG_IDENTIFIER_REGEX, "_") + "_$kotlinFunctionName"
if (independent) kotlinLines.add("@" + topLevelKotlinScope.reference(KotlinTypes.independent))
// TODO: this should be separate annotation
kotlinLines.add("@GCUnsafeCall(${functionName.quoteAsKotlinLiteral()})")
kotlinLines.add("@SymbolName(${functionName.quoteAsKotlinLiteral()})")
"$externCPrefix$cReturnType $functionName ($joinedCParameters)"
}
}
@@ -581,7 +581,7 @@ private fun KotlinStubs.createFakeKotlinExternalFunction(
)
bridge.annotations += buildSimpleAnnotation(irBuiltIns, UNDEFINED_OFFSET, UNDEFINED_OFFSET,
symbols.gcUnsafeCall.owner, cFunctionName)
symbols.symbolName.owner, cFunctionName)
if (isObjCMethod) {
val methodInfo = signature.getObjCMethodInfo()!!
@@ -130,9 +130,8 @@ private fun createKotlinBridge(
isInfix = false
)
if (isExternal) {
// TODO this should be separate annotation
bridge.annotations += buildSimpleAnnotation(stubs.irBuiltIns, startOffset, endOffset,
stubs.symbols.gcUnsafeCall.owner, cBridgeName)
stubs.symbols.symbolName.owner, cBridgeName)
bridge.annotations += buildSimpleAnnotation(stubs.irBuiltIns, startOffset, endOffset,
stubs.symbols.filterExceptions.owner,
foreignExceptionMode.value)
@@ -88,7 +88,6 @@ internal class KonanSymbols(
}.toMap()
val symbolName = topLevelClass(RuntimeNames.symbolNameAnnotation)
val gcUnsafeCall = topLevelClass(KonanFqNames.gcUnsafeCall)
val filterExceptions = topLevelClass(RuntimeNames.filterExceptions)
val exportForCppRuntime = topLevelClass(RuntimeNames.exportForCppRuntime)
@@ -2590,8 +2590,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
val result = context.memoryModel == MemoryModel.EXPERIMENTAL && origin == CBridgeOrigin.KOTLIN_TO_C_BRIDGE
if (result) {
check(isExternal)
// TODO: this should be separate annotation
// check(!annotations.hasAnnotation(KonanFqNames.gcUnsafeCall))
check(!annotations.hasAnnotation(KonanFqNames.gcUnsafeCall))
check(annotations.hasAnnotation(RuntimeNames.filterExceptions))
}
return result