dreamhead wrote:
Hi, Charlie!
MethodIndex in compiler is worth considering.
The following code is from invokeDynamic of StandardASMCompiler.
int index = MethodIndex.getIndex(name);
...
if (index != 0) {
invokeUtilityMethod("doInvokeDynamicIndexed", callSigIndexed);
In new MethodIndex, index is always greater than 0 (except ""), so
doInvokeDynamicIndexed is always invoked, right? I want to if it is
meaningful.
Yes, this is a side effect of having indices dynamically generated, and
it does mean that the indexed version is always called. I'm not sure if
that's a problem though.
On the other hand, the index is only meaningful in current JRuby
instance. I mean the index of "example" could be 123 in current JRuby
instance, but it could be 456 in another JRuby instance. So when it's
saved into Class file, it could meaningless when it's loaded again.
If I'm wrong, feel free to tell me.
I believe the important indicies will be specific to a given JRuby
version, but not necessarily a given JRuby instance. The keys used to
generate the STI table and switch are sorted first, and should be the
same from run to run, so they should generate indices in the same order.
However, I don't like trusting this...you'll notice there's one or two
FIXMEs in the code that relate to this problem. I really don't want to
have to generate a static list of methods, but it seems like we need a
better way to generate the indices that's not going to change from
version to version, especially if we want to AOT compile code and have
it run across at least a couple JRuby version.
Note that the current design will be fine in interpreted and JIT modes.
It's mainly AOT that would be a problem.
- Charlie
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email