review request (URGENT): 7051206: JSR 292 method name SwitchPoint.isValid is misleading to unwary users; should be hasBeenInvalidated
Vladimir Kozlov
vladimir.kozlov at oracle.com
Fri Jun 3 09:20:02 PDT 2011
Looks good to me.
Vladimir
John Rose wrote:
> http://cr.openjdk.java.net/~jrose/7051206
>
> This is a changed method name (and inverted sense), replacing
> SwitchPoint.isValid. Here's the updated javadoc:
>
>
> hasBeenInvalidated
>
> public boolean hasBeenInvalidated()
>
> Determines if this switch point has been invalidated yet.
>
> /Discussion:/ Because of the one-way nature of invalidation, once a
> switch point begins to return true for |hasBeenInvalidated|, it will
> always do so in the future. On the other hand, a valid switch point
> visible to other threads may invalidated at any moment, due to a request
> by another thread.
>
> Since invalidation is a global and immediate operation, the execution of
> this query, on a valid switchpoint, must be internally sequenced with
> any other threads that could cause invalidation. This query may
> therefore be expensive. The recommended way to build a boolean-valued
> method handle which queries the invalidation state of a switch
> point |s| is to call |s.guardWithTest| on |constant|
> <file:///Users/jrose/Projects/davinci/patches/netbeans/meth/dist/javadoc/java/lang/invoke/MethodHandles.html#constant(java.lang.Class,%20java.lang.Object)> true
> and false method handles.
>
> Returns:
> true if this switch point has been invalidated
>
>
More information about the hotspot-compiler-dev
mailing list