Jasmin 汇编器使用数组赋值语句

Jasmin assembler using array assignment satements

var a int[1];
var aa int[1];
aa = a;

假设我们想在 java jvm 中编译这样的东西。它会接缝,一个人会做一个

ldc 1
newarray    int
astore  0
ldc 1
newarray    int
astore  1
aload   0
istore  1

但是这是行不通的,它正在抛出一个 (class: test, method: main signature: ()V) Expecting to find integer on stack 你能不能 aload 一个数组到一个局部变量中?

这是导致问题的 istore 指令。在 Virtual Machine Specification 中它被定义为

Store int into local variable

您正在尝试存储数组引用,因此 astore 是正确的指令类型,就像您在 newarray 指令之后所做的那样。