< prev index next >

src/hotspot/share/opto/parse2.cpp

Print this page
rev 52279 : Cleanup C2 parse sources


  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "compiler/compileLog.hpp"
  30 #include "interpreter/linkResolver.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "memory/universe.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "opto/addnode.hpp"
  35 #include "opto/castnode.hpp"
  36 #include "opto/convertnode.hpp"
  37 #include "opto/divnode.hpp"
  38 #include "opto/idealGraphPrinter.hpp"
  39 #include "opto/matcher.hpp"
  40 #include "opto/memnode.hpp"
  41 #include "opto/mulnode.hpp"
  42 #include "opto/opaquenode.hpp"
  43 #include "opto/parse.hpp"
  44 #include "opto/runtime.hpp"
  45 #include "runtime/deoptimization.hpp"
  46 #include "runtime/sharedRuntime.hpp"
  47 #include "utilities/macros.hpp"
  48 #if INCLUDE_SHENANDOAHGC
  49 #include "gc/shenandoah/c2/shenandoahSupport.hpp"
  50 #endif
  51 
  52 #ifndef PRODUCT
  53 extern int explicit_null_checks_inserted,
  54            explicit_null_checks_elided;
  55 #endif
  56 
  57 //---------------------------------array_load----------------------------------
  58 void Parse::array_load(BasicType bt) {
  59   const Type* elemtype = Type::TOP;
  60   bool big_val = bt == T_DOUBLE || bt == T_LONG;
  61   Node* adr = array_addressing(bt, 0, false, &elemtype);
  62   if (stopped())  return;     // guaranteed null or range check
  63 
  64   pop();                      // index (already used)
  65   Node* array = pop();        // the array itself
  66 
  67   if (elemtype == TypeInt::BOOL) {
  68     bt = T_BOOLEAN;
  69   } else if (bt == T_OBJECT) {
  70     elemtype = _gvn.type(array)->is_aryptr()->elem()->make_oopptr();
  71   }
  72 
  73   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
  74 
  75   Node* ld = access_load_at(array, adr, adr_type, elemtype, bt,
  76                             IN_HEAP | IS_ARRAY | C2_CONTROL_DEPENDENT_LOAD);
  77   if (big_val) {
  78     push_pair(ld);
  79   } else {
  80     push(ld);
  81   }
  82 }
  83 
  84 
  85 //--------------------------------array_store----------------------------------
  86 void Parse::array_store(BasicType bt) {
  87   const Type* elemtype = Type::TOP;
  88   bool big_val = bt == T_DOUBLE || bt == T_LONG;
  89   Node* adr = array_addressing(bt, big_val ? 2 : 1, true, &elemtype);
  90   if (stopped())  return;     // guaranteed null or range check
  91   if (bt == T_OBJECT) {
  92     array_store_check();
  93   }
  94   Node* val;                  // Oop to store
  95   if (big_val) {
  96     val = pop_pair();
  97   } else {
  98     val = pop();
  99   }
 100   pop();                      // index (already used)
 101   Node* array = pop();        // the array itself
 102 
 103   if (elemtype == TypeInt::BOOL) {
 104     bt = T_BOOLEAN;
 105   } else if (bt == T_OBJECT) {
 106     elemtype = _gvn.type(array)->is_aryptr()->elem()->make_oopptr();
 107   }
 108 
 109   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
 110 
 111   access_store_at(array, adr, adr_type, val, elemtype, bt, MO_UNORDERED | IN_HEAP | IS_ARRAY);
 112 }
 113 
 114 
 115 //------------------------------array_addressing-------------------------------
 116 // Pull array and index from the stack.  Compute pointer-to-element.
 117 Node* Parse::array_addressing(BasicType type, int vals, bool is_store, const Type* *result2) {
 118   Node *idx   = peek(0+vals);   // Get from stack without popping
 119   Node *ary   = peek(1+vals);   // in case of exception
 120 
 121   // Null check the array base, with correct stack contents
 122   ary = null_check(ary, T_ARRAY);
 123   // Compile-time detect of null-exception?
 124   if (stopped())  return top();
 125 
 126   const TypeAryPtr* arytype  = _gvn.type(ary)->is_aryptr();
 127   const TypeInt*    sizetype = arytype->size();
 128   const Type*       elemtype = arytype->elem();
 129 
 130   if (UseUniqueSubclasses && result2 != NULL) {
 131     const Type* el = elemtype->make_ptr();
 132     if (el && el->isa_instptr()) {
 133       const TypeInstPtr* toop = el->is_instptr();
 134       if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) {
 135         // If we load from "AbstractClass[]" we must see "ConcreteSubClass".
 136         const Type* subklass = Type::get_const_type(toop->klass());
 137         elemtype = subklass->join_speculative(el);




  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "compiler/compileLog.hpp"
  30 #include "interpreter/linkResolver.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "memory/universe.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "opto/addnode.hpp"
  35 #include "opto/castnode.hpp"
  36 #include "opto/convertnode.hpp"
  37 #include "opto/divnode.hpp"
  38 #include "opto/idealGraphPrinter.hpp"
  39 #include "opto/matcher.hpp"
  40 #include "opto/memnode.hpp"
  41 #include "opto/mulnode.hpp"
  42 #include "opto/opaquenode.hpp"
  43 #include "opto/parse.hpp"
  44 #include "opto/runtime.hpp"
  45 #include "runtime/deoptimization.hpp"
  46 #include "runtime/sharedRuntime.hpp"




  47 
  48 #ifndef PRODUCT
  49 extern int explicit_null_checks_inserted,
  50            explicit_null_checks_elided;
  51 #endif
  52 
  53 //---------------------------------array_load----------------------------------
  54 void Parse::array_load(BasicType bt) {
  55   const Type* elemtype = Type::TOP;
  56   bool big_val = bt == T_DOUBLE || bt == T_LONG;
  57   Node* adr = array_addressing(bt, 0, &elemtype);
  58   if (stopped())  return;     // guaranteed null or range check
  59 
  60   pop();                      // index (already used)
  61   Node* array = pop();        // the array itself
  62 
  63   if (elemtype == TypeInt::BOOL) {
  64     bt = T_BOOLEAN;
  65   } else if (bt == T_OBJECT) {
  66     elemtype = _gvn.type(array)->is_aryptr()->elem()->make_oopptr();
  67   }
  68 
  69   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
  70 
  71   Node* ld = access_load_at(array, adr, adr_type, elemtype, bt,
  72                             IN_HEAP | IS_ARRAY | C2_CONTROL_DEPENDENT_LOAD);
  73   if (big_val) {
  74     push_pair(ld);
  75   } else {
  76     push(ld);
  77   }
  78 }
  79 
  80 
  81 //--------------------------------array_store----------------------------------
  82 void Parse::array_store(BasicType bt) {
  83   const Type* elemtype = Type::TOP;
  84   bool big_val = bt == T_DOUBLE || bt == T_LONG;
  85   Node* adr = array_addressing(bt, big_val ? 2 : 1, &elemtype);
  86   if (stopped())  return;     // guaranteed null or range check
  87   if (bt == T_OBJECT) {
  88     array_store_check();
  89   }
  90   Node* val;                  // Oop to store
  91   if (big_val) {
  92     val = pop_pair();
  93   } else {
  94     val = pop();
  95   }
  96   pop();                      // index (already used)
  97   Node* array = pop();        // the array itself
  98 
  99   if (elemtype == TypeInt::BOOL) {
 100     bt = T_BOOLEAN;
 101   } else if (bt == T_OBJECT) {
 102     elemtype = _gvn.type(array)->is_aryptr()->elem()->make_oopptr();
 103   }
 104 
 105   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
 106 
 107   access_store_at(array, adr, adr_type, val, elemtype, bt, MO_UNORDERED | IN_HEAP | IS_ARRAY);
 108 }
 109 
 110 
 111 //------------------------------array_addressing-------------------------------
 112 // Pull array and index from the stack.  Compute pointer-to-element.
 113 Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) {
 114   Node *idx   = peek(0+vals);   // Get from stack without popping
 115   Node *ary   = peek(1+vals);   // in case of exception
 116 
 117   // Null check the array base, with correct stack contents
 118   ary = null_check(ary, T_ARRAY);
 119   // Compile-time detect of null-exception?
 120   if (stopped())  return top();
 121 
 122   const TypeAryPtr* arytype  = _gvn.type(ary)->is_aryptr();
 123   const TypeInt*    sizetype = arytype->size();
 124   const Type*       elemtype = arytype->elem();
 125 
 126   if (UseUniqueSubclasses && result2 != NULL) {
 127     const Type* el = elemtype->make_ptr();
 128     if (el && el->isa_instptr()) {
 129       const TypeInstPtr* toop = el->is_instptr();
 130       if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) {
 131         // If we load from "AbstractClass[]" we must see "ConcreteSubClass".
 132         const Type* subklass = Type::get_const_type(toop->klass());
 133         elemtype = subklass->join_speculative(el);


< prev index next >