Rtalk Performance for micro benchmarks (how to improve)
Mark Roos
mroos at roos.com
Mon Sep 17 23:56:55 PDT 2012
>From Charles
then could it simply be that your
indy guard logic and arbitrary precision logic adding all that
overhead? It seems like a lot indeed.
I had not thought about this in a while so perhaps my call site handling
is an issue. I went
for simple in that I use a varArgs style of type matching for my fallback
used in the GWT processing.
Since I really don't understand how the jvm or the compiler deal with
varArgs I could be pretty inefficient.
Others I believe have specialized based on airity.
So my one bootstrap looks like this: ( well I have them for constants and
super but only one for each )
bootStrapSelf(MethodHandles.Lookup callerLookup, String name,
MethodType type, Object[] arg)
To drive the fallback I combine the args so I only need one fallback
method ( airity reduction )
mh=lookup.findStatic(RtCallSite.class, "fallbackSelf", mt);
mh2=MethodHandles.insertArguments(mh, 0, site); // insert the call
site
mh3=mh2.asCollector(RtObject[].class, site.getAirity()); // combine
the args into an array
My fallback looks like:
fallbackSelf(RtCallSite site, Object[] args)
And my test path has to add the value to test against and drop the args
except for the receiver.
My class is based on a field in the object
MethodHandle test = site._test;
test=MethodHandles.insertArguments(test, 0, rcvr.classField()); //
need to insert the old rcvr class at the beginning
test=MethodHandles.dropArguments(test, 0, site.dropArray()); // drop
all but the last arg ( rcvr )
Test is then simple
public static boolean test(RtObject oldClass, RtObject receiver) {
boolean rtn=receiver.classField() == oldClass;
return rtn;
}
The GWT is formed as
gwt=MethodHandles.guardWithTest(test, newTarget, oldTarget);
newTarget is my method which in not varArgs style but a normal method with
airity.
So I think my only hit is in the insert and drop in the test path. But I
do have to do this for each GWT
in series so it seems repetitive. I could specialize the test by airity
but I am not sure of the impact.
thanks
mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20120917/5ae4ee9c/attachment.html
More information about the mlvm-dev
mailing list