From: Karl Williamson Date: Mon, 3 May 2010 16:06:30 +0000 (-0600) Subject: Use in-line 'no overloading' for speed X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f998e60c2aa1b9879e2c7c365acd05c0799ae46a;p=p5sagit%2Fp5-mst-13.2.git Use in-line 'no overloading' for speed An earlier performance enhancement was to change the subroutine that gets the address of a ref to using 'no overloading' and then numifying the ref, which returns its address. This patch speeds things up slightly by in-lining the "no overloading" so that the function call overhead is avoided. It also gets rid of the kludge that was done before the original speed-up that created a local in the call stack of one of the classes so that the address would only have to be executed once per call stack; This was subject to failure if maintenance of the code perturbed things so it didn't work; now the overhead is minimal, so the address is gotten in each call. --- diff --git a/lib/unicore/mktables b/lib/unicore/mktables index 73ca970..c774f82 100644 --- a/lib/unicore/mktables +++ b/lib/unicore/mktables @@ -6,7 +6,12 @@ # Needs 'no overloading' to run faster on miniperl. Code commented out at the # subroutine objaddr can be used instead to work as far back (untested) as -# 5.8: needs pack "U". +# 5.8: needs pack "U". But almost all occurrences of objaddr have been +# removed in favor of using 'no overloading'. You also would have to go +# through and replace occurrences like: +# my $addr; { no overloading; $addr = 0+$self; } +# with +# my $addr = main::objaddr $self; require 5.010_001; use strict; use warnings; @@ -1431,7 +1436,7 @@ package main; # Use typeglob to give the anonymous subroutine the name we want *$destroy_name = sub { my $self = shift; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } $self->$destroy_callback if $destroy_callback; foreach my $field (keys %{$package_fields{$package}}) { @@ -1530,16 +1535,15 @@ package main; return Carp::carp_too_few_args(\@_, 2) if main::DEBUG && @_ < 2; my $self = shift; my $value = shift; + my $addr; { no overloading; $addr = 0+$self; } Carp::carp_extra_args(\@_) if main::DEBUG && @_; if (ref $value) { - return if grep { $value == $_ } - @{$field->{main::objaddr $self}}; + return if grep { $value == $_ } @{$field->{$addr}}; } else { - return if grep { $value eq $_ } - @{$field->{main::objaddr $self}}; + return if grep { $value eq $_ } @{$field->{$addr}}; } - push @{$field->{main::objaddr $self}}, $value; + push @{$field->{$addr}}, $value; return; } } @@ -1565,7 +1569,7 @@ package main; *$subname = sub { use strict "refs"; Carp::carp_extra_args(\@_) if main::DEBUG && @_ > 1; - my $addr = main::objaddr $_[0]; + my $addr; { no overloading; $addr = 0+$_[0]; } if (ref $field->{$addr} ne 'ARRAY') { my $type = ref $field->{$addr}; $type = 'scalar' unless $type; @@ -1587,7 +1591,8 @@ package main; *$subname = sub { use strict "refs"; Carp::carp_extra_args(\@_) if main::DEBUG && @_ > 1; - return $field->{main::objaddr $_[0]}; + no overloading; + return $field->{0+$_[0]}; } } } @@ -1601,7 +1606,8 @@ package main; Carp::carp_extra_args(\@_) if @_ > 2; } # $self is $_[0]; $value is $_[1] - $field->{main::objaddr $_[0]} = $_[1]; + no overloading; + $field->{0+$_[0]} = $_[1]; return; } } @@ -1761,7 +1767,7 @@ sub trace { return main::trace(@_); } my $class = shift; my $self = bless \do{ my $anonymous_scalar }, $class; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } # Set defaults $handler{$addr} = \&main::process_generic_property_file; @@ -1852,7 +1858,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } my $file = $file{$addr}; @@ -2022,7 +2028,7 @@ END my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # Here the file is open (or if the handle is not a ref, is an open # 'virtual' file). Get the next line; any inserted lines get priority @@ -2167,7 +2173,7 @@ END # # an each_line_handler() on the line. # # my $self = shift; -# my $addr = main::objaddr $self; +# my $addr; { no overloading; $addr = 0+$self; } # # foreach my $inserted_ref (@{$added_lines{$addr}}) { # my ($adjusted, $line) = @{$inserted_ref}; @@ -2208,7 +2214,8 @@ END # Each inserted line is an array, with the first element being 0 to # indicate that this line hasn't been adjusted, and needs to be # processed. - push @{$added_lines{main::objaddr $self}}, map { [ 0, $_ ] } @_; + no overloading; + push @{$added_lines{0+$self}}, map { [ 0, $_ ] } @_; return; } @@ -2231,7 +2238,8 @@ END # Each inserted line is an array, with the first element being 1 to # indicate that this line has been adjusted - push @{$added_lines{main::objaddr $self}}, map { [ 1, $_ ] } @_; + no overloading; + push @{$added_lines{0+$self}}, map { [ 1, $_ ] } @_; return; } @@ -2244,7 +2252,7 @@ END my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # If not accepting a list return, just return the first one. return shift @{$missings{$addr}} unless wantarray; @@ -2257,7 +2265,9 @@ END sub _insert_property_into_line { # Add a property field to $_, if this file requires it. - my $property = $property{main::objaddr shift}; + my $self = shift; + my $addr; { no overloading; $addr = 0+$self; } + my $property = $property{$addr}; Carp::carp_extra_args(\@_) if main::DEBUG && @_; $_ =~ s/(;|$)/; $property$1/; @@ -2275,7 +2285,7 @@ END my $message = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } $message = 'Unexpected line' unless $message; @@ -2286,7 +2296,7 @@ END # increment the count of how many times it has occurred unless ($errors{$addr}->{$message}) { Carp::my_carp("$message in '$_' in " - . $file{main::objaddr $self} + . $file{$addr} . " at line $.. Skipping this line;"); $errors{$addr}->{$message} = 1; } @@ -2340,7 +2350,7 @@ package Multi_Default; my $class = shift; my $self = bless \do{my $anonymous_scalar}, $class; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } while (@_ > 1) { my $default = shift; @@ -2358,7 +2368,7 @@ package Multi_Default; my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } return each %{$class_defaults{$addr}}; } @@ -2405,7 +2415,7 @@ package Alias; my $class = shift; my $self = bless \do { my $anonymous_scalar }, $class; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } $name{$addr} = shift; $loose_match{$addr} = shift; @@ -2467,7 +2477,7 @@ sub trace { return main::trace(@_); } my $class = shift; my $self = bless \do { my $anonymous_scalar }, $class; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } $start{$addr} = shift; $end{$addr} = shift; @@ -2497,7 +2507,7 @@ sub trace { return main::trace(@_); } sub _operator_stringify { my $self = shift; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # Output it like '0041..0065 (value)' my $return = sprintf("%04X", $start{$addr}) @@ -2520,7 +2530,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } return $standard_form{$addr} if defined $standard_form{$addr}; return $value{$addr}; @@ -2533,7 +2543,7 @@ sub trace { return main::trace(@_); } my $indent = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } my $return = $indent . sprintf("%04X", $start{$addr}) @@ -2622,7 +2632,7 @@ sub trace { return main::trace(@_); } return _union($class, $initialize, %args) if defined $initialize; $self = bless \do { my $anonymous_scalar }, $class; - local $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } # Optional parent object, only for debug info. $owner_name_of{$addr} = delete $args{'Owner'}; @@ -2654,7 +2664,7 @@ sub trace { return main::trace(@_); } sub _operator_stringify { my $self = shift; - local $addr = main::objaddr($self) if !defined $addr; + my $addr; { no overloading; $addr = 0+$self; } return "Range_List attached to '$owner_name_of{$addr}'" if $owner_name_of{$addr}; @@ -2712,7 +2722,8 @@ sub trace { return main::trace(@_); } if (! defined $arg) { my $message = ""; if (defined $self) { - $message .= $owner_name_of{main::objaddr $self}; + no overloading; + $message .= $owner_name_of{0+$self}; } Carp::my_carp_bug($message .= "Undefined argument to _union. No union done."); return; @@ -2733,7 +2744,8 @@ sub trace { return main::trace(@_); } else { my $message = ""; if (defined $self) { - $message .= $owner_name_of{main::objaddr $self}; + no overloading; + $message .= $owner_name_of{0+$self}; } Carp::my_carp_bug($message . "Cannot take the union of a $type. No union done."); return; @@ -2773,9 +2785,8 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr($self) if ! defined $addr; - - return scalar @{$ranges{$addr}}; + no overloading; + return scalar @{$ranges{0+$self}}; } sub min { @@ -2788,7 +2799,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr($self) if ! defined $addr; + my $addr; { no overloading; $addr = 0+$self; } # If the range list is empty, return a large value that isn't adjacent # to any that could be in the range list, for simpler tests @@ -2805,8 +2816,6 @@ sub trace { return main::trace(@_); } my $codepoint = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr $self if ! defined $addr; - my $i = $self->_search_ranges($codepoint); return 0 unless defined $i; @@ -2814,7 +2823,8 @@ sub trace { return main::trace(@_); } # range[$i-1]->end < $codepoint <= range[$i]->end # So is in the table if and only iff it is at least the start position # of range $i. - return 0 if $ranges{$addr}->[$i]->start > $codepoint; + no overloading; + return 0 if $ranges{0+$self}->[$i]->start > $codepoint; return $i + 1; } @@ -2825,13 +2835,12 @@ sub trace { return main::trace(@_); } my $codepoint = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr $self if ! defined $addr; - my $i = $self->contains($codepoint); return unless $i; # contains() returns 1 beyond where we should look - return $ranges{$addr}->[$i-1]->value; + no overloading; + return $ranges{0+$self}->[$i-1]->value; } sub _search_ranges { @@ -2845,7 +2854,7 @@ sub trace { return main::trace(@_); } my $code_point = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr $self if ! defined $addr; + my $addr; { no overloading; $addr = 0+$self; } return if $code_point > $max{$addr}; my $r = $ranges{$addr}; # The current list of ranges @@ -3019,7 +3028,7 @@ sub trace { return main::trace(@_); } Carp::carp_extra_args(\%args) if main::DEBUG && %args; - local $addr = main::objaddr($self) if ! defined $addr; + my $addr; { no overloading; $addr = 0+$self; } if ($operation ne '+' && $operation ne '-') { Carp::my_carp_bug("$owner_name_of{$addr}First parameter to _add_delete must be '+' or '-'. No action taken."); @@ -3603,9 +3612,8 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr $self if ! defined $addr; - - undef $each_range_iterator{$addr}; + no overloading; + undef $each_range_iterator{0+$self}; return; } @@ -3616,7 +3624,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr($self) if ! defined $addr; + my $addr; { no overloading; $addr = 0+$self; } return if $self->is_empty; @@ -3633,7 +3641,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr($self) if ! defined $addr; + my $addr; { no overloading; $addr = 0+$self; } my $count = 0; foreach my $range (@{$ranges{$addr}}) { @@ -3656,8 +3664,8 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr($self) if ! defined $addr; - return scalar @{$ranges{$addr}} == 0; + no overloading; + return scalar @{$ranges{0+$self}} == 0; } sub hash { @@ -3668,7 +3676,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - local $addr = main::objaddr($self) if ! defined $addr; + my $addr; { no overloading; $addr = 0+$self; } # These are quickly computable. Return looks like 'min..max;count' return $self->min . "..$max{$addr};" . scalar @{$ranges{$addr}}; @@ -3987,7 +3995,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } # On first pass, don't choose less desirable code points; if no good # one is found, repeat, allowing a less desirable one to be selected. @@ -4179,7 +4187,7 @@ sub trace { return main::trace(@_); } my $class = shift; my $self = bless \do { my $anonymous_scalar }, $class; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } my %args = @_; @@ -4327,7 +4335,8 @@ sub trace { return main::trace(@_); } sub ranges { # Returns the array of ranges associated with this table. - return $range_list{main::objaddr shift}->ranges; + no overloading; + return $range_list{0+shift}->ranges; } sub add_alias { @@ -4363,7 +4372,7 @@ sub trace { return main::trace(@_); } # release $name = ucfirst($name) unless $name =~ /^k[A-Z]/; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # Figure out if should be loosely matched if not already specified. if (! defined $loose_match) { @@ -4424,7 +4433,8 @@ sub trace { return main::trace(@_); } # This name may be shorter than any existing ones, so clear the cache # of the shortest, so will have to be recalculated. - undef $short_name{main::objaddr $self}; + no overloading; + undef $short_name{0+$self}; return; } @@ -4447,7 +4457,7 @@ sub trace { return main::trace(@_); } my $nominal_length_ptr = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # For efficiency, don't recalculate, but this means that adding new # aliases could change what the shortest is, so the code that does @@ -4522,7 +4532,8 @@ sub trace { return main::trace(@_); } chomp $description; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - push @{$description{main::objaddr $self}}, $description; + no overloading; + push @{$description{0+$self}}, $description; return; } @@ -4534,7 +4545,8 @@ sub trace { return main::trace(@_); } chomp $note; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - push @{$note{main::objaddr $self}}, $note; + no overloading; + push @{$note{0+$self}}, $note; return; } @@ -4546,7 +4558,9 @@ sub trace { return main::trace(@_); } Carp::carp_extra_args(\@_) if main::DEBUG && @_; chomp $comment; - push @{$comment{main::objaddr $self}}, $comment; + + no overloading; + push @{$comment{0+$self}}, $comment; return; } @@ -4559,7 +4573,8 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my @list = @{$comment{main::objaddr $self}}; + my $addr; { no overloading; $addr = 0+$self; } + my @list = @{$comment{$addr}}; return @list if wantarray; my $return = ""; foreach my $sentence (@list) { @@ -4576,13 +4591,14 @@ sub trace { return main::trace(@_); } # initialization for range lists. my $self = shift; + my $addr; { no overloading; $addr = 0+$self; } my $initialization = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; # Replace the current range list with a new one of the same exact # type. - my $class = ref $range_list{main::objaddr $self}; - $range_list{main::objaddr $self} = $class->new(Owner => $self, + my $class = ref $range_list{$addr}; + $range_list{$addr} = $class->new(Owner => $self, Initialize => $initialization); return; @@ -4598,7 +4614,8 @@ sub trace { return main::trace(@_); } my $return = ""; $return .= $DEVELOPMENT_ONLY if $compare_versions; $return .= $HEADER; - $return .= $INTERNAL_ONLY if $internal_only{main::objaddr $self}; + no overloading; + $return .= $INTERNAL_ONLY if $internal_only{0+$self}; return $return; } @@ -4613,7 +4630,7 @@ sub trace { return main::trace(@_); } # the range Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } # Start with the header my @OUT = $self->header; @@ -4701,7 +4718,7 @@ sub trace { return main::trace(@_); } my $info = shift; # Any message associated with it. Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } $status{$addr} = $status; $status_info{$addr} = $info; @@ -4716,7 +4733,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } $locked{$addr} = ""; @@ -4744,7 +4761,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } return 0 if ! $locked{$addr}; Carp::my_carp_bug("Can't modify a locked table. Stack trace of locking:\n$locked{$addr}\n\n"); @@ -4755,7 +4772,8 @@ sub trace { return main::trace(@_); } my $self = shift; # Rest of parameters passed on - @{$file_path{main::objaddr $self}} = @_; + no overloading; + @{$file_path{0+$self}} = @_; return } @@ -4778,7 +4796,8 @@ sub trace { return main::trace(@_); } *$sub = sub { use strict "refs"; my $self = shift; - return $range_list{main::objaddr $self}->$sub(@_); + no overloading; + return $range_list{0+$self}->$sub(@_); } } @@ -4793,7 +4812,8 @@ sub trace { return main::trace(@_); } my $self = shift; return if $self->carp_if_locked; - return $range_list{main::objaddr $self}->$sub(@_); + no overloading; + return $range_list{0+$self}->$sub(@_); } } @@ -4899,7 +4919,7 @@ sub trace { return main::trace(@_); } _Range_List => $range_list, %args); - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } $anomalous_entries{$addr} = []; $core_access{$addr} = $core_access; @@ -4951,7 +4971,7 @@ sub trace { return main::trace(@_); } # Can't change the table if locked. return if $self->carp_if_locked; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } $has_specials{$addr} = 1 if $type; @@ -4969,7 +4989,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } return "" unless @{$anomalous_entries{$addr}}; return join("\n", @{$anomalous_entries{$addr}}) . "\n"; @@ -4996,8 +5016,8 @@ sub trace { return main::trace(@_); } return; } - my $addr = main::objaddr $self; - my $other_addr = main::objaddr $other; + my $addr; { no overloading; $addr = 0+$self; } + my $other_addr; { no overloading; $other_addr = 0+$other; } local $to_trace = 0 if main::DEBUG; @@ -5030,7 +5050,7 @@ sub trace { return main::trace(@_); } my $map = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # Convert the input to the standard equivalent, if any (won't have any # for $STRING properties) @@ -5075,7 +5095,7 @@ sub trace { return main::trace(@_); } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # If overridden, use that return $to_output_map{$addr} if defined $to_output_map{$addr}; @@ -5120,7 +5140,7 @@ sub trace { return main::trace(@_); } # No sense generating a comment if aren't going to write it out. return if ! $self->to_output_map; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } my $property = $self->property; @@ -5292,7 +5312,7 @@ END my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } my $name = $self->property->swash_name; @@ -5735,7 +5755,7 @@ END my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } return $self->SUPER::write( ($self->property == $block) @@ -5875,7 +5895,6 @@ sub trace { return main::trace(@_); } # places in this program that assume an equal sign) $complete = $property->full_name . "=$complete" if $property != $perl; - my $self = $class->SUPER::new(%args, Name => $name, Complete_Name => $complete, @@ -5883,7 +5902,7 @@ sub trace { return main::trace(@_); } _Property => $property, _Range_List => $range_list, ); - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } $conflicting{$addr} = [ ]; $equivalents{$addr} = [ ]; @@ -5924,7 +5943,7 @@ sub trace { return main::trace(@_); } return if $self->carp_if_locked; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } if (ref $other) { @@ -5991,7 +6010,7 @@ sub trace { return main::trace(@_); } # be an optional parameter. Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # Check if the conflicting name is exactly the same as any existing # alias in this table (as long as there is a real object there to @@ -6038,8 +6057,8 @@ sub trace { return main::trace(@_); } } # Two tables are equivalent if they have the same leader. - return $leader{main::objaddr $self} - == $leader{main::objaddr $other}; + no overloading; + return $leader{0+$self} == $leader{0+$other}; return; } @@ -6113,9 +6132,8 @@ sub trace { return main::trace(@_); } my $are_equivalent = $self->is_equivalent_to($other); return if ! defined $are_equivalent || $are_equivalent; - my $current_leader = ($related) - ? $parent{main::objaddr $self} - : $leader{main::objaddr $self}; + my $addr; { no overloading; $addr = 0+$self; } + my $current_leader = ($related) ? $parent{$addr} : $leader{$addr}; if ($related && ! $other->perl_extension @@ -6125,8 +6143,8 @@ sub trace { return main::trace(@_); } $related = 0; } - my $leader = main::objaddr $current_leader; - my $other_addr = main::objaddr $other; + my $leader; { no overloading; $leader = 0+$current_leader; } + my $other_addr; { no overloading; $other_addr = 0+$other; } # Any tables that are equivalent to or children of this table must now # instead be equivalent to or (children) to the new leader (parent), @@ -6141,7 +6159,7 @@ sub trace { return main::trace(@_); } next if $table == $other; trace "setting $other to be the leader of $table, status=$status" if main::DEBUG && $to_trace; - my $table_addr = main::objaddr $table; + my $table_addr; { no overloading; $table_addr = 0+$table; } $leader{$table_addr} = $other; $matches_all{$table_addr} = $matches_all; $self->_set_range_list($other->_range_list); @@ -6195,7 +6213,7 @@ sub trace { return main::trace(@_); } # an equivalent group Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $leader; + my $addr; { no overloading; $addr = 0+$leader; } if ($leader{$addr} != $leader) { Carp::my_carp_bug(<table('N') && defined (my $yes = $property->table('Y'))) { - my $yes_addr = main::objaddr $yes; + my $yes_addr; { no overloading; $yes_addr = 0+$yes; } @yes_perl_synonyms = grep { $_->property == $perl } main::uniques($yes, @@ -6266,11 +6284,12 @@ END my @conflicting; # Will hold the table conflicts. # Look at the parent, any yes synonyms, and all the children + my $parent_addr; { no overloading; $parent_addr = 0+$parent; } for my $table ($parent, @yes_perl_synonyms, - @{$children{main::objaddr $parent}}) + @{$children{$parent_addr}}) { - my $table_addr = main::objaddr $table; + my $table_addr; { no overloading; $table_addr = 0+$table; } my $table_property = $table->property; # Tables are separated by a blank line to create a grouping. @@ -6687,7 +6706,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } my %args = @_; $self = bless \do { my $anonymous_scalar }, $class; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } $directory{$addr} = delete $args{'Directory'}; $file{$addr} = delete $args{'File'}; @@ -6747,7 +6766,8 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } return $self; } else { - $map{main::objaddr $self}->delete_range($other, $other); + no overloading; + $map{0+$self}->delete_range($other, $other); } return $self; } @@ -6760,7 +6780,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } my $name = shift; my %args = @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } my $table = $table_ref{$addr}{$name}; my $standard_name = main::standardize($name); @@ -6828,7 +6848,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } my $name = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } return $table_ref{$addr}{$name} if defined $table_ref{$addr}{$name}; @@ -6846,7 +6866,8 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } # Return a list of pointers to all the match tables attached to this # property - return main::uniques(values %{$table_ref{main::objaddr shift}}); + no overloading; + return main::uniques(values %{$table_ref{0+shift}}); } sub directory { @@ -6855,7 +6876,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } # priority; 'undef' is returned if the type isn't defined; # or $map_directory for everything else. - my $addr = main::objaddr shift; + my $addr; { no overloading; $addr = 0+shift; } return $directory{$addr} if defined $directory{$addr}; return undef if $type{$addr} == $UNKNOWN; @@ -6876,7 +6897,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } return $file{$addr} if defined $file{$addr}; return $map{$addr}->external_name; @@ -6892,7 +6913,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } # The whole point of this pseudo property is match tables. return 1 if $self == $perl; - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # Don't generate tables of code points that match the property values # of a string property. Such a list would most likely have many @@ -6926,8 +6947,8 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } return; } - return $map{main::objaddr $self}-> - map_add_or_replace_non_nulls($map{main::objaddr $other}); + no overloading; + return $map{0+$self}->map_add_or_replace_non_nulls($map{0+$other}); } sub set_type { @@ -6946,7 +6967,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } return; } - $type{main::objaddr $self} = $type; + { no overloading; $type{0+$self} = $type; } return if $type != $BINARY; my $yes = $self->table('Y'); @@ -6976,7 +6997,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } my $map = shift; # What the range maps to. # Rest of parameters passed on. - my $addr = main::objaddr $self; + my $addr; { no overloading; $addr = 0+$self; } # If haven't the type of the property, gather information to figure it # out. @@ -7028,7 +7049,7 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } my $self = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr($self); + my $addr; { no overloading; $addr = 0+$self; } my $type = $type{$addr}; @@ -7137,7 +7158,8 @@ sub trace { return main::trace(@_) if main::DEBUG && $to_trace } *$sub = sub { use strict "refs"; my $self = shift; - return $map{main::objaddr $self}->$sub(@_); + no overloading; + return $map{0+$self}->$sub(@_); } } @@ -7545,10 +7567,11 @@ sub standardize ($) { else { # Keep track of cycles in the input, and refuse to infinitely loop - if (defined $already_output{main::objaddr $item}) { + my $addr; { no overloading; $addr = 0+$item; } + if (defined $already_output{$addr}) { return "${indent}ALREADY OUTPUT: $item\n"; } - $already_output{main::objaddr $item} = $item; + $already_output{$addr} = $item; if (ref $item eq 'ARRAY') { my $using_brackets; @@ -7665,7 +7688,7 @@ sub dump_inside_out { my $fields_ref = shift; Carp::carp_extra_args(\@_) if main::DEBUG && @_; - my $addr = main::objaddr $object; + my $addr; { no overloading; $addr = 0+$object; } my %hash; foreach my $key (keys %$fields_ref) { @@ -7693,7 +7716,7 @@ sub _operator_dot { } else { my $ref = ref $$which; - my $addr = main::objaddr $$which; + my $addr; { no overloading; $addr = 0+$$which; } $$which = "$ref ($addr)"; } } @@ -7711,7 +7734,8 @@ sub _operator_equal { return 0 unless defined $other; return 0 unless ref $other; - return main::objaddr $self == main::objaddr $other; + no overloading; + return 0+$self == 0+$other; } sub _operator_not_equal { @@ -8672,7 +8696,7 @@ END $file->carp_bad_line("Unexpected property '$property_name'. Skipped"); next LINE; } - $property_addr = main::objaddr($property_object); + { no overloading; $property_addr = 0+($property_object); } # Defer changing names until have a line that is acceptable # (the 'next' statement above means is unacceptable) @@ -8724,7 +8748,7 @@ END if $file->has_missings_defaults; foreach my $default_ref (@missings_list) { my $default = $default_ref->[0]; - my $addr = objaddr property_ref($default_ref->[1]); + my $addr; { no overloading; $addr = 0+property_ref($default_ref->[1]); } # For string properties, the default is just what the # file says, but non-string properties should already