[svn:parrot] r38207 - trunk/runtime/parrot/library

jonathan at svn.parrot.org jonathan at svn.parrot.org
Sun Apr 19 13:21:28 UTC 2009


Author: jonathan
Date: Sun Apr 19 13:21:28 2009
New Revision: 38207
URL: https://trac.parrot.org/parrot/changeset/38207

Log:
[p6object] Refactor ACCEPTS to better handle non-P6 objects and maybe a little performance win too.

Modified:
   trunk/runtime/parrot/library/P6object.pir

Modified: trunk/runtime/parrot/library/P6object.pir
==============================================================================
--- trunk/runtime/parrot/library/P6object.pir	Sun Apr 19 13:09:59 2009	(r38206)
+++ trunk/runtime/parrot/library/P6object.pir	Sun Apr 19 13:21:28 2009	(r38207)
@@ -672,24 +672,21 @@
     .param pmc topic
     .local pmc topichow, topicwhat, parrotclass
 
+    $P0 = self.'HOW'()
+    parrotclass = $P0.'get_parrotclass'(self)
+    $S0 = parrotclass
+    if $S0 == 'Perl6Object' goto accept_anyway
+    if $S0 == 'Junction' goto normal_check
+    if $S0 == 'Any' goto accept_anyway
+  normal_check:
+
+    $I0 = can topic, 'HOW'
+    unless $I0 goto end
     topichow = topic.'HOW'()
     topicwhat = topic.'WHAT'()
-    parrotclass = topichow.'get_parrotclass'(self)
     $I0 = isa topicwhat, parrotclass
     if $I0 goto end
     $I0 = does topic, parrotclass
-    if $I0 goto end
-
-    # Here comes some special handling for Perl 6, that really shouldn't be in
-    # here; we'll figure out a way to let Perl 6 provide it's own ACCEPTS that
-    # does this or, better make it so we don't need to do this. The purpose is
-    # to make Any accept stuff that doesn't actually inherit from it, aside
-    # from Junction, and to make Perl6Object accept anything.
-    $S0 = parrotclass
-    if $S0 == 'Perl6Object' goto accept_anyway
-    if $S0 != 'Any' goto end
-    $S0 = topicwhat
-    if $S0 != 'Junction' goto accept_anyway
     goto end
 
   accept_anyway:


More information about the parrot-commits mailing list