<div>I don&#39;t know if this is how guardWithTest is intended to be used, but I found your code very clever. Making dynamic calls fall to the fallback implementation in the first time and after that, always going to the target method until cache is invalidated. I&#39;m impressed! (and just trying to understand all these mlvm new things better).</div>
<div><br></div><div>Correct me if I&#39;m wrong, but then the JVM has the opportunity to cache CallSites until their target changes (cache is invalidated, in your case) and dynamic invocations could perform as much as &quot;static&quot; invocations! Is entry.typeOk() just a flag check, or does it have some complex logic? I&#39;m asking because it&#39;s going to be called for every dynamic invocation.</div>
<div><br></div><div>Congrats!</div><div><br></div><div>Just two more questions:</div><div><br></div><div>1) are all ruby method calls going to be compiled (when not in interpreter mode, off course) to a indy bytecode in JRuby?</div>
<div>2) are there other benefits, besides CallSite caching by the JVM?</div><div><br></div><div><br><div class="gmail_quote">On Fri, May 22, 2009 at 12:25 AM, Charles Oliver Nutter <span dir="ltr">&lt;<a href="mailto:charles.nutter@sun.com">charles.nutter@sun.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">More information...with -Xint I don&#39;t get a hard crash, I get this<br>
exception:<br>
<br>
MemberName.java:406:in `newIllegalArgumentException&#39;:<br>
java.lang.IllegalArgumentException: cannot spread<br>
(java.lang.Object[])boolean to<br>
(org.jruby.runtime.ThreadContext,org.jruby.runtime.builtin.IRubyObject,org.jruby.runtime.builtin.IRubyObject,java.lang.String,org.jruby.runtime.builtin.IRubyObject)boolean<br>
        from MethodHandles.java:859:in `spreadArguments&#39;<br>
        from MethodHandleImpl.java:312:in `makeGuardWithTest&#39;<br>
        from MethodHandles.java:1031:in `guardWithTest&#39;<br>
        from InvokeDynamicSupport.java:67:in `fallback&#39;<br>
<br>
Seems to be a failure in the spread, no?<br>
<br>
- Charlie<br>
<div><div></div><div class="h5"><br>
Charles Oliver Nutter wrote:<br>
&gt; Ok, I was too intrigued by guardWithTest to not give it a try. Here&#39;s<br>
&gt; the revised InvokeDynamicSupport I came up with. It seems like things<br>
&gt; are wired correctly, but it results in a crash:<br>
&gt;<br>
&gt; <a href="http://gist.github.com/115901" target="_blank">http://gist.github.com/115901</a><br>
&gt;<br>
&gt; It crashes with a message like:<br>
&gt;<br>
&gt; # A fatal error has been detected by the Java Runtime Environment:<br>
&gt; #<br>
&gt; #  Internal Error (signature.cpp:60), pid=57856, tid=2954375168<br>
&gt; #  Error: expecting (<br>
&gt;<br>
&gt; I presume this means the guardWithTest stuff isn&#39;t quite functional yet.<br>
&gt;<br>
&gt; A few notes on this:<br>
&gt;<br>
&gt; * I like this very much; it fits well our current call site logic. I<br>
&gt; could also see how easy it would be to chain guardWithTest MHs to create<br>
&gt; a polymorphic cache, which is super cool.<br>
&gt; * One major improvement on my end would be to get our Ruby method<br>
&gt; objects to actually *be* method handles, so they won&#39;t require the<br>
&gt; intermediate code that, in this version, does nothing more than pass<br>
&gt; arguments through.<br>
&gt; * guardWithTest brings this much closer to being completely<br>
&gt; primitive-MHs all the way through, and I think that&#39;s the right way for<br>
&gt; us to be moving, yes?<br>
&gt;<br>
&gt; I&#39;m eager to get more of this stuff wired up. I don&#39;t suppose there&#39;s<br>
&gt; anything folks like me can do to help, is there?<br>
&gt;<br>
&gt; - Charlie<br>
&gt;<br>
<br>
_______________________________________________<br>
mlvm-dev mailing list<br>
<a href="mailto:mlvm-dev@openjdk.java.net">mlvm-dev@openjdk.java.net</a><br>
<a href="http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev" target="_blank">http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Fabio Kung<br><a href="http://www.fabiokung.com">http://www.fabiokung.com</a><br><br>Caelum - Ensino e Inovação<br><a href="http://www.caelum.com.br">http://www.caelum.com.br</a><br>

</div>