Re: Smoke [5.9.2] 23450 FAIL(M) MSWin32 WinXP/.Net SP1 (x86/1 cpu)

2004-11-04 Thread Steve Hay
Nick Ing-Simmons wrote:

>Yitzchak Scott-Thoennes <[EMAIL PROTECTED]> writes:
>  
>
>>On Mon, Nov 01, 2004 at 07:55:02PM +, Dave Mitchell <[EMAIL PROTECTED]> wrote:
>>
>>
>>>On Mon, Nov 01, 2004 at 11:07:07AM +, Steve Hay wrote:
>>>  
>>>
Note that ext/re/re_comp.c is copied from regcomp.c


>>>Does anyone know why this is done? It basically recompiles the core regex
>>>funtions under new names, and allows them to be called instead of the
>>>standard ones.
>>>  
>>>
>>For use re "debug", I've always assumed it needed to be compiled
>>specially.
>>
>>
>
>IIRC it is compiled with different #defines in effect.
>
Indeed - regcomp.c is compiled with PERL_CORE and ext/re/re_comp.c is not.

So I could modify my proposed patch 
(http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-11/msg00168.html) 
to this:

 //depot/perl/embed.fnc#135 - C:\p5p\bleadperl\embed.fnc 
@@ -361,8 +361,10 @@
 Ap|void|leave_scope|I32 base
 p|void|lex_end
 p|void|lex_start|SV* line
-Ap |void   |op_null|OP* o
+Ap|void|op_null|OP* o
 p|void|op_clear|OP* o
+Ap|void|op_refcnt_lock
+Ap|void|op_refcnt_unlock
 p|OP*|linklist|OP* o
 p|OP*|list|OP* o
 p|OP*|listkids|OP* o
 //depot/perl/embed.h#445 - C:\p5p\bleadperl\embed.h 
@@ -443,6 +443,8 @@
 #ifdef PERL_CORE
 #define op_clearPerl_op_clear
 #endif
+#define op_refcnt_lockPerl_op_refcnt_lock
+#define op_refcnt_unlockPerl_op_refcnt_unlock
 #ifdef PERL_CORE
 #define linklistPerl_linklist
 #endif
@@ -3067,6 +3069,8 @@
 #ifdef PERL_CORE
 #define op_clear(a)Perl_op_clear(aTHX_ a)
 #endif
+#define op_refcnt_lock()Perl_op_refcnt_lock(aTHX)
+#define op_refcnt_unlock()Perl_op_refcnt_unlock(aTHX)
 #ifdef PERL_CORE
 #define linklist(a)Perl_linklist(aTHX_ a)
 #endif
 //depot/perl/global.sym#253 - C:\p5p\bleadperl\global.sym 
@@ -223,6 +223,8 @@
 Perl_is_utf8_mark
 Perl_leave_scope
 Perl_op_null
+Perl_op_refcnt_lock
+Perl_op_refcnt_unlock
 Perl_load_module
 Perl_vload_module
 Perl_looks_like_number
 //depot/perl/op.c#639 - C:\p5p\bleadperl\op.c 
@@ -442,6 +442,18 @@
 o->op_ppaddr = PL_ppaddr[OP_NULL];
 }
 
+void
+Perl_op_refcnt_lock(void)
+{
+OP_REFCNT_LOCK;
+}
+
+void
+Perl_op_refcnt_unlock(void)
+{
+OP_REFCNT_UNLOCK;
+}
+
 /* Contextualizers */
 
 #define LINKLIST(o) ((o)->op_next ? (o)->op_next : linklist((OP*)o))
 //depot/perl/op.h#132 - C:\p5p\bleadperl\op.h 
@@ -481,8 +481,13 @@
 
 #ifdef USE_ITHREADS
 #  define OP_REFCNT_INITMUTEX_INIT(&PL_op_mutex)
-#  define OP_REFCNT_LOCKMUTEX_LOCK(&PL_op_mutex)
-#  define OP_REFCNT_UNLOCKMUTEX_UNLOCK(&PL_op_mutex)
+#  ifdef PERL_CORE
+#define OP_REFCNT_LOCKMUTEX_LOCK(&PL_op_mutex)
+#define OP_REFCNT_UNLOCKMUTEX_UNLOCK(&PL_op_mutex)
+#  else
+#define OP_REFCNT_LOCKop_refcnt_lock()
+#define OP_REFCNT_UNLOCKop_refcnt_unlock()
+#  endif
 #  define OP_REFCNT_TERMMUTEX_DESTROY(&PL_op_mutex)
 #else
 #  define OP_REFCNT_INITNOOP
 //depot/perl/proto.h#483 - C:\p5p\bleadperl\proto.h 
@@ -340,6 +340,8 @@
 PERL_CALLCONV voidPerl_lex_start(pTHX_ SV* line);
 PERL_CALLCONV voidPerl_op_null(pTHX_ OP* o);
 PERL_CALLCONV voidPerl_op_clear(pTHX_ OP* o);
+PERL_CALLCONV voidPerl_op_refcnt_lock(pTHX);
+PERL_CALLCONV voidPerl_op_refcnt_unlock(pTHX);
 PERL_CALLCONV OP*Perl_linklist(pTHX_ OP* o);
 PERL_CALLCONV OP*Perl_list(pTHX_ OP* o);
 PERL_CALLCONV OP*Perl_listkids(pTHX_ OP* o);

i.e. change the definition of OP_REFCNT_LOCK/UNLOCK in op.h to use the 
new functions if PERL_CORE is not defined.

- Steve




This email has been scanned for viruses and content by the Radan Computational 
Webshield Appliances.



Re: Smoke [5.9.2] 23450 FAIL(M) MSWin32 WinXP/.Net SP1 (x86/1 cpu)

2004-11-03 Thread Nick Ing-Simmons
Yitzchak Scott-Thoennes <[EMAIL PROTECTED]> writes:
>On Mon, Nov 01, 2004 at 07:55:02PM +, Dave Mitchell <[EMAIL PROTECTED]> wrote:
>> On Mon, Nov 01, 2004 at 11:07:07AM +, Steve Hay wrote:
>> > Note that ext/re/re_comp.c is copied from regcomp.c
>> 
>> Does anyone know why this is done? It basically recompiles the core regex
>> funtions under new names, and allows them to be called instead of the
>> standard ones.
>
>For use re "debug", I've always assumed it needed to be compiled
>specially.

IIRC it is compiled with different #defines in effect.



Re: Smoke [5.9.2] 23450 FAIL(M) MSWin32 WinXP/.Net SP1 (x86/1 cpu)

2004-11-01 Thread Yitzchak Scott-Thoennes
On Mon, Nov 01, 2004 at 07:55:02PM +, Dave Mitchell <[EMAIL PROTECTED]> wrote:
> On Mon, Nov 01, 2004 at 11:07:07AM +, Steve Hay wrote:
> > Note that ext/re/re_comp.c is copied from regcomp.c
> 
> Does anyone know why this is done? It basically recompiles the core regex
> funtions under new names, and allows them to be called instead of the
> standard ones.

For use re "debug", I've always assumed it needed to be compiled
specially.


Re: Smoke [5.9.2] 23450 FAIL(M) MSWin32 WinXP/.Net SP1 (x86/1 cpu)

2004-11-01 Thread Dave Mitchell
On Mon, Nov 01, 2004 at 11:07:07AM +, Steve Hay wrote:
> Note that ext/re/re_comp.c is copied from regcomp.c

Does anyone know why this is done? It basically recompiles the core regex
funtions under new names, and allows them to be called instead of the
standard ones.

-- 
The Enterprise successfully ferries an alien VIP from one place to another
without serious incident.
-- Things That Never Happen in "Star Trek" #7


Re: Smoke [5.9.2] 23450 FAIL(M) MSWin32 WinXP/.Net SP1 (x86/1 cpu)

2004-11-01 Thread Steve Hay
Nicholas Clark wrote:

> //depot/perl/regcomp.c#340 (text) 
>
>@@ -4983,9 +4983,14 @@
>(SvTYPE(new_comppad) == SVt_PVAV) ?
>new_comppad : Null(PAD *)
>);
>+   OP_REFCNT_LOCK;
>if (!OpREFCNT_dec((OP_4tree*)r->data->data[n])) {
>+   OP_REFCNT_UNLOCK;
> op_free((OP_4tree*)r->data->data[n]);
>}
>+   else {
>+   OP_REFCNT_UNLOCK;
>+   }
> 
>PAD_RESTORE_LOCAL(old_comppad);
>SvREFCNT_dec((SV*)new_comppad);
>  
>
The above seems to be the cause of the problem, since now re.dll doesn't 
link:

link -out:..\..\lib\auto\re\re.dll -dll -nologo -nodefaultlib 
-debug -opt:ref,icf  -libpath:"c:\perl\lib\CORE"  -machine:x86 
re_exec.obj re_comp.obj re.obj   ..\..\lib\CORE\perl59.lib oldnames.lib 
kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib 
ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib 
msvcrt.lib -def:re.def
   Creating library ..\..\lib\auto\re\re.lib and object 
..\..\lib\auto\re\re.exp

re_comp.obj : error LNK2001: unresolved external symbol __imp__PL_op_mutex
..\..\lib\auto\re\re.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
Unsuccessful make(re): code=512 at buildext.pl line 146.
NMAKE : fatal error U1077: '..\miniperl.exe' : return code '0x2'
Stop.

Reverting the above regcomp.c change fixes things.

Note that ext/re/re_comp.c is copied from regcomp.c, which didn't cause 
any problems when built into the main Perl library.  Likewise, similar 
changes to pad.c and sv.c didn't cause any problem, so I am guessing 
that the use of OP_REFCNT_(UN)LOCK is OK in the core (PERL_CORE?), but 
not within extensions?

So it probably comes down to needing to export PL_op_mutex?

My perl59.lib definitely doesn't have the symbol exported, so how do I 
make that happen (or would that not be the right thing to do anyway)?  
makedef.pl already skips it for non-ithreads builds, but it doesn't seem 
to be getting included for ithreads builds anyway :(

Grepping around a bit, I found an old change for a possibly similar 
problem (19484) which mentions that "PL_op_mutex [...] isn't exported as 
such", but it doesn't elaborate.

- Steve




This email has been scanned for viruses and content by the Radan Computational 
Webshield Appliances.



Re: Smoke [5.9.2] 23450 FAIL(M) MSWin32 WinXP/.Net SP1 (x86/1 cpu)

2004-11-01 Thread Nicholas Clark
On Mon, Nov 01, 2004 at 04:46:00AM +, Steve Hay wrote:
> Automated smoke report for 5.9.2 patch 23450
> TANGAROA.uk.radan.com:  Intel(R) Pentium(R) 4 CPU 2.00GHz(~1992 MHz) (x86/1 cpu)
> onMSWin32 - WinXP/.Net SP1
> using cl version 12.00.8804
> smoketime 6 hours 8 minutes (average 11 minutes 32 seconds)
> 
> Summary: FAIL(M)
> 
> O = OK  F = Failure(s), extended report at the bottom
> X = Failure(s) under TEST but not under harness
> ? = still running or test results not (yet) available
> Build failures during:   - = unknown or N/A
> c = Configure, m = make, M = make (after miniperl), t = make test-prep
> 
>23450 Configuration (common) -DINST_TOP=$(INST_DRV)\Smoke\doesntexist
> --- -
> O O 
> O O -Dusemymalloc
> O O -Duselargefiles
> O O -Duselargefiles -Dusemymalloc
> M M -Duseithreads
> M M -Duseithreads -Dusemymalloc
> M M -Duseithreads -Duselargefiles
> M M -Duseithreads -Duselargefiles -Dusemymalloc
> O O -Accflags='-DPERL_COPY_ON_WRITE'
> O O -Accflags='-DPERL_COPY_ON_WRITE' -Dusemymalloc
> O O -Accflags='-DPERL_COPY_ON_WRITE' -Duselargefiles
> O O -Accflags='-DPERL_COPY_ON_WRITE' -Duselargefiles -Dusemymalloc
> M M -Accflags='-DPERL_COPY_ON_WRITE' -Duseithreads
> M M -Accflags='-DPERL_COPY_ON_WRITE' -Duseithreads -Dusemymalloc
> M M -Accflags='-DPERL_COPY_ON_WRITE' -Duseithreads -Duselargefiles
> M M -Accflags='-DPERL_COPY_ON_WRITE' -Duseithreads -Duselargefiles 
> -Dusemymalloc
> | +- -DDEBUGGING
> +--- no debugging

Given that this all went wrong between 23432 and 23436, I susped change 23433:


Change 23433 by [EMAIL PROTECTED] on 2004/10/29 21:04:17

[perl #31851] Threading crash with closures
various OpREFCNT_inc() operations weren't doing locking

Affected files ...

... //depot/perl/pad.c#37 edit
... //depot/perl/regcomp.c#340 edit
... //depot/perl/sv.c#767 edit

Differences ...

 //depot/perl/pad.c#37 (text) 

@@ -1410,7 +1410,9 @@
 #endif
 CvGV(cv)   = CvGV(proto);
 CvSTASH(cv)= CvSTASH(proto);
+OP_REFCNT_LOCK;
 CvROOT(cv) = OpREFCNT_inc(CvROOT(proto));
+OP_REFCNT_UNLOCK;
 CvSTART(cv)= CvSTART(proto);
 CvOUTSIDE(cv)  = (CV*)SvREFCNT_inc(outside);
 CvOUTSIDE_SEQ(cv) = CvOUTSIDE_SEQ(proto);

 //depot/perl/regcomp.c#340 (text) 

@@ -4983,9 +4983,14 @@
(SvTYPE(new_comppad) == SVt_PVAV) ?
new_comppad : Null(PAD *)
);
+   OP_REFCNT_LOCK;
if (!OpREFCNT_dec((OP_4tree*)r->data->data[n])) {
+   OP_REFCNT_UNLOCK;
 op_free((OP_4tree*)r->data->data[n]);
}
+   else {
+   OP_REFCNT_UNLOCK;
+   }
 
PAD_RESTORE_LOCAL(old_comppad);
SvREFCNT_dec((SV*)new_comppad);

 //depot/perl/sv.c#767 (text) 

@@ -10244,7 +10244,9 @@
case 'o':
/* Compiled op trees are readonly, and can thus be
   shared without duplication. */
+   OP_REFCNT_LOCK;
d->data[i] = (void*)OpREFCNT_inc((OP*)r->data->data[i]);
+   OP_REFCNT_UNLOCK;
break;
case 'n':
d->data[i] = r->data->data[i];
@@ -10955,7 +10957,9 @@
Perl_rvpv_dup(aTHX_ dstr, sstr, param);
CvSTASH(dstr)   = hv_dup(CvSTASH(sstr), param); /* NOTE: not refcounted */
CvSTART(dstr)   = CvSTART(sstr);
+   OP_REFCNT_LOCK;
CvROOT(dstr)= OpREFCNT_inc(CvROOT(sstr));
+   OP_REFCNT_UNLOCK;
CvXSUB(dstr)= CvXSUB(sstr);
CvXSUBANY(dstr) = CvXSUBANY(sstr);
if (CvCONST(sstr)) {