cvs commit: ponie/src/pmc perl5cargo_cult.pmc
[email protected] (Nicholas Clark) 15 Oct 2004 16:58:05 -0000
| Newsgroups | perl.ponie.changes |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 04/10/15 09:58:05
Modified: perl perl.c sv.c sv.h
src/pmc perl5cargo_cult.pmc
Log:
Split out SvUPGRADE and setting SvTYPE.
Provide a SvTYPE_set macro for the parts of the core that need to directly
set the SV type.
Revision Changes Path
1.13 +4 -6 ponie/perl/perl.c
Index: perl.c
===================================================================
RCS file: /cvs/public/ponie/perl/perl.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -r1.12 -r1.13
--- perl.c 30 Aug 2004 14:37:45 -0000 1.12
+++ perl.c 15 Oct 2004 16:58:04 -0000 1.13
@@ -719,8 +719,8 @@
}
/* Now absolutely destruct everything, somehow or other, loops or no. */
- SvFLAGS(PL_fdpid) |= SVTYPEMASK; /* don't clean out pid table now */
- SvFLAGS(PL_strtab) |= SVTYPEMASK; /* don't clean out strtab now */
+ SvTYPE_set(PL_fdpid,SVTYPEMASK); /* don't clean out pid table now */
+ SvTYPE_set(PL_strtab,SVTYPEMASK); /* don't clean out strtab now */
{
int i;
@@ -734,10 +734,8 @@
while (PL_sv_count > 6 && sv_clean_all())
;
- SvFLAGS(PL_fdpid) &= ~SVTYPEMASK;
- SvFLAGS(PL_fdpid) |= SVt_PVAV;
- SvFLAGS(PL_strtab) &= ~SVTYPEMASK;
- SvFLAGS(PL_strtab) |= SVt_PVHV;
+ SvTYPE_set(PL_fdpid,SVt_PVAV);
+ SvTYPE_set(PL_strtab,SVt_PVHV);
AvREAL_off(PL_fdpid); /* no surviving entries */
SvREFCNT_dec(PL_fdpid); /* needed in io_close() */
1.45 +2 -3 ponie/perl/sv.c
Index: sv.c
===================================================================
RCS file: /cvs/public/ponie/perl/sv.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -w -r1.44 -r1.45
--- sv.c 11 Oct 2004 16:23:40 -0000 1.44
+++ sv.c 15 Oct 2004 16:58:04 -0000 1.45
@@ -1784,8 +1784,7 @@
IoPAGE_LEN(sv) = 60;
break;
}
- SvFLAGS(sv) &= ~SVTYPEMASK;
- SvFLAGS(sv) |= mt;
+ SvTYPE_set(sv, mt);
return TRUE;
}
@@ -5599,7 +5598,7 @@
}
#endif
SvREFCNT(sv) = refcnt;
- SvFLAGS(nsv) |= SVTYPEMASK; /* Mark as freed */
+ SvTYPE_set(nsv, SVTYPEMASK); /* Mark as freed */
SvREFCNT(nsv) = 0;
del_SV(nsv);
}
1.44 +5 -2 ponie/perl/sv.h
Index: sv.h
===================================================================
RCS file: /cvs/public/ponie/perl/sv.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -w -r1.43 -r1.44
--- sv.h 15 Oct 2004 16:22:45 -0000 1.43
+++ sv.h 15 Oct 2004 16:58:04 -0000 1.44
@@ -189,6 +189,7 @@
typedef enum {
Ponie_I_SV_TYPE,
+ Ponie_I_SV_UPGRADE,
Ponie_I_SVp_OK,
Ponie_I_SVf_OK,
Ponie_I_SVf_OK_exc_UV,
@@ -244,8 +245,10 @@
#define SVTYPEMASK 0xff
#define SvTYPE(sv) ((U32)Parrot_PMC_get_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SV_TYPE))
-
-#define SvUPGRADE(sv, mt) (Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SV_TYPE, mt), TRUE)
+#ifdef PERL_CORE
+#define SvTYPE_set(sv,mt) Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SV_TYPE, mt)
+#endif
+#define SvUPGRADE(sv, mt) (Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SV_UPGRADE, mt), TRUE)
#define SVs_PADSTALE 0x00000100 /* lexical has gone out of scope */
#define SVs_PADTMP 0x00000200 /* in use as tmp */
1.33 +7 -1 ponie/src/pmc/perl5cargo_cult.pmc
Index: perl5cargo_cult.pmc
===================================================================
RCS file: /cvs/public/ponie/src/pmc/perl5cargo_cult.pmc,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -w -r1.32 -r1.33
--- perl5cargo_cult.pmc 15 Oct 2004 15:52:25 -0000 1.32
+++ perl5cargo_cult.pmc 15 Oct 2004 16:58:05 -0000 1.33
@@ -1,7 +1,7 @@
/* Perl5QQQ.pmc -*- c -*-
* Copyright: 2001-2004 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: perl5cargo_cult.pmc,v 1.32 2004/10/15 15:52:25 nicholas Exp $
+ * $Id: perl5cargo_cult.pmc,v 1.33 2004/10/15 16:58:05 nicholas Exp $
* Overview:
* These are the vtable functions for the Perl5QQQ base class
* Data Structure and Algorithms:
@@ -221,6 +221,12 @@
void set_integer_keyed_int(INTVAL key, INTVAL value) {
switch (key) {
case Ponie_I_SV_TYPE:
+ /* Some of the internals needs to force the type. */
+ ((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags &= ~SVTYPEMASK;
+ ((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);
return;