日期:2014-05-20  浏览次数:20721 次

关于sipush
接触到sipush,对几个方面有些疑惑,先上图:



push的是short,但是这命令是将源数据按两个byte的方式接收的,而且指明是unsigned,不知道这里透露出了什么讯息?大家都知道,java中的byte是signed的,就是说在class文件中存储的short数据是不是按两个byte并列的方式存储的,unsigned意味着它可能是以十进制非负数的形式存储?如果是这样,目的是为了节约空间了


------解决方案--------------------
SIPUSH pushes a signed short onto the stack。
SIPUSH is a signed integer in the range -32768 to 32767

push two-byte signed integer

sipush takes a single parameter, <n> (a 16-bit signed integer), sign extends it to a 32-bit int, and pushes the resulting int onto the operand stack.

sipush is typically more efficient than ldc. It also occupies fewer bytes in the class file.

具体目的是干什么,不知道了。
------解决方案--------------------
这里的byte不是java的数据类型byte,内存多少个byte,就这个东东。

lz把简单问题复杂化了。

想个最基础的问题,一个int数 0xffffffff 占4个字节,在内存里怎么表示的? 记住只有最高位的1才是符号位。