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

Comparing Faster/Faster.xs (file contents):
Revision 1.4 by root, Thu Mar 9 22:55:56 2006 UTC vs.
Revision 1.7 by root, Fri Mar 10 22:18:39 2006 UTC

3#include "XSUB.h" 3#include "XSUB.h"
4 4
5typedef CV *B__CV; 5typedef CV *B__CV;
6 6
7static OP *(*old_entersub)(pTHX); 7static OP *(*old_entersub)(pTHX);
8
9int count = 1;
10 8
11// this is, of course, a slower entersub 9// this is, of course, a slower entersub
12static OP * 10static OP *
13faster_entersub (pTHX) 11faster_entersub (pTHX)
14{ 12{
53 51
54IV 52IV
55ppaddr (int optype) 53ppaddr (int optype)
56 CODE: 54 CODE:
57 RETVAL = optype == OP_ENTERSUB 55 RETVAL = optype == OP_ENTERSUB
58 ? old_entersub 56 ? (IV)old_entersub
59 : PL_ppaddr [optype]; 57 : (IV)PL_ppaddr [optype];
60 OUTPUT: 58 OUTPUT:
61 RETVAL 59 RETVAL
62 60
63void 61void
64hook_entersub () 62hook_entersub ()
70patch_cv (B::CV cv, void *ptr) 68patch_cv (B::CV cv, void *ptr)
71 CODE: 69 CODE:
72{ 70{
73 OP *op; 71 OP *op;
74 72
73 if (!ptr)
74 croak ("NULL not allowed as code address for patch_cv");
75
75 NewOp (0, op, 1, OP); 76 NewOp (0, op, 1, OP);
76 77
77 op->op_sibling = CvSTART (cv); 78 op->op_sibling = CvSTART (cv);
78 op->op_type = OP_NULL; 79 op->op_type = OP_NULL;
79 op->op_ppaddr = ptr; 80 op->op_ppaddr = ptr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines