简体   繁体   English

jsr关键字是什么意思?

[英]What does the jsr keyword mean?

I'm looking at some Java code, and I've noticed the following: 我正在看一些Java代码,我注意到以下内容:

if (!foo(bar, baz, qux)) {
    i = 0; jsr 433;
}

javac chokes on it, saying it's not a statement and that a semicolon is expected after the keyword jsr . javac嘲笑它,说这不是一个声明,并且在关键字jsr之后预计会有分号。

I did some Googling, and I found some code containing the same thing , which leads me to believe it's there intentionally (even though they weren't able to get it to compile either). 我做了一些谷歌搜索,我发现一些代码包含相同的东西 ,这让我相信它是故意的(即使他们也无法让它编译)。 So what does jsr do? jsr做了什么? How does one get code containing it to compile? 如何获取包含它的代码进行编译?

I'm close to sure that this code is coming from a Java decompiler. 我很接近这个代码来自Java反编译器。

The JSR 432 smells like a decompiler note, where the decompiler found a "jump" code but doesn't have a clue on how to express it in java language. JSR 432闻起来像一个反编译注释,反编译器发现了一个“跳转”代码,但没有关于如何用java语言表达它的线索。

You are most likely looking at the results of decompiling some code which the decompiler wasn't able to cope with. 您很可能会查看反编译器无法处理的某些代码的反编译结果。 JSR is the mnemonic for the jump subroutine bytecode; JSR是跳转子程序字节码的助记符; see this page for a listing. 请参阅此页面以获取列表。 So jsr 432 may mean call a private method at bytecode address 432 . 因此jsr 432可能意味着在字节码地址432处调用私有方法。 However, the decompiler cannot figure that out, so maybe the method is synthetic, or something else is going on. 但是,反编译器无法解决这个问题,所以也许这个方法是合成的,或者其他的东西正在进行中。

EDIT 编辑

Googled example you found is definitely decompiler output, and it looks like the part with the JSRs is either cause by obfuscation, byte code modification / generation, or by a decompiler stuffup. 您发现的Google搜索示例肯定是反编译器输出,看起来JSR的部分是由混淆,字节码修改/生成或反编译器填充引起的。

jsr 433 is not a valid Java statement. jsr 433不是有效的Java语句。 It is a VM instruction which stands for "Jump to Sub Routine" (See the VM Spec for more information). 它是一个VM指令,代表“跳转到子程序”(有关更多信息,请参阅VM规范 )。 The decompiler inserted it because it didn't understand the bytecode instruction (perhaps it was obfuscated) and so couldn't decompile it into valid Java source. 反编译器插入它是因为它不理解字节码指令(可能是它被混淆了),因此无法将其反编译成有效的Java源代码。

JSR stands for Java Specification Request. JSR代表Java规范请求。

There's probably a typo in that code and it should have been 该代码中可能存在拼写错误,应该是这样的

if (!foo(bar, baz, qux)) {
    i = 0; //jsr 433;
}

It seems to me that somebody did a non working checkin for some reason. 在我看来,有些人出于某种原因做了非工作登记。

But, looking at that code, it looks awfully artificial, so it's probably decompiled code, as Andreas_D already stated. 但是,看看那段代码,它看起来非常人为,所以它可能是反编译代码,正如Andreas_D已经说过的那样。

Mini update : check the bottom comment: 迷你更新 :查看底部评论:

/* Location:           C:\Users\Matteo\Downloads\FreeDownApplet.signed.jar
 * Qualified Name:     FreeDownApplet
 * JD-Core Version:    0.5.4
 */

From this, I'd say somebody made a signed jar file that was obfuscated, and whoever posted that code decompiled it. 从这一点来看,我会说有人制作了一个被签名的jar文件,这个文件被混淆了,发布该代码的人反编译了它。

Update 2 : Googling "JD core" yields http://java.decompiler.free.fr/ as the first result. 更新2 :谷歌搜索“JD核心”产生http://java.decompiler.free.fr/作为第一个结果。

It is not in the list of Java keywords . 它不在Java关键字列表中 So I don't believe it has any meaning. 所以我不相信它有任何意义。 And I doubt it's possible to compile it. 我怀疑是否可以编译它。

JSR (which stands for Jump Subroutine) is part of the Java Virtual Machine Specification. JSR (代表Jump Subroutine)是Java虚拟机规范的一部分。 It's a instruction set for the JVM. 它是JVM的指令集。

Brief description 简要描述;简介

The address of the opcode of the instruction immediately following this jsr instruction is pushed onto the operand stack as a value of type returnAddress . 紧跟在此jsr指令之后的指令的操作码的地址被作为returnAddress类型的值压入操作数堆栈。

This can be found on the JVM book 2nd edition . 这可以在JVM第2版上找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM