cvs commit: ponie/src/pmc perl5cargo_cult.pmc
[email protected] (Nicholas Clark) 16 Oct 2004 19:04:22 -0000
| Newsgroups | perl.ponie.changes |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 04/10/16 12:04:22
Modified: perl sv.c sv.h
src/pmc perl5cargo_cult.pmc
Log:
Make as much of sv.c as practial use PMC access to the flags.
New core only macro to get/set/clear SVf_BREAK
New core only macro to reset flags and set a type
Make a distinction between clearing SVf_OOK and conditionally calling
sv_backoff
Revision Changes Path
1.46 +38 -20 ponie/perl/sv.c
Index: sv.c
===================================================================
RCS file: /cvs/public/ponie/perl/sv.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -w -r1.45 -r1.46
--- sv.c 15 Oct 2004 16:58:04 -0000 1.45
+++ sv.c 16 Oct 2004 19:04:22 -0000 1.46
@@ -171,7 +171,8 @@
UNLOCK_SV_MUTEX;
SvANY(sv) = 0;
SvREFCNT(sv) = 1;
- SvFLAGS(sv) = 0;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv),
+ Ponie_I_SV_ZERO_FLAGS_SET_TYPE, 0);
SvPMC_off(sv);
return sv;
}
@@ -208,7 +209,9 @@
Perl_ptr_table_delete(PL_sv_arenatable, p);
UNLOCK_SV_MUTEX;
- SvFLAGS(p) = SVTYPEMASK;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(p),
+ Ponie_I_SV_ZERO_FLAGS_SET_TYPE,
+ SVTYPEMASK);
if (!PL_in_clean_all) {
/* Is the SV mutex needed outside 5005 threads? */
@@ -379,7 +382,7 @@
do_clean_all(pTHX_ SV *sv)
{
DEBUG_D((PerlIO_printf(Perl_debug_log, "Cleaning loops: SV at 0x%"UVxf"\n", PTR2UV(sv)) ));
- SvFLAGS(sv) |= SVf_BREAK;
+ SvBREAK_on(sv);
SvREFCNT_dec(sv);
}
@@ -1808,7 +1811,7 @@
SvIV_set(sv, 0);
Move(s, SvPVX(sv), SvCUR(sv)+1, char);
}
- SvFLAGS(sv) &= ~SVf_OOK;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_OOK, 0);
return 0;
}
@@ -4234,13 +4237,15 @@
SvNOKp_on(dstr);
/* Only set the public OK flag if the source has public OK. */
if (sflags & SVf_NOK)
- SvFLAGS(dstr) |= SVf_NOK;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(dstr),
+ Ponie_I_SVf_NOK, 1);
SvNVX(dstr) = SvNVX(sstr);
}
if (sflags & SVp_IOK) {
(void)SvIOKp_on(dstr);
if (sflags & SVf_IOK)
- SvFLAGS(dstr) |= SVf_IOK;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(dstr),
+ Ponie_I_SVf_IOK, 1);
if (sflags & SVf_IVisUV)
SvIsUV_on(dstr);
SvIVX(dstr) = SvIVX(sstr);
@@ -4319,7 +4324,8 @@
/* Initial code is common. */
if (SvPVX(dstr)) { /* we know that dtype >= SVt_PV */
if (SvOOK(dstr)) {
- SvFLAGS(dstr) &= ~SVf_OOK;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(dstr),
+ Ponie_I_SVf_OOK, 0);
Safefree(SvPVX(dstr) - SvIVX(dstr));
}
else if (SvLEN(dstr))
@@ -4375,13 +4381,15 @@
if (sflags & SVp_NOK) {
SvNOKp_on(dstr);
if (sflags & SVf_NOK)
- SvFLAGS(dstr) |= SVf_NOK;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(dstr),
+ Ponie_I_SVf_NOK, 1);
SvNVX(dstr) = SvNVX(sstr);
}
if (sflags & SVp_IOK) {
(void)SvIOKp_on(dstr);
if (sflags & SVf_IOK)
- SvFLAGS(dstr) |= SVf_IOK;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(dstr),
+ Ponie_I_SVf_IOK, 1);
if (sflags & SVf_IVisUV)
SvIsUV_on(dstr);
SvIVX(dstr) = SvIVX(sstr);
@@ -4846,7 +4854,7 @@
/* Same SvOOK_on but SvOOK_on does a SvIOK_off
and we do that anyway inside the SvNIOK_off
*/
- SvFLAGS(sv) |= SVf_OOK;
+ SvOOK_on(sv);
}
SvNIOK_off(sv);
SvLEN(sv) -= delta;
@@ -5144,8 +5152,14 @@
mg->mg_virtual = vtable;
mg_magical(sv);
- if (SvGMAGICAL(sv))
- SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK|SVf_POK);
+ if (SvGMAGICAL(sv)) {
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv),
+ Ponie_I_SVf_IOK, 0);
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv),
+ Ponie_I_SVf_NOK, 0);
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv),
+ Ponie_I_SVf_POK, 0);
+ }
return mg;
}
@@ -5357,7 +5371,7 @@
}
if (!SvMAGIC(sv)) {
SvMAGICAL_off(sv);
- SvFLAGS(sv) |= (SvFLAGS(sv) & (SVp_NOK|SVp_POK)) >> PRIVSHIFT;
+ SV_PRIVSHIFT(sv);
}
return 0;
@@ -5565,7 +5579,7 @@
else
sv_upgrade(nsv, SVt_PVMG);
SvMAGIC(nsv) = SvMAGIC(sv);
- SvFLAGS(nsv) |= SvMAGICAL(sv);
+ SvMAGICAL_set(nsv, SvMAGICAL(sv));
SvMAGICAL_off(sv);
SvMAGIC(sv) = 0;
}
@@ -5822,8 +5836,10 @@
case SVt_PVGV:
del_XPVGV(SvANY(sv));
/* code duplication for increased performance. */
- SvFLAGS(sv) &= SVf_BREAK;
- SvFLAGS(sv) |= SVTYPEMASK;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv),
+ Ponie_I_SV_ZERO_FLAGS_SET_TYPE,
+ SVTYPEMASK);
+ SvBREAK_on(sv);
/* decrease refcount of the stash that owns this GV, if any */
if (stash)
SvREFCNT_dec(stash);
@@ -5838,8 +5854,9 @@
del_XPVIO(SvANY(sv));
break;
}
- SvFLAGS(sv) &= SVf_BREAK;
- SvFLAGS(sv) |= SVTYPEMASK;
+ Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv),
+ Ponie_I_SV_ZERO_FLAGS_SET_TYPE, SVTYPEMASK);
+ SvBREAK_on(sv);
}
/*
@@ -5876,7 +5893,7 @@
if (!sv)
return;
if (SvREFCNT(sv) == 0) {
- if (SvFLAGS(sv) & SVf_BREAK)
+ if (SvBREAK(sv))
/* this SV's refcnt has been artificially decremented to
* trigger cleanup */
return;
@@ -7321,7 +7338,8 @@
register SV *sv;
new_SV(sv);
- SvFLAGS(sv) = SVs_TEMP;
+ /* Returns flags as all zero. */
+ SvTEMP_on(sv);
EXTEND_MORTAL(1);
PL_tmps_stack[++PL_tmps_ix] = sv;
return sv;
1.48 +11 -1 ponie/perl/sv.h
Index: sv.h
===================================================================
RCS file: /cvs/public/ponie/perl/sv.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -w -r1.47 -r1.48
--- sv.h 16 Oct 2004 11:31:47 -0000 1.47
+++ sv.h 16 Oct 2004 19:04:22 -0000 1.48
@@ -190,6 +190,8 @@
typedef enum {
Ponie_I_SV_TYPE,
Ponie_I_SV_UPGRADE,
+ Ponie_I_SV_ZERO_FLAGS_SET_TYPE,
+ Ponie_I_SVf_BREAK,
Ponie_I_SVp_OK,
Ponie_I_SVf_OK,
Ponie_I_SVf_OK_exc_UV,
@@ -218,6 +220,7 @@
Ponie_I_SV_NP_PRIVSHIFT,
Ponie_I_SV_VOK,
Ponie_I_SVf_OOK,
+ Ponie_I_SVf_OOK_backoff,
Ponie_I_SVf_FAKE,
Ponie_I_SVf_ROK,
Ponie_I_SVf_ROK_AMAGIC,
@@ -699,12 +702,19 @@
#define SvVOK(sv) ((U32)Parrot_PMC_get_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SV_VOK))
#define SvOOK(sv) ((U32)Parrot_PMC_get_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_OOK))
#define SvOOK_on(sv) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_OOK, 1)
-#define SvOOK_off(sv) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_OOK, 0)
+#define SvOOK_off(sv) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_OOK_backoff, 1)
#define SvFAKE(sv) ((U32)Parrot_PMC_get_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_FAKE))
#define SvFAKE_on(sv) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_FAKE, 1)
#define SvFAKE_off(sv) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_FAKE, 0)
+
+#ifdef PERL_CORE
+#define SvBREAK(sv) ((U32)Parrot_PMC_get_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_BREAK))
+#define SvBREAK_on(sv) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_BREAK, 1)
+#define SvBREAK_off(sv) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_BREAK, 0)
+#endif
+
#define SvROK(sv) ((U32)Parrot_PMC_get_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_ROK))
#define SvROK_on(sv) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_ROK, 1)
#define SvROK_off(sv) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_ROK_AMAGIC, 0)
1.37 +27 -6 ponie/src/pmc/perl5cargo_cult.pmc
Index: perl5cargo_cult.pmc
===================================================================
RCS file: /cvs/public/ponie/src/pmc/perl5cargo_cult.pmc,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -w -r1.36 -r1.37
--- perl5cargo_cult.pmc 16 Oct 2004 11:31:47 -0000 1.36
+++ perl5cargo_cult.pmc 16 Oct 2004 19:04:22 -0000 1.37
@@ -1,7 +1,7 @@
/* Perl5QQQ.pmc -*- c -*-
* Copyright: 2001-2004 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: perl5cargo_cult.pmc,v 1.36 2004/10/16 11:31:47 nicholas Exp $
+ * $Id: perl5cargo_cult.pmc,v 1.37 2004/10/16 19:04:22 nicholas Exp $
* Overview:
* These are the vtable functions for the Perl5QQQ base class
* Data Structure and Algorithms:
@@ -150,6 +150,9 @@
case Ponie_I_SVf_FAKE:
return ((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags
& SVf_FAKE;
+ case Ponie_I_SVf_BREAK:
+ return ((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags
+ & SVf_BREAK;
case Ponie_I_SVf_ROK:
return ((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags
& SVf_ROK;
@@ -238,6 +241,10 @@
((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags
|= (value & SVTYPEMASK);
return;
+ case Ponie_I_SV_ZERO_FLAGS_SET_TYPE:
+ ((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags
+ = (value & SVTYPEMASK);
+ return;
case Ponie_I_SV_UPGRADE:
if ((((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags & SVTYPEMASK) < value)
sv_upgrade(MUMBLE(SELF), value);
@@ -288,7 +295,6 @@
return;
case Ponie_I_SVf_IOK:
if (value) {
- SvRELEASE_IVX(MUMBLE(SELF));
(((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags)
|= SVf_IOK;
} else {
@@ -435,12 +441,18 @@
(((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags)
|= SVf_OOK;
} else {
+ (((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags)
+ &= ~SVf_OOK;
+ }
+ return;
+ case Ponie_I_SVf_OOK_backoff:
+ if (value) {
if ((((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags)
& SVf_OOK) {
sv_backoff(MUMBLE(SELF));
}
- }
return;
+ }
case Ponie_I_SVf_FAKE:
if (value) {
(((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags)
@@ -450,6 +462,15 @@
&= ~SVf_FAKE;
}
return;
+ case Ponie_I_SVf_BREAK:
+ if (value) {
+ (((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags)
+ |= SVf_BREAK;
+ } else {
+ (((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags)
+ &= ~SVf_BREAK;
+ }
+ return;
case Ponie_I_SVf_ROK:
if (value) {
(((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags)