Fix methods inherited from Any in interop value types
This commit is contained in:
committed by
SvyatoslavScherbina
parent
d1859dd280
commit
c9b04bc0bb
+2
@@ -112,6 +112,8 @@ internal class InteropBuiltIns(builtIns: KonanBuiltIns) {
|
||||
|
||||
val nativePtrPlusLong = nativePtr.unsubstitutedMemberScope.getContributedFunctions("plus").single()
|
||||
|
||||
val nativePtrToLong = nativePtr.unsubstitutedMemberScope.getContributedFunctions("toLong").single()
|
||||
|
||||
val bitsToFloat = packageScope.getContributedFunctions("bitsToFloat").single()
|
||||
|
||||
val bitsToDouble = packageScope.getContributedFunctions("bitsToDouble").single()
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ internal class CodeGenerator(override val context: Context) : ContextUtils {
|
||||
private var localAllocs = 0
|
||||
private var arenaSlot: LLVMValueRef? = null
|
||||
|
||||
private val intPtrType = LLVMIntPtrType(llvmTargetData)!!
|
||||
val intPtrType = LLVMIntPtrType(llvmTargetData)!!
|
||||
private val immOneIntPtrType = LLVMConstInt(intPtrType, 1, 1)!!
|
||||
|
||||
fun prologue(descriptor: FunctionDescriptor) {
|
||||
|
||||
+10
@@ -1711,6 +1711,16 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid
|
||||
interop.nativePtrPlusLong -> codegen.gep(args[0], args[1])
|
||||
interop.getNativeNullPtr -> kNullInt8Ptr
|
||||
interop.getPointerSize -> Int32(LLVMPointerSize(codegen.llvmTargetData)).llvm
|
||||
interop.nativePtrToLong -> {
|
||||
val intPtrValue = codegen.ptrToInt(args.single(), codegen.intPtrType)
|
||||
val resultType = codegen.getLLVMType(descriptor.returnType!!)
|
||||
|
||||
if (resultType == intPtrValue.type) {
|
||||
intPtrValue
|
||||
} else {
|
||||
LLVMBuildSExt(codegen.builder, intPtrValue, resultType, "")!!
|
||||
}
|
||||
}
|
||||
else -> TODO(callee.descriptor.original.toString())
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -324,6 +324,10 @@ private class DeclarationsGeneratorVisitor(override val context: Context) :
|
||||
val llvmFunctionType = getLlvmFunctionType(descriptor)
|
||||
|
||||
val llvmFunction = if (descriptor.isExternal) {
|
||||
if (descriptor.isIntrinsic) {
|
||||
return
|
||||
}
|
||||
|
||||
context.llvm.externalFunction(descriptor.symbolName, llvmFunctionType)
|
||||
} else {
|
||||
val symbolName = if (descriptor.isExported()) {
|
||||
|
||||
Reference in New Issue
Block a user