Re: Smalltalk and tiered compile data

2012-02-07 Thread Christian Thalinger
On Feb 3, 2012, at 1:25 AM, Mark Roos wrote: > So I ran some tests using a simple benchmark using the jdk8-b23 from the > Openjdk google code. > > Without tiered compile I get: ( times in nanoseconds ) > 52101000 > 53973000 > 20932000 > > with tiered on > 493788000 > 521448000 > 51328

problem with vargs method

2012-02-07 Thread Jochen Theodorou
Hi all, maybe someone can explain to me why method handles behave this way in my case. Bascially I have a handle for Class#getDeclaredConstructor(Class...) I created via unreflect. http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getDeclaredConstructor%28java.lang.Class...%29 thi

Re: problem with vargs method

2012-02-07 Thread Jochen Theodorou
The problem can be easily reproduced using this: > MethodType type = MethodType.methodType(Constructor.class, > Class[].class); > MethodHandle mh = MethodHandles.lookup().findVirtual(Class.class, > "getDeclaredConstructor", type); > MethodType target = MethodType.methodTyp

Re: problem with vargs method

2012-02-07 Thread Jim Laskey
As soon as you mh = mh.asType(target); it is no longer vararg, so it is treating new Class[0] as the second argument cast to Object. If you are trying to type as (Object , Object[]). I think you are going to run into difficulties validating (Class[]) Object[]. You may have to add a wrapper to

Re: problem with vargs method

2012-02-07 Thread Jim Laskey
As soon as you mh = mh.asType(target); it is no longer vararg, so it is treating new Class[0] as the second argument cast to Object. If you are trying to type as (Object , Object[]). I think you are going to run into difficulties validating (Class[]) Object[]. You may have to add a wrapper to

Re: problem with vargs method

2012-02-07 Thread Jochen Theodorou
Am 07.02.2012 17:29, schrieb Jim Laskey: MethodType type = MethodType.methodType(Constructor.class, Class[].class); MethodHandle mh = MethodHandles.lookup().findVirtual(Class.class, "getDeclaredConstructor", type); MethodType target = MethodType.me

Re: problem with vargs method

2012-02-07 Thread Jim Laskey
Try MethodType type = MethodType.methodType(Constructor.class, Class[].class); MethodHandle mh = MethodHandles.lookup().findVirtual(Class.class, "getDeclaredConstructor", type); MethodType target = MethodType.methodType(void.class, Object.class, Object[].class); mh =

Re: problem with vargs method

2012-02-07 Thread Jochen Theodorou
That will produce a java.lang.invoke.WrongMethodTypeException: (Ljava/lang/Object;[Ljava/lang/Object;)V cannot be called without a receiver argument as ([Ljava/lang/Object;)Ljava/lang/Object; imho casting to Object and Object[] in mh.invokeExact((Object)Class.class, (Object[])new Class[0]);

Re: problem with vargs method

2012-02-07 Thread Jim Laskey
Worked okay for me. So must be addressed in a later release. :-/ On 2012-02-07, at 1:17 PM, Jochen Theodorou wrote: > > That will produce a > > java.lang.invoke.WrongMethodTypeException: > (Ljava/lang/Object;[Ljava/lang/Object;)V cannot be called without a receiver > argument as ([Ljava/l

Re: problem with vargs method

2012-02-07 Thread Jochen Theodorou
Am 07.02.2012 18:29, schrieb Jim Laskey: > Worked okay for me. So must be addressed in a later release. :-/ later than jdk7u2? oh boy. I would feel better if I could find a bug report that shows the problem and that is resolved. Then I would at least have something for the release notes. But I

Re: Smalltalk and tiered compile data

2012-02-07 Thread Mark Roos
Christian asked: What exactly do you mean by "invalidate call sites before the benchmark"? Are you using MutableCallSites and call setTarget on them? Exactly. I am using setTarget to set each call site to its initial fallback method. This should drop the GWT lookup chain forc

Fast long overflow detection?

2012-02-07 Thread Mark Roos
So I thought I could get away with 64bit ints and not implement the Smalltalk automatic conversion to BigIntegers. Bad plan. So I went ahead and did it while I waited for the super bowl to start. Not too difficult. Just wrappered java BigInteger and added some simple overflow detection. But I

Re: Smalltalk and tiered compile data

2012-02-07 Thread Rémi Forax
On 02/07/2012 08:28 PM, Mark Roos wrote: > Christian asked: > > What exactly do you mean by "invalidate call sites before the > benchmark"? > Are you using MutableCallSites and call setTarget on them? > > Exactly. I am using setTarget to set each call site to its initial > fallba

Re: problem with vargs method

2012-02-07 Thread Jim Laskey (Oracle)
As soon as you mh = mh.asType(target); it is no longer vararg, so it is treating new Class[0] as the second argument cast to Object. If you are trying to type as (Object , Object[]). I think you are going to run into difficulties validating (Class[]) Object[]. You may have to add a wrapper to

Re: Fast long overflow detection?

2012-02-07 Thread Charles Oliver Nutter
The JRuby logic mimics what I think others are doing: private IRubyObject addFixnum(ThreadContext context, RubyFixnum other) { long otherValue = other.value; long result = value + otherValue; if (additionOverflowed(value, otherValue, result)) { return addAsB

Re: Fast long overflow detection?

2012-02-07 Thread Vitaly Davidovich
Can't the overflow test be (value ^ result) & (otherValue ^ result) < 0? I think that's what hacker's delight suggests and you don't need the negation and the sign bit mask in that case. Sent from my phone On Feb 7, 2012 3:31 PM, "Charles Oliver Nutter" wrote: > The JRuby logic mimics what I thi

Re: Fast long overflow detection?

2012-02-07 Thread Per Bothner
On 02/07/2012 03:04 PM, Vitaly Davidovich wrote: > Can't the overflow test be (value ^ result) & (otherValue ^ result) < 0? > I think that's what hacker's delight suggests and you don't need the > negation and the sign bit mask in that case. In gnu.math the "fixnums" are int, so I do long addition

Re: Smalltalk and tiered compile data

2012-02-07 Thread Mark Roos
>From Rémi Mark, you should use a SwitchPoint I was thinking of that. I'll move it up on the list of things to try. My current approach gives me the option to filter the callsites and only invalidate the ones for a given signature. This would only matter if I have issues with hotspot

Re: Smalltalk and tiered compile data

2012-02-07 Thread Mark Roos
Hi Rémi Just a clarification on the switchpoint usage to invalidate sites. The switch path would still do a setTarget correct? So I am still sending lots of setTargets just based on switch point state? It also seems that if the switch point is in series with the target that the callsite will