mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
WASM: NFC. Rename WasmPrimitive into WasmAutoboxed and add few comments.
This commit is contained in:
committed by
TeamCityServer
parent
59ad7e0e04
commit
9ccdffe8ad
@@ -29,8 +29,8 @@ fun IrAnnotationContainer.hasWasmReinterpretAnnotation(): Boolean =
|
||||
fun IrAnnotationContainer.hasWasmForeignAnnotation(): Boolean =
|
||||
hasAnnotation(FqName("kotlin.wasm.internal.WasmForeign"))
|
||||
|
||||
fun IrAnnotationContainer.hasWasmPrimitiveAnnotation(): Boolean =
|
||||
hasAnnotation(FqName("kotlin.wasm.internal.WasmPrimitive"))
|
||||
fun IrAnnotationContainer.hasWasmAutoboxedAnnotation(): Boolean =
|
||||
hasAnnotation(FqName("kotlin.wasm.internal.WasmAutoboxed"))
|
||||
|
||||
fun IrAnnotationContainer.getWasmImportAnnotation(): WasmImportPair? =
|
||||
getAnnotation(FqName("kotlin.wasm.internal.WasmImport"))?.let {
|
||||
|
||||
@@ -32,7 +32,9 @@ class WasmInlineClassesUtils(private val wasmSymbols: WasmSymbols) : InlineClass
|
||||
}
|
||||
|
||||
override fun isClassInlineLike(klass: IrClass): Boolean {
|
||||
return klass.isInline || klass.hasWasmPrimitiveAnnotation()
|
||||
// TODO: This hook is called from autoboxing lowering so we also handle autoboxing annotation here. In the future it's better
|
||||
// to separate autoboxing from the inline class handling.
|
||||
return klass.isInline || klass.hasWasmAutoboxedAnnotation()
|
||||
}
|
||||
|
||||
override val boxIntrinsic: IrSimpleFunctionSymbol
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlin.wasm.internal.*
|
||||
* Represents a value which is either `true` or `false`. On the JVM, non-nullable values of this type are
|
||||
* represented as values of the primitive type `boolean`.
|
||||
*/
|
||||
@WasmPrimitive
|
||||
@WasmAutoboxed
|
||||
public class Boolean private constructor(private val value: Boolean) : Comparable<Boolean> {
|
||||
/**
|
||||
* Returns the inverse of this boolean.
|
||||
|
||||
@@ -13,7 +13,7 @@ import kotlin.wasm.internal.*
|
||||
*
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `char`.
|
||||
*/
|
||||
@WasmPrimitive
|
||||
@WasmAutoboxed
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public class Char private constructor(public val value: Char) : Comparable<Char> {
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,7 @@ import kotlin.wasm.internal.*
|
||||
/**
|
||||
* Represents a 8-bit signed integer.
|
||||
*/
|
||||
@WasmPrimitive
|
||||
@WasmAutoboxed
|
||||
public class Byte private constructor(public val value: Byte) : Number(), Comparable<Byte> {
|
||||
public companion object {
|
||||
/**
|
||||
@@ -359,7 +359,7 @@ private fun byteToStringImpl(byte: Byte): String =
|
||||
/**
|
||||
* Represents a 16-bit signed integer.
|
||||
*/
|
||||
@WasmPrimitive
|
||||
@WasmAutoboxed
|
||||
public class Short private constructor(public val value: Short) : Number(), Comparable<Short> {
|
||||
public companion object {
|
||||
/**
|
||||
@@ -701,7 +701,7 @@ private fun shortToStringImpl(x: Short): String = implementedAsIntrinsic
|
||||
/**
|
||||
* Represents a 32-bit signed integer.
|
||||
*/
|
||||
@WasmPrimitive
|
||||
@WasmAutoboxed
|
||||
public class Int private constructor(val value: Int) : Number(), Comparable<Int> {
|
||||
|
||||
public companion object {
|
||||
@@ -1099,7 +1099,7 @@ private fun intToStringImpl(x: Int): String =
|
||||
/**
|
||||
* Represents a 64-bit signed integer.
|
||||
*/
|
||||
@WasmPrimitive
|
||||
@WasmAutoboxed
|
||||
public class Long private constructor(val value: Long) : Number(), Comparable<Long> {
|
||||
|
||||
public companion object {
|
||||
@@ -1473,7 +1473,7 @@ public class Long private constructor(val value: Long) : Number(), Comparable<Lo
|
||||
/**
|
||||
* Represents a single-precision 32-bit IEEE 754 floating point number.
|
||||
*/
|
||||
@WasmPrimitive
|
||||
@WasmAutoboxed
|
||||
public class Float private constructor(public val value: Float) : Number(), Comparable<Float> {
|
||||
|
||||
public companion object {
|
||||
@@ -1786,7 +1786,7 @@ private fun floatToStringImpl(x: Float): String =
|
||||
/**
|
||||
* Represents a double-precision 64-bit IEEE 754 floating point number.
|
||||
*/
|
||||
@WasmPrimitive
|
||||
@WasmAutoboxed
|
||||
public class Double private constructor(public val value: Double) : Number(), Comparable<Double> {
|
||||
|
||||
public companion object {
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlin.wasm.internal.*
|
||||
* The `String` class represents character strings. All string literals in Kotlin programs, such as `"abc"`, are
|
||||
* implemented as instances of this class.
|
||||
*/
|
||||
@WasmPrimitive
|
||||
@WasmAutoboxed
|
||||
public class String constructor(public val string: String) : Comparable<String>, CharSequence {
|
||||
public companion object;
|
||||
|
||||
|
||||
@@ -32,9 +32,11 @@ internal annotation class WasmArrayOf(
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class WasmReinterpret
|
||||
|
||||
// This tells backend to insert box/unbox intrinsics around the annotated class. It's used to represent built-in types without making them
|
||||
// explicitly "inline" (or "value" in the newest terminology).
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
internal annotation class WasmPrimitive
|
||||
internal annotation class WasmAutoboxed
|
||||
|
||||
/**
|
||||
* Replace calls to this functions with specified Wasm instruction.
|
||||
|
||||
Reference in New Issue
Block a user