java - "taking operands immediately following the opcode"是什么意思?

标签 java jvm stack

我正在看书Inside the Java 2 Virtual Machine我不明白这意味着什么:

The Java Virtual Machine is stack-based rather than register-based because its instructions take their operands from the operand stack rather than from registers. Instructions can also take operands from other places, such as immediately following the opcode (the byte representing the instruction) in the bytecode stream, or from the constant pool.

谁能帮我解决这个问题:

Instructions can also take operands from other places, such as immediately following the opcode

,也许有一个例子?

最佳答案

例如,有一个 iinc 指令,它向局部变量添加一个常量值,如下所示:

iinc 1, 8

这意味着“将 8 添加到局部变量 #1”。常量8直接写在字节码中,位于iinc指令代码和常量1之后:0x84 0x01 0x08

关于java - "taking operands immediately following the opcode"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30012078/

相关文章:

java - 为什么 Hibernate 在使用 IDENTITY 标识符生成器时禁用 INSERT 批处理

java - Intellij Idea 使用什么 JVM 启动?

android - 将特定 Activity 作为堆栈中的根 Activity

java - 在java中同时制作两个对象

java - 无法启动 Swing 计时器

java - 针对 C2 编译期间 Java 高内存使用率生成编译器重放数据文件

Java 流 sorted() 行为取决于下一个 takeWhile() 调用

c - 当我使用 valgrind 运行这段代码时,它的执行方式与我在没有 valgrind 的情况下运行它时的执行方式不同

algorithm - 使用队列实现栈——最好的复杂度

java - MouseDragged 有效或 mouseMoved 有效,但不能同时有效