< prev index next >

src/hotspot/share/opto/locknode.cpp

Print this page
@@ -147,10 +147,22 @@
  //------------------------------cmp--------------------------------------------
  bool FastLockNode::cmp( const Node &n ) const {
    return (&n == this);                // Always fail except on self
  }
  
+ const Type* FastLockNode::Value(PhaseGVN* phase) const {
+   const Type* in1_t = phase->type(in(1));
+   if (in1_t == Type::TOP) {
+     return Type::TOP;
+   }
+   if (in1_t->is_inlinetypeptr()) {
+     // Locking on inline types always fails
+     return TypeInt::CC_GT;
+   }
+   return TypeInt::CC;
+ }
+ 
  //=============================================================================
  //-----------------------------hash--------------------------------------------
  uint FastUnlockNode::hash() const { return NO_HASH; }
  
  //------------------------------cmp--------------------------------------------

@@ -177,14 +189,22 @@
  //=============================================================================
  //------------------------------do_monitor_enter-------------------------------
  void Parse::do_monitor_enter() {
    kill_dead_locals();
  
+   Node* obj = peek();
+   const Type* obj_type = gvn().type(obj);
+   if (obj_type->is_inlinetypeptr()) {
+     uncommon_trap(Deoptimization::Reason_class_check,
+                   Deoptimization::Action_none);
+     return;
+   }
+ 
    C->set_has_monitors(true);
  
    // Null check; get casted pointer.
-   Node* obj = null_check(peek());
+   obj = null_check(obj);
    // Check for locking null object
    if (stopped()) return;
  
    // the monitor object is not part of debug info expression stack
    pop();
< prev index next >