src/share/vm/interpreter/bytecodeHistogram.hpp

Sun, 13 Apr 2008 17:43:42 -0400

author
coleenp
date
Sun, 13 Apr 2008 17:43:42 -0400
changeset 548
ba764ed4b6f2
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold

     1 /*
     2  * Copyright 1997-2004 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 // BytecodeCounter counts the number of bytecodes executed
    27 class BytecodeCounter: AllStatic {
    28  private:
    29   NOT_PRODUCT(static int   _counter_value;)
    30   NOT_PRODUCT(static jlong _reset_time;)
    32   friend class TemplateInterpreterGenerator;
    33   friend class         BytecodeInterpreter;
    35  public:
    36   // Initialization
    37   static void reset()                      PRODUCT_RETURN;
    39   // Counter info (all info since last reset)
    40   static int    counter_value()            PRODUCT_RETURN0 NOT_PRODUCT({ return _counter_value; });
    41   static double elapsed_time()             PRODUCT_RETURN0; // in seconds
    42   static double frequency()                PRODUCT_RETURN0; // bytecodes/seconds
    44   // Counter printing
    45   static void   print()                    PRODUCT_RETURN;
    46 };
    49 // BytecodeHistogram collects number of executions of bytecodes
    51 class BytecodeHistogram: AllStatic {
    52  private:
    53   NOT_PRODUCT(static int _counters[Bytecodes::number_of_codes];)   // a counter for each bytecode
    55   friend class TemplateInterpreterGenerator;
    56   friend class         InterpreterGenerator;
    57   friend class         BytecodeInterpreter;
    59  public:
    60   // Initialization
    61   static void reset()                       PRODUCT_RETURN; // reset counters
    63   // Profile printing
    64   static void print(float cutoff = 0.01F)   PRODUCT_RETURN; // cutoff in percent
    65 };
    68 // BytecodePairHistogram collects number of executions of bytecode pairs.
    69 // A bytecode pair is any sequence of two consequtive bytecodes.
    71 class BytecodePairHistogram: AllStatic {
    72  public: // for SparcWorks
    73   enum Constants {
    74     log2_number_of_codes = 8,                         // use a power of 2 for faster addressing
    75     number_of_codes      = 1 << log2_number_of_codes, // must be no less than Bytecodes::number_of_codes
    76     number_of_pairs      = number_of_codes * number_of_codes
    77   };
    79  private:
    80   NOT_PRODUCT(static int  _index;)                      // new bytecode is shifted in - used to index into _counters
    81   NOT_PRODUCT(static int  _counters[number_of_pairs];)  // a counter for each pair
    83   friend class TemplateInterpreterGenerator;
    84   friend class         InterpreterGenerator;
    86  public:
    87   // Initialization
    88   static void reset()                       PRODUCT_RETURN;   // reset counters
    90   // Profile printing
    91   static void print(float cutoff = 0.01F)   PRODUCT_RETURN;   // cutoff in percent
    92 };

mercurial