JVM の命令セットを眺める

合成命令の実装の前に JVM の命令セットを眺めてみた。(VM Spec

目に留まったものをいくつか列挙。

aconst_null Push the null object reference onto the operand stack.
bipush The immediate byte is sign-extended to an int value. That value is pushed onto the operand stack.
dconst_ Push the double constant (0.0 or 1.0) onto the operand stack.
if_acmp if_acmpeq/if_acmpne Branch if reference comparison succeeds
if_icmp if_icmpeq/if_icmpne/if_icmplt/if_icmpge/if_icmpgt/if_icmple Branch if int comparison succeeds
if ifeq/ifne/iflt/ifge/ifgt/ifle Branch if int comparison with zero succeeds
ifnonnull ifnonnull
ifnull ifnull
iinc Increment local variable by constant
swap Swap the top two values on the operand stack.
tableswitch Access jump table by index and jump


これを見ていると

  • よくあらわれる分岐
  • 定数の push

あたりは合成命令にして良さそう。(確かに Gauche でもそうだった)