hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp
author never
Fri, 21 Jan 2011 13:01:02 -0800
changeset 8065 7ca689ce3d32
parent 7397 5b173b4ca846
child 11886 feebf5c9f40c
permissions -rw-r--r--
6809483: hotspot:::method_entry are not correctly generated for "method()V" Reviewed-by: iveresov, twisti
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
8065
7ca689ce3d32 6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents: 7397
diff changeset
     2
 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    25
#ifndef SHARE_VM_C1_C1_INSTRUCTIONPRINTER_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    26
#define SHARE_VM_C1_C1_INSTRUCTIONPRINTER_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    28
#include "c1/c1_IR.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    29
#include "c1/c1_Instruction.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    30
#include "c1/c1_Runtime1.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class InstructionPrinter: public InstructionVisitor {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  outputStream* _output;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  bool _print_phis;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  enum LayoutConstants {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
    bci_pos   =  2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    use_pos   =  7,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    temp_pos  = 12,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    instr_pos = 19,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    end_pos   = 60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  bool is_illegal_phi(Value v);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  InstructionPrinter(bool print_phis = true, outputStream* output = tty)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    : _print_phis(print_phis)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    , _output(output)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  outputStream* output() { return _output; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // helpers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  static const char* basic_type_name(BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  static const char* cond_name(If::Condition cond);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  static const char* op_name(Bytecodes::Code op);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  bool is_phi_of_block(Value v, BlockBegin* b);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // type-specific print functions
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  void print_klass(ciKlass* klass);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  void print_object(Value obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // generic print functions
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  void print_temp(Value value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  void print_field(AccessField* field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  void print_indexed(AccessIndexed* indexed);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  void print_monitor(AccessMonitor* monitor);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  void print_op2(Op2* instr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  void print_value(Value value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  void print_instr(Instruction* instr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  void print_stack(ValueStack* stack);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  void print_inline_level(BlockBegin* block);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  void print_unsafe_op(UnsafeOp* op, const char* name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  void print_unsafe_raw_op(UnsafeRawOp* op, const char* name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  void print_unsafe_object_op(UnsafeObjectOp* op, const char* name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  void print_phi(int i, Value v, BlockBegin* b);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  void print_alias(Value v);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  // line printing of instructions
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  void fill_to(int pos, char filler = ' ');
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  void print_head();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  void print_line(Instruction* instr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  // visitor functionality
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  virtual void do_Phi            (Phi*             x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  virtual void do_Local          (Local*           x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  virtual void do_Constant       (Constant*        x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  virtual void do_LoadField      (LoadField*       x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  virtual void do_StoreField     (StoreField*      x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  virtual void do_ArrayLength    (ArrayLength*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  virtual void do_LoadIndexed    (LoadIndexed*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  virtual void do_StoreIndexed   (StoreIndexed*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  virtual void do_NegateOp       (NegateOp*        x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  virtual void do_ArithmeticOp   (ArithmeticOp*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  virtual void do_ShiftOp        (ShiftOp*         x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  virtual void do_LogicOp        (LogicOp*         x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  virtual void do_CompareOp      (CompareOp*       x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  virtual void do_IfOp           (IfOp*            x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  virtual void do_Convert        (Convert*         x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  virtual void do_NullCheck      (NullCheck*       x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  virtual void do_Invoke         (Invoke*          x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  virtual void do_NewInstance    (NewInstance*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  virtual void do_NewTypeArray   (NewTypeArray*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  virtual void do_NewObjectArray (NewObjectArray*  x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  virtual void do_NewMultiArray  (NewMultiArray*   x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  virtual void do_CheckCast      (CheckCast*       x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  virtual void do_InstanceOf     (InstanceOf*      x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  virtual void do_MonitorEnter   (MonitorEnter*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  virtual void do_MonitorExit    (MonitorExit*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  virtual void do_Intrinsic      (Intrinsic*       x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  virtual void do_BlockBegin     (BlockBegin*      x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  virtual void do_Goto           (Goto*            x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  virtual void do_If             (If*              x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  virtual void do_IfInstanceOf   (IfInstanceOf*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  virtual void do_TableSwitch    (TableSwitch*     x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  virtual void do_LookupSwitch   (LookupSwitch*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  virtual void do_Return         (Return*          x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  virtual void do_Throw          (Throw*           x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  virtual void do_Base           (Base*            x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  virtual void do_OsrEntry       (OsrEntry*        x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  virtual void do_ExceptionObject(ExceptionObject* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  virtual void do_RoundFP        (RoundFP*         x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  virtual void do_UnsafeGetRaw   (UnsafeGetRaw*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  virtual void do_UnsafePutRaw   (UnsafePutRaw*    x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  virtual void do_UnsafeGetObject(UnsafeGetObject* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  virtual void do_UnsafePutObject(UnsafePutObject* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  virtual void do_ProfileCall    (ProfileCall*     x);
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 5547
diff changeset
   133
  virtual void do_ProfileInvoke  (ProfileInvoke*   x);
8065
7ca689ce3d32 6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents: 7397
diff changeset
   134
  virtual void do_RuntimeCall    (RuntimeCall*     x);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
#endif // PRODUCT
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
   137
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
   138
#endif // SHARE_VM_C1_C1_INSTRUCTIONPRINTER_HPP