Question

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

enter image description here Taken 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?

Was it helpful?

Solution

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.

OTHER TIPS

It might be because r refers to the type returnAddress which is used internally by the JVM.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top