cvs commit: modperl-2.0/src/modules/perl modperl_perl_pp.c modperl_perl_pp.h

2002-06-15 Thread dougm

dougm   2002/06/15 18:07:21

  Added:   src/modules/perl modperl_perl_pp.c modperl_perl_pp.h
  Log:
  new module where any PL_ppaddr modifications are done
  
  Revision  ChangesPath
  1.1  modperl-2.0/src/modules/perl/modperl_perl_pp.c
  
  Index: modperl_perl_pp.c
  ===
  #include mod_perl.h
  
  static enum opcode MP_pp_map[] = {
  #ifdef MP_REFGEN_FIXUP
  OP_SREFGEN,
  #endif
  };
  
  typedef OP * MP_FUNC_T(modperl_pp_t)(pTHX);
  
  static modperl_pp_t MP_PERL_ppaddr[MP_OP_max];
  
  #ifdef MP_REFGEN_FIXUP
  
  /*
   * nasty workaround for bug fixed in bleedperl (11536 + 11553)
   * XXX: when 5.8.0 is released + stable, we will require 5.8.0
   * if ithreads are enabled.
   */
  
  static OP *modperl_pp_srefgen(pTHX)
  {
  dSP;
  OP *o;
  SV *sv = *SP;
  
  if (SvPADTMP(sv)  IS_PADGV(sv)) {
  /* prevent S_refto from making a copy of the GV,
   * tricking it to SvREFCNT_inc and point to this one instead.
   */
  SvPADTMP_off(sv);
  }
  else {
  sv = Nullsv;
  }
  
  /* o = Perl_pp_srefgen(aTHX) */
  o = MP_PERL_ppaddr[MP_OP_SREFGEN](aTHX);
  
  if (sv) {
  /* restore original flags */
  SvPADTMP_on(sv);
  }
  
  return o;
  }
  
  #endif /* MP_REFGEN_FIXUP */
  
  static modperl_pp_t MP_ppaddr[] = {
  #ifdef MP_REFGEN_FIXUP
  MEMBER_TO_FPTR(modperl_pp_srefgen),
  #endif
  };
  
  void modperl_perl_pp_set(modperl_perl_opcode_e idx)
  {
  int pl_idx = MP_pp_map[idx];
  
  /* save original */
  MP_PERL_ppaddr[idx] = PL_ppaddr[pl_idx];
  
  /* replace with our own */
  PL_ppaddr[pl_idx] = MP_ppaddr[idx];
  }
  
  void modperl_perl_pp_set_all(void)
  {
  int i;
  
  for (i=0; iMP_OP_max; i++) {
  modperl_perl_pp_set(i);
  }
  }
  
  void modperl_perl_pp_unset(modperl_perl_opcode_e idx)
  {
  int pl_idx = MP_pp_map[idx];
  
  /* restore original */
  PL_ppaddr[pl_idx] = MP_PERL_ppaddr[idx];
  }
  
  void modperl_perl_pp_unset_all(void)
  {
  int i;
  
  for (i=0; iMP_OP_max; i++) {
  modperl_perl_pp_unset(i);
  }
  }
  
  
  
  1.1  modperl-2.0/src/modules/perl/modperl_perl_pp.h
  
  Index: modperl_perl_pp.h
  ===
  #ifndef MODPERL_PERL_PP_H
  #define MODPERL_PERL_PP_H
  
  #if defined(USE_ITHREADS)  defined(MP_PERL_5_6_x)
  #   define MP_REFGEN_FIXUP
  #endif
  
  typedef enum {
  #ifdef MP_REFGEN_FIXUP
  MP_OP_SREFGEN,
  #endif
  MP_OP_max
  } modperl_perl_opcode_e;
  
  void modperl_perl_pp_set(modperl_perl_opcode_e idx);
  
  void modperl_perl_pp_set_all(void);
  
  void modperl_perl_pp_unset(modperl_perl_opcode_e idx);
  
  void modperl_perl_pp_unset_all(void);
  
  #endif /* MODPERL_PERL_PP_H */
  
  
  



cvs commit: modperl-2.0/src/modules/perl modperl_perl_pp.c modperl_perl_pp.h

2002-06-15 Thread dougm

dougm   2002/06/15 18:20:50

  Modified:src/modules/perl modperl_perl_pp.c modperl_perl_pp.h
  Log:
  stub modperl_pp_require
  
  Revision  ChangesPath
  1.2   +8 -0  modperl-2.0/src/modules/perl/modperl_perl_pp.c
  
  Index: modperl_perl_pp.c
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl_pp.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_perl_pp.c 16 Jun 2002 01:07:21 -  1.1
  +++ modperl_perl_pp.c 16 Jun 2002 01:20:50 -  1.2
   -4,6 +4,7 
   #ifdef MP_REFGEN_FIXUP
   OP_SREFGEN,
   #endif
  +OP_REQUIRE
   };
   
   typedef OP * MP_FUNC_T(modperl_pp_t)(pTHX);
   -47,10 +48,17 
   
   #endif /* MP_REFGEN_FIXUP */
   
  +static OP *modperl_pp_require(pTHX)
  +{
  +/* nothing yet */
  +return MP_PERL_ppaddr[MP_OP_REQUIRE](aTHX);
  +}
  +
   static modperl_pp_t MP_ppaddr[] = {
   #ifdef MP_REFGEN_FIXUP
   MEMBER_TO_FPTR(modperl_pp_srefgen),
   #endif
  +MEMBER_TO_FPTR(modperl_pp_require)
   };
   
   void modperl_perl_pp_set(modperl_perl_opcode_e idx)
  
  
  
  1.2   +1 -0  modperl-2.0/src/modules/perl/modperl_perl_pp.h
  
  Index: modperl_perl_pp.h
  ===
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_perl_pp.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_perl_pp.h 16 Jun 2002 01:07:21 -  1.1
  +++ modperl_perl_pp.h 16 Jun 2002 01:20:50 -  1.2
   -9,6 +9,7 
   #ifdef MP_REFGEN_FIXUP
   MP_OP_SREFGEN,
   #endif
  +MP_OP_REQUIRE,
   MP_OP_max
   } modperl_perl_opcode_e;