From 65b251a411ee0e8162afd2340b5d92d3eaeb730a Mon Sep 17 00:00:00 2001 From: chromatic Date: Tue, 5 May 2009 02:20:48 +0000 Subject: [PATCH] [oo] Reduced the number of PMCs created in Parrot_ComputeMRO_C3, which is a modest optimization. git-svn-id: https://svn.parrot.org/parrot/trunk@38476 d31e2699-5ff4-0310-a27c-f18f2fbe73fe --- src/oo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/oo.c b/src/oo.c index 8ef413b5b7..9497adab96 100644 --- a/src/oo.c +++ b/src/oo.c @@ -1101,7 +1101,7 @@ Parrot_ComputeMRO_C3(PARROT_INTERP, ARGIN(PMC *_class)) { ASSERT_ARGS(Parrot_ComputeMRO_C3) PMC *result; - PMC * const merge_list = pmc_new(interp, enum_class_ResizablePMCArray); + PMC *merge_list = PMCNULL; PMC *immediate_parents; int i, parent_count; @@ -1131,6 +1131,10 @@ Parrot_ComputeMRO_C3(PARROT_INTERP, ARGIN(PMC *_class)) if (PMC_IS_NULL(lin)) return PMCNULL; + /* instantiated lazily */ + if (PMC_IS_NULL(merge_list)) + merge_list = pmc_new(interp, enum_class_ResizablePMCArray); + VTABLE_push_pmc(interp, merge_list, lin); }