develooper Front page | perl.perl5.porters | Postings from January 2003

Re: Freeing code

Thread Previous | Thread Next
From:
Paul Johnson
Date:
January 28, 2003 05:14
Subject:
Re: Freeing code
Message ID:
18918.193.134.254.145.1043759589.squirrel@wesley.pjcj.net
Rafael Garcia-Suarez said:

> "Paul Johnson" <paul@pjcj.net> wrote:
>> >
>> > op_seq seems to be used only as a flag : "has this OP been optimized
>> by
>> > now"
>>
>> It is also used by B::C.  The value -1 is a flag to indicate that an op
>> is
>> statically defined and should not be freed.
>
> So we could theorically replace op_seq by two boolean flags, as far as
> the core and the bytecode compiler backend are concerned.

I think so.  The whole thing is a little messy at the moment, but in any
case, here's a patch that plugs the leak.

It's against 5.8.0, cos that's all I have available at the moment, and
I'll attach it too because I don't trust this mailer, but at least it's
small :-)

*** op.c.org	Wed Jul 10 01:36:04 2002
--- op.c	Tue Jan 28 13:34:37 2003
***************
*** 6988,6995 ****
      for (; o; o = o->op_next) {
  	if (o->op_seq)
  	    break;
! 	if (!PL_op_seqmax)
! 	    PL_op_seqmax++;
  	PL_op = o;
  	switch (o->op_type) {
  	case OP_SETSTATE:
--- 6988,6997 ----
      for (; o; o = o->op_next) {
  	if (o->op_seq)
  	    break;
!         /* The special value -1 is used by the B::C compiler backend to
indicate
!          * that an op is statically defined and should not be freed */
! 	if (!PL_op_seqmax || PL_op_seqmax == (U16)-1)
! 	    PL_op_seqmax = 1;
  	PL_op = o;
  	switch (o->op_type) {
  	case OP_SETSTATE:

-- 
Paul Johnson - paul@pjcj.net
http://www.pjcj.net


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About