-XX:CompileCommand

用法:-XX:CompileCommand=_
例子:
-XX:CompileCommand=exclude,com/app/App,test
-XX:CompileCommand=exclude,com.app.App::test
-XX:CompileCommand=exclude,com/app/App::test
表示com.app.App.test这个方法将不会进行jit编译,一直解释执行,从而绕过jit相关的bug

当JVM crash的时候,查看error log:

  
---------------  T H R E A D  ---------------  
  
Current thread (0x00002aab4803e800):  JavaThread "CompilerThread1" daemon [_thread_in_native, id=28511, stack(0x0000000040d0d000,0x0000000040e0e000)]  
  
siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x000000000000002c  
  
Current CompileTask:  
C2:171% !   
com.app.App.test(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object; @ 56 (492 bytes)  
  

当在错误日志中显示“the Current thread is a JavaThread named CompilerThread0, CompilerThread1, or AdapterCompiler”时,可能是触发了JVM的编译器的BUG导致的。

此时需要去掉JIT编译优化,那么就需要用到上面的参数,在启动参数中加上-XX:CompileCommand=exclude,com/app/App::test,使得导致crash的方法不进行编译优化。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容