Re: [PATCH] Optree Generation

2005-09-02 Thread Alexey Tourbin
On Wed, Aug 31, 2005 at 05:18:23AM -0700, Yitzchak Scott-Thoennes wrote:
 --- perl/ext/B/B/Concise.pm.orig  2005-08-25 02:43:55.0 -0700
 +++ perl/ext/B/B/Concise.pm   2005-08-31 05:17:14.543707200 -0700

Thanks a lot!  Recently I've seen a lot of that method_named/1234567890
stuff when playing with B::Concise.  Thus I urge (if I can please) this
patch to be merged into bleadperl.


pgpwyWiUYJBJv.pgp
Description: PGP signature


Re: Optree Generation

2005-09-02 Thread Rafael Garcia-Suarez
On 8/31/05, Yitzchak Scott-Thoennes [EMAIL PROTECTED] wrote:
 The method_named ops are the unimport() method calls that no generates.
 It seems that the SV that holds the method name has an integer value also
 (perhaps related to sharing?) and Concise is showing that in preference
 to the string value.
 
 The following (untested) would be an unobtrusive way to fix this in
 this one case, though it might be better for concise_sv to dump both
 the string and numeric values when both are present.

Thanks, applied as change #25352.


Re: Optree Generation

2005-08-31 Thread mohammad yaseen
Hi Yitzchak Scott,
 

when you run the command given below 

perl -I../lib -MO=Concise,BEGIN,CHECK,INIT,END,-exec -e '$a=$b  print 
q/foo/'

 

i am getting following output in EBCDIC platform. 

 

BEGIN 1:

1  ; nextstate(B::Concise -249 Concise.pm:306) v/2

2  $ const(PV strict.pm) s/BARE

3  1 require sK/1

4  ; nextstate(B::Concise -249 Concise.pm:306) v/2

5  ; nextstate(B::Concise -249 Concise.pm:306) /2

6  0 pushmark s

7  $ const(PV strict) sM

8  $ const(PV refs) sM

9  $ method_named(PVIV -1585856300)

a  1 entersub[t1] KS*/TARG,2

b  1 leavesub[1 ref] K/REFC,1

BEGIN 2:

c  ; nextstate(B::Concise -234 Concise.pm:329) v/2

d  $ const(PV warnings.pm) s/BARE

e  1 require sK/1

f  ; nextstate(B::Concise -234 Concise.pm:329) v/2

g  ; nextstate(B::Concise -234 Concise.pm:329) /2

h  0 pushmark s

i  $ const(PV warnings) sM

j  $ const(PV qw) sM

k  $ method_named(PVIV -1585856300)

l  1 entersub[t1] KS*/TARG,2

m  1 leavesub[1 ref] K/REFC,1

-e syntax OK

 

As far as my understanding goes i thought -1585856300 is the address of the 
function. if that is the case then -1585856300 is not correct. what exactly 
-1585856300 represent. 

 

When i was debugging this i reached lib/B.pm there i tried to print  $self-IV 
thinking that it is getting number from this variable and it happed to be 
right. Futher i could not proceed as i did not have clear understand here 
itself.

Thanks and regards

Yaseen


Yitzchak Scott-Thoennes [EMAIL PROTECTED] wrote:
Can you tell us what your goal is?


-
 Start your day with Yahoo! - make it your home page 

Re: Optree Generation

2005-08-31 Thread Yitzchak Scott-Thoennes
On Tue, Aug 30, 2005 at 11:46:46PM -0700, mohammad yaseen wrote:
 when you run the command given below 
 
 perl -I../lib -MO=Concise,BEGIN,CHECK,INIT,END,-exec -e '$a=$b  print 
 q/foo/'

Also with just: perl -I../lib -MO=Concise,BEGIN,-exec -e0

As instructed, Concise is dumping out the BEGIN blocks, even some of
the ones in Concise.pm itself, specifically the two lines:

no strict 'refs';
  and 
no warnings 'qw'; # Possible attempt to put comments...; use #7

The method_named ops are the unimport() method calls that no generates.
It seems that the SV that holds the method name has an integer value also
(perhaps related to sharing?) and Concise is showing that in preference
to the string value.

The following (untested) would be an unobtrusive way to fix this in
this one case, though it might be better for concise_sv to dump both
the string and numeric values when both are present.

--- perl/ext/B/B/Concise.pm.orig2005-08-25 02:43:55.0 -0700
+++ perl/ext/B/B/Concise.pm 2005-08-31 05:17:14.543707200 -0700
@@ -627,7 +627,7 @@
 }
 
 sub concise_sv {
-my($sv, $hr) = @_;
+my($sv, $hr, $preferpv) = @_;
 $hr-{svclass} = class($sv);
 $hr-{svclass} = UV
   if $hr-{svclass} eq IV and $sv-FLAGS  SVf_IVisUV;
@@ -650,6 +650,8 @@
}
if (class($sv) eq SPECIAL) {
$hr-{svval} .= [Null, sv_undef, sv_yes, sv_no]-[$$sv];
+   } elsif ($preferpv  $sv-FLAGS  SVf_POK) {
+   $hr-{svval} .= cstring($sv-PV);
} elsif ($sv-FLAGS  SVf_NOK) {
$hr-{svval} .= $sv-NV;
} elsif ($sv-FLAGS  SVf_IOK) {
@@ -764,12 +766,13 @@
 elsif ($h{class} eq SVOP or $h{class} eq PADOP) {
unless ($h{name} eq 'aelemfast' and $op-flags  OPf_SPECIAL) {
my $idx = ($h{class} eq SVOP) ? $op-targ : $op-padix;
+   my $preferpv = $h{name} eq method_named;
if ($h{class} eq PADOP or !${$op-sv}) {
my $sv = (($curcv-PADLIST-ARRAY)[1]-ARRAY)[$idx];
-   $h{arg} = [ . concise_sv($sv, \%h) . ];
+   $h{arg} = [ . concise_sv($sv, \%h, $preferpv) . ];
$h{targarglife} = $h{targarg} = ;
} else {
-   $h{arg} = ( . concise_sv($op-sv, \%h) . );
+   $h{arg} = ( . concise_sv($op-sv, \%h, $preferpv) . );
}
}
 }

End of Patch.


 i am getting following output in EBCDIC platform. 
 
  
 
 BEGIN 1:
 
 1  ; nextstate(B::Concise -249 Concise.pm:306) v/2
 
 2  $ const(PV strict.pm) s/BARE
 
 3  1 require sK/1
 
 4  ; nextstate(B::Concise -249 Concise.pm:306) v/2
 
 5  ; nextstate(B::Concise -249 Concise.pm:306) /2
 
 6  0 pushmark s
 
 7  $ const(PV strict) sM
 
 8  $ const(PV refs) sM
 
 9  $ method_named(PVIV -1585856300)
 
 a  1 entersub[t1] KS*/TARG,2
 
 b  1 leavesub[1 ref] K/REFC,1
 
 BEGIN 2:
 
 c  ; nextstate(B::Concise -234 Concise.pm:329) v/2
 
 d  $ const(PV warnings.pm) s/BARE
 
 e  1 require sK/1
 
 f  ; nextstate(B::Concise -234 Concise.pm:329) v/2
 
 g  ; nextstate(B::Concise -234 Concise.pm:329) /2
 
 h  0 pushmark s
 
 i  $ const(PV warnings) sM
 
 j  $ const(PV qw) sM
 
 k  $ method_named(PVIV -1585856300)
 
 l  1 entersub[t1] KS*/TARG,2
 
 m  1 leavesub[1 ref] K/REFC,1
 
 -e syntax OK
 
  
 
 As far as my understanding goes i thought -1585856300 is the address of the 
 function. if that is the case then -1585856300 is not correct. what exactly 
 -1585856300 represent.

No, it's not an address; I'm not sure what it is, though. 


Optree Generation

2005-08-30 Thread mohammad yaseen

There is file called lib/B.pm here there is function as follows

 

sub B::IV::int_value {

  my ($self) = @_;

  my $ni = $self-IV; # i have added this

   print \n $ni $self \n; # i have added this

  return (($self-FLAGS()  SVf_IVisUV()) ? $self-UVX : $self-IV);

}

when i tried printing the $ni. if i run the following comman 

 

perl -I../lib -MO=Concise,BEGIN,CHECK,INIT,END,-exec -e '$a=$b  print 
q/foo/' 

 

then $ni is printing negative value -1585856300 (i am working on EBCDIC 
platform)  B::PVIV=SCALAR(0x2102f900) 

 

my question 

 

1. what is that negative value is it correct or what. 

2. how is variable IV is populated from where? 

3. what is the meaning of B::PVIV=SCALAR(0x2102f900) 

4. if u go to the begining of the file (lib/B.pm) and comment the following 
line @B::PVIV::ISA = qw(B::PV B::IV); on running the above mentioned line gives 
error. Here from where B::IV is picked from. what is the exact meaning of 
B::IV

Regards

Yaseen



-
Yahoo! Mail for Mobile
 Take Yahoo! Mail with you! Check email on your mobile phone.

Re: Optree Generation

2005-08-30 Thread Yitzchak Scott-Thoennes
Can you tell us what your goal is?