Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is 'a' the Java bytecode prefix for object references? [closed]

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

enter image description hereTaken from Wikipedia's entry on Java bytecode

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.

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

like image 408
FThompson Avatar asked Oct 02 '22 20:10

FThompson


1 Answers

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.

like image 172
Holger Avatar answered Oct 10 '22 14:10

Holger