From: Nicholas Clark <nick@ccl4.org>
Date: Fri, 21 Aug 2009 10:04:06 +0000 (+0100)
Subject: Use the constant _CAN_PCS to optimise out things that can't happen pre 5.10
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a8ae8fee103e29c80450bb74b87866088a24b4a1;p=p5sagit%2Fp5-mst-13.2.git

Use the constant _CAN_PCS to optimise out things that can't happen pre 5.10
---

diff --git a/lib/constant.pm b/lib/constant.pm
index 24a6603..a51ee7f 100644
--- a/lib/constant.pm
+++ b/lib/constant.pm
@@ -117,7 +117,9 @@ sub import {
 	    $declared{$full_name}++;
 	    if ($multiple || @_ == 1) {
 		my $scalar = $multiple ? $constants->{$name} : $_[0];
-		if ($symtab && !exists $symtab->{$name}) {
+		# The constant serves to optimise this entire block out on
+		# 5.8 and earlier.
+		if (_CAN_PCS && $symtab && !exists $symtab->{$name}) {
 		    # No typeglob yet, so we can use a reference as space-
 		    # efficient proxy for a constant subroutine
 		    # The check in Perl_ck_rvconst knows that inlinable
@@ -137,7 +139,7 @@ sub import {
 	}
     }
     # Flush the cache exactly once if we make any direct symbol table changes.
-    mro::method_changed_in($pkg) if $flush_mro;
+    mro::method_changed_in($pkg) if _CAN_PCS && $flush_mro;
 }
 
 1;