Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are JSR/RET deprecated Java bytecode?

Does anyone know why the JSR/RET bytecode pair is deprecated in Java 6?

The only meaningful explanation I found on the net was that they made code analysis by the runtime harder and slower to perform. Does anyone know another reason?

like image 397
George Penn. Avatar asked May 03 '11 14:05

George Penn.


People also ask

Which features is not available in Java?

There are no pointers in Java. There is no typedef option in Java. Since Java is a purely object oriented language, there are no global variables or global functions. The concept of templates present in C++ can't be found in Java.

What is a bytecode instruction?

Bytecode is computer object code that an interpreter converts into binary machine code so it can be read by a computer's hardware processor. The interpreter is typically implemented as a virtual machine (VM) that translates the bytecode for the target platform.

What is opcode in Java?

A Java Virtual Machine instruction consists of an opcode specifying the operation to be performed, followed by zero or more operands embodying values to be operated upon. This chapter gives details about the format of each Java Virtual Machine instruction and the operation it performs.


1 Answers

JSR and RET make bytecode verification a lot more difficult than it might otherwise be due to the relaxation of some normal bytecode constraints (such as having a consistent stack shape on entry to a JSR). The upside is very minor (potentially slightly smaller methods in some cases) and the continuing difficulties in the verifier dealing with odd JSR/RET patterns (and potential security vulnerabilities, and the associated runtime cost of full verification) make it a non-useful feature to continue having.

Stack maps and the lighter-weight verifier that is enabled as a result of the data are a big performance win during class loading for no sacrifice in safety.

like image 69
Trent Gray-Donald Avatar answered Oct 18 '22 23:10

Trent Gray-Donald