为什么“ a”是对象引用的Java字节码前缀? [英] Why is 'a' the Java bytecode prefix for object references?

查看:93
本文介绍了为什么“ a”是对象引用的Java字节码前缀?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

特定于类型的Java字节码指令具有单字符前缀以指定该指令所涉及的类型。

Type-specific Java bytecode instructions have single-character prefixes to specify the type that the instruction relates to.


来自 Wikipedia在Java字节码上的条目

在每种情况下,前缀选择都是有意义的,由类型的第一个字母组成(布尔值除外,布尔值没有指令前缀)。但是,对象引用前缀似乎不合逻辑,因为它们同时显示为 o r (两个第一字母) ) 免费的。相反,对象引用指令使用 a 作为其前缀。

In each case, the prefix choice makes sense, consisting of the first letter of the type (except boolean, which doesn't have an instruction prefix). The object reference prefix, however, does not seem logical, seeing as both o and r (the two first-letters) are free. Instead, object reference instructions use a as their prefix.

为什么对象引用字节码指令的前缀为 a ,而不是看似更合适的 o r p>

Why are object reference bytecode instructions prefixed with a, rather than the seemingly more appropriate o or r?

推荐答案

该表存在问题。没有用于处理布尔值的字节码指令,因此没有以 z开头的指令名称。 z可能来自类型签名,其中 Z 表示 boolean ,但这与类型签名 J 代表 long ,而 L 表示一个类名。因此那里没有一致性。对于指令 a可能代表地址,因为 astore 指令也能够将返回地址存储到本地变量中。也许,在更早的时间内,更多……这些指令能够处理除对象以外的地址,并且后来受到限制。

That table is questionable. There is no byte code instruction dealing with boolean thus there is no instruction name starting with "z". The "z" might come from type signatures where Z stands for boolean but that’s not the same as for type signatures J stands for long and L starts a class name. So there’s no consistency there. For instructions "a" might stand for address as astore instructions are able to store return addresses into a local variable too. Maybe, at an earlier time more of these a… instructions were able to deal with addresses other than objects and that has been limited later.

这篇关于为什么“ a”是对象引用的Java字节码前缀?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆