bytecode

Downgrade Java code 1.5 to 1.4 (bonus points: J2ME, Blackberry!!!)

I want to port some existing j2se libraries (e.g. Apache Compression libs) to use for Blackberry development, but there is a catch (and not just one). First, most java libs extensively use j2se collections and data types that are typically missing on j2me platforms — but that's theoretically solvable thanks to open-source j2se api imple...

JiBX on Android (or any other build-time bytecode manipulating library)

I'm considering the use of JiBX for a project that will have to run on both Blackberry and RIM. While it seems like J2ME use of JiBX has been considered by the community (as per JiBX jira tickets), Android is relatively new. The question is, therefore, this: has anybody had any success (or issues, for that matter) using JiBX on Android,...

How to detect array size in Java bytecode (FindBugs)

I'd like to find out about the size of an array being allocated by looking at the bytecode, if that information is known at compile time, of course. Background: I want to write a FindBugs detector (which looks at the compiled bytecode) and report certain occurences of array allocations. In order to filter out false positives I am not in...

how many places are optimized in Python's bytecode(version 2.5)

Can anyone tell me how many places there are optimized in Python's bytecode? I was trying to de-compile Python's bytecode these days,but I found that in Python's version 2.5 there are a lot of optimization.For example: to this code a,b,c=([],[],[])#build list the non-optimized bytecode before version2.5 is like that: BUILD_LIST_0 BUI...

Interpret something, and run the generated bytecode in Java?

I'm writing a toy interpreter with a REPL in Java. I'd like to generate bytecode from the language and run that, instead of interpreting an AST and running that instead. Since my Java is a bit rusty, is it possible to run generated bytecode on the fly on the JVM? ...

Scala - Java interop: can Scala emit enums in bytecode for Java to consume?

I have a project that is mixed Java/Scala, it is Java GUI code that makes use of a Scala library. Is there a way to write Scala code such that it will emit Java enums on compile time? The approaches I tried so far (sealed case classes, extend Enumeration) seem to generate normal classes which makes working with them from Java much hairie...

Java and "frontwards" compatiblity question

I've compiled my source with java version 1.6 using the parameters -source 1.5 and -target 1.5, and the compiler doesnt complain at all. Still, the application won't run with java 1.5 due to missing methods. Ofcourse I could rewrite some of my source code to be 1.5 compliant, but what I don't understand is; shouldn't the java bytecode i...

Bytecode Design?

I'm designing a programming language which compiles to an intermediary bytecode. However, I'm having a lot of trouble designing the bytecode structure. Does anybody have any pointers on how to represent a program in binary? Alternatively, are there any resources (preferably free) on how to do this? The closest I've found is the descr...

Learning about Java bytecode and the JVM

Hey all, In a recent question asked recently my simple minded answer highlighted many of my misconceptions about Java, the JVM, and how the code gets compiled and run. This has created a desire in me to take my understanding to a lower level. I have no problems with the low level understanding like assembly how ever bytecode and the...

Methodologies for designing a simple programming language

In my ongoing effort to quench my undying thirst for more programming knowledge I have come up with the idea of attempting to write a (at least for now) simple programming language that compiles into bytecode. The problem is I don't know the first thing about language design. Does anyone have any advice on a methodology to build a pars...

How do I byte-compile everything in my .emacs.d directory?

I have decided to check out Emacs, and I liked it very much. Now, I'm using the Emacs Starter Kit, which sort of provides better defaults and some nice customizations to default install of Emacs. I have customized it a little, added some stuff like yasnippet, color-themes, unbound, and other stuff. I've set up a github repository where ...

What tools are available to edit/create AVM2 bytecode?

I'd like to generate some bytecode for the Flash 10 AVM2 directly, i.e. without AS3. An assembler that produced a SWF file would be ideal. Does this exist? If not, what's the easiest way to get from assembler abc SWF? ...

Dynamic bytecode instrumentation - issue

I have a problem I am not able to solve. Let's assume we have the following two classes and an inheritance relationship: public class A { } public class B extends A { public void foo() {} } I want to instrument additional code such that it looks as follows: public class A { public void print() { } } public class B extends A...

ASM bytecode instrumentation for method entry / exit

I've created a JVMTI agent that does the following at a high level: onClassLoadHook send the bytecodes for the loaded class to a separate Java process that will instrument the class using ASM get the bytecodes back and load them In my seperate java process that instruments the loaded Java class I do the following : .. .. cr = n...

Is Java bytecode compatible with different versions of Java?

If I compile an application using Java 5 code into bytecode, are the resulting .class files going to be able to run under Java 1.4? If the latter can work and I'm trying to use a Java 5 framework in my Java 1.4 application, is there anything I should watch out for? ...

exec() bytecode with arbitrary locals?

Suppose I want to execute code, for example value += 5 inside a namespace of my own (so the result is essentially mydict['value'] += 5). There's a function exec(), but I have to pass a string there: exec('value += 5', mydict) and passing statements as strings seems strange (e.g. it's not colorized that way). Can it be done...

Java Byte Code Visualizer

What could help me in helping writing highly compact(least byte code count) programs in Java. Possibly I'm looking at: A tool that tells me how many byte codes a Class or a method generates. To visualize byte codes. The tool could tell me which areas need optimization in terms of byte code count or cpu cycles. A byte code chart woul...

Java, Most Expensive Statements?

What are the most expensive (both in terms of bytecode and cpu cycles) statements in the Java Programming language? ...

Bytecode instrumentation generating java verifier error

Hi, I am using ASM in order to do bytecode instrumentation for Java programs. What I'm doing is simple - When instrumenting a method, if the instruction is a PUTFIELD, simply do a DUP_X1 right before the instruction, then visit the PUTFIELD and inject a function call with an argument that includes the DUP'ed stack entry. ...

Can you "compile" PHP code?

I know that PHP is compiled to byte code before it is run on the server, and then that byte code can be cached so that the whole script doesn't have to be re-interpreted with every web access. But can you "compile" php and upload a binary-ish file, which will just be run by the byte code interpreter? ...