Skip to content

Commit

Permalink
[PMC] Promoted a frequent STRING to a CONST_STRING.
Browse files Browse the repository at this point in the history
ObjectRef's string "$!OBJECTREF" can safely be a constant.  This is a minor
optimization.
  • Loading branch information
chromatic committed Jun 26, 2010
1 parent 4e6cce6 commit 4e3a1a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pmc/objectref_pmc.template
Expand Up @@ -17,12 +17,18 @@ Forwards all but some methods to the held PMC.
*/

#include "parrot/parrot.h"
static STRING *OBJECTREF_str;

pmclass ObjectRef dynpmc group perl6_group manual_attrs {
ATTR PMC *value;

void class_init() {
OBJECTREF_str = CONST_STRING(interp, "$!OBJECTREF");
}

VTABLE void init() {
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(INTERP);
STRING * const s_obj = string_from_literal(INTERP, "$!OBJECTREF");
STRING * const s_obj = OBJECTREF_str;
PMC * const objectpmc = Parrot_ns_find_namespace_global(INTERP, hll_ns, s_obj);
STATICSELF.init_pmc(objectpmc);
}
Expand Down

0 comments on commit 4e3a1a1

Please sign in to comment.