Questions tagged [bytecode-manipulation]

Low level Virtual Machine bytecode manipulations. Including creating/modifying/optimizing/etc bytecode for various VMs. For example JVM, Python VM, Lua VM, etc.

Why?

Using some VM based programming languages for period of time usually leads to realising that some parts of the code aren't translated into bytecode efficiently, might be optimized for the specific VM even more or we just need some functionality which isn't implemented into standard bytecode compiler/interpreter/etc, like:

  • bytecode encryption
  • bytecode linkage
  • etc.

Links:

More about bytecode:

383 questions
3
votes
1 answer

java.lang.VerifyError errors using Java ASM

I am trying to write an instrumentation module for Java programs. One particular instrumentation I am looking to add is collecting all the objects in a method's argument list and do some processing on them. Currently, to get the list of object…
arunxls
  • 124
  • 1
  • 9
3
votes
5 answers

Statically checking a Java app for link errors

I have a scenario where I have code written against version 1 of a library but I want to ship version 2 of the library instead. The code has shipped and is therefore not changeable. I'm concerned that it might try to access classes or members of the…
3
votes
1 answer

Getting a class bytcode on android

I want to send on the wire a class file (.class) for execution on a remote server. I can not use serialization, because the class does not exist on server side, and I want to add new classes dynamically. I don't want to use RMI. On Dekstop Java,…
3
votes
2 answers

Is jack and jill for android compatible with byte code weaving?

I just read the new blog post of @eric lafortune about Jack and Jill's new compiler on Android. http://www.saikoa.com/blog/the_upcoming_jack_and_jill_compilers_in_android And as I am working intensively on a bunch of new technologies built on byte…
Snicolas
  • 37,840
  • 15
  • 114
  • 173
3
votes
1 answer

Can i insert Bytecode inside my source code?

Can i write bytecode inside a method of a class so that the compiler bypasses that part since it is already compiled. Something similar to writing assembly programs in C language using "asm"...
AD.
  • 389
  • 1
  • 5
  • 20
3
votes
1 answer

is it possible to remove jumps with final boolean on java jit?

As we know some people say java JIT is faster then C++. I had some idea to utilize JIT and remove some instructions at runtime code. Here is sample code i tried: /** * Created by kadirbasol on 4/6/14. */ public class RemoveJump { public final…
3
votes
1 answer

Can one re-generate Java Stackmaps automatically?

We are using some closed-source commercial application framework that involves a byte-code enhancer. While the byte-code enhancer can process Java 7 byte-code, it requires the use of the "-XX:-UseSplitVerifier" flag when starting the JVM. We have…
Sebastien Diot
  • 7,183
  • 6
  • 43
  • 85
3
votes
0 answers

Can Scala 2.10 reflection emulate this Javassist functionality?

I would like to know if it is possible to rewrite this function using Scala-2.10 reflection instead of Javassist: def adaptClass(name1: String, name2: String) : Class[_] = { import javassist._ val cls = ClassPool.getDefault().getAndRename(name1,…
Daniel Mahler
  • 7,653
  • 5
  • 51
  • 90
3
votes
3 answers

Embed the existing code of a method in a try-finally block

I want to add instructions to the code of methods. These instructions should be executed after reaching and before leaving the method. In order to make sure that the latter instructions are always executed before leaving I want to put these in a…
3
votes
1 answer

Final field value not working in bytecode generation

I am trying to learn about how classes work. I am trying to add a final field to my class using this code dout.writeShort(1);//field count dout.writeShort(Modifier.PUBLIC|Modifier.STATIC|Modifier.FINAL);//modifiers …
Popgalop
  • 737
  • 2
  • 9
  • 26
3
votes
2 answers

Renaming imports on pre-compiled class files (Java)

What is the issue? I'm a Minecraft server admin/ server host / plugin developer, but find it an absolute annoyance to have to update my own personal plugins on every new release of the core game. It wasn't always like this, I've had plugins work…
Pangamma
  • 731
  • 12
  • 28
3
votes
1 answer

Java ASM4: super(ASM4);?

Well I was reading the PDF tutorial/documentation/book(if you will) on the ASM4 Bytecode library. I was trying out the examples and learn as I went by, by reading, and actually typing out the code, executing, then learning from the output. I came…
3
votes
1 answer

Byte Code off-card verifier for cap file

I need to verify a Java Card programme (a cap file) using an off-card byte code verifier. I have manually modify the informations in the cap file and i want to verify if the new cap file is well type. I try to use the…
AAA
  • 41
  • 4
2
votes
4 answers

Executing a piece of bytecode

Think about this sample code: ... try { stm1 stm2 stm3 } catch(){ ... } ... Suppose to run the code and within the try block an exception is raised. Execution flow goes into the catch block. Here, I would like to copy the bytecode…
Niko P
  • 41
  • 1
  • 3
2
votes
0 answers

How can I override a method with Javassist?

Basically I have a parent class Entity with a method test in it. I have a subclass MoreSpecificEntity, and I have a bunch of calls to MoreSpecificEntity.test and OtherEntity.test. Neither class overrides the test method, and I want to single out…