cvsuser     04/04/26 23:32:06

  Modified:    jit/i386 jit_emit.h
               src      objects.c
  Log:
  dont call getenv in a loop - its a memory hog
  
  Revision  Changes    Path
  1.110     +12 -42    parrot/jit/i386/jit_emit.h
  
  Index: jit_emit.h
  ===================================================================
  RCS file: /cvs/public/parrot/jit/i386/jit_emit.h,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -w -r1.109 -r1.110
  --- jit_emit.h        23 Apr 2004 09:20:45 -0000      1.109
  +++ jit_emit.h        27 Apr 2004 06:32:03 -0000      1.110
  @@ -3,7 +3,7 @@
    *
    * i386
    *
  - * $Id: jit_emit.h,v 1.109 2004/04/23 09:20:45 jrieks Exp $
  + * $Id: jit_emit.h,v 1.110 2004/04/27 06:32:03 leo Exp $
    */
   
   #if !defined(PARROT_I386_JIT_EMIT_H_GUARD)
  @@ -1879,8 +1879,6 @@
   
   #    undef Parrot_jit_vtable1_op
   #    undef Parrot_jit_vtable1r_op
  -#    undef Parrot_jit_vtable2rk_op
  -#    undef Parrot_jit_vtable3k_op
   
   #    undef Parrot_jit_vtable_112_op
   #    undef Parrot_jit_vtable_221_op
  @@ -1914,7 +1912,7 @@
   
   static void
   Parrot_jit_vtable_n_op(Parrot_jit_info_t *jit_info,
  -                Interp * interpreter, int n, int bp, int *args)
  +                Interp * interpreter, int n, int *args)
   {
       int nvtable = op_jit[*jit_info->cur_op].extcall;
       size_t offset;
  @@ -1938,10 +1936,6 @@
           emitm_pushl_r(jit_info->native_ptr, emit_ECX);
           saved = 2;
       }
  -    if (bp) {
  -        jit_emit_stack_frame_enter(jit_info->native_ptr);
  -        jit_emit_sub_ri_i(jit_info->native_ptr, emit_ESP, sizeof(INTVAL));
  -    }
   
       /* get the offset of the first vtable func */
       offset = offsetof(struct _vtable, init);
  @@ -2124,9 +2118,6 @@
               offsetof(struct PMC, vtable));
       /* call *(offset)eax */
       emitm_callm(jit_info->native_ptr, emit_EAX, emit_None, emit_None, offset);
  -    if (bp)
  -        jit_emit_stack_frame_leave(jit_info->native_ptr);
  -    else
           emitm_addb_i_r(jit_info->native_ptr,
                   st + sizeof(void *) * (n + 1), emit_ESP);
       if (saved == 2)
  @@ -2207,7 +2198,7 @@
                        Interp * interpreter)
   {
       int a[] = { 1 };
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 1, 0, a);
  +    Parrot_jit_vtable_n_op(jit_info, interpreter, 1, a);
   }
   
   /* emit a call to a vtable func
  @@ -2218,21 +2209,10 @@
                        Interp * interpreter)
   {
       int a[] = { 2 };
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 1, 0, a);
  +    Parrot_jit_vtable_n_op(jit_info, interpreter, 1, a);
       Parrot_jit_store_retval(jit_info, interpreter);
   }
   
  -/* emit a call to a vtable func
  - * $1 = $2->vtable(interp, $2, &key)
  - */
  -static void
  -Parrot_jit_vtable2rk_op(Parrot_jit_info_t *jit_info,
  -                     Interp * interpreter)
  -{
  -    int a[] = { 2 , 3};
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 2, 1, a);
  -    Parrot_jit_store_retval(jit_info, interpreter);
  -}
   
   /* emit a call to a vtable func
    * $1 = $2->vtable(interp, $2, $3)
  @@ -2242,7 +2222,7 @@
                        Interp * interpreter)
   {
       int a[] = { 2 , 3};
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 2, 0, a);
  +    Parrot_jit_vtable_n_op(jit_info, interpreter, 2, a);
       Parrot_jit_store_retval(jit_info, interpreter);
   }
   
  @@ -2254,7 +2234,7 @@
                        Interp * interpreter)
   {
       int a[] = { 3 , 2};
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 2, 0, a);
  +    Parrot_jit_vtable_n_op(jit_info, interpreter, 2, a);
       Parrot_jit_store_retval(jit_info, interpreter);
   }
   /* emit a call to a vtable func
  @@ -2265,7 +2245,7 @@
                        Interp * interpreter)
   {
       int a[] = { 1, 2 };
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 2, 0, a);
  +    Parrot_jit_vtable_n_op(jit_info, interpreter, 2, a);
   }
   
   /* emit a call to a vtable func
  @@ -2276,7 +2256,7 @@
                        Interp * interpreter)
   {
       int a[] = { 2, 1 };
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 2, 0, a);
  +    Parrot_jit_vtable_n_op(jit_info, interpreter, 2, a);
   }
   
   /* emit a call to a vtable func
  @@ -2287,7 +2267,7 @@
                        Interp * interpreter)
   {
       int a[] = { 2, 3, 1 };
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 3, 0, a);
  +    Parrot_jit_vtable_n_op(jit_info, interpreter, 3, a);
   }
   
   /* emit a call to a vtable func
  @@ -2298,7 +2278,7 @@
                        Interp * interpreter)
   {
       int a[] = { 1, 2, 3 };
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 3, 0, a);
  +    Parrot_jit_vtable_n_op(jit_info, interpreter, 3, a);
   }
   
   /* emit a call to a vtable func
  @@ -2309,19 +2289,9 @@
                        Interp * interpreter)
   {
       int a[] = { 1, 2, 1 };
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 3, 0, a);
  +    Parrot_jit_vtable_n_op(jit_info, interpreter, 3, a);
   }
   
  -/* emit a call to a vtable func
  - * $1->vtable(interp, $1, &key, $3)
  - */
  -static void
  -Parrot_jit_vtable3k_op(Parrot_jit_info_t *jit_info,
  -                     Interp * interpreter)
  -{
  -    int a[] = { 1, 2, 3 };
  -    Parrot_jit_vtable_n_op(jit_info, interpreter, 3, 1, a);
  -}
   
   /* if_p_ic, unless_p_ic */
   static void
  
  
  
  1.89      +5 -3      parrot/src/objects.c
  
  Index: objects.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/objects.c,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -w -r1.88 -r1.89
  --- objects.c 19 Apr 2004 16:32:59 -0000      1.88
  +++ objects.c 27 Apr 2004 06:32:06 -0000      1.89
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: objects.c,v 1.88 2004/04/19 16:32:59 leo Exp $
  +$Id: objects.c,v 1.89 2004/04/27 06:32:06 leo Exp $
   
   =head1 NAME
   
  @@ -500,11 +500,13 @@
       PMC *parent_class;
       INTVAL i, nparents;
       int free_it;
  +    static void *what = (void*)-1;
       /*
        * XXX compat mode
        */
  -
  -    if (!Parrot_getenv("CALL__BUILD", &free_it)) {
  +    if (what == (void*)-1)
  +        what = Parrot_getenv("CALL__BUILD", &free_it);
  +    if (!what) {
           nparents = VTABLE_elements(interpreter, classsearch_array);
           for (i = nparents - 1; i >= 0; --i) {
               parent_class = VTABLE_get_pmc_keyed_int(interpreter,
  
  
  

Reply via email to