cvs commit: ponie/src/pmc perl5cargo_cult.pmc
[email protected] (Nicholas Clark) 4 May 2005 10:12:44 -0000
| Newsgroups | perl.ponie.changes |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 05/05/04 03:12:44
Modified: perl sv.c
src/pmc perl5cargo_cult.pmc
Log:
Exterminate! new_SV.
(All in the PMC now)
Revision Changes Path
1.83 +2 -49 ponie/perl/sv.c
Index: sv.c
===================================================================
RCS file: /cvs/public/ponie/perl/sv.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- sv.c 4 May 2005 09:44:01 -0000 1.82
+++ sv.c 4 May 2005 10:12:44 -0000 1.83
@@ -165,58 +165,11 @@
* "A time to plant, and a time to uproot what was planted..."
*/
-/* new_SV(): return a new, empty SV head */
-
-/* provide a real function for a debugger to play with */
-STATIC SV*
-S_new_SV(pTHX)
-{
- Parrot_PMC sv = Parrot_PMC_new(PL_Parrot, PL_pmcname[SVt_NULL]);
- Parrot_register_pmc(PL_Parrot, sv);
- sv = MUMBLE(sv);
- LOCK_SV_MUTEX;
- ptr_table_store(PL_sv_arenatable, sv, sv);
- ++PL_sv_count;
- UNLOCK_SV_MUTEX;
- SvANY_set(sv, 0);
- SvREFCNT_set(sv, 1);
- Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv),
- Ponie_I_SV_ZERO_FLAGS_SET_TYPE, 0);
-#ifdef DEBUG_LEAKING_SCALARS
- /* FIXME */
- sv->sv_debug_optype = PL_op ? PL_op->op_type : 0;
- sv->sv_debug_line = (U16) ((PL_copline == NOLINE) ?
- (PL_curcop ? CopLINE(PL_curcop) : 0) : PL_copline);
- sv->sv_debug_inpad = 0;
- sv->sv_debug_cloned = 0;
-# ifdef NETWARE
- sv->sv_debug_file = PL_curcop ? savepv(CopFILE(PL_curcop)): NULL;
-# else
- sv->sv_debug_file = PL_curcop ? savesharedpv(CopFILE(PL_curcop)): NULL;
-# endif
-# endif
-
- return sv;
-}
-# define new_SV(p) (p)=S_new_SV(aTHX)
-
-STATIC void S_ptr_table_cleanup(pTHX_ PTR_TBL_t *tbl);
-
+#define new_SV(p) (p)=MUMBLE(Parrot_PMC_new(PL_Parrot, PL_pmcname[SVt_NULL]))
#define del_SV(p) Parrot_PMC_set_pointer_intkey(PL_Parrot, MUMBLE(p), \
Ponie_P_PINE_FOR_FJORDS, 0)
-
-/*
-=head1 SV Manipulation Functions
-
-=for apidoc sv_add_arena
-
-Given a chunk of memory, link it to the head of the list of arenas,
-and split it into a list of free SVs.
-
-=cut
-*/
-
+STATIC void S_ptr_table_cleanup(pTHX_ PTR_TBL_t *tbl);
/* visit(): call the named function for each non-free SV in the arenas. */
1.61 +30 -2 ponie/src/pmc/perl5cargo_cult.pmc
Index: perl5cargo_cult.pmc
===================================================================
RCS file: /cvs/public/ponie/src/pmc/perl5cargo_cult.pmc,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- perl5cargo_cult.pmc 4 May 2005 09:44:02 -0000 1.60
+++ perl5cargo_cult.pmc 4 May 2005 10:12:44 -0000 1.61
@@ -61,9 +61,37 @@
pmclass Perl5cargo_cult dynpmc {
void init () {
+ SV *sv;
+ struct STRUCT_SV *head;
+
PObj_active_destroy_SET(SELF);
- PMC_struct_val(SELF) = malloc(sizeof(struct STRUCT_SV));
+ PMC_struct_val(SELF) = head = malloc(sizeof(struct STRUCT_SV));
PMC_pmc_val(SELF) = NULL;
+
+ Parrot_register_pmc(PL_Parrot, SELF);
+
+ sv = MUMBLE(SELF);
+
+ ptr_table_store(PL_sv_arenatable, sv, sv);
+ ++PL_sv_count;
+
+ head->sv_any = 0;
+ head->sv_flags = 0;
+ head->sv_refcnt = 1;
+
+#ifdef DEBUG_LEAKING_SCALARS
+ /* FIXME */
+ sv->sv_debug_optype = PL_op ? PL_op->op_type : 0;
+ sv->sv_debug_line = (U16) ((PL_copline == NOLINE) ?
+ (PL_curcop ? CopLINE(PL_curcop) : 0) : PL_copline);
+ sv->sv_debug_inpad = 0;
+ sv->sv_debug_cloned = 0;
+# ifdef NETWARE
+ sv->sv_debug_file = PL_curcop ? savepv(CopFILE(PL_curcop)): NULL;
+# else
+ sv->sv_debug_file = PL_curcop ? savesharedpv(CopFILE(PL_curcop)): NULL;
+# endif
+# endif
}
void destroy () {