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

  • 相关阅读:
    【马化腾如何工作】
    NOKIA格机方法
    C和C++资源
    JSP/Servlet 中的汉字编码问题
    好听力网站
    GRE单词法
    Visual Studio 2008的一些小技巧
    从键盘输入一个字符串,将其中的大写字母变小写字母,小写字母变大写字母,并输出 。
    中图文分类号 TP自动化技术、计算机技术
    保护您眼睛视力 对Win7/Vista/XP作如下设置
  • 原文地址:https://www.cnblogs.com/kingdelee/p/9700014.html
Copyright © 2011-2022 走看看