ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Faster/Faster.xs
(Generate patch)

Comparing Faster/Faster.xs (file contents):
Revision 1.8 by root, Sun Mar 12 17:03:39 2006 UTC vs.
Revision 1.9 by root, Sun Mar 12 21:36:00 2006 UTC

1#include "EXTERN.h" 1#include "EXTERN.h"
2#include "perl.h" 2#include "perl.h"
3#include "XSUB.h" 3#include "XSUB.h"
4
5#include <fcntl.h>
6#include <unistd.h>
4 7
5typedef CV *B__CV; 8typedef CV *B__CV;
6 9
7static OP *(*old_entersub)(pTHX); 10static OP *(*old_entersub)(pTHX);
8 11
9// this is, of course, a slower entersub 12// this is, of course, a slower entersub
10static OP * 13static OP *
11faster_entersub (pTHX) 14faster_entersub (pTHX)
12{ 15{
16 static int in_perl;
17
13 if (!PL_compcv) // only when not compiling, reduces recompiling due to op-address-shift 18 if (!PL_compcv || in_perl) // only when not compiling, reduces recompiling due to op-address-shift
14 { 19 {
15 dSP; 20 dSP;
16 dTOPss; 21 dTOPss;
22
23 ++in_perl;
17 24
18 if (SvTYPE (sv) == SVt_PVGV) 25 if (SvTYPE (sv) == SVt_PVGV)
19 sv = (SV *)GvCV (sv); 26 sv = (SV *)GvCV (sv);
20 27
21 if (sv) 28 if (sv)
41 SPAGAIN; 48 SPAGAIN;
42 FREETMPS; 49 FREETMPS;
43 LEAVE; 50 LEAVE;
44 } 51 }
45 } 52 }
53
54 --in_perl;
46 } 55 }
47 56
48 return old_entersub (aTHX); 57 return old_entersub (aTHX);
49} 58}
50 59
83 op->op_ppaddr = ptr; 92 op->op_ppaddr = ptr;
84 93
85 CvSTART (cv) = op; 94 CvSTART (cv) = op;
86} 95}
87 96
97bool
98fcntl_lock (int fd)
99 CODE:
100{
101 struct flock lck;
102 lck.l_type = F_WRLCK;
103 lck.l_whence = SEEK_SET;
104 lck.l_start = 0;
105 lck.l_len = 0;
88 106
107 RETVAL = fcntl (fd, F_SETLKW, &lck) == 0;
108}
109 OUTPUT:
110 RETVAL
111
112
113

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines