Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure we don't double-init the meta-model / dynops.
  • Loading branch information
jnthn committed Sep 25, 2010
1 parent c295c00 commit afeebf6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/ops/nqp.ops
Expand Up @@ -9,6 +9,10 @@ BEGIN_OPS_PREAMBLE
#include "../metamodel/rakudoobject.h"
#include "../metamodel/repr_registry.h"

/* Did we do the dynop setup yet?
* XXX Relies on this happening once in a single thread at startup. */
static INTVAL initialized = 0;

/* Cached type IDs. */
static INTVAL stable_id = 0;
static INTVAL repr_id = 0;
Expand All @@ -26,13 +30,17 @@ Does various setup tasks for the benefit of the other dynops.

*/
inline op nqp_dynop_setup() :base_core {
/* Look up and cache some type IDs. */
stable_id = pmc_type(interp, Parrot_str_new(interp, "STable", 0));
repr_id = pmc_type(interp, Parrot_str_new(interp, "REPR", 0));
ro_id = pmc_type(interp, Parrot_str_new(interp, "RakudoObject", 0));
if (!initialized) {
initialized = 1;

/* Look up and cache some type IDs. */
stable_id = pmc_type(interp, Parrot_str_new(interp, "STable", 0));
repr_id = pmc_type(interp, Parrot_str_new(interp, "REPR", 0));
ro_id = pmc_type(interp, Parrot_str_new(interp, "RakudoObject", 0));

/* Initialize the object model. */
RakudoObject_initialize(interp);
/* Initialize the object model. */
RakudoObject_initialize(interp);
}
}

/*
Expand Down

0 comments on commit afeebf6

Please sign in to comment.