dan         01/09/07 08:23:41

  Modified:    .        Makefile assemble.pl interpreter.c interpreter.h
                        opcode_table parrot.h test.pasm
  Added:       .        global_setup.h
  Log:
  (Here's hoping this takes)
  Added global_setup.h to declare init_world function
  
  Moved variable declarations out of the interpreter loop for small speed boost.
  
  Changed end opcode to now be opcode #0. A function is provided for it, but
  isn't ever executed.
  
  When the interpreter sees an opcode 0 in the stream it means the end
  of stream. Things were coring on Cygwin otherwise. (I think I was
  dereferencing a zero, which is bad)
  
  Revision  Changes    Path
  1.3       +18 -15    parrot/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/perlcvs/parrot/Makefile,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- Makefile  2001/09/06 02:31:01     1.2
  +++ Makefile  2001/09/07 15:23:39     1.3
  @@ -1,38 +1,41 @@
  -H_FILES = config.h exceptions.h io.h op.h register.h string.h events.h 
interpreter.h memory.h parrot.h stacks.h bytecode.h
  +O = .o
   
  -O_FILES = global_setup.o interpreter.o parrot.o register.o basic_opcodes.o memory.o 
bytecode.o string.o strnative.o
  +H_FILES = config.h exceptions.h io.h op.h register.h string.h events.h 
interpreter.h memory.h parrot.h stacks.h bytecode.h global_setup.h
   
  -C_FLAGS = -Wall
  +O_FILES = global_setup$(O) interpreter$(O) parrot$(O) register$(O) 
basic_opcodes$(O) memory$(O) bytecode$(O) string$(O) strnative$(O)
   
  +C_FLAGS = -Wall -o $@
  +
  +
   CC = gcc $(C_FLAGS)
   
   all : $(O_FILES)
   
  -test_prog: test_main.o $(O_FILES)
  -     gcc -o test_prog $(O_FILES) test_main.o
  +test_prog: test_main$(O) $(O_FILES)
  +     gcc -o test_prog $(O_FILES) test_main$(O)
   
  -driver.o: $(H_FILES)
  +test_main$(O): $(H_FILES)
   
  -global_setup.o: $(H_FILES)
  +global_setup$(O): $(H_FILES)
   
  -string.o: $(H_FILES)
  +string$(O): $(H_FILES)
   
  -strnative.o: $(H_FILES)
  +strnative$(O): $(H_FILES)
   
   interp_guts.h: opcode_table
        perl build_interp_starter.pl
   
  -interpreter.o: $(H_FILES) interp_guts.h
  +interpreter$(O): interpreter.c $(H_FILES) interp_guts.h
   
  -memory.o: $(H_FILES)
  +memory$(O): $(H_FILES)
   
  -bytecode.o: $(H_FILES)
  +bytecode$(O): $(H_FILES)
   
  -parrot.o: $(H_FILES)
  +parrot$(O): $(H_FILES)
   
  -register.o: $(H_FILES)
  +register$(O): $(H_FILES)
   
  -basic_opcodes.o: $(H_FILES) basic_opcodes.c
  +basic_opcodes$(O): $(H_FILES) basic_opcodes.c
   
   basic_opcodes.c: basic_opcodes.ops
        perl process_opfunc.pl basic_opcodes.ops
  
  
  
  1.2       +1 -0      parrot/assemble.pl
  
  Index: assemble.pl
  ===================================================================
  RCS file: /home/perlcvs/parrot/assemble.pl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- assemble.pl       2001/08/29 12:07:01     1.1
  +++ assemble.pl       2001/09/07 15:23:39     1.2
  @@ -13,6 +13,7 @@
   while (<OPCODES>) {
       next if /^\s*#/;
       chomp;
  +    next unless $_;
       my ($code, $name, $args, @types) = split /\s+/, $_;
       $opcodes{$name} = {CODE => $code,
                       ARGS => $args,
  
  
  
  1.3       +6 -4      parrot/interpreter.c
  
  Index: interpreter.c
  ===================================================================
  RCS file: /home/perlcvs/parrot/interpreter.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- interpreter.c     2001/09/06 02:31:01     1.2
  +++ interpreter.c     2001/09/07 15:23:39     1.3
  @@ -9,13 +9,15 @@
   #include "interp_guts.h"
   
   void runops (struct Perl_Interp *interpreter, IV *code) {
  -  while (code) {
  +  /* Move these out of the inner loop. No need to redeclare 'em each
  +     time through */
       IV *(*func)();
       void **foo;
  +  while (*code) {
       foo = (void *)interpreter->opcode_funcs;
       (void *)func = foo[*code];
       //    printf("code %i\n", *code);
  -    code = func(code, interpreter)
  +    code = func(code, interpreter);
       CHECK_EVENTS(interpreter);
     }
   }
  
  
  
  1.2       +2 -0      parrot/interpreter.h
  
  Index: interpreter.h
  ===================================================================
  RCS file: /home/perlcvs/parrot/interpreter.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- interpreter.h     2001/08/29 12:07:02     1.1
  +++ interpreter.h     2001/09/07 15:23:39     1.2
  @@ -32,4 +32,6 @@
   
   struct Perl_Interp *make_interpreter();
   
  +void runops(struct Perl_Interp *, IV *);
  +
   #endif
  
  
  
  1.3       +2 -2      parrot/opcode_table
  
  Index: opcode_table
  ===================================================================
  RCS file: /home/perlcvs/parrot/opcode_table,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- opcode_table      2001/09/03 16:43:17     1.2
  +++ opcode_table      2001/09/07 15:23:39     1.3
  @@ -11,7 +11,7 @@
   
   # Integer ops
   
  -0    set_i_ic        2       i i
  +6    set_i_ic        2       i i
   1    add_i   3       i i i
   7    sub_i   3       i i i
   8    mul_i   3       i i i
  @@ -40,7 +40,7 @@
   
   # Flow control
   
  -6    end     0
  +0    end     0
   15   jump_i  1       i
   5    branch_ic       1       i
   10   if_i_ic 3       i i i
  
  
  
  1.2       +1 -0      parrot/parrot.h
  
  Index: parrot.h
  ===================================================================
  RCS file: /home/perlcvs/parrot/parrot.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- parrot.h  2001/08/29 12:07:03     1.1
  +++ parrot.h  2001/09/07 15:23:40     1.2
  @@ -43,6 +43,7 @@
   
   typedef struct PMC PMC;
   
  +#include "global_setup.h"
   #include "string.h"
   #include "interpreter.h"
   #include "register.h"
  
  
  
  1.2       +0 -6      parrot/test.pasm
  
  Index: test.pasm
  ===================================================================
  RCS file: /home/perlcvs/parrot/test.pasm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- test.pasm 2001/08/29 12:07:04     1.1
  +++ test.pasm 2001/09/07 15:23:40     1.2
  @@ -1,11 +1,5 @@
           time_i I1
           set_i_ic I2, 0
  -        set_n_nc N1, 50
  -        print_n N1
  -        set_n_nc N2, 5
  -        print_n N2
  -        add_n N1, N1, N2
  -        print_n N1
           set_i_ic I3, 1
           set_i_ic I4, 10000000
   REDO:   eq_i_ic I2, I4, DONE, NEXT
  
  
  
  1.1                  parrot/global_setup.h
  
  Index: global_setup.h
  ===================================================================
  /* Global_setup.h
   *
   * Global stuff goes here
   *
   */
  
  #if !defined(PARROT_GLOBAL_SETUP_H_GUARD)
  #define PARROT_GLOBAL_SETUP_H_GUARD
  
  void init_world();
  
  #endif
  
  
  

Reply via email to