Android多线程对私有属性访问为何会导致JIT unchain for all on thread 11 ?

情况大概是这样: class A() { 属性 a; void method() { 启动线程1 { while(true){ 读写a } } 启动线程…
关注者
25
被浏览
7143
这个必须是Android的问题。给问题加上了Android标签。

答案很简单,请参考爆栈站的一个问题下面的评论:concurrency - Android: Reduce time spent in garabage collection

"JIT unchain all" means a thread is taking a really long time to suspend, and the VM suspects the thread might be spinning in compiled code, so it's breaking apart some of the compiled code to ensure it hits a safe-point and suspends.

这是Dalvik VM一个小聪明但比较搓的地方⋯

以下备注自用:

JIT unchain all的动作在dvmJitUnchainAll()函数中实现,由Thread.cpp的waitForThreadSuspend()调用。