Added used annotaions for functions that are used from JS
This commit is contained in:
committed by
Sergey Bogolepov
parent
c57a12967b
commit
b5f6c2460d
@@ -7,12 +7,20 @@ typealias Arena = Int
|
||||
typealias Object = Int
|
||||
typealias Pointer = Int
|
||||
|
||||
/**
|
||||
* Used annotation is required to preserve functions
|
||||
* from internalization and DCE
|
||||
*/
|
||||
|
||||
@Used
|
||||
@SymbolName("Konan_js_allocateArena")
|
||||
external public fun allocateArena(): Arena
|
||||
|
||||
@Used
|
||||
@SymbolName("Konan_js_freeArena")
|
||||
external public fun freeArena(arena: Arena)
|
||||
|
||||
@Used
|
||||
@SymbolName("Konan_js_pushIntToArena")
|
||||
external public fun pushIntToArena(arena: Arena, value: Int)
|
||||
|
||||
@@ -24,12 +32,15 @@ fun doubleUpper(value: Double): Int =
|
||||
fun doubleLower(value: Double): Int =
|
||||
(value.toBits() and 0x00000000ffffffff) .toInt()
|
||||
|
||||
@Used
|
||||
@SymbolName("ReturnSlot_getDouble")
|
||||
external public fun ReturnSlot_getDouble(): Double
|
||||
|
||||
@Used
|
||||
@SymbolName("Kotlin_String_utf16pointer")
|
||||
external public fun stringPointer(message: String): Pointer
|
||||
|
||||
@Used
|
||||
@SymbolName("Kotlin_String_utf16length")
|
||||
external public fun stringLengthBytes(message: String): Int
|
||||
|
||||
@@ -40,6 +51,7 @@ fun <R> wrapFunction(func: KtFunction<R>): Int {
|
||||
return ptr.toInt() // TODO: LP64 unsafe.
|
||||
}
|
||||
|
||||
@Used
|
||||
@ExportForCppRuntime("Konan_js_runLambda")
|
||||
fun runLambda(pointer: Int, argumentsArena: Arena, argumentsArenaSize: Int): Int {
|
||||
val arguments = arrayListOf<JsValue>()
|
||||
@@ -75,15 +87,19 @@ open class JsArray(arena: Arena, index: Object): JsValue(arena, index) {
|
||||
get() = this.getInt("length")
|
||||
}
|
||||
|
||||
@Used
|
||||
@SymbolName("Konan_js_getInt")
|
||||
external public fun getInt(arena: Arena, obj: Object, propertyPtr: Pointer, propertyLen: Int): Int;
|
||||
|
||||
@Used
|
||||
@SymbolName("Konan_js_getProperty")
|
||||
external public fun Konan_js_getProperty(arena: Arena, obj: Object, propertyPtr: Pointer, propertyLen: Int): Int;
|
||||
|
||||
@Used
|
||||
@SymbolName("Konan_js_setFunction")
|
||||
external public fun setFunction(arena: Arena, obj: Object, propertyName: Pointer, propertyLength: Int , function: Int)
|
||||
|
||||
@Used
|
||||
@SymbolName("Konan_js_setString")
|
||||
external public fun setString(arena: Arena, obj: Object, propertyName: Pointer, propertyLength: Int, stringPtr: Pointer, stringLength: Int )
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#ifndef RUNTIME_RUNTIME_H
|
||||
#define RUNTIME_RUNTIME_H
|
||||
|
||||
#include "Porting.h"
|
||||
|
||||
struct RuntimeState;
|
||||
struct InitNode;
|
||||
|
||||
@@ -24,8 +26,8 @@ struct InitNode;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void Kotlin_initRuntimeIfNeeded();
|
||||
void Kotlin_deinitRuntimeIfNeeded();
|
||||
void RUNTIME_USED Kotlin_initRuntimeIfNeeded();
|
||||
void RUNTIME_USED Kotlin_deinitRuntimeIfNeeded();
|
||||
|
||||
// Appends given node to an initializer list.
|
||||
void AppendToInitializersTail(struct InitNode*);
|
||||
|
||||
Reference in New Issue
Block a user