bytecode

How does bytecode get verified in the JVM?

限于喜欢 提交于 2019-12-18 02:30:47
问题 How does bytecode get verified in the JVM? 回答1: Oracle themselves have a little snippet page on how it works here. Basically, the JRE doesn't trust the JDK. That's because it has no knowledge of which JDK compiler created the class file. It treats the class file as hostile until verified. Expanding on that, the bytecode verification is a necessary step to protect from what Sun call a "hostile compiler". Sun's own Java compiler ensures that Java source code doesn't violate the safety rules but

Is there a llvm java front end that converts java source to llvm's intermediate form?

本秂侑毒 提交于 2019-12-17 23:30:01
问题 From what I've read, there is a llvm program that converts java bytecode to llvm's intermediate form called class2llvm. My question is, how do I access this. What front end do I have to install in order to access this. VMkit is their implementation of a JVM, but I am looking for how to compile the java source code with llvm, not how to run it. 回答1: The Java frontend translates Java bytecode (.class files) into LLVM bytecode. Take a look at this link: https://llvm.org/svn/llvm-project/java

Why the Java language need bytecode? Why java design in this way? [closed]

China☆狼群 提交于 2019-12-17 19:50:53
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . As I know a java developer, need to let their .java file to become .class, and the .class requires the JVM to convert to native code

Compile to java bytecode (without using Java)

Deadly 提交于 2019-12-17 17:34:28
问题 My compilers class is creating a language that we intend to compile to Java Bytecode. We have made plenty of progress and are nearing the time where it's time for code generation. We are having problems locating information on how to create .class files from our compiler. Do you have any resources that can give us some assistance? We already have plenty of documentation on the instruction set, but need information on how to directly fill out the class file/the writing of hex. We do not need

ASM Get exact value from stack frame

孤人 提交于 2019-12-17 16:52:59
问题 I have some method, which contains instrustion like ILOAD, and I want in some way to get value of stack after this instruction. Not just type, but exact value. I know I need to emulate method execution in order to do that, but I don't know how to make this properly. I have such method for test called main : sipush 15649 istore_0 /* c */ getstatic java/lang/System.out:Ljava/io/PrintStream; bipush 45 bipush 11 iload_0 /* c */ ... I want to get value, loaded by iload_0 . I tried to make Analyzer

Is there a way to obtain the bytecode for a class at runtime?

自作多情 提交于 2019-12-17 16:17:04
问题 In Java, is there a way (at runtime) to obtain the bytecode which defined a particular class? Put another way, is there a way to obtain the byte[] array passed to ClassLoader.defineClass(String name, byte[] b, int off, int len) when a particular class was loaded? I see that this method is declared final , so creating a custom ClassLoader to intercept class definitions seems out of the question. In the past, I have used the class's ClassLoader to obtain the bytecode via the getResourceAsStream

Best tool(s) for decompiling Lua bytecode? [closed]

こ雲淡風輕ζ 提交于 2019-12-17 10:54:33
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I am really having trouble finding a good working Lua bytecode decompiler. I'm trying to decompile some scripting files I found in a

how to find all methods called in a method?

霸气de小男生 提交于 2019-12-17 09:50:24
问题 how to take the methods of other classes invoked in a specific method? EXAMPLE method getItem1() public String getItem1() throws UnsupportedEncodingException{ String a = "2"; a.getBytes(); a.getBytes("we"); System.out.println(a); int t = Integer.parseInt(a); return a; } The methods called in getItem1() are: String.getBytes() String.getBytes(String) PrintStream.println(String) Integer.parseInt(String) 回答1: I would do this with javassist. So let's say you have the following class accessible in

Why are Java 8 lambdas invoked using invokedynamic?

不羁岁月 提交于 2019-12-17 07:02:37
问题 The invokedynamic instruction is used to help the VM determine the method reference at runtime instead hardwiring it at compile time. This is useful with dynamic languages where the exact method and argument types aren't known until runtime. But that isn't the case with Java lambdas. They are translated to a static method with well defined arguments. And this method can be invoked using invokestatic . So then what is the need of invokedynamic for lambdas, especially when there is a

is it possible to disable javac's inlining of static final variables?

99封情书 提交于 2019-12-17 04:27:58
问题 The Java static compiler (javac) inlines some static final variables and brings the values directly to the constant pool. Consider the following example. Class A defines some constants (public static final variables): public class A { public static final int INT_VALUE = 1000; public static final String STRING_VALUE = "foo"; } Class B uses these constants: public class B { public static void main(String[] args) { int i = A.INT_VALUE; System.out.println(i); String s = A.STRING_VALUE; System.out