diff --git a/include/parrot/gc_api.h b/include/parrot/gc_api.h index 9b8c71e..d393669 100644 --- a/include/parrot/gc_api.h +++ b/include/parrot/gc_api.h @@ -181,11 +181,6 @@ int Parrot_gc_active_pmcs(PARROT_INTERP) int Parrot_gc_active_sized_buffers(PARROT_INTERP) __attribute__nonnull__(1); -void Parrot_gc_add_pmc_sync(PARROT_INTERP, ARGMOD(PMC *pmc)) - __attribute__nonnull__(1) - __attribute__nonnull__(2) - FUNC_MODIFIES(*pmc); - void Parrot_gc_allocate_buffer_storage_aligned(PARROT_INTERP, ARGOUT(Buffer *buffer), size_t size) @@ -265,11 +260,6 @@ void Parrot_gc_free_pmc_header(PARROT_INTERP, ARGMOD(PMC *pmc)) __attribute__nonnull__(2) FUNC_MODIFIES(*pmc); -void Parrot_gc_free_pmc_sync(PARROT_INTERP, ARGMOD(PMC *p)) - __attribute__nonnull__(1) - __attribute__nonnull__(2) - FUNC_MODIFIES(*p); - void Parrot_gc_free_string_header(PARROT_INTERP, ARGMOD(STRING *s)) __attribute__nonnull__(1) __attribute__nonnull__(2) @@ -377,9 +367,6 @@ int Parrot_gc_total_sized_buffers(PARROT_INTERP) #define ASSERT_ARGS_Parrot_gc_active_sized_buffers \ __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(interp) -#define ASSERT_ARGS_Parrot_gc_add_pmc_sync __attribute__unused__ int _ASSERT_ARGS_CHECK = \ - PARROT_ASSERT_ARG(interp) \ - || PARROT_ASSERT_ARG(pmc) #define ASSERT_ARGS_Parrot_gc_allocate_buffer_storage_aligned \ __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(interp) \ @@ -430,9 +417,6 @@ int Parrot_gc_total_sized_buffers(PARROT_INTERP) #define ASSERT_ARGS_Parrot_gc_free_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(interp) \ || PARROT_ASSERT_ARG(pmc) -#define ASSERT_ARGS_Parrot_gc_free_pmc_sync __attribute__unused__ int _ASSERT_ARGS_CHECK = \ - PARROT_ASSERT_ARG(interp) \ - || PARROT_ASSERT_ARG(p) #define ASSERT_ARGS_Parrot_gc_free_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(interp) \ || PARROT_ASSERT_ARG(s) diff --git a/include/parrot/pobj.h b/include/parrot/pobj.h index f40ce93..fd95c57 100644 --- a/include/parrot/pobj.h +++ b/include/parrot/pobj.h @@ -102,18 +102,6 @@ struct PMC { DPOINTER *data; PMC *_metadata; /* properties */ - /* - * PMC access synchronization for shared PMCs - * s. parrot/thread.h - */ - struct _Sync *_synchronize; - - /* This flag determines the next PMC in the 'used' list during - dead object detection in the GC. It is a linked list, which is - only valid in trace_active_PMCs. Also, the linked list is - guaranteed to have the tail element's _next_for_GC point to itself, - which makes much of the logic and checks simpler. We then have to - check for PMC->_next_for_GC == PMC to find the end of list. */ PMC *_next_for_GC; /* Yeah, the GC data should be out of @@ -134,7 +122,6 @@ struct PMC { #define PMC_data0_typed(pmc) (type)(1 ? (pmc)->data : 0) #define PMC_metadata(pmc) ((pmc)->_metadata) #define PMC_next_for_GC(pmc) ((pmc)->_next_for_GC) -#define PMC_sync(pmc) ((pmc)->_synchronize) #define POBJ_FLAG(n) ((UINTVAL)1 << (n)) /* PObj flags */ diff --git a/include/parrot/thread.h b/include/parrot/thread.h index fb314ea..f0497b8 100644 --- a/include/parrot/thread.h +++ b/include/parrot/thread.h @@ -1,5 +1,5 @@ /* thread.h - * Copyright (C) 2001-2007, Parrot Foundation. + * Copyright (C) 2001-2009, Parrot Foundation. * SVN Info * $Id$ * Overview: @@ -147,12 +147,6 @@ typedef struct _Shared_gc_info { /* TODO use thread pools instead */ VAR_SCOPE Shared_gc_info *shared_gc_info; -typedef struct _Sync { - Parrot_Interp owner; /* that interpreter, that owns - the arena, where the PMC is in */ - Parrot_mutex pmc_lock; /* for wr access to PMCs content */ -} Sync; - /* HEADERIZER BEGIN: src/thread.c */ /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ diff --git a/src/gc/api.c b/src/gc/api.c index acf8308..426934f 100644 --- a/src/gc/api.c +++ b/src/gc/api.c @@ -104,13 +104,6 @@ implementation, and malloc wrappers for various purposes. These are unused. static void cleanup_next_for_GC_pool(ARGIN(Small_Object_Pool *pool)) __attribute__nonnull__(1); -static void fix_pmc_syncs( - ARGMOD(Interp *dest_interp), - ARGIN(Small_Object_Pool *pool)) - __attribute__nonnull__(1) - __attribute__nonnull__(2) - FUNC_MODIFIES(*dest_interp); - static void free_pool(ARGMOD(Small_Object_Pool *pool)) __attribute__nonnull__(1) FUNC_MODIFIES(*pool); @@ -149,9 +142,6 @@ static int sweep_cb_pmc(PARROT_INTERP, #define ASSERT_ARGS_cleanup_next_for_GC_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(pool) -#define ASSERT_ARGS_fix_pmc_syncs __attribute__unused__ int _ASSERT_ARGS_CHECK = \ - PARROT_ASSERT_ARG(dest_interp) \ - || PARROT_ASSERT_ARG(pool) #define ASSERT_ARGS_free_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \ PARROT_ASSERT_ARG(pool) #define ASSERT_ARGS_get_free_buffer __attribute__unused__ int _ASSERT_ARGS_CHECK = \ @@ -334,9 +324,6 @@ Parrot_gc_new_pmc_header(PARROT_INTERP, UINTVAL flags) flags |= PObj_is_special_PMC_FLAG; - if (flags & PObj_is_PMC_shared_FLAG) - Parrot_gc_add_pmc_sync(interp, pmc); - PObj_get_FLAGS(pmc) = PObj_is_PMC_FLAG|flags; pmc->vtable = NULL; PMC_data(pmc) = NULL; @@ -368,58 +355,6 @@ Parrot_gc_free_pmc_header(PARROT_INTERP, ARGMOD(PMC *pmc)) pool->num_free_objects++; } -/* - -=item C - -Frees the PMC_sync field of the PMC, if one exists. - -=cut - -*/ - -void -Parrot_gc_free_pmc_sync(PARROT_INTERP, ARGMOD(PMC *p)) -{ - ASSERT_ARGS(Parrot_gc_free_pmc_sync) - - if (PObj_is_PMC_shared_TEST(p) && PMC_sync(p)) { - MUTEX_DESTROY(PMC_sync(p)->pmc_lock); - mem_internal_free(PMC_sync(p)); - PMC_sync(p) = NULL; - } -} - -/* - -=item C - -Adds a C structure to the given C. Initializes the PMC's owner -field and the synchronization mutext. Throws an exception if Sync allocation -fails. - -=cut - -*/ - -void -Parrot_gc_add_pmc_sync(PARROT_INTERP, ARGMOD(PMC *pmc)) -{ - ASSERT_ARGS(Parrot_gc_add_pmc_sync) - - /* This mutex already exists, leave it alone. */ - if (PMC_sync(pmc)) - return; - - PMC_sync(pmc) = mem_allocate_typed(Sync); - - if (!PMC_sync(pmc)) - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR, - "Parrot VM: PMC Sync allocation failed!\n"); - - PMC_sync(pmc)->owner = interp; - MUTEX_INIT(PMC_sync(pmc)->pmc_lock); -} /* @@ -837,11 +772,9 @@ Parrot_gc_merge_header_pools(ARGMOD(Interp *dest_interp), UINTVAL i; /* heavily borrowed from forall_header_pools */ - fix_pmc_syncs(dest_interp, source_arena->constant_pmc_pool); Parrot_gc_merge_buffer_pools(dest_interp, dest_arena->constant_pmc_pool, source_arena->constant_pmc_pool); - fix_pmc_syncs(dest_interp, source_arena->pmc_pool); Parrot_gc_merge_buffer_pools(dest_interp, dest_arena->pmc_pool, source_arena->pmc_pool); @@ -935,44 +868,6 @@ Parrot_gc_merge_buffer_pools(PARROT_INTERP, source->num_free_objects = 0; } -/* - -=item C - -Walks through the given arena, looking for all live and shared PMCs, -transferring their sync values to the destination interpreter. - -=cut - -*/ - -static void -fix_pmc_syncs(ARGMOD(Interp *dest_interp), ARGIN(Small_Object_Pool *pool)) -{ - ASSERT_ARGS(fix_pmc_syncs) - Small_Object_Arena *cur_arena; - const UINTVAL object_size = pool->object_size; - - for (cur_arena = pool->last_Arena; cur_arena; cur_arena = cur_arena->prev) { - PMC *p = (PMC *)((char*)cur_arena->start_objects + GC_HEADER_SIZE); - size_t i; - - for (i = 0; i < cur_arena->used; i++) { - if (!PObj_on_free_list_TEST(p) && PObj_is_PMC_TEST(p)) { - if (PObj_is_PMC_shared_TEST(p)) - PMC_sync(p)->owner = dest_interp; - else - Parrot_ex_throw_from_c_args(dest_interp, NULL, - EXCEPTION_INTERP_ERROR, - "Unshared PMC still alive after interpreter" - "destruction. address=%p, base_type=%d\n", - p, p->vtable->base_type); - } - - p = (PMC *)((char *)p + object_size); - } - } -} /* diff --git a/src/gc/mark_sweep.c b/src/gc/mark_sweep.c index 8f03796..9f4a4b7 100644 --- a/src/gc/mark_sweep.c +++ b/src/gc/mark_sweep.c @@ -414,7 +414,7 @@ mark_special(PARROT_INTERP, ARGIN(PMC *obj)) * the object. */ if (PObj_is_PMC_shared_TEST(obj)) { - interp = PMC_sync(obj)->owner; + /* TODO: assign interp to owning interpreter */ PARROT_ASSERT(interp); if (!interp->arena_base->gc_mark_ptr) diff --git a/src/hll.c b/src/hll.c index 0756470..a74cbac 100644 --- a/src/hll.c +++ b/src/hll.c @@ -53,11 +53,9 @@ static PMC* new_hll_entry(PARROT_INTERP, ARGIN_NULLOK(STRING *entry_name)) #define END_READ_HLL_INFO(interp, hll_info) #define START_WRITE_HLL_INFO(interp, hll_info) \ do { \ - if (PObj_is_PMC_shared_TEST(hll_info) && PMC_sync((interp)->HLL_info)) { \ + if (PObj_is_PMC_shared_TEST(hll_info)) { \ (hll_info) = (interp)->HLL_info = \ Parrot_clone((interp), (interp)->HLL_info); \ - if (PMC_sync((interp)->HLL_info)) \ - mem_internal_free(PMC_sync((interp)->HLL_info)); \ } \ } while (0) #define END_WRITE_HLL_INFO(interp, hll_info) @@ -363,7 +361,7 @@ Parrot_register_HLL_type(PARROT_INTERP, INTVAL hll_id, /* the type might already be registered in a non-conflicting way, in which * ca se we can avoid copying */ - if (PObj_is_PMC_shared_TEST(hll_info) && PMC_sync(hll_info)) { + if (PObj_is_PMC_shared_TEST(hll_info)) { if (hll_type == Parrot_get_HLL_type(interp, hll_id, core_type)) return; } diff --git a/src/ops/set.ops b/src/ops/set.ops index e17ec39..78e88c5 100644 --- a/src/ops/set.ops +++ b/src/ops/set.ops @@ -512,7 +512,6 @@ inline op copy(inout PMC, invar PMC) :base_mem { /* don't let the clone's destruction destroy the destination's data */ PObj_active_destroy_CLEAR(clone); PMC_data(clone) = NULL; - PMC_sync(clone) = NULL; PMC_metadata(clone) = NULL; PMC_next_for_GC(clone) = NULL; diff --git a/src/pmc.c b/src/pmc.c index 627aa32..9251d25 100644 --- a/src/pmc.c +++ b/src/pmc.c @@ -118,9 +118,6 @@ Parrot_pmc_destroy(PARROT_INTERP, ARGMOD(PMC *pmc)) PObj_custom_mark_CLEAR(pmc); PObj_live_CLEAR(pmc); - if (PObj_is_PMC_shared_TEST(pmc) && PMC_sync(pmc)) - Parrot_gc_free_pmc_sync(interp, pmc); - if (pmc->vtable->attr_size) { if (PMC_data(pmc)) { #if GC_USE_FIXED_SIZE_ALLOCATOR @@ -832,7 +829,6 @@ create_class_pmc(PARROT_INTERP, INTVAL type) && (_class == _class->vtable->pmc_class)) interp->vtables[type]->pmc_class = _class; else { - Parrot_gc_free_pmc_sync(interp, _class); gc_flag_CLEAR(is_special_PMC, _class); PObj_is_PMC_shared_CLEAR(_class); interp->vtables[type]->pmc_class = _class; diff --git a/src/pmc/object.pmc b/src/pmc/object.pmc index 046809f..9bf425a 100644 --- a/src/pmc/object.pmc +++ b/src/pmc/object.pmc @@ -756,7 +756,6 @@ Used to mark a PMC as read-only shared. VTABLE_set_integer_native(INTERP, _true, 1); VTABLE_setprop(INTERP, ret, CONST_STRING(interp, "_ro"), _true); SELF->vtable->pmc_class = master->vtables[type_num]->pmc_class; - Parrot_gc_add_pmc_sync(INTERP, ret); PObj_is_PMC_shared_SET(ret); data = PARROT_CLASS(classobj)->parents; diff --git a/src/pmc/parrotinterpreter.pmc b/src/pmc/parrotinterpreter.pmc index df2c484..edd5ed5 100644 --- a/src/pmc/parrotinterpreter.pmc +++ b/src/pmc/parrotinterpreter.pmc @@ -67,7 +67,6 @@ clone_interpreter(Parrot_Interp d, Parrot_Interp s, INTVAL flags) if (flags & PARROT_CLONE_HLL) { /* we'd like to share the HLL data. Give it a PMC_sync structure if it doesn't have one already */ - Parrot_gc_add_pmc_sync(s, s->HLL_info); d->HLL_info = s->HLL_info; Parrot_regenerate_HLL_namespaces(d); } diff --git a/src/pmc/scalar.pmc b/src/pmc/scalar.pmc index ff2f876..a415f87 100644 --- a/src/pmc/scalar.pmc +++ b/src/pmc/scalar.pmc @@ -1375,7 +1375,6 @@ Sets this PMC as shared and read-only. VTABLE_setprop(INTERP, ret, CONST_STRING(INTERP, "_ro"), _true); /* We're sharing this, so make sure it has a PMC_sync */ - Parrot_gc_add_pmc_sync(INTERP, ret); PObj_is_PMC_shared_SET(ret); /* XXX FIXME workaround lack of metadata sharing*/ diff --git a/src/thread.c b/src/thread.c index eedea3d..6d43be5 100644 --- a/src/thread.c +++ b/src/thread.c @@ -352,8 +352,6 @@ pt_shared_fixup(PARROT_INTERP, ARGMOD(PMC *pmc)) if (is_ro) pmc->vtable = pmc->vtable->ro_variant_vtable; - Parrot_gc_add_pmc_sync(interp, pmc); - PObj_is_PMC_shared_SET(pmc); /* make sure metadata doesn't go away unexpectedly */