diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1997-01-08 11:52:00 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-01-08 11:52:00 +1200 |
commit | 28757baaaeaa3801dd997fad8b1f5f62c64a228e (patch) | |
tree | 207f182f2a7bbe578c2ac82a754f776d0bc25193 /op.c | |
parent | 26f45c0087f1216e071d7b395c24e01de531479d (diff) | |
download | perl-28757baaaeaa3801dd997fad8b1f5f62c64a228e.tar.gz |
[inseparable changes from patch from perl5.003_19 to perl5.003_20]
BUILD PROCESS
Subject: Make Configure default to the first domain in /etc/resolv.conf
From: Chip Salzenberg <chip@atlantic.net>
Files: Configure
Subject: Start all helper scripts with $startsh
From: Chip Salzenberg <chip@atlantic.net>
Files: Configure
Subject: Support libperl.so under FreeBSD
Date: Sun, 5 Jan 1997 22:41:49 +0100
From: Ollivier Robert <roberto@keltia.freenix.fr>
Files: Configure Makefile.SH
Msg-ID: <Mutt.19970105224149.roberto@keltia.freenix.fr>
(applied based on p5p patch as commit b126116e5ae3d57fa007f8a42fd506805b35163b)
CORE LANGUAGE CHANGES
Subject: Rescind named closures
From: Chip Salzenberg <chip@atlantic.net>
Files: Makefile.SH op.c perly.c perly.c.diff perly.y pp_hot.c
Subject: Fix: empty @_ when calling empty-proto subs without parens
Date: Sat, 04 Jan 1997 10:29:04 +0000
From: Graham Barr <bodg@tiuk.ti.com>
Files: perly.c perly.y
(applied based on p5p patch as commit 3112f5de73952f91aa4e8005d9852dfddbcf0402)
CORE PORTABILITY
Subject: Configure/perl5/Compartmented Mode Workstation (fwd)
Date: Mon, 06 Jan 1997 13:15:38 -0500 (EST)
From: Andy Dougherty <doughera@fractal.phys.lafayette.edu>
Files: Configure hints/dec_osf.sh
private-msgid: <Pine.SOL.3.95.970106131505.1662C-100000@fractal.lafayette.ed
Subject: Remove obsolete file "dl_os2.xs".
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Files: MANIFEST
DOCUMENTATION
Subject: tiny doc patches
Date: Sat, 04 Jan 1997 11:12:13 -0500
From: Roderick Schertler <roderick@gate.net>
Files: pod/perlapio.pod pod/perlnews.pod pod/perltoc.pod
Msg-ID: <23338.852394333@eeyore.ibcinc.com>
(applied based on p5p patch as commit b681178584626ba3718f1279845fd452317134c1)
Subject: doc patch for defined on perlfunc.pod
Date: 04 Jan 1997 21:28:30 -0500
From: Roderick Schertler <roderick@gate.net>
Files: pod/perlfunc.pod
Msg-ID: <pz91686ek1.fsf@eeyore.ibcinc.com>
(applied based on p5p patch as commit 38e3adfd2e3d40b46e465482945c4f3de4bb50ef)
Subject: doc patch: perldsc
Date: 04 Jan 1997 21:25:58 -0500
From: Roderick Schertler <roderick@gate.net>
Files: pod/perldsc.pod pod/perltoc.pod
Msg-ID: <pzafqo6eo9.fsf@eeyore.ibcinc.com>
(applied based on p5p patch as commit 4d42f92e5bf79556508016b7af91233b12e526eb)
Subject: scalar caller doc fix
Date: Mon, 06 Jan 1997 22:34:20 -0500
From: Roderick Schertler <roderick@gate.net>
Files: pod/perlfunc.pod
Msg-ID: <18245.852608060@eeyore.ibcinc.com>
(applied based on p5p patch as commit 218104faecb0ec19e0f4f89e084959e757a5230f)
Subject: Misc perlfunc updates
From: Tom Christiansen <tchrist@mox.perl.com>
Files: pod/perlfunc.pod pod/perltoc.pod
LIBRARY AND EXTENSIONS
Subject: sigaction() problems
Date: Mon, 06 Jan 1997 15:42:04 -0500
From: Roderick Schertler <roderick@gate.net>
Files: ext/POSIX/POSIX.pm ext/POSIX/POSIX.pod
Msg-ID: <12808.852583324@eeyore.ibcinc.com>
(applied based on p5p patch as commit 84e96f2bcc509ba2fb5d2c9608a30cc3cfdea41a)
Subject: Fix importation of FileHandle methods; fix POSIX docs
From: Chip Salzenberg <chip@atlantic.net>
Files: ext/POSIX/POSIX.pm ext/POSIX/POSIX.pod lib/FileHandle.pm
Subject: Patch: make hints files warn about db-recno failures
Date: Sun, 5 Jan 1997 12:34:25 +0100
From: Dominic Dunlop <domo@slipper.ip.lu>
Files: MANIFEST hints/aux.sh hints/broken-db.msg hints/freebsd.sh
(applied based on p5p patch as commit 692df45da95e2b7d14c4560347ef4555bb40b621)
OTHER CORE CHANGES
Subject: Fix C< sub foo (&@); sub bar (&); foo {}, bar {}, bar {} >
From: Chip Salzenberg <chip@atlantic.net>
Files: perly.c perly.c.diff perly.y
Subject: plug for safe/opcode leaks
Date: Tue, 07 Jan 1997 17:20:46 -0500
From: Doug MacEachern <dougm@osf.org>
Files: op.c
Msg-ID: <199701072220.RAA02117@postman.osf.org>
(applied based on p5p patch as commit 5cbfc2849d37f748a8facbcbf1c889c575943488)
Subject: Fix Dynaloader failures with DProf
Date: Mon, 06 Jan 1997 12:18:46 -0500
From: Gurusamy Sarathy <gsar@engin.umich.edu>
Files: pp_hot.c
private-msgid: <199701061718.MAA26909@aatma.engin.umich.edu>
TESTS
Subject: New test: comp/proto.t
Date: Mon, 06 Jan 1997 09:13:03 +0000
From: Graham Barr <bodg@tiuk.ti.com>
Files: MANIFEST t/comp/proto.t
(applied based on p5p patch as commit 8c1635e65dc1b3900503d444e985e3f0e5601454)
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 147 |
1 files changed, 80 insertions, 67 deletions
@@ -26,8 +26,10 @@ * think the expression is of the right type: croak actually does a Siglongjmp. */ #define CHECKOP(type,op) \ - ((op_mask && op_mask[type]) \ - ? (croak("%s trapped by operation mask", op_desc[type]), (OP*)op) \ + ((op_mask && op_mask[type]) \ + ? ( op_free((OP*)op), \ + croak("%s trapped by operation mask", op_desc[type]), \ + Nullop ) \ : (*check[type])((OP*)op)) #else #define CHECKOP(type,op) (*check[type])(op) @@ -210,14 +212,28 @@ pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix) SvNVX(sv) = (double)curcop->cop_seq; SvIVX(sv) = 999999999; /* A ref, intro immediately */ SvFLAGS(sv) |= SVf_FAKE; - /* "It's closures all the way down." */ - CvCLONE_on(compcv); - if (cv != startcv) { - CV *bcv; - for (bcv = startcv; - bcv && bcv != cv && !CvCLONE(bcv); - bcv = CvOUTSIDE(bcv)) - CvCLONE_on(bcv); + if (CvANON(compcv)) { + /* "It's closures all the way down." */ + CvCLONE_on(compcv); + if (cv != startcv) { + CV *bcv; + for (bcv = startcv; + bcv && bcv != cv && !CvCLONE(bcv); + bcv = CvOUTSIDE(bcv)) { + if (CvANON(bcv)) + CvCLONE_on(bcv); + else { + if (dowarn) + warn("Value of %s may be unavailable", + name); + break; + } + } + } + } + else { + if (dowarn && !CvUNIQUE(cv)) + warn("Value of %s will not stay shared", name); } } av_store(comppad, newoff, SvREFCNT_inc(oldsv)); @@ -3006,7 +3022,6 @@ OP *block; char *name = op ? SvPVx(cSVOP->op_sv, na) : "__ANON__"; GV* gv = gv_fetchpv(name, GV_ADDMULTI, SVt_PVCV); AV* av; - char *s; I32 ix; if (op) { @@ -3020,8 +3035,9 @@ OP *block; cv = 0; } else if (CvROOT(cv) || CvXSUB(cv) || GvASSUMECV(gv)) { - SV* const_sv = cv_const_sv(cv); + /* already defined (or promised) */ + SV* const_sv = cv_const_sv(cv); char *p = proto ? SvPVx(((SVOP*)proto)->op_sv, na) : Nullch; if((!proto != !SvPOK(cv)) || (p && strNE(SvPV((SV*)cv,na), p))) { @@ -3029,8 +3045,7 @@ OP *block; SvPOK(cv) ? SvPV((SV*)cv,na) : "none", p ? p : "none"); } - - if ((const_sv || dowarn) && strNE(name, "BEGIN")) {/* already defined (or promised)? */ + if ((const_sv || dowarn) && strNE(name, "BEGIN")) { line_t oldline = curcop->cop_line; curcop->cop_line = copline; @@ -3079,10 +3094,6 @@ OP *block; return cv; } - /* XXX: Named functions at file scope cannot be closures */ - if (op && CvUNIQUE(CvOUTSIDE(cv))) - CvCLONE_off(cv); - av = newAV(); /* Will be @_ */ av_extend(av, 0); av_store(comppad, 0, (SV*)av); @@ -3101,34 +3112,37 @@ OP *block; CvROOT(cv)->op_next = 0; peep(CvSTART(cv)); - if (s = strrchr(name,':')) - s++; - else - s = name; - if (strEQ(s, "BEGIN") && !error_count) { - ENTER; - SAVESPTR(compiling.cop_filegv); - SAVEI16(compiling.cop_line); - SAVEI32(perldb); - save_svref(&rs); - sv_setsv(rs, nrs); - - if (!beginav) - beginav = newAV(); - DEBUG_x( dump_sub(gv) ); - av_push(beginav, (SV *)cv); - GvCV(gv) = 0; - calllist(beginav); + if (op) { + char *s = strrchr(name,':'); + if (s) + s++; + else + s = name; + if (strEQ(s, "BEGIN") && !error_count) { + ENTER; + SAVESPTR(compiling.cop_filegv); + SAVEI16(compiling.cop_line); + SAVEI32(perldb); + save_svref(&rs); + sv_setsv(rs, nrs); + + if (!beginav) + beginav = newAV(); + DEBUG_x( dump_sub(gv) ); + av_push(beginav, (SV *)cv); + GvCV(gv) = 0; + calllist(beginav); - curcop = &compiling; - LEAVE; - } - else if (strEQ(s, "END") && !error_count) { - if (!endav) - endav = newAV(); - av_unshift(endav, 1); - av_store(endav, 0, (SV *)cv); - GvCV(gv) = 0; + curcop = &compiling; + LEAVE; + } + else if (strEQ(s, "END") && !error_count) { + if (!endav) + endav = newAV(); + av_unshift(endav, 1); + av_store(endav, 0, (SV *)cv); + GvCV(gv) = 0; + } } if (perldb && curstash != debstash) { @@ -3159,10 +3173,9 @@ OP *block; } } - if (!op) { + if (!op) GvCV(gv) = 0; /* Will remember in SVOP instead. */ - CvANON_on(cv); - } + copline = NOLINE; LEAVE_SCOPE(floor); return cv; @@ -3191,7 +3204,6 @@ char *filename; { register CV *cv; GV *gv = gv_fetchpv((name ? name : "__ANON__"), GV_ADDMULTI, SVt_PVCV); - char *s; if (name) sub_generation++; @@ -3223,24 +3235,25 @@ char *filename; GvCVGEN(gv) = 0; CvFILEGV(cv) = gv_fetchfile(filename); CvXSUB(cv) = subaddr; - if (!name) - s = "__ANON__"; - else if (s = strrchr(name,':')) - s++; - else - s = name; - if (strEQ(s, "BEGIN")) { - if (!beginav) - beginav = newAV(); - av_push(beginav, SvREFCNT_inc(gv)); - } - else if (strEQ(s, "END")) { - if (!endav) - endav = newAV(); - av_unshift(endav, 1); - av_store(endav, 0, SvREFCNT_inc(gv)); - } - if (!name) { + if (name) { + char *s = strrchr(name,':'); + if (s) + s++; + else + s = name; + if (strEQ(s, "BEGIN")) { + if (!beginav) + beginav = newAV(); + av_push(beginav, SvREFCNT_inc(gv)); + } + else if (strEQ(s, "END")) { + if (!endav) + endav = newAV(); + av_unshift(endav, 1); + av_store(endav, 0, SvREFCNT_inc(gv)); + } + } + else { GvCV(gv) = 0; /* Will remember elsewhere instead. */ CvANON_on(cv); } |