dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/engine cvm.h,1.39,1.40 cvm_call.c,1.62,


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine cvm.h,1.39,1.40 cvm_call.c,1.62,1.63 cvm_dasm.c,1.45,1.46 cvm_lengths.c,1.8,1.9 cvmc.c,1.34,1.35 cvmc_setup.c,1.31,1.32 ilrun.c,1.28,1.29 process.c,1.41,1.42
Date: Sat, 22 Feb 2003 07:03:00 -0500

Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv23225/engine

Modified Files:
        cvm.h cvm_call.c cvm_dasm.c cvm_lengths.c cvmc.c cvmc_setup.c 
        ilrun.c process.c 
Log Message:


Rearrange method profiling so that it can be turned on and off
without without a #define.


Index: cvm.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** cvm.h       31 Jan 2003 02:00:29 -0000      1.39
--- cvm.h       22 Feb 2003 12:02:57 -0000      1.40
***************
*** 501,504 ****
--- 501,509 ----
  
  /*
+  * Method profiling.
+  */
+ #define COP_PREFIX_PROFILE_COUNT      0x55
+ 
+ /*
   * Definition of a CVM stack word which can hold
   * either 32-bit quantities or pointers.

Index: cvm_call.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_call.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -r1.62 -r1.63
*** cvm_call.c  16 Sep 2002 02:18:15 -0000      1.62
--- cvm_call.c  22 Feb 2003 12:02:57 -0000      1.63
***************
*** 473,479 ****
                CVM_OPTIMIZE_BLOCK();
        }
- #ifdef IL_PROFILE_CVM_METHODS
-       ++(method->count);
- #endif
  }
  VMBREAK(COP_CALL);
--- 473,476 ----
***************
*** 558,564 ****
                CVM_OPTIMIZE_BLOCK();
        }
- #ifdef IL_PROFILE_CVM_METHODS
-       ++(method->count);
- #endif
  }
  VMBREAK(COP_CALL_CTOR);
--- 555,558 ----
***************
*** 782,788 ****
                        CVM_OPTIMIZE_BLOCK();
                }
-       #ifdef IL_PROFILE_CVM_METHODS
-               ++(method->count);
-       #endif
        }
        else
--- 776,779 ----
***************
*** 884,890 ****
                        CVM_OPTIMIZE_BLOCK();
                }
-       #ifdef IL_PROFILE_CVM_METHODS
-               ++(method->count);
-       #endif
        }
        else
--- 875,878 ----
***************
*** 1293,1299 ****
                NULL_POINTER_EXCEPTION();
        }
- #ifdef IL_PROFILE_CVM_METHODS
-       ++(method->count);
- #endif
  }
  VMBREAK(COP_CALLI);
--- 1281,1284 ----
***************
*** 1343,1349 ****
                method = methodToCall;
                CVM_OPTIMIZE_BLOCK();
-       #ifdef IL_PROFILE_CVM_METHODS
-               ++(method->count);
-       #endif
        }
        else
--- 1328,1331 ----
***************
*** 1393,1399 ****
                method = methodToCall;
                CVM_OPTIMIZE_BLOCK();
-       #ifdef IL_PROFILE_CVM_METHODS
-               ++(method->count);
-       #endif
        }
        else
--- 1375,1378 ----
***************
*** 1472,1478 ****
        pc = (unsigned char *)tempptr;
        method = methodToCall;
- #ifdef IL_PROFILE_CVM_METHODS
-       ++(method->count);
- #endif
  }
  VMBREAK(COP_PREFIX_TAIL_CALL);
--- 1451,1454 ----
***************
*** 1631,1634 ****
--- 1607,1633 ----
  }
  VMBREAK(COP_PREFIX_PACK_VARARGS);
+ 
+ /**
+  *<opcode name="profile_count" group="Profiling Instructions">
+  *    <operation>Count the number of times the current method is
+  *             invoked</operation>
+  *
+  *    <format>profile_count</format>
+  *    <dformat>{profile_count}</dformat>
+  *
+  *    <form name="profile_count" code="COP_PREFIX_PROFILE_COUNT"/>
+  *
+  *  <description>This instruction adds 1 to the profiling count for
+  *  the current method.  It is normally inserted at the beginning
+  *  of a method's code by the CVM coder when the engine is running
+  *  in the profiling mode.</description>
+  * </opcode>
+  */
+ VMCASE(COP_PREFIX_PROFILE_COUNT):
+ {
+       ++(method->count);
+       MODIFY_PC_AND_STACK(CVMP_LEN_NONE,0);
+ }
+ VMBREAK(COP_PREFIX_PROFILE_COUNT);
  
  #endif /* IL_CVM_PREFIX */

Index: cvm_dasm.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_dasm.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -r1.45 -r1.46
*** cvm_dasm.c  31 Jan 2003 02:00:29 -0000      1.45
--- cvm_dasm.c  22 Feb 2003 12:02:57 -0000      1.46
***************
*** 67,70 ****
--- 67,71 ----
  
  } CVMOpcode;
+ 
  static CVMOpcode const opcodes[256] = {
  
***************
*** 560,566 ****
  
        /*
         * Reserved opcodes.
         */
-       {"preserved_55",        CVM_OPER_NONE},
        {"preserved_56",        CVM_OPER_NONE},
        {"preserved_57",        CVM_OPER_NONE},
--- 561,571 ----
  
        /*
+        * Method profiling.
+        */
+       {"profile_count",       CVM_OPER_NONE},
+ 
+       /*
         * Reserved opcodes.
         */
        {"preserved_56",        CVM_OPER_NONE},
        {"preserved_57",        CVM_OPER_NONE},

Index: cvm_lengths.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_lengths.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** cvm_lengths.c       17 Feb 2003 05:20:31 -0000      1.8
--- cvm_lengths.c       22 Feb 2003 12:02:57 -0000      1.9
***************
*** 519,525 ****
  
        /*
         * Reserved opcodes.
         */
-       /* preserved_55 */              CVMP_LEN_NONE,
        /* preserved_56 */              CVMP_LEN_NONE,
        /* preserved_57 */              CVMP_LEN_NONE,
--- 519,529 ----
  
        /*
+        * Method profiling.
+        */
+       /* profile_count */             CVMP_LEN_NONE,
+       
+       /*
         * Reserved opcodes.
         */
        /* preserved_56 */              CVMP_LEN_NONE,
        /* preserved_57 */              CVMP_LEN_NONE,

Index: cvmc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvmc.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** cvmc.c      15 Nov 2002 01:37:42 -0000      1.34
--- cvmc.c      22 Feb 2003 12:02:57 -0000      1.35
***************
*** 77,81 ****
        int                             tailCallFlag;
        int                             debugEnabled;
! 
  };
  
--- 77,81 ----
        int                             tailCallFlag;
        int                             debugEnabled;
!       int                             flags;
  };
  
***************
*** 160,164 ****
        coder->tailCallFlag = 0;
        coder->debugEnabled = 0;
! 
        /* Call the interpreter to export the label tables for
           use in code generation for direct threading */
--- 160,164 ----
        coder->tailCallFlag = 0;
        coder->debugEnabled = 0;
!       coder->flags = 0;
        /* Call the interpreter to export the label tables for
           use in code generation for direct threading */
***************
*** 459,462 ****
--- 459,463 ----
        CVMCoder_MarkBytecode,
        CVMCoder_MarkEnd,
+       CVMCoder_SetFlags,
        "sentinel"
  };

Index: cvmc_setup.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvmc_setup.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** cvmc_setup.c        17 Feb 2003 05:20:31 -0000      1.31
--- cvmc_setup.c        22 Feb 2003 12:02:57 -0000      1.32
***************
*** 243,246 ****
--- 243,247 ----
        ILType *type;
  
+ 
        /* Determine where the new method will start output within the buffer */
        if(newStart)
***************
*** 341,344 ****
--- 342,351 ----
        CVM_OUT_CKHEIGHT();
  
+       /* Output the CVM code to do the profiling of the methods*/
+       if((coder->flags & IL_CODER_FLAG_METHOD_PROFILE) != 0)
+       {
+               CVMP_OUT_NONE(COP_PREFIX_PROFILE_COUNT);
+       }
+ 
        /* Mark this method as perhaps needing to be unrolled later */
        if(ordinaryMethod && _ILCVMUnrollPossible() && !(coder->debugEnabled))
***************
*** 1303,1306 ****
--- 1310,1326 ----
        /* Ready to go */
        return result;
+ }
+ 
+ /*
+  * Set the flags for profiling debugging etc.
+  */
+ static void CVMCoder_SetFlags(ILCoder *_coder,int flags)
+ {
+       ILCVMCoder *coder = (ILCVMCoder*)_coder;
+       /*TODO*/
+       /*Need a better of doing this using the bitwise operators.
+        * But for now the flags are just assigned
+        */
+         coder->flags = flags;
  }
  

Index: ilrun.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/ilrun.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** ilrun.c     16 Feb 2003 22:54:24 -0000      1.28
--- ilrun.c     22 Feb 2003 12:02:57 -0000      1.29
***************
*** 48,51 ****
--- 48,52 ----
  int _ILDumpMethodProfile(FILE *stream, ILExecProcess *process);
  
+ 
  /*
   * Table of command-line options.
***************
*** 122,129 ****
        char *ilprogram;
        int ilprogramLen;
  #ifndef IL_CONFIG_REDUCE_CODE
        int dumpInsnProfile = 0;
-       int dumpMethodProfile = 0;
        int dumpVarProfile = 0;
        int dumpParams = 0;
  #endif
--- 123,131 ----
        char *ilprogram;
        int ilprogramLen;
+       int flags=0;
  #ifndef IL_CONFIG_REDUCE_CODE
        int dumpInsnProfile = 0;
        int dumpVarProfile = 0;
+       int dumpMethodProfile = 0;
        int dumpParams = 0;
  #endif
***************
*** 191,194 ****
--- 193,202 ----
                        case 'M':
                        {
+                               /*TODO*/
+                               /*flags |= IL_CODER_FLAG_METHOD_PROFILE;
+                                *Should have been something like the above
+                                *but for making it work temporarily, doing this
+                                **/
+                               flags |= 2;
                                dumpMethodProfile = 1;
                        }
***************
*** 258,261 ****
--- 266,271 ----
                return 1;
        }
+ 
+       ILExecProcessSetCoderFlags(process,flags);
  
        /* Set the list of directories to use for path searching */

Index: process.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/process.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** process.c   2 Feb 2003 09:15:45 -0000       1.41
--- process.c   22 Feb 2003 12:02:57 -0000      1.42
***************
*** 516,519 ****
--- 516,524 ----
  }
  
+ void ILExecProcessSetCoderFlags(ILExecProcess *process,int flags)
+ {
+       ILCoderSetFlags(process->coder,flags);
+ }
+ 
  #ifdef        __cplusplus
  };





reply via email to

[Prev in Thread] Current Thread [Next in Thread]