cvsuser     03/01/16 09:37:44

  Modified:    .        MANIFEST
  Added:       classes  compiler.pmc eval.pmc
  Log:
  eval #1 - missing
  
  Revision  Changes    Path
  1.305     +2 -0      parrot/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /cvs/public/parrot/MANIFEST,v
  retrieving revision 1.304
  retrieving revision 1.305
  diff -u -w -r1.304 -r1.305
  --- MANIFEST  16 Jan 2003 17:26:17 -0000      1.304
  +++ MANIFEST  16 Jan 2003 17:37:37 -0000      1.305
  @@ -21,10 +21,12 @@
   chartypes/usascii.c
   classes/array.pmc
   classes/boolean.pmc
  +classes/compiler.pmc
   classes/continuation.pmc
   classes/coroutine.pmc
   classes/csub.pmc
   classes/default.pmc
  +classes/eval.pmc
   classes/genclass.pl
   classes/intlist.pmc
   classes/key.pmc
  
  
  
  1.1                  parrot/classes/compiler.pmc
  
  Index: compiler.pmc
  ===================================================================
  /* Compiler.pmc
   *  Copyright: 2002 Yet Another Society
   *  CVS Info
   *     $$
   *  Overview:
   *     The vtable functions for implementing assembler/compilers
   *  Data Structure and Algorithms:
   *  History:
   *     Initial revision by leo 2003/01/16
   *  Notes:
   *  References:
   *     pdd06_pasm.pod
   */
  
  #include "parrot/parrot.h"
  #include "parrot/method_util.h"
  #include "parrot/interp_guts.h"
  
  pmclass Compiler extends NCI {
  
      STRING* name () {
          return whoami;
      }
  
      void* invoke (void * code_ptr) {
          Parrot_csub_t func = (Parrot_csub_t)D2FPTR(SELF->data);
        PMC *code_seg;
        opcode_t *pc;
          Parrot_push_i(interpreter);
          Parrot_push_s(interpreter);
          Parrot_push_p(interpreter);
          interpreter->ctx.string_reg.registers[5] = (String*) code_ptr;
          func(INTERP, SELF);
        /* return value PMC is in P5 */
          stack_push(interpreter, &interpreter->ctx.user_stack,
          interpreter->ctx.pmc_reg.registers[5],
                STACK_ENTRY_PMC, STACK_CLEANUP_NULL);
          Parrot_pop_p(interpreter);
          Parrot_pop_s(interpreter);
          Parrot_pop_i(interpreter);
        (void)stack_pop(interpreter, &interpreter->ctx.user_stack, &code_seg,
                    STACK_ENTRY_PMC);
        pc = (opcode_t*) code_seg->data;
        /* test
        while (pc)
            DO_OP(pc, interpreter);
        */
        /* morph the opcode_t *pointer in code_seg to an invokable sub */
        code_seg->vtable = &Parrot_base_vtables[enum_class_Eval];
        code_seg->vtable->init(interpreter, code_seg);
        code_seg->vtable->set_integer_native(interpreter, code_seg,
                (INTVAL) pc);
          return code_seg;
      }
  }
  
  
  
  
  1.1                  parrot/classes/eval.pmc
  
  Index: eval.pmc
  ===================================================================
  /* Eval.pmc
   *  Copyright: (When this is determined...it will go here)
   *  CVS Info
   *     $$
   *  Overview:
   *     These are the vtable functions for evaluating a code segment
   *  Data Structure and Algorithms:
   *  History:
   *     Initial version by leo 2003/01/16
   *  Notes:
   *  References:
   */
  
  #include "parrot/parrot.h"
  #include "parrot/runops_cores.h"
  #include "parrot/interp_guts.h"
  
  pmclass Eval extends Sub {
  
     STRING* name () {
        return whoami;
     }
  
     void* invoke (void* next) {
         PMC * pad = ((struct Parrot_Sub *)SELF->data)->lex_pad;
         opcode_t * pc = ((struct Parrot_Sub *)SELF->data)->init;
  
         if (pad) {
           /* put the correct pad in place */
           stack_push(INTERP, &INTERP->ctx.pad_stack, pad,
                   STACK_ENTRY_PMC, STACK_CLEANUP_NULL);
         }
  
         /* return address that the interpreter should jump to */
         stack_push(INTERP, &(INTERP->ctx.control_stack), next,
               STACK_ENTRY_DESTINATION, STACK_CLEANUP_NULL);
         /* run evaled code with the normal cores */
  #if 0
         while (pc)
           DO_OP(pc, interpreter);
  #else
         if (Interp_flags_TEST(interpreter, (PARROT_BOUNDS_FLAG |
                       PARROT_PROFILE_FLAG |
                       PARROT_TRACE_FLAG)))
           runops_slow_core(interpreter, pc);
         else
           runops_fast_core(interpreter, pc);
  #endif
  
         return next;
     }
  }
  
  
  


Reply via email to