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

LibGDX bytecode reader/writer

I am working on a mapeditor for my game. And I need a way to save the map. I'm working with libGDX. And use the Android and Desktop Backends. The maps are 2d and should contain: Shape / Body data (vertices/radius/type...) for…
user4959397
1
vote
1 answer

Java bytecode error using AspectJ

I am trying to modify the working of some code using AspectJ. The aspectJ code is of the form (Profiler.java): public aspect Profiler { pointcut beforeMethod(): !within(Profiler); before(): beforeMethod() { /* Do something */ } …
Arani
  • 400
  • 6
  • 21
1
vote
2 answers

How is the stacktrace printed when the program is compiled?

This is a very simple question: When you compile a java program, it is converted to byte code, so therefore, every line number of the .java or .class file is missed (I think so, probably I am wrong..). So, when you print a stack trace, how does it…
Pablo Matias Gomez
  • 6,614
  • 7
  • 38
  • 72
1
vote
1 answer

Adding a parameter to function in Java Bytecode

I've got compiled .jar plugin with X.class file. X.class file contains a method Y with parameters Y(string s1, string s2....). I need to pass to one more string - so i launched reJ and dirtyJoe, edited a descriptor of my Y method, changed maximum…
1
vote
1 answer

Obtain the index of the currenr interpreted bytecode instruction in a method

I want to obtain index number of a bytecode in a method when visiting this bytecode. For example, given a bytecode sequence below, the index number for the invokevirtual is 7 (The method body is visited with SKIP_DEBUG). public…
shijie xu
  • 1,975
  • 21
  • 52
1
vote
1 answer

Purpose of iconst_x

Why do we have the iconst_* instructions? Why would I ever want to use these instead of bipush? I found this StackOverflow question when searching but it does not properly answer my question.
1
vote
1 answer

NoClassDefFoundError when method call inserted via instrumentation is called via sun.reflect.NativeConstructorAccessorImpl.newInstance0

I have created a JavaAgent using ASM that inserts method calls (INVOKESTATIC org/test/Logger/Log) at specific areas of in a class being loaded. The inserted method calls (org/test/Logger/Log) are declared in the JavaAgent itself. This works under…
1
vote
0 answers

How to call WebApp with premain

I have a WebApplication in Java that has 3 threads which just sends some data to a program that calls the application and saves data (log files from log4j) to a h2 database. Now I don't want to have 3 threads which are more or less the same. So I'm…
1
vote
2 answers

ByteBuddy not redefining static method

I am trying to redefine 2 methods using ByteBuddy, like so: ClassLoader classLoader = ClassLoader.getSystemClassLoader(); ClassLoadingStrategy.Default classLoadingStrategy = ClassLoadingStrategy.Default.INJECTION; new…
Anon10W1z
  • 167
  • 10
1
vote
1 answer

Convert this 32-Bit Machine Code to Assembly language

What is the easiest way to convert the following Bytecode to Assembly language? 83 EC 8B 55 51 53 AC C4 05 8B 64 57 00 00 00 30 8B 0C 40 8B 00 8B 0C 40 58 8B 00 8B 03 D8 89 18 50 8B 3C 40 8B DA 01 78 DF 01 20 7A 07 8B C9 31 38 81 D8 01 61 65 72 43…
nemoest
  • 81
  • 1
  • 10
1
vote
2 answers

Where can I find the opcode numbers for the LLVM bitcode?

Where can I find the LLVM bytecode representation of the LLVM IR language? Like this = add , , but in binary form like this incept for LLVM instead of JVM. More specifically I want the opcode numbers so I can study the…
zeitue
  • 1,674
  • 2
  • 20
  • 45
1
vote
1 answer

How to reuse original frame information from a methodNode in asm to create `org.objectweb.asm.tree.analysis.Frame`

How can I construct a org.objectweb.asm.tree.analysis.Frame for each instruction in a method using only FrameNodes and LocalVariableNodes from the MethodNode? Context While instrumenting some code I need all the locals and stack types for some of…
Daniel Sperry
  • 4,381
  • 4
  • 31
  • 41
1
vote
2 answers

Is there any difference in those two way of casting?

In the following code Object o; //getting o Integer i = (Integer) o; //1 Integer j = Integer.class.cast(mapValue); //2 is there any difference between //1 and //2? I mean, in JVM all those cases are going to be carried out with the same…
St.Antario
  • 26,175
  • 41
  • 130
  • 318
1
vote
1 answer

Accessing Nashorn generated bytecode

Nashorn translates javascript source code directly into memory. Is there any way to access the bytecode just for reading purpose? (manipulation isn't required). If there is, kindly explain in detail as I have limited experience... I am aware of…
Stradm
  • 47
  • 1
  • 5
1 2 3
99
100