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

  • 相关阅读:
    C++——文件的读写
    我以我血荐轩辕——记徐家福教授的演讲
    文件命名
    面向对象
    关于函数
    php跨域发送请求原理以及同步异步问题
    关于iframe
    关于url
    cookie
    call和apply
  • 原文地址:https://www.cnblogs.com/kingdelee/p/9700014.html
Copyright © 2011-2022 走看看