[svn:parrot] r40981 - trunk/src/gc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Sat Sep 5 00:14:35 UTC 2009
Author: chromatic
Date: Sat Sep 5 00:14:33 2009
New Revision: 40981
URL: https://trac.parrot.org/parrot/changeset/40981
Log:
[GC] Inlined calculation of PMC attribute pools into
Parrot_gc_free_pmc_attributes() and Parrot_gc_free_fixed_size_storage(). This
gives a 2.73% performance improvement on the primes.pasm benchmark.
Modified:
trunk/src/gc/api.c
trunk/src/gc/mark_sweep.c
Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c Fri Sep 4 23:18:14 2009 (r40980)
+++ trunk/src/gc/api.c Sat Sep 5 00:14:33 2009 (r40981)
@@ -1629,10 +1629,11 @@
{
ASSERT_ARGS(Parrot_gc_free_pmc_attributes)
void * const data = PMC_data(pmc);
- /* const size_t size = pmc->vtable->attr_size; */
- const size_t size = item_size;
- if (data != NULL) {
- PMC_Attribute_Pool * const pool = Parrot_gc_get_attribute_pool(interp, size);
+
+ if (data) {
+ PMC_Attribute_Pool **pools = interp->arena_base->attrib_pools;
+ const size_t idx = item_size - sizeof (void *);
+ PMC_Attribute_Pool * const pool = pools[idx];
Parrot_gc_free_attributes_from_pool(interp, pool, data);
PMC_data(pmc) = NULL;
}
@@ -1667,11 +1668,13 @@
*/
void
-Parrot_gc_free_fixed_size_storage(PARROT_INTERP, size_t size, ARGMOD(void * data))
+Parrot_gc_free_fixed_size_storage(PARROT_INTERP, size_t size, ARGMOD(void *data))
{
ASSERT_ARGS(Parrot_gc_free_fixed_size_storage)
- PMC_Attribute_Pool * const pool = Parrot_gc_get_attribute_pool(interp,
- size);
+ PMC_Attribute_Pool **pools = interp->arena_base->attrib_pools;
+ const size_t idx = size - sizeof (void *);
+ PMC_Attribute_Pool * const pool = pools[idx];
+
Parrot_gc_free_attributes_from_pool(interp, pool, data);
}
Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c Fri Sep 4 23:18:14 2009 (r40980)
+++ trunk/src/gc/mark_sweep.c Sat Sep 5 00:14:33 2009 (r40981)
@@ -1250,10 +1250,12 @@
{
ASSERT_ARGS(Parrot_gc_get_attribute_pool)
- Arenas * const arenas = interp->arena_base;
- PMC_Attribute_Pool ** pools = arenas->attrib_pools;
- const size_t size = (attrib_size < sizeof (void *))?(sizeof (void *)):(attrib_size);
- const size_t idx = size - sizeof (void *);
+ Arenas * const arenas = interp->arena_base;
+ PMC_Attribute_Pool **pools = arenas->attrib_pools;
+ const size_t size = (attrib_size < sizeof (void *))
+ ? sizeof (void *)
+ : attrib_size;
+ const size_t idx = size - sizeof (void *);
if (pools == NULL) {
const size_t total_length = idx + GC_ATTRIB_POOLS_HEADROOM;
More information about the parrot-commits
mailing list