Different behaviour of java bytecode

前端 未结 6 1254
面向向阳花
面向向阳花 2020-12-30 03:17

I am a newbee in Java Bytecode. I was understanding the bytecode through some examples but I got stuck in an example.
These are my java and bytecode file



        
相关标签:
6条回答
  • 2020-12-30 03:22

    iconst_n is defined for n from 0 to 5

    There's no iconst_9, so you have to use the equivalent (but less efficent) bipush

    0 讨论(0)
  • 2020-12-30 03:24

    the i_const instruction only range from 0~5, so it must spit the instuction by push and store

    0 讨论(0)
  • 2020-12-30 03:32

    there is no iconst_9 instruction

    0 讨论(0)
  • 2020-12-30 03:39

    The instructions iconst_* are optimised to work with small and specific numbers while bipush (push a byte onto the stack as an integer value) works for bigger numbers.

    0 讨论(0)
  • 2020-12-30 03:42

    There is no iconst_9 instruction. So to push 9 you cannot use iconst. You must go for bipush

    0 讨论(0)
  • 2020-12-30 03:47

    iconst can push constant values -1 to 5. It is a single-byte instruction.

    bipush can push constant values between -128 and 127. It is a two-byte instruction.

    To push 9 you cannot use iconst. There is no iconst_9 instruction.

    0 讨论(0)
提交回复
热议问题