-
1. Re: Array access
chiba Jun 27, 2006 2:47 PM (in response to kabirkhan)Implementing this spec. would be tricky. Because:
test.array[5] = 10;
is compiled into:long[] a = test.array; a[5] = 10;
It would be difficult to recognize "a" is "test.array" when Javassist transforms "a[5] = 10". -
2. Re: Array access
ben.wang Jun 29, 2006 11:04 PM (in response to kabirkhan)So in other words, neither AspectJ (or asm) can do this? Just to confirm.
-
3. Re: Array access
brian.stansberry Jun 30, 2006 12:30 AM (in response to kabirkhan)Jonas Boner told me they can track changes to arrays. He said how but I had no idea what he meant and was doing a presentation at the time so couldn't really follow up.
-
4. Re: Array access
jason.greene Jun 30, 2006 1:20 AM (in response to kabirkhan)"chiba" wrote:
Implementing this spec. would be tricky. Because:test.array[5] = 10;
is compiled into:long[] a = test.array; a[5] = 10;
It would be difficult to recognize "a" is "test.array" when Javassist transforms "a[5] = 10".
It seems this isn't the case for the sun compiler:
20: getfield #2; //Field array:[J
23: iconst_5
24: lconst_1
25: lastore
Or did you mean that a user can assign it to a local var and manipulate it there?
In that case, couldnt you store a reference map from local vars to arrays you are interested in?
-Jason -
5. Re: Array access
kabirkhan Jul 6, 2006 5:08 AM (in response to kabirkhan)Hi Chiba,
I heard from Emmanuel that you'd discussed array interception with him and that it might be possible, but with some limitations.
Could you please explain the limitations a bit?
In particular Emmanuel mentioned differences between different compilers and reassignment of the array variables. As a first cut, I think it would be fine to not allow reassignment of variables, but the Hibernate and POJOCache guys will need to verify if this works for them.
Thanks,
Kabir -
6. Re: Array access
eliotmoss Jan 10, 2007 11:09 PM (in response to kabirkhan)I have implemented an Editor for the array fetch and store bytescodes.
There is one, possibly significant, limitation at present. For object arrays,
it does not know the type. The reason is that this is not trivially
apparent from the bytecodes (unlike calls, for example, where you a
signature, and fields give their declared type).
I have begun writing the code necessary to propagate type information
(similar to what is needed in a bytecode verifier, but limited just to this
purpose), but won't have the chance to finish it for a while.
Note that this just intercepts every usage at a particular code point. -
7. Re: Array access
kabirkhan Jan 11, 2007 6:05 AM (in response to kabirkhan)Hi,
I've already implemented this http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98175
but would be curious to see your approach