什么Java编译器使用jsr指令

什么Java编译器使用jsr指令

本文介绍了什么Java编译器使用jsr指令,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java字节码语言具有JSR指令。

The Java bytecode language has the JSR instruction.

我用Java 7编译器编译的代码都不使用此指令。

None of the code I've compiled with the Java 7 compiler uses this instruction.

但是,有时我下载的Java二进制文件确实使用它,尽管很少。

However, sometimes Java binaries I've downloaded do use it, although rarely.

我有兴趣知道编译器做了什么使用该指令,以及Java代码构造将导致它们使用它。

I'd be interested to know what compilers do use the instruction, and what Java code constructs would cause them to use it.

编辑这不是重复,因为它引用了JSR字节码指令而不是Java规范请求

Edit this is not a duplicate as it refers to the JSR bytecode instruction and not a Java Specification Request

推荐答案

在Java 7类文件中甚至不允许使用JSR指令。它仅允许在49.0或更早版本的类文件中,对应于Java 5或更早版本。实际上,它早就不再使用了。

The JSR instruction is actually not even allowed in Java 7 classfiles. It is only allowed in version 49.0 or earlier classfiles, corresponding to Java 5 or earlier. In practice, it fell out of use long before that.

JSR / RET机制最初用于实现finally块。然而,他们认为代码大小的节省不值得额外的复杂性,并逐渐被淘汰。

The JSR/RET mechanism was originally used to implement finally blocks. However, they decided that the code size savings weren't worth the extra complexity and it got gradually phased out.

我不知道确切的版本,因为我找不到任何旧的编译器,但根据我在网上发现的讨论,似乎过渡发生在Java 1.2-1.3时代,不同编译器在不同时间切换。我从未见过这些旧编译器中的合法类文件,但你永远不知道它何时会发生。

I don't know the exact versions since I can't find any compilers that old, but based on discussions I found online, it seems that the transition happened in the Java 1.2-1.3 era, with different compilers switching at different times. I have never seen a legitimate classfile from one of these old compilers, but you never know when it could happen.

在实践中,我见过的JSR的唯一用途在野外是为了混淆。例如,Zelix Klassmaster曾经将它用作字符串解密代码。我也在我自己的几个Java破解中使用它。

In practice, the only use of JSR I've seen in the wild is for obfuscation. For example, Zelix Klassmaster used to use it for its string decryption code. I've also used it in several of my own Java crackmes.

这篇关于什么Java编译器使用jsr指令,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 07:47