< prev index next >

src/hotspot/share/opto/locknode.cpp

Print this page
@@ -147,10 +147,18 @@
  //------------------------------cmp--------------------------------------------
  bool FastLockNode::cmp( const Node &n ) const {
    return (&n == this);                // Always fail except on self
  }
  
+ const Type* FastLockNode::Value(PhaseGVN* phase) const {
+   if (phase->type(in(1))->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,12 +185,20 @@
  //=============================================================================
  //------------------------------do_monitor_enter-------------------------------
  void Parse::do_monitor_enter() {
    kill_dead_locals();
  
+   Node* obj = peek();
+   const Type* obj_type = gvn().type(obj);
+   if (obj_type->isa_inlinetype() || obj_type->is_inlinetypeptr()) {
+     uncommon_trap(Deoptimization::Reason_class_check,
+                   Deoptimization::Action_none);
+     return;
+   }
+ 
    // 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 >