< prev index next >

src/hotspot/share/opto/locknode.cpp

Print this page
*** 183,10 ***
--- 183,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--------------------------------------------

*** 202,10 ***
--- 214,16 ---
    // Null check; get casted pointer.
    Node* obj = null_check(peek());
    // Check for locking null object
    if (stopped()) return;
  
+   {
+     // Synchronizing on an inline type is not allowed
+     BuildCutout unless(this, inline_type_test(obj, /* is_inline = */ false), PROB_MAX);
+     uncommon_trap_exact(Deoptimization::Reason_class_check, Deoptimization::Action_none);
+   }
+ 
    // the monitor object is not part of debug info expression stack
    pop();
  
    // Insert a FastLockNode which takes as arguments the current thread pointer,
    // the obj pointer & the address of the stack slot pair used for the lock.
< prev index next >