cvsuser     03/10/16 00:21:26

  Modified:    .        core.ops interpreter.c
  Log:
  get rid of some magic opnums
  
  Revision  Changes    Path
  1.332     +13 -7     parrot/core.ops
  
  Index: core.ops
  ===================================================================
  RCS file: /cvs/public/parrot/core.ops,v
  retrieving revision 1.331
  retrieving revision 1.332
  diff -u -w -r1.331 -r1.332
  --- core.ops  15 Oct 2003 18:00:16 -0000      1.331
  +++ core.ops  16 Oct 2003 07:21:26 -0000      1.332
  @@ -33,7 +33,8 @@
   
   These are the fundamental operations.
   Please note: These opcodes must not be moved; they must have
  -exactly these opcode numbers.
  +exactly these opcode numbers. Opcodes ending with underscores are for
  +internal use only, don't emit these opcodes.
   
   =over 4
   
  @@ -43,7 +44,7 @@
   
   =item B<end>()
   
  -Halts the interpreter. (Must be op #0)
  +Halts the interpreter. (Must be op #0, CORE_OPS_end). See also B<exit>.
   
   =cut
   
  @@ -57,37 +58,42 @@
   =item B<noop>()
   
   Does nothing other than waste an iota of time and 32 bits of bytecode space.
  +(Must be op #1, CORE_OPS_noop)
   
   =item B<cpu_ret>()
   
   Emit a cpu return instruction. This is used to return from CGP core
   to JIT code. Note: Do B<not> use this opcode. It is for internal use only.
  -(Must be op #2)
  +(Must be op #2, CORE_OPS_cpu_ret)
   
   =item B<check_events>()
   
   Check the event queue and run event handlers if there are unhandled events.
   Note: This opcode is mainly for testing. It should not be necessary to ever
   use it explicitly.
  -(Must be op #3).
  +(Must be op #3, CORE_OPS_check_events).
   
   =item B<check_events__>()
   
   Check the event queue and run event handlers if there are unhandled events.
   Note: Do B<not> use this opcode. It is for internal use only.
  -(Must be op #4).
  +(Must be op #4, CORE_OPS_check_events__).
   
   =item B<wrapper__>()
   
   Internal opcode to wrap unknown ops from loaded opcode libs.
   Don't use.
  -(Must be op #5).
  +(Must be op #5, CORE_OPS_wrapper__).
   
   =item B<prederef__>()
   
   Internal opcode to prederef opcodes on the fly.
   Don't use.
  -(Must be op #6).
  +(Must be op #6, CORE_OPS_prederef__ ).
  +
  +=item B<reserved>(in INT)
  +
  +Reserve 2 more fixed entries.
   
   =item B<load_bytecode>(in STR)
   
  
  
  
  1.218     +5 -5      parrot/interpreter.c
  
  Index: interpreter.c
  ===================================================================
  RCS file: /cvs/public/parrot/interpreter.c,v
  retrieving revision 1.217
  retrieving revision 1.218
  diff -u -w -r1.217 -r1.218
  --- interpreter.c     16 Oct 2003 04:09:05 -0000      1.217
  +++ interpreter.c     16 Oct 2003 07:21:26 -0000      1.218
  @@ -1,7 +1,7 @@
   /* interpreter.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: interpreter.c,v 1.217 2003/10/16 04:09:05 sfink Exp $
  + *     $Id: interpreter.c,v 1.218 2003/10/16 07:21:26 leo Exp $
    *  Overview:
    *     The interpreter api handles running the operations
    *  Data Structure and Algorithms:
  @@ -135,7 +135,6 @@
           }
   
           if (pc_prederef[i] == 0) {
  -            /* switched core has no func_table, so a NULL op is ok */
               internal_exception(INTERP_ERROR,
                       "Prederef generated a NULL pointer for arg of type %d!\n",
                       opinfo->types[i]);
  @@ -252,9 +251,10 @@
   
           /* fill with the prederef__ opcode function */
           if (which == PARROT_SWITCH_CORE)
  -            pred_func = (void*) 6;
  +            pred_func = (void*) CORE_OPS_prederef__;
           else
  -            pred_func = ((void **) interpreter->op_lib->op_func_table)[6];
  +            pred_func = ((void **)
  +                    interpreter->op_lib->op_func_table)[CORE_OPS_prederef__];
           for (i = 0; i < N; i++) {
               temp[i] = pred_func;
           }
  @@ -1132,7 +1132,7 @@
           ops_addr[i] = ((void **)cg_lib->op_func_table)[i];
       /* fill new entries with the wrapper op */
       for (i = n_old; i < n_old + n_new; ++i)
  -        ops_addr[i] = ((void **)cg_lib->op_func_table)[5];
  +        ops_addr[i] = ((void **)cg_lib->op_func_table)[CORE_OPS_wrapper__];
       /*
        * tell the cg_core about the new jump table
        */
  
  
  

Reply via email to