Anyone with a better idea?
java.lang.ClassFormatError: Field "slot$1" in class com/infomancers/
tests/YielderTests$1 has illegal signature "Ljava/lang/Object"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at com.infomancers.tests.YielderTests.array(YielderTests.java:23)
Would it be possible to determine the type of the variable based on
the type of instruction that stores the variable. E.g. astore -
object reference, istore - integer value.
Mike.
You can read my post about the problems of determining the type of the
slot, but to be brief, the slot is an interchangeable 4 bytes
container. It can be used for anything, and in different scopes it can
be used for different types - That's why I originally used the
debugging information, since it contained the type for the slot at a
selected scope.
At the time I didn't realise it was the debugging information I was
using, though. It makes sense now that I think back to it. So, as I
said - I can't determine the type of the slot from the operations done
on it. I can, for optimisation's sake, try to determine it by scanning
all the uses of the slot along a code segment and try to use a
primitive if its only used for that primitive type - but I prefer to
do optimisations after I get the yielder back to work, even on non-
debug code.
This actually works great, except for anything to do with arrays.
Take for example the "arraySize" test. The yielder method is:
int[] l = arr;
yieldReturn(l.length);
Which needs to be translated to:
slot$1 = arr;
yieldReturn(((int[])slot$1).length);
But how can I infer that slot$1 is an array at any given time? I
couldn't think of a way, so I don't at the moment. Which causes the
following bytecode:
ALOAD 0
GETFIELD slot$1
ARRAYLENGTH
Which throws the VeryifyError of "Expecting to find array on stack" -
the loaded item into the stack needs to first be cast using a
CHECKCAST operator - but cast to what?
I'm too tired for this today. I'll try to resolve this tomorrow - But
in the meantime, see if the current version works for you without
debugging information (unless you're using arrays!)
On Aug 28, 7:54 pm, mikeb01 <mike...@gmail.com> wrote:
Get the latest trunk, it should be working without debugging
information. However, it is using the autoboxing method, and there is
still a minor bug with arrays of objects (Object[] or multidimensional
arrays). I'll fix it later today.
On Aug 30, 7:20 am, aviad.infomanc...@gmail.com wrote:
java.util.NoSuchElementException
at java.util.LinkedList.remove(LinkedList.java:788)
at java.util.LinkedList.removeLast(LinkedList.java:144)
at com.infomancers.collections.yield.asm.LocalVariableMapper
$MyMethodAdapter.visitVarInsn(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at
com.infomancers.collections.yield.asm.YielderTransformer.transform(Unknown
Source)
Mike.
On Aug 30, 8:24 pm, mikeb01 <mike...@gmail.com> wrote: