- 浏览: 128728 次
- 性别:
- 来自: 上海
最新评论
字节码
enum Code { _illegal = -1, // Java bytecodes _nop = 0, // 0x00 _aconst_null = 1, // 0x01 _iconst_m1 = 2, // 0x02 _iconst_0 = 3, // 0x03 _iconst_1 = 4, // 0x04 _iconst_2 = 5, // 0x05 _iconst_3 = 6, // 0x06 _iconst_4 = 7, // 0x07 _iconst_5 = 8, // 0x08 _lconst_0 = 9, // 0x09 _lconst_1 = 10, // 0x0a _fconst_0 = 11, // 0x0b _fconst_1 = 12, // 0x0c _fconst_2 = 13, // 0x0d _dconst_0 = 14, // 0x0e _dconst_1 = 15, // 0x0f _bipush = 16, // 0x10 _sipush = 17, // 0x11 _ldc = 18, // 0x12 _ldc_w = 19, // 0x13 _ldc2_w = 20, // 0x14 _iload = 21, // 0x15 _lload = 22, // 0x16 _fload = 23, // 0x17 _dload = 24, // 0x18 _aload = 25, // 0x19 _iload_0 = 26, // 0x1a _iload_1 = 27, // 0x1b _iload_2 = 28, // 0x1c _iload_3 = 29, // 0x1d _lload_0 = 30, // 0x1e _lload_1 = 31, // 0x1f _lload_2 = 32, // 0x20 _lload_3 = 33, // 0x21 _fload_0 = 34, // 0x22 _fload_1 = 35, // 0x23 _fload_2 = 36, // 0x24 _fload_3 = 37, // 0x25 _dload_0 = 38, // 0x26 _dload_1 = 39, // 0x27 _dload_2 = 40, // 0x28 _dload_3 = 41, // 0x29 _aload_0 = 42, // 0x2a _aload_1 = 43, // 0x2b _aload_2 = 44, // 0x2c _aload_3 = 45, // 0x2d _iaload = 46, // 0x2e _laload = 47, // 0x2f _faload = 48, // 0x30 _daload = 49, // 0x31 _aaload = 50, // 0x32 _baload = 51, // 0x33 _caload = 52, // 0x34 _saload = 53, // 0x35 _istore = 54, // 0x36 _lstore = 55, // 0x37 _fstore = 56, // 0x38 _dstore = 57, // 0x39 _astore = 58, // 0x3a _istore_0 = 59, // 0x3b _istore_1 = 60, // 0x3c _istore_2 = 61, // 0x3d _istore_3 = 62, // 0x3e _lstore_0 = 63, // 0x3f _lstore_1 = 64, // 0x40 _lstore_2 = 65, // 0x41 _lstore_3 = 66, // 0x42 _fstore_0 = 67, // 0x43 _fstore_1 = 68, // 0x44 _fstore_2 = 69, // 0x45 _fstore_3 = 70, // 0x46 _dstore_0 = 71, // 0x47 _dstore_1 = 72, // 0x48 _dstore_2 = 73, // 0x49 _dstore_3 = 74, // 0x4a _astore_0 = 75, // 0x4b _astore_1 = 76, // 0x4c _astore_2 = 77, // 0x4d _astore_3 = 78, // 0x4e _iastore = 79, // 0x4f _lastore = 80, // 0x50 _fastore = 81, // 0x51 _dastore = 82, // 0x52 _aastore = 83, // 0x53 _bastore = 84, // 0x54 _castore = 85, // 0x55 _sastore = 86, // 0x56 _pop = 87, // 0x57 _pop2 = 88, // 0x58 _dup = 89, // 0x59 _dup_x1 = 90, // 0x5a _dup_x2 = 91, // 0x5b _dup2 = 92, // 0x5c _dup2_x1 = 93, // 0x5d _dup2_x2 = 94, // 0x5e _swap = 95, // 0x5f _iadd = 96, // 0x60 _ladd = 97, // 0x61 _fadd = 98, // 0x62 _dadd = 99, // 0x63 _isub = 100, // 0x64 _lsub = 101, // 0x65 _fsub = 102, // 0x66 _dsub = 103, // 0x67 _imul = 104, // 0x68 _lmul = 105, // 0x69 _fmul = 106, // 0x6a _dmul = 107, // 0x6b _idiv = 108, // 0x6c _ldiv = 109, // 0x6d _fdiv = 110, // 0x6e _ddiv = 111, // 0x6f _irem = 112, // 0x70 _lrem = 113, // 0x71 _frem = 114, // 0x72 _drem = 115, // 0x73 _ineg = 116, // 0x74 _lneg = 117, // 0x75 _fneg = 118, // 0x76 _dneg = 119, // 0x77 _ishl = 120, // 0x78 _lshl = 121, // 0x79 _ishr = 122, // 0x7a _lshr = 123, // 0x7b _iushr = 124, // 0x7c _lushr = 125, // 0x7d _iand = 126, // 0x7e _land = 127, // 0x7f _ior = 128, // 0x80 _lor = 129, // 0x81 _ixor = 130, // 0x82 _lxor = 131, // 0x83 _iinc = 132, // 0x84 _i2l = 133, // 0x85 _i2f = 134, // 0x86 _i2d = 135, // 0x87 _l2i = 136, // 0x88 _l2f = 137, // 0x89 _l2d = 138, // 0x8a _f2i = 139, // 0x8b _f2l = 140, // 0x8c _f2d = 141, // 0x8d _d2i = 142, // 0x8e _d2l = 143, // 0x8f _d2f = 144, // 0x90 _i2b = 145, // 0x91 _i2c = 146, // 0x92 _i2s = 147, // 0x93 _lcmp = 148, // 0x94 _fcmpl = 149, // 0x95 _fcmpg = 150, // 0x96 _dcmpl = 151, // 0x97 _dcmpg = 152, // 0x98 _ifeq = 153, // 0x99 _ifne = 154, // 0x9a _iflt = 155, // 0x9b _ifge = 156, // 0x9c _ifgt = 157, // 0x9d _ifle = 158, // 0x9e _if_icmpeq = 159, // 0x9f _if_icmpne = 160, // 0xa0 _if_icmplt = 161, // 0xa1 _if_icmpge = 162, // 0xa2 _if_icmpgt = 163, // 0xa3 _if_icmple = 164, // 0xa4 _if_acmpeq = 165, // 0xa5 _if_acmpne = 166, // 0xa6 _goto = 167, // 0xa7 _jsr = 168, // 0xa8 _ret = 169, // 0xa9 _tableswitch = 170, // 0xaa _lookupswitch = 171, // 0xab _ireturn = 172, // 0xac _lreturn = 173, // 0xad _freturn = 174, // 0xae _dreturn = 175, // 0xaf _areturn = 176, // 0xb0 _return = 177, // 0xb1 _getstatic = 178, // 0xb2 _putstatic = 179, // 0xb3 _getfield = 180, // 0xb4 _putfield = 181, // 0xb5 _invokevirtual = 182, // 0xb6 _invokespecial = 183, // 0xb7 _invokestatic = 184, // 0xb8 _invokeinterface = 185, // 0xb9 _invokedynamic = 186, // 0xba // if EnableInvokeDynamic _new = 187, // 0xbb _newarray = 188, // 0xbc _anewarray = 189, // 0xbd _arraylength = 190, // 0xbe _athrow = 191, // 0xbf _checkcast = 192, // 0xc0 _instanceof = 193, // 0xc1 _monitorenter = 194, // 0xc2 _monitorexit = 195, // 0xc3 _wide = 196, // 0xc4 _multianewarray = 197, // 0xc5 _ifnull = 198, // 0xc6 _ifnonnull = 199, // 0xc7 _goto_w = 200, // 0xc8 _jsr_w = 201, // 0xc9 _breakpoint = 202, // 0xca number_of_java_codes, // JVM bytecodes _fast_agetfield = number_of_java_codes, _fast_bgetfield , _fast_cgetfield , _fast_dgetfield , _fast_fgetfield , _fast_igetfield , _fast_lgetfield , _fast_sgetfield , _fast_aputfield , _fast_bputfield , _fast_zputfield , _fast_cputfield , _fast_dputfield , _fast_fputfield , _fast_iputfield , _fast_lputfield , _fast_sputfield , _fast_aload_0 , _fast_iaccess_0 , _fast_aaccess_0 , _fast_faccess_0 , _fast_iload , _fast_iload2 , _fast_icaload , _fast_invokevfinal , _fast_linearswitch , _fast_binaryswitch , // special handling of oop constants: _fast_aldc , _fast_aldc_w , _return_register_finalizer , _shouldnotreachhere, // For debugging // Platform specific JVM bytecodes #ifdef TARGET_ARCH_x86 # include "bytecodes_x86.hpp" #endif #ifdef TARGET_ARCH_sparc # include "bytecodes_sparc.hpp" #endif #ifdef TARGET_ARCH_zero # include "bytecodes_zero.hpp" #endif #ifdef TARGET_ARCH_arm # include "bytecodes_arm.hpp" #endif #ifdef TARGET_ARCH_ppc # include "bytecodes_ppc.hpp" #endif number_of_codes };
int i = 10; long l = 100L; float f = 0.1F; double d = 0.1; String s = "abc"; char c = 'a';0: bipush 10
int i2 = i; long l2 = l; float f2 = f; double d2 = d; String s2 = s; char c2 = c;
public class JavaNew { public static void main(String[] args) { Object obj = new Object(); } }反汇编结果:
public class JavaNewArray { public static void main(String[] args) { int test[] = new int[123]; } }反汇编结果:
>javap -c JavaNewArray Compiled from "JavaNewArray.java" public class JavaNewArray { public JavaNewArray(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>": ()V 4: return public static void main(java.lang.String[]); Code: 0: bipush 123 2: newarray int 4: astore_1 5: return }
String str = "string abc";0: ldc #2 // String string abc
String str = new String("string abc");
public class SynchronizedTest { private int value; public synchronized void set(int value) { this.value = value; } public void set0(int value) { synchronized (this) { this.value = value; } } }
private int value; public void set() { value = 100; }0: aload_0
private int value; public void assign() { int i = 100; }0: bipush 100
public class VariableSetTest { private int value; public static void main(String[] args) { VariableSetTest test = new VariableSetTest(); test.value++; System.out.println(test.value); } }public class VariableSetTest {
public class VariableSetTest2 { public static void main(String[] args) { int value = 0; value++; System.out.println(value); } }public class VariableSetTest2 {
顶
踩
发表评论
相关资源推荐
- 什么是JVM?java被称作是平台无关的编程语言?
要知道java虚拟机是什么,从虚拟机定义开始:虚拟机是模拟某种计算机体系结构,用来执行某种特定指令集的软件。 虚拟机分成系统虚拟机(VM ware 、Virtual box)和进程虚拟机(adobe flash player 、JVM等等),如果进一步细分,再加上高级语言的筛选,就有jvm、.net ClR 。怎样才算是JVM ?要成为jvm,要通过java tck(technology comp
- 深入Java虚拟机之基于栈指令的解释器执行引擎
解释执行Java被人定位于“解释执行”的语言。在jdk1.0时,定义还算准确,但后来当主流虚拟机中都包含了即使编译器后,Class文件中的代码 大部分的程序代码到物理机的目标代码或虚拟机能执行的指令集之前,都需要经过以下过程:如今,基于物理机、Java虚拟机,或者非Java的其他高级语言虚拟机的语言,大多数都会遵循这种基于现代经典编译原理的思路,在执行前先对程序源码进行词法分析和语法分析处理,把源
- 可以运行在JVM上的10种编程语言
- Scala基于JVM的编程语言
一、Scala简介 Scala是将面向对象和面向函数式整合在一起,基于JVM的编程语言。它由Martin Odersk于2001开发,2004年开始运行在JVM与.Net平台之上,由于其简洁、优雅、类型安全的编程模式而受到关注。 Scala六个特征: Java和scala可以无缝混编(因为都是基于JVM的编程语言) 类型推测(自动推测类型) 并发和分布式(Actor) 特质trait,特征(整合...
- JVM指令详解
一、未归类系列A 此系列暂未归类。 指令码 助记符 说明 0x00 nop 什么都不做 0x01 aconst_null 将null推送至栈顶 二、const系列 该系列命令主
- jvm 指令
转自:http://blog.csdn.net/lm2302293/article/details/6713147 1.反编译指令: javap -c xxx.class 2.jvm指令集 JVM指令集(指令码、助记符、功能描述) 指令码
- jvm hotspot 虚拟机源代码编译
- 基于JVM的编程语言Scala
Scala介绍 首先Scala是一门基于JVM的编程语言,具有很好的兼容性和并发性。 Scala六大特征 Java和Scala可以无缝混编 类型推测(自动推测类型) 并发和分布式 特质trait,特征(类似于java中interface和abstract结合,可以实现多继承) 模式匹配(类似于java switch) 高阶函数(包含两种:①函数的参数是函数②函数的返回是函数) Scala的安装与配...
- JVM 指令重排
1 概念 指令重排序是JVM为了优化指令,提高程序运行效率,在不影响单线程程序执行结果的前提下,尽可能地提高并行度。编译器、处理器也遵循这样一个目标。注意是单线程。多线程的情况下指令重排序就会给程序员带来问题。 不同的指令间可能存在数据依赖。比如下面计算圆的面积的语句: double r = 2.3d;//(1) double pi =3.1415926; //(2)
- jvm指令手册
java虚拟机的指令手册指南.....................
- 应对java反编译中的JVM指令
应对java反编译中的JVM指令 反编译的一个主要困难就是遭遇虚拟机指令,但是并不可怕。现举一例: 1: private static String b(String s) 2: { 3: char ac[]; 4: int i; 5: int j; 6: ac = s.toCharArray(); 7:
- 《Java平台体系》——第二章 JVM——从JVM指令到机器指令
我们前面也聊过JVM在规范层面引入字节码的好处,但将Java字节码翻译成机器指令是需要时间的。所以如何提高Java指令到机器指令的转化效率成为每一个JVM实现必须考虑的问题。如果发挥我们的想象力来理解应该有如下方法: □ 把Java字节码直接再次编译成本地可执行代码,执行的时候就没有JVM的事了。 □ JVM在运行期负责不断地解释了。 把Java字节码直接编译成机器码
- JVM指令重排
- JVM之指令重排分析
引言:在Java中看似顺序的代码在JVM中,可能会出现编译器或者CPU对这些操作指令进行了重新排序;在特定情况下,指令重排将会给我们的程序带来不确定的结果....
- jvm 指令集代码
jvm基本指令 iconst_1 int型常量值1进栈 bipush 将一个byte型常量值推送至栈顶 iload_1 第二个int型局部变量进栈,从0开始计数 istore_1 将栈顶int型数值存入第二个局部变量,从0开始计数 iadd 栈顶两
- 通过JVM指令分析Java中i++与++i的区别
通过jvm编译指令,来解析为何i++与++i运算过程的区别 i++ public void testFun(){ int y = 13; int x = y++; } 对应指令结构 public void testFun(); descriptor: ()V flags: (0x0001) ACC_PUBLIC ...
- JVM指令集整理
看字节码从这里开始。 指令码 助记符 说明 0×00 nop 什么都不做 0×01 aconst_null 将null推送至栈顶 0×02 iconst_m1 将int型-1推送至栈顶 0×03 iconst_0 将int型0推送至栈顶 0×04 iconst_1 将int型1推送至栈顶 0×05 ...
- Java JVM(十二):指令重排序
介绍指令重排序的相关知识。
- JVM字节码执行模型及字节码指令集
JVM执行模型,是如何把Class文件里的字节码转换成我们的虚拟机栈的操作指令,以及整个虚拟机栈的内部数据结构是怎样的,这篇文章后续会详细介绍,并且稍微扩展下JVM规范中的一些字节码指令集。
- JVM (三)--内存模型、变量可见性、指令重排、内存屏障