Commit 6ab0afea authored by qq_38816927's avatar qq_38816927

10层复杂对象优化

parent b6539f43
...@@ -10,4 +10,7 @@ actual fun pirntRandomHiLog() { ...@@ -10,4 +10,7 @@ actual fun pirntRandomHiLog() {
} }
actual fun testArkTsToKotin() { actual fun testArkTsToKotin() {
}
actual fun triggerANRByInfiniteLoop() {
} }
\ No newline at end of file
...@@ -24,6 +24,7 @@ import com.dong.demo013.navigation.ComposeGroup ...@@ -24,6 +24,7 @@ import com.dong.demo013.navigation.ComposeGroup
import com.dong.demo013.navigation.Page import com.dong.demo013.navigation.Page
import com.dong.maxhap.demos.FaultLogDemo import com.dong.maxhap.demos.FaultLogDemo
import com.dong.maxhap.demos.NativeFaultDemo import com.dong.maxhap.demos.NativeFaultDemo
import kotlin.native.concurrent.ThreadLocal
@Composable @Composable
internal fun App() { internal fun App() {
...@@ -110,7 +111,7 @@ internal fun HomeScreen( ...@@ -110,7 +111,7 @@ internal fun HomeScreen(
} }
Button( Button(
onClick = { onClick = {
// 无限递归 - 栈溢出 // 触发卡死
val testInfinite: Boolean = true; val testInfinite: Boolean = true;
fun infinite(): Int = infinite() + 1 fun infinite(): Int = infinite() + 1
infinite() // 触发 StackOverflowError infinite() // 触发 StackOverflowError
...@@ -349,4 +350,5 @@ internal fun DemoScreen( ...@@ -349,4 +350,5 @@ internal fun DemoScreen(
} }
} }
} }
} }
\ No newline at end of file
...@@ -10,4 +10,8 @@ expect fun pirntSingleHiLog(); ...@@ -10,4 +10,8 @@ expect fun pirntSingleHiLog();
expect fun pirntRandomHiLog(); expect fun pirntRandomHiLog();
expect fun testArkTsToKotin(); expect fun testArkTsToKotin();
\ No newline at end of file
//稳定触发鸿蒙卡死
expect fun triggerANRByInfiniteLoop();
\ No newline at end of file
...@@ -11,4 +11,7 @@ actual fun pirntRandomHiLog() { ...@@ -11,4 +11,7 @@ actual fun pirntRandomHiLog() {
} }
actual fun testArkTsToKotin() { actual fun testArkTsToKotin() {
}
actual fun triggerANRByInfiniteLoop() {
} }
\ No newline at end of file
...@@ -54,4 +54,10 @@ actual fun pirntRandomHiLog(){ ...@@ -54,4 +54,10 @@ actual fun pirntRandomHiLog(){
@CName("testArkTsToKotin") @CName("testArkTsToKotin")
actual fun testArkTsToKotin() { actual fun testArkTsToKotin() {
print("测试ArkTs至Kotlin单向跳转") print("测试ArkTs至Kotlin单向跳转")
}
actual fun triggerANRByInfiniteLoop() {
while (true){
}
} }
\ No newline at end of file
package com.dong.demo013 package com.dong.demo013
import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.ExperimentalForeignApi
import platform.ohos.OH_LOG_Print import platform.ohos.OH_LOG_Print
import platform.posix.usleep
import kotlin.experimental.ExperimentalNativeApi import kotlin.experimental.ExperimentalNativeApi
@OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, kotlin.experimental.ExperimentalNativeApi::class) @OptIn(kotlinx.cinterop.ExperimentalForeignApi::class, kotlin.experimental.ExperimentalNativeApi::class)
...@@ -53,4 +54,10 @@ actual fun pirntRandomHiLog(){ ...@@ -53,4 +54,10 @@ actual fun pirntRandomHiLog(){
@CName("testArkTsToKotin") @CName("testArkTsToKotin")
actual fun testArkTsToKotin() { actual fun testArkTsToKotin() {
print("测试ArkTs至Kotlin单向跳转") print("测试ArkTs至Kotlin单向跳转")
}
actual fun triggerANRByInfiniteLoop() {
while (true){
}
} }
\ No newline at end of file
...@@ -1138,6 +1138,7 @@ typedef struct { ...@@ -1138,6 +1138,7 @@ typedef struct {
void (*pirntRandomHiLog)(); void (*pirntRandomHiLog)();
void (*pirntSingleHiLog)(); void (*pirntSingleHiLog)();
void (*testArkTsToKotin_)(); void (*testArkTsToKotin_)();
void (*triggerANRByInfiniteLoop)();
} demo013; } demo013;
} dong; } dong;
} com; } com;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment