On 02/08/2012 02:55 AM, Mark Roos wrote: > Hi Rémi > > Just a clarification on the switchpoint usage to invalidate sites. > > The switch path would still do a setTarget correct?
No, SwitchPoint.invalidateAll() doesn't call setTarget(). > So I am still sending lots of > setTargets just based on switch point state? No. The idea is that you introduce a guard created from the SwitchPoint at the beginning of your target. You create the guard with a target (your old target) and a fallback which in this case is the fallback that you install when you call setTarget. When you call invalidateAll with all your SwitchPoints (you can create one by signature if you want) then the VM ask all other threads to go to a safe point. For all callsite targets that have been JITed, the code is marked as dead and the next call to invokedynamic on that callsite will go through the target method handle tree instead of calling the JITed code. When the VM will call the guard of the invalidated SwitchPoint instead of calling the target, it will calll the fallback method of the guard. All will be done at one safepoint. > > It also seems that if the switch point is in series with the target > that the callsite will not > invalidate until its next use. technically, it's the guard of the switch point which is in serie but yes, JITed code willl be dropped later (when no callsite will be able to call it) and if the code is not JITed, the SwitchPoint is just turn off so nothing will be done until the callsite is called again. > Seems like this could spread the invalidations out over time > giving hotspot even more to do. No, because the VM will be able to do the cleanup without using a safepoint and the cleanup phase is not something heavy. > > Or am I not clear on how to do this? > > thanks > mark cheers, Rémi _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev