cvsuser     03/07/14 02:54:52

  Modified:    classes  sarray.pmc
               .        core.ops dod.c embed.c global_setup.c interpreter.c
               include/parrot interpreter.h
               languages/imcc parser_util.c
  Log:
  interpreter->iglobals: a list of some interpreter internal PMCs
  
  Revision  Changes    Path
  1.7       +5 -3      parrot/classes/sarray.pmc
  
  Index: sarray.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/sarray.pmc,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- sarray.pmc        9 Jul 2003 10:31:46 -0000       1.6
  +++ sarray.pmc        14 Jul 2003 09:54:48 -0000      1.7
  @@ -1,7 +1,7 @@
   /* sarray.pmc
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: sarray.pmc,v 1.6 2003/07/09 10:31:46 leo Exp $
  + *     $Id: sarray.pmc,v 1.7 2003/07/14 09:54:48 leo Exp $
    *  Overview:
    *     These are the vtable functions for the SArray base class
    *  Data Structure and Algorithms:
  @@ -40,9 +40,11 @@
        for (i = start; i < end; i++, e++) {
            switch (e->type) {
                case enum_hash_string:
  +                 if (e->val.string_val)
                    pobject_lives(INTERP, (PObj *)e->val.string_val);
                    break;
                case enum_hash_pmc:
  +                 if (e->val.pmc_val)
                    pobject_lives(INTERP, (PObj *)e->val.pmc_val);
                    break;
                default:
  
  
  
  1.304     +6 -5      parrot/core.ops
  
  Index: core.ops
  ===================================================================
  RCS file: /cvs/public/parrot/core.ops,v
  retrieving revision 1.303
  retrieving revision 1.304
  diff -u -w -r1.303 -r1.304
  --- core.ops  10 Jul 2003 16:56:46 -0000      1.303
  +++ core.ops  14 Jul 2003 09:54:50 -0000      1.304
  @@ -4755,10 +4755,10 @@
   
   op find_type(out INT, in STR) {
       PMC * key = key_new_string(interpreter, $2);
  +    PMC *classname_hash = VTABLE_get_pmc_keyed_int(interpreter,
  +      interpreter->iglobals, IGLOBALS_CLASSNAME_HASH);
   
  -    $1 = interpreter->Parrot_base_classname_hash->vtable->
  -     get_integer_keyed(interpreter,
  -             interpreter->Parrot_base_classname_hash, key);
  +    $1 = VTABLE_get_integer_keyed(interpreter, classname_hash, key);
       if ($1 == enum_type_undef)
        $1 = Parrot_get_datatype_enum(interpreter, $2);
       goto NEXT();
  @@ -4965,8 +4965,9 @@
   
   inline op compreg(OUT PMC, in STR) {
     PMC *key = key_new_string(interpreter, $2);
  -  $1 = interpreter->Parrot_compreg_hash->vtable->get_pmc_keyed(
  -    interpreter, interpreter->Parrot_compreg_hash, key);
  +  PMC *compreg_hash = VTABLE_get_pmc_keyed_int(interpreter,
  +      interpreter->iglobals, IGLOBALS_COMPREG_HASH);
  +  $1 = VTABLE_get_pmc_keyed(interpreter, compreg_hash, key);
     goto NEXT();
   }
   
  
  
  
  1.63      +3 -5      parrot/dod.c
  
  Index: dod.c
  ===================================================================
  RCS file: /cvs/public/parrot/dod.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -w -r1.62 -r1.63
  --- dod.c     28 Jun 2003 11:25:08 -0000      1.62
  +++ dod.c     14 Jul 2003 09:54:50 -0000      1.63
  @@ -1,7 +1,7 @@
   /* dod.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: dod.c,v 1.62 2003/06/28 11:25:08 leo Exp $
  + *     $Id: dod.c,v 1.63 2003/07/14 09:54:50 leo Exp $
    *  Overview:
    *     Handles dead object destruction of the various headers
    *  Data Structure and Algorithms:
  @@ -132,14 +132,12 @@
       UINTVAL mask = PObj_is_PMC_ptr_FLAG | PObj_is_buffer_ptr_FLAG
           | PObj_custom_mark_FLAG;
   
  -    /* We have to start somewhere, and the classname hash is a good place */
  -    interpreter->mark_ptr = current = interpreter->Parrot_base_classname_hash;
  +    /* We have to start somewhere, the interpreter globals is a good place */
  +    interpreter->mark_ptr = current = interpreter->iglobals;
   
       /* mark it as used  */
       pobject_lives(interpreter, (PObj *)current);
       pobject_lives(interpreter, interpreter->ctx.warns);
  -    if (interpreter->Parrot_compreg_hash)
  -        pobject_lives(interpreter, (PObj *)interpreter->Parrot_compreg_hash);
       /* Now, go run through the PMC registers and mark them as live */
       /* First mark the current set. */
       for (i = 0; i < NUM_REGISTERS; i++) {
  
  
  
  1.74      +3 -1      parrot/embed.c
  
  Index: embed.c
  ===================================================================
  RCS file: /cvs/public/parrot/embed.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -w -r1.73 -r1.74
  --- embed.c   6 Jul 2003 16:14:04 -0000       1.73
  +++ embed.c   14 Jul 2003 09:54:50 -0000      1.74
  @@ -1,7 +1,7 @@
   /* embed.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: embed.c,v 1.73 2003/07/06 16:14:04 leo Exp $
  + *     $Id: embed.c,v 1.74 2003/07/14 09:54:50 leo Exp $
    *  Overview:
    *     The Parrot embedding interface.
    *  Data Structure and Algorithms:
  @@ -272,6 +272,8 @@
       userargv = pmc_new_noinit(interpreter, enum_class_SArray);
       /* immediately anchor pmc to root set */
       interpreter->pmc_reg.registers[0] = userargv;
  +    VTABLE_set_pmc_keyed_int(interpreter, interpreter->iglobals,
  +            (INTVAL)IGLOBALS_ARGV_LIST, userargv);
       VTABLE_init(interpreter, userargv);
       VTABLE_set_integer_native(interpreter, userargv, argc);
   
  
  
  
  1.41      +18 -5     parrot/global_setup.c
  
  Index: global_setup.c
  ===================================================================
  RCS file: /cvs/public/parrot/global_setup.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -w -r1.40 -r1.41
  --- global_setup.c    27 Dec 2002 09:33:11 -0000      1.40
  +++ global_setup.c    14 Jul 2003 09:54:50 -0000      1.41
  @@ -1,7 +1,7 @@
   /* global_setup.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: global_setup.c,v 1.40 2002/12/27 09:33:11 leo Exp $
  + *     $Id: global_setup.c,v 1.41 2003/07/14 09:54:50 leo Exp $
    *  Overview:
    *      Performs all the global setting up of things. This includes the
    *      (very few) global variables that Parrot totes around
  @@ -21,6 +21,11 @@
   void
   init_world(Interp *interpreter)
   {
  +    INTVAL i;
  +
  +    PMC *iglobals;
  +    PMC *classname_hash;
  +
       string_init();              /* Set up the string subsystem */
   
       /* Call base vtable class constructor methods */
  @@ -29,12 +34,20 @@
       /* Now register the names of the PMCs */
   
       /* We need a hash */
  -    interpreter->Parrot_base_classname_hash =
  -        pmc_new(interpreter, enum_class_PerlHash);
  +    classname_hash = pmc_new(interpreter, enum_class_PerlHash);
   
       /* Now fill the hash */
  -    Parrot_register_core_pmcs(interpreter,
  -            interpreter->Parrot_base_classname_hash);
  +    Parrot_register_core_pmcs(interpreter, classname_hash);
  +
  +    /* init the interpreter globals array */
  +    iglobals = pmc_new(interpreter, enum_class_SArray);
  +    interpreter->iglobals = iglobals;
  +    VTABLE_set_integer_native(interpreter, iglobals, (INTVAL)IGLOBALS_SIZE);
  +    /* clear the array */
  +    for (i = 0; i < (INTVAL)IGLOBALS_SIZE; i++)
  +        VTABLE_set_pmc_keyed_int(interpreter, iglobals, i, NULL);
  +    VTABLE_set_pmc_keyed_int(interpreter, iglobals,
  +            (INTVAL)IGLOBALS_CLASSNAME_HASH, classname_hash);
   }
   
   /*
  
  
  
  1.170     +8 -7      parrot/interpreter.c
  
  Index: interpreter.c
  ===================================================================
  RCS file: /cvs/public/parrot/interpreter.c,v
  retrieving revision 1.169
  retrieving revision 1.170
  diff -u -w -r1.169 -r1.170
  --- interpreter.c     11 Jul 2003 11:31:52 -0000      1.169
  +++ interpreter.c     14 Jul 2003 09:54:50 -0000      1.170
  @@ -1,7 +1,7 @@
   /* interpreter.c
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: interpreter.c,v 1.169 2003/07/11 11:31:52 leo Exp $
  + *     $Id: interpreter.c,v 1.170 2003/07/14 09:54:50 leo Exp $
    *  Overview:
    *     The interpreter api handles running the operations
    *  Data Structure and Algorithms:
  @@ -595,7 +595,6 @@
       SET_NULL_P(interpreter->prederef_code, void **);
       SET_NULL(interpreter->jit_info);
   
  -    SET_NULL_P(interpreter->Parrot_compreg_hash, PMC *);
       /* register assembler/compilers */
       setup_default_compreg(interpreter);
   
  @@ -792,13 +791,15 @@
   void Parrot_compreg(Parrot_Interp interpreter, STRING *type, PMC *func)
   {
       PMC* key, *hash;
  -    if (!interpreter->Parrot_compreg_hash) {
  -        hash = interpreter->Parrot_compreg_hash =
  -            pmc_new_noinit(interpreter, enum_class_PerlHash);
  +    PMC* iglobals = interpreter->iglobals;
  +    hash = VTABLE_get_pmc_keyed_int(interpreter, interpreter->iglobals,
  +            IGLOBALS_COMPREG_HASH);
  +    if (!hash) {
  +        hash = pmc_new_noinit(interpreter, enum_class_PerlHash);
           VTABLE_init(interpreter, hash);
  +        VTABLE_set_pmc_keyed_int(interpreter, iglobals,
  +                (INTVAL)IGLOBALS_COMPREG_HASH, hash);
       }
  -    else
  -        hash = interpreter->Parrot_compreg_hash;
       key = key_new_string(interpreter, type);
       VTABLE_set_pmc_keyed(interpreter, hash, key, func);
   }
  
  
  
  1.76      +14 -3     parrot/include/parrot/interpreter.h
  
  Index: interpreter.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/interpreter.h,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -w -r1.75 -r1.76
  --- interpreter.h     6 Jul 2003 16:14:06 -0000       1.75
  +++ interpreter.h     14 Jul 2003 09:54:51 -0000      1.76
  @@ -1,7 +1,7 @@
   /* interpreter.h
    *  Copyright: (When this is determined...it will go here)
    *  CVS Info
  - *     $Id: interpreter.h,v 1.75 2003/07/06 16:14:06 leo Exp $
  + *     $Id: interpreter.h,v 1.76 2003/07/14 09:54:51 leo Exp $
    *  Overview:
    *     The interpreter api handles running the operations
    *  Data Structure and Algorithms:
  @@ -173,11 +173,22 @@
       /* per interpreter global vars */
       INTVAL world_inited;        /* Parrot_init is done */
       PMC *mark_ptr;             /* last PMC marked used in DOD runs */
  -    PMC *Parrot_base_classname_hash;    /* hash containing name->base_type */
  -    PMC *Parrot_compreg_hash;   /* hash containing assembler/compilers */
  +    PMC *iglobals;              /* SArray of PMCs, containing: */
  +/* 0:   PMC *Parrot_base_classname_hash; hash containing name->base_type */
  +/* 1:   PMC *Parrot_compreg_hash;    hash containing assembler/compilers */
  +/* 2:   PMC *Argv;                   list of argv */
  +/* 3:   PMC *Env;                    hash_like Env PMC */
       int has_early_DOD_PMCs;   /* Flag that some want immediate destruction */
   } Interp;
   
  +typedef enum {
  +    IGLOBALS_CLASSNAME_HASH,
  +    IGLOBALS_COMPREG_HASH,
  +    IGLOBALS_ARGV_LIST,
  +    IGLOBALS_ENV_HASH,
  +
  +    IGLOBALS_SIZE
  +} iglobals_enum;
   /*
    * Macros to make accessing registers more convenient/readable.
    */
  
  
  
  1.16      +2 -1      parrot/languages/imcc/parser_util.c
  
  Index: parser_util.c
  ===================================================================
  RCS file: /cvs/public/parrot/languages/imcc/parser_util.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -w -r1.15 -r1.16
  --- parser_util.c     6 Jul 2003 09:23:59 -0000       1.15
  +++ parser_util.c     14 Jul 2003 09:54:52 -0000      1.16
  @@ -210,7 +210,8 @@
       STRING * s = string_make(interp, pmc_type,
               (UINTVAL) strlen(pmc_type), NULL, 0, NULL);
       PMC * key = key_new_string(interp, s);
  -    PMC * cnames = interp->Parrot_base_classname_hash;
  +    PMC * cnames = VTABLE_get_pmc_keyed_int(interp, interp->iglobals,
  +            IGLOBALS_CLASSNAME_HASH);
   
       return VTABLE_get_integer_keyed(interp, cnames, key);
   }
  
  
  

Reply via email to