Talk about the opcode in the JVM.

Source: Internet
Author: User
JVM opcode loading and storage operation code
load --从局部变量加载值到栈上ldc --从池中加载常量到栈上store --把值从栈中移走,存到局部变量中dup --复制栈顶的值getField --从栈顶对象常量池中得到指定位置的域putField --把值放入对象在常量池中指定位置的域上
mathematical Operation opcode
add --栈顶端的2个值相加,并把结果存在栈中sub --栈顶端的2个值相减,并把结果存在栈中div --栈顶端的2个值相除,并把结果存在栈中mul --栈顶端的2个值相乖,并把结果存在栈中
Execute control opcode
if --如果符合特定条件,则跳转到特定分支的偏移处goto --无条件跳转到分支偏移处jsr --跳到本地子流程中,并把返回地址放到栈中ret --返回到索引的局部变量所指向的偏移地址tableswitch --用于实现switchlookupswitch --用于实现switch
Call Operation code
invokestatic --调用一个静态方法invokevirtual --调用一个‘常规’的实例方法invokeinterface --调用一个接口方法invokespecial --调用一个‘特殊’的实例方法(private)invokedynamic --动态调用,暂不考虑
Platform Operation Operation Code
new --为新对象分配内存,类型由指定位置的常量确定monitorenter --锁住对象monitorexit --解锁对象

The above section is excerpted from the "Java Programmer's Way of practicing" chapter Fifth: File and bytecode, 5.4 bytecode ' part of the content, please refer to the original version! Here is the main view is the classification , detailed description can be referred to: http://blog.csdn.net/lm2302293/article/details/6713147, there is a more detailed introduction, just a little old age!

Talk about the opcode in the JVM.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.