Boxing.
This commit is contained in:
committed by
SvyatoslavScherbina
parent
86a6771a09
commit
3b7321ef94
+5
-5
@@ -1,11 +1,8 @@
|
||||
package org.jetbrains.kotlin.backend.konan
|
||||
|
||||
import org.jetbrains.kotlin.backend.konan.PhaseManager
|
||||
import org.jetbrains.kotlin.backend.konan.Context
|
||||
import org.jetbrains.kotlin.backend.common.lower.LocalFunctionsLowering
|
||||
import org.jetbrains.kotlin.backend.common.lower.SharedVariablesLowering
|
||||
import org.jetbrains.kotlin.backend.common.runOnFilePostfix
|
||||
import org.jetbrains.kotlin.backend.konan.lower.CallableReferenceLowering
|
||||
import org.jetbrains.kotlin.backend.common.lower.*
|
||||
import org.jetbrains.kotlin.backend.konan.lower.*
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
|
||||
@@ -29,5 +26,8 @@ internal class KonanLower(val context: Context) {
|
||||
phaser.phase("Lower_callables") {
|
||||
CallableReferenceLowering(context).runOnFilePostfix(irFile)
|
||||
}
|
||||
phaser.phase("Autobox") {
|
||||
Autoboxing(context).runOnFilePostfix(irFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -13,6 +13,7 @@ object KonanPhases {
|
||||
"Lower_shared_variables" to KonanPhase("Shared Variable Lowering"),
|
||||
"Lower_local_functions" to KonanPhase("Local Function Lowering"),
|
||||
"Lower_callables" to KonanPhase("Callable references Lowering"),
|
||||
"Autobox" to KonanPhase("Autoboxing of primitive types"),
|
||||
"Lower" to KonanPhase("IR Lowering"),
|
||||
"Bitcode" to KonanPhase("LLVM BitCode Generation"),
|
||||
"RTTI" to KonanPhase("RTTI Generation"),
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package org.jetbrains.kotlin.backend.konan.lower
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.*
|
||||
import org.jetbrains.kotlin.backend.konan.KonanBackendContext
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.ir2string
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
|
||||
internal class Autoboxing(val context: KonanBackendContext) : FunctionLoweringPass {
|
||||
|
||||
var boxedCount = 0
|
||||
|
||||
/*
|
||||
override fun lower(irBody: IrBody) {
|
||||
println("Boxer body " + ir2string(irBody))
|
||||
} */
|
||||
|
||||
override fun lower(irFunction: IrFunction) {
|
||||
println("Boxer function " + ir2string(irFunction))
|
||||
|
||||
}
|
||||
}
|
||||
@@ -461,7 +461,12 @@ task statements0(type: RunKonanTest) {
|
||||
task boxing0(type: RunKonanTest) {
|
||||
disabled = true
|
||||
goldValue = "17\n"
|
||||
source = "runtime/basic/boxing0.kt"
|
||||
source = "codegen/boxing/boxing0.kt"
|
||||
}
|
||||
|
||||
task boxing1 (type:RunKonanTest) {
|
||||
disabled = true
|
||||
source = "codegen/boxing/boxing1.kt"
|
||||
}
|
||||
|
||||
task interface0(type: RunKonanTest) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
fun foo(arg: Any) {
|
||||
println(arg.toString())
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
foo(1)
|
||||
foo(false)
|
||||
foo("Hello")
|
||||
}
|
||||
Reference in New Issue
Block a user