< prev index next >

src/hotspot/share/opto/graphKit.cpp

Print this page




  26 #include "ci/ciUtilities.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "gc/shared/barrierSet.hpp"
  29 #include "gc/shared/c2/barrierSetC2.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "opto/addnode.hpp"
  33 #include "opto/castnode.hpp"
  34 #include "opto/convertnode.hpp"
  35 #include "opto/graphKit.hpp"
  36 #include "opto/idealKit.hpp"
  37 #include "opto/intrinsicnode.hpp"
  38 #include "opto/locknode.hpp"
  39 #include "opto/machnode.hpp"
  40 #include "opto/opaquenode.hpp"
  41 #include "opto/parse.hpp"
  42 #include "opto/rootnode.hpp"
  43 #include "opto/runtime.hpp"
  44 #include "runtime/deoptimization.hpp"
  45 #include "runtime/sharedRuntime.hpp"




  46 
  47 //----------------------------GraphKit-----------------------------------------
  48 // Main utility constructor.
  49 GraphKit::GraphKit(JVMState* jvms)
  50   : Phase(Phase::Parser),
  51     _env(C->env()),
  52     _gvn(*C->initial_gvn()),
  53     _barrier_set(BarrierSet::barrier_set()->barrier_set_c2())
  54 {
  55   _exceptions = jvms->map()->next_exception();
  56   if (_exceptions != NULL)  jvms->map()->set_next_exception(NULL);
  57   set_jvms(jvms);
  58 }
  59 
  60 // Private constructor for parser.
  61 GraphKit::GraphKit()
  62   : Phase(Phase::Parser),
  63     _env(C->env()),
  64     _gvn(*C->initial_gvn()),
  65     _barrier_set(BarrierSet::barrier_set()->barrier_set_c2())


3702     Node* ccast = alloc->make_ideal_length(ary_type, &_gvn);
3703     if (ccast != length) {
3704       _gvn.set_type_bottom(ccast);
3705       record_for_igvn(ccast);
3706       replace_in_map(length, ccast);
3707     }
3708   }
3709 
3710   return javaoop;
3711 }
3712 
3713 // The following "Ideal_foo" functions are placed here because they recognize
3714 // the graph shapes created by the functions immediately above.
3715 
3716 //---------------------------Ideal_allocation----------------------------------
3717 // Given an oop pointer or raw pointer, see if it feeds from an AllocateNode.
3718 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) {
3719   if (ptr == NULL) {     // reduce dumb test in callers
3720     return NULL;
3721   }








3722   if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast
3723     ptr = ptr->in(1);
3724     if (ptr == NULL) return NULL;
3725   }
3726   // Return NULL for allocations with several casts:
3727   //   j.l.reflect.Array.newInstance(jobject, jint)
3728   //   Object.clone()
3729   // to keep more precise type from last cast.
3730   if (ptr->is_Proj()) {
3731     Node* allo = ptr->in(0);
3732     if (allo != NULL && allo->is_Allocate()) {
3733       return allo->as_Allocate();
3734     }
3735   }
3736   // Report failure to match.
3737   return NULL;
3738 }
3739 
3740 // Fancy version which also strips off an offset (and reports it to caller).
3741 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase,




  26 #include "ci/ciUtilities.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "gc/shared/barrierSet.hpp"
  29 #include "gc/shared/c2/barrierSetC2.hpp"
  30 #include "interpreter/interpreter.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "opto/addnode.hpp"
  33 #include "opto/castnode.hpp"
  34 #include "opto/convertnode.hpp"
  35 #include "opto/graphKit.hpp"
  36 #include "opto/idealKit.hpp"
  37 #include "opto/intrinsicnode.hpp"
  38 #include "opto/locknode.hpp"
  39 #include "opto/machnode.hpp"
  40 #include "opto/opaquenode.hpp"
  41 #include "opto/parse.hpp"
  42 #include "opto/rootnode.hpp"
  43 #include "opto/runtime.hpp"
  44 #include "runtime/deoptimization.hpp"
  45 #include "runtime/sharedRuntime.hpp"
  46 #include "utilities/macros.hpp"
  47 #if INCLUDE_SHENANDOAHGC
  48 #include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp"
  49 #endif
  50 
  51 //----------------------------GraphKit-----------------------------------------
  52 // Main utility constructor.
  53 GraphKit::GraphKit(JVMState* jvms)
  54   : Phase(Phase::Parser),
  55     _env(C->env()),
  56     _gvn(*C->initial_gvn()),
  57     _barrier_set(BarrierSet::barrier_set()->barrier_set_c2())
  58 {
  59   _exceptions = jvms->map()->next_exception();
  60   if (_exceptions != NULL)  jvms->map()->set_next_exception(NULL);
  61   set_jvms(jvms);
  62 }
  63 
  64 // Private constructor for parser.
  65 GraphKit::GraphKit()
  66   : Phase(Phase::Parser),
  67     _env(C->env()),
  68     _gvn(*C->initial_gvn()),
  69     _barrier_set(BarrierSet::barrier_set()->barrier_set_c2())


3706     Node* ccast = alloc->make_ideal_length(ary_type, &_gvn);
3707     if (ccast != length) {
3708       _gvn.set_type_bottom(ccast);
3709       record_for_igvn(ccast);
3710       replace_in_map(length, ccast);
3711     }
3712   }
3713 
3714   return javaoop;
3715 }
3716 
3717 // The following "Ideal_foo" functions are placed here because they recognize
3718 // the graph shapes created by the functions immediately above.
3719 
3720 //---------------------------Ideal_allocation----------------------------------
3721 // Given an oop pointer or raw pointer, see if it feeds from an AllocateNode.
3722 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase) {
3723   if (ptr == NULL) {     // reduce dumb test in callers
3724     return NULL;
3725   }
3726 
3727 #if INCLUDE_SHENANDOAHGC
3728   if (UseShenandoahGC) {
3729     BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
3730     ptr = bs->step_over_gc_barrier(ptr);
3731   }
3732 #endif
3733 
3734   if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast
3735     ptr = ptr->in(1);
3736     if (ptr == NULL) return NULL;
3737   }
3738   // Return NULL for allocations with several casts:
3739   //   j.l.reflect.Array.newInstance(jobject, jint)
3740   //   Object.clone()
3741   // to keep more precise type from last cast.
3742   if (ptr->is_Proj()) {
3743     Node* allo = ptr->in(0);
3744     if (allo != NULL && allo->is_Allocate()) {
3745       return allo->as_Allocate();
3746     }
3747   }
3748   // Report failure to match.
3749   return NULL;
3750 }
3751 
3752 // Fancy version which also strips off an offset (and reports it to caller).
3753 AllocateNode* AllocateNode::Ideal_allocation(Node* ptr, PhaseTransform* phase,


< prev index next >