<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 06/21/2011 05:43 AM, Mark Roos wrote:
<blockquote
cite="mid:OF435CEA5D.66F8946C-ON882578B6.0013EF8E-882578B6.00147D60@roos.com"
type="cite">
<br>
<font face="sans-serif" size="2">John Rose stated</font>
<br>
<br>
<tt><font size="2"> See section 5,
"Case Study: Inline Caches and invokedynamic".</font></tt>
<br>
<br>
<tt><font size="2">Thanks John, I have read that several times and
it
is very helpful<br>
<br>
A small (non-megamorphic) polymorphic
cache can be represented as a cascade or decision tree of GWT
combinators,
probably with a control block of some sort that can rebalance
from time
to time.</font></tt>
<br>
<br>
<tt><font size="2">This is interesting but it seems that the jvm
is in
a better place to collect the information and</font></tt>
<br>
<tt><font size="2">reorder the paths. I would have to add
counters
and some way to remember the MHs ( no reflection yet)</font></tt>
<br>
<tt><font size="2">which seems like a lot of book keeping. My
current
approach is to keep track of the total methods in use</font></tt>
<br>
<tt><font size="2">and then invalidate the entire set of call
sites (
cache flush ). This matches the ST I am using as</font></tt>
<br>
<tt><font size="2">a reference and seems to keep the working set
and
depths under control.<br>
<br>
A megamorphic call site can be represented
using the class pattern of a two-step dispatch plus indirect
function call. </font></tt>
<br>
<br>
<tt><font size="2">How about the case where the site is
megamorphic in
classes but has only one or two implementations? </font></tt></blockquote>
<br>
If the hierarchy is frozen, you can use instanceof (or
Class.isInstanceof) instead of<br>
a getClass() == as guard test.<br>
<br>
But if it's open, you need a way to know when a class is loaded and
currently<br>
there is no "official" way to get this information.<br>
<br>
<br>
<blockquote
cite="mid:OF435CEA5D.66F8946C-ON882578B6.0013EF8E-882578B6.00147D60@roos.com"
type="cite"><tt><font size="2"> I'll</font></tt>
<tt><font size="2">study the foldArguments to see if I can see how
to
do this</font></tt>
<br>
</blockquote>
<br>
The pattern is foldArgument + an invoker.<br>
<br>
<blockquote
cite="mid:OF435CEA5D.66F8946C-ON882578B6.0013EF8E-882578B6.00147D60@roos.com"
type="cite">
<br>
<tt><font size="2">thanks</font></tt>
<br>
<br>
<tt><font size="2">mark</font></tt></blockquote>
<br>
Rémi<br>
<br>
</body>
</html>