Danger Will Robinson! Missing API!

Ola Bini ola.bini at gmail.com
Wed May 25 22:19:31 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2011-05-26 10.33, Charles Oliver Nutter wrote:
> Oh my goodness...I just realized an obvious missing API...is there still time?!
> 
> SwitchPoint has no way to query if it has been invalidated!
> 
> Is this by design? I would like to use this as both a call site guard
> and as a queryable trigger...to know whether I can go forward with the
> faster SwitchPoint-based logic or not.
> 
> So, am I missing something, or is the API missing something?
> 
> SwitchPoint.isValid()boolean: Returns true if this SwitchPoint is
> still valid (i.e. has not yet been invalidated).

Take a look at the way I use SwitchPoints in Seph. The api you're
looking for is already there:

SwitchPoint x = new SwitchPoint();
MethodHandle valid =
x.guardWithTest(MethodHandles.constant(boolean.class, true),
MethodHandle.constant(boolean.class, false));

System.err.println("Still valid: " + valid.invoke());
SwitchPoint.invalidateAll(new SwitchPoint[]{x});
System.err.println("Now not valid: " + valid.invoke());

Cheers
- -- 
 Ola Bini (http://olabini.com)
  Ioke - JRuby - ThoughtWorks

 "Yields falsehood when quined" yields falsehood when quined.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJN3eLeAAoJEClcdGmEr38Mi90P+wSoWCGiNL7mDbZii7nxpZSC
VYA9UiZQsHqvZqwAiK3XRp5ODdRqdfU5DFfuJ6YP0tDWERW6XK4tzViFAuCKMEs0
RPdoJUqUZv53ZrubqiefFeelcgXhs8NErBjQvY6eDkIhYB7m23sWpCt3Pp3yD7vQ
omcG9pN/pPqo1OcG+u1W8i499kp9rtg4e06roDzWCWmAT18BN8KWsAXqcpJUlNm1
MjrNIgp1SvfZiaqufywhYctfVSnO5DD3Hy5zEyvznM/redonAPfI+brjLhjOSH/Q
yYHaK6aEegSNegdFK8AlgsV4zb3WF1w+ZLukt/ZFjtwVoMxvNoJzneHBJ7K/iW5z
K2Q0QL5WX94tRebkGL9r3rp6jsaQECx0kNp810EfkQVjAMf/nCQko9RcrXcqfTvu
+QAlw8lhV3OyHq04inYVoR+mLfbyiON6cUvp/nlqCHVem0juCnp7SHOfLBeB/N72
d6Iag0bBUMGeagixSrsErmYve7Y8INCRZpGce8OTX0BKKch/Gqox8nI0SOkoyr+/
XBf5VwP6I+9QMVl+OBSgp3aydtoHXP34OPDvI5S8yd7Fbk7EVRTXan1NbO5+eppM
aIQ8o/zesbmenIoUf/a/Dwp0ykiOhUZT93Mt3/qndylZ+ZVx46HnEce26ZxAxxEe
s5MhVfpE9gEjU7InM0CF
=7/oQ
-----END PGP SIGNATURE-----


More information about the mlvm-dev mailing list