zoukankan      html  css  js  c++  java
  • 【JVM】-NO.110.JVM.1 -【hsdis jitwatch 生成查看汇编代码】

    Style:Mac

    Series:Java

    Since:2018-09-10

    End:2018-09-10

    Total Hours:1

    Degree Of Diffculty:5

    Degree Of Mastery:5

    Practical Level:5

    Desired Goal:5

    Archieve Goal:3

    Gerneral Evaluation:3

    Writer:kingdelee

    Related Links:

    http://www.cnblogs.com/kingdelee/

    http://yunjiechao-163-com.iteye.com/blog/2386423

    https://blog.csdn.net/unei66/article/details/26477629

    https://blog.csdn.net/hengyunabc/article/details/26898657

    1.需要下载编译,如果编译失败,可以下载已经编译好的

    https://www.chrisnewland.com/updated-instructions-for-building-hsdis-on-osx-417

    最终要将 hsdis-amd64.dylib

    存放在以下目录:

    /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/server 

    public class DynamicDispatch {
    
    //	static abstract class Human {
    //		protected abstract void sayHello();
    //	}
    
    	static  class Human {
    		protected  void sayHello(){
    			System.out.println("hello");
    		}
    	}
    
    	static class Man extends Human {
    		@Override
    		protected void sayHello() {
    			System.out.println("man say hello");
    		}
    	}
    
    	static class Woman extends Human {
    		@Override
    		protected void sayHello() {
    			System.out.println("woman say hello");
    		}
    	}
    
    	public static void main(String[] args) {
    		Human man = new Man();
    		Human woman = new Woman();
    		man.sayHello();
    		woman.sayHello();
    		man = new Woman();
    		man.sayHello();
    	}
    }
    

     

    用如下命令行可以更多地了解内联优化的实际情况以及优化发生的级别:

    java -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining -XX:+TieredCompilation DynamicDispatch

      

    查看JIT生成的汇编代码

    -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
    

    如果只查看某个方法产生的汇编代码,可以使用命令:

    
    

    https://zeroturnaround.com/rebellabs/why-it-rocks-to-finally-understand-java-jit-with-jitwatch/  

     

    -XX:+UnlockDiagnosticVMOptions-XX:+PrintAssembly

  • 相关阅读:
    记一次不好不坏的数据库优化
    洛谷 P3065 [USACO12DEC]First! G(字典树,环的判断)
    洛谷 P3879 [TJOI2010]阅读理解(trie树)
    洛谷 [USACO08DEC]Secret Message G(01字典树)
    洛谷 P5149 会议座位(归并排序,trie树)
    2019强网杯babybank writeup及浅析
    python多线程的学习
    关于信息安全的学习
    FineCMS v5.4.1 后台getshell
    二次注入的复现
  • 原文地址:https://www.cnblogs.com/kingdelee/p/9700014.html
Copyright © 2011-2022 走看看