Questions tagged [bytecode]

"bytecode" is a blanket term for opcodes that are consumed by a virtual machine. For example, the JVM runs bytecode stored in .class files and the CPython interpreter runs bytecode stored in .pyc files.

Bytecode, also known as p-code (portable code), is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normally numeric addresses) which encode the result of parsing and semantic analysis of things like type, scope, and nesting depths of program objects. They therefore allow much better performance than direct interpretation of source code.

The name bytecode stems from instruction sets which have one-byte opcodes followed by optional parameters. Intermediate representations such as bytecode may be output by programming language implementations to ease interpretation, or it may be used to reduce hardware and operating system dependence by allowing the same code to run on different platforms. Bytecode may often be either directly executed on a virtual machine (i.e. interpreter), or it may be further compiled into machine code for better performance.

Since bytecode instructions are processed by software, they may be arbitrarily complex, but are nonetheless often akin to traditional hardware instructions; virtual stack machines are the most common, but virtual register machines have also been built. Different parts may often be stored in separate files, similar to object modules, but dynamically loaded during execution.

Source: Wikipedia (Bytecode)

Understanding bytecode makes you a better programmer https://www.ibm.com/developerworks/ibm/library/it-haggar_bytecode/

2276 questions
1
vote
1 answer

Compile lua to bytecode to run on embded linux

I compiled lua on PC with luac and run it on MIPS device. It shows lua: bad header in precompiled chunk. I searched for it and seems bytecode not portable. How to crosscompile it?
eri
  • 3,133
  • 1
  • 23
  • 35
1
vote
1 answer

Create method using ASM

Using ASM, I need to modify a method, then I need to insert two methods into it. I have gotten the modification fine, but how to I create a method? Do I need a separate MethodVisitor, or can I use the same one, but call something else?
JD9999
  • 394
  • 1
  • 7
  • 18
1
vote
0 answers

How can I use the class2llvm tool and where is its documentation?

I need to transform a Java class file to LLVM IR. I have googled and heard that there exists a tool 'class2llvm' for that purpose. However, its documentation seems missing or at least, I cannot find any. How can I install and use class2llvm, and…
zell
  • 9,830
  • 10
  • 62
  • 115
1
vote
1 answer

Byte code version mismatch when using subset

I have been working on the same R script now for 5 months, had some minor coding problems, but this morning I got a problem that makes me unable to run the whole script. To clean my imported data I use a lot of subset(), but this morning when…
Shark167
  • 581
  • 1
  • 8
  • 16
1
vote
1 answer

Track Method Dependencies Via ASM

I'm trying to track method dependencies via ASM. For example, lets say I have class like this: class Test{ public void methodToRun(){ Depedencies.startTracking(); //method calls here Depedencies.stopTracking(); } } and…
Ant's
  • 13,545
  • 27
  • 98
  • 148
1
vote
1 answer

CgLib Enhancer private Constructor

I'm trying to create a proxy with cglib for a class that only has a private constructor. I can't change the visibility, as it's a library method. I found this post, and followed the instrcutions to override the filterConstructors method, but when…
skappler
  • 722
  • 1
  • 10
  • 26
1
vote
1 answer

ASM 5.0.3 With Java 1.8 incorrect maxStack with Java.lang.VerifyError: Operand stack overflow

Using ASM 5.0.3 (with Java 1.8.0_65 & Tomcat 8.0.30) , Visiting one of the JSP (date.jsp) Method - _JSP(_jspService) , getting below exception javax.servlet.ServletException: java.lang.VerifyError: Operand stack overflow Exception Details: …
Ramesh Subramanian
  • 944
  • 1
  • 12
  • 28
1
vote
1 answer

Hex editing Java bytecode throwing ClassFormatError

While researching Java, bytecode editing in particular, I stumbled across this tutorial, which guides through the steps of editing compiled Java .class files with a hex editor. Intrigued, I gave it a go. I made sure I typed everything in correctly,…
Hatchet
  • 5,320
  • 1
  • 30
  • 42
1
vote
1 answer

Java ByteCode on String Array [Bad Type in putstatic]

I'm trying to write JVM bytecode for the class equivalent to the following: public class foo { static String[] crr; public static void printString(String str) { System.out.println(str); } public static void main(String[] args) { …
1
vote
0 answers

CannotCompileException when modifying line of code

For a project I am doing, I need to do bytecode manipulation on a method inside an external jar file, using javassist. This is working fine, except that I have a source code error, which I can't see to work out what the problem is. So I created an…
JD9999
  • 394
  • 1
  • 7
  • 18
1
vote
1 answer

Method marked as abstract but not shown by javap

Its a very peculiar case, seems to be a .class file corruption. Our Application depends on a dependency provided by other team. There are 2 java files of relevance: FTGService and FTGServiceLight implements FTGService. So when I do javap -p…
Jatin
  • 31,116
  • 15
  • 98
  • 163
1
vote
1 answer

Type Annotation Location Erasure

I'm currently experiencing a strange scenario where it appears that some of the TypeAnnotation coordinate/path data ends up getting erased. The interface below, while obviously not anything you'd see in actual code (this is just for experimental…
1
vote
1 answer

How to intercept a constructor

I want to intercept all methods who are annotated with @Inject. The following test shows that it works fine with methods but it does not with constructors. What am I missing? I tried to add a custom method matcher and I noticed I was never given a…
user3408654
  • 301
  • 1
  • 13
1
vote
0 answers

LLVM bytecode analyzer issue

I am wondering why there are so many mis-matches between the llvm-bcanalyzer help page on LLVM_website and the current v3.8 that I am using. I have checked them with v3.0 and v3.4 and none of them are consistent. Secondly, apparently no-matter what…
Amir
  • 1,348
  • 3
  • 21
  • 44
1
vote
1 answer

Why does a jar get corrupted if i change the bin folder in eclipse?

I have a finished program which compiled successfully and works just fine. Out of interest, I wanted to see the bytecode in the project folder in eclipse (under the bin folder). I accidentally saved it as a .txt rather than a .class and now the jar…
TheSporech
  • 17
  • 5