Fri, 04 Apr 2008 10:48:43 -0400
Merge
1.1 --- a/src/cpu/sparc/vm/sparc.ad Thu Apr 03 12:21:06 2008 -0700 1.2 +++ b/src/cpu/sparc/vm/sparc.ad Fri Apr 04 10:48:43 2008 -0400 1.3 @@ -6023,7 +6023,7 @@ 1.4 ins_pipe(ialu_imm); 1.5 %} 1.6 1.7 -instruct cmovII_U_reg(cmpOp cmp, flagsRegU icc, iRegI dst, iRegI src) %{ 1.8 +instruct cmovII_U_reg(cmpOpU cmp, flagsRegU icc, iRegI dst, iRegI src) %{ 1.9 match(Set dst (CMoveI (Binary cmp icc) (Binary dst src))); 1.10 ins_cost(150); 1.11 size(4); 1.12 @@ -6032,7 +6032,7 @@ 1.13 ins_pipe(ialu_reg); 1.14 %} 1.15 1.16 -instruct cmovII_U_imm(cmpOp cmp, flagsRegU icc, iRegI dst, immI11 src) %{ 1.17 +instruct cmovII_U_imm(cmpOpU cmp, flagsRegU icc, iRegI dst, immI11 src) %{ 1.18 match(Set dst (CMoveI (Binary cmp icc) (Binary dst src))); 1.19 ins_cost(140); 1.20 size(4);
2.1 --- a/src/share/vm/opto/memnode.cpp Thu Apr 03 12:21:06 2008 -0700 2.2 +++ b/src/share/vm/opto/memnode.cpp Fri Apr 04 10:48:43 2008 -0400 2.3 @@ -1122,6 +1122,12 @@ 2.4 } 2.5 // Split through Phi (see original code in loopopts.cpp). 2.6 assert(phase->C->have_alias_type(addr_t), "instance should have alias type"); 2.7 + 2.8 + // Do nothing here if Identity will find a value 2.9 + // (to avoid infinite chain of value phis generation). 2.10 + if ( !phase->eqv(this, this->Identity(phase)) ) 2.11 + return NULL; 2.12 + 2.13 const Type* this_type = this->bottom_type(); 2.14 int this_index = phase->C->get_alias_index(addr_t); 2.15 int this_offset = addr_t->offset();
3.1 --- a/src/share/vm/runtime/deoptimization.cpp Thu Apr 03 12:21:06 2008 -0700 3.2 +++ b/src/share/vm/runtime/deoptimization.cpp Fri Apr 04 10:48:43 2008 -0400 3.3 @@ -143,6 +143,7 @@ 3.4 // relock objects if synchronization on them was eliminated. 3.5 if (DoEscapeAnalysis) { 3.6 if (EliminateAllocations) { 3.7 + assert (chunk->at(0)->scope() != NULL,"expect only compiled java frames"); 3.8 GrowableArray<ScopeValue*>* objects = chunk->at(0)->scope()->objects(); 3.9 bool reallocated = false; 3.10 if (objects != NULL) { 3.11 @@ -162,19 +163,26 @@ 3.12 } 3.13 } 3.14 if (EliminateLocks) { 3.15 +#ifndef PRODUCT 3.16 + bool first = true; 3.17 +#endif 3.18 for (int i = 0; i < chunk->length(); i++) { 3.19 - GrowableArray<MonitorValue*>* monitors = chunk->at(i)->scope()->monitors(); 3.20 - if (monitors != NULL) { 3.21 - relock_objects(&deoptee, &map, monitors); 3.22 + compiledVFrame* cvf = chunk->at(i); 3.23 + assert (cvf->scope() != NULL,"expect only compiled java frames"); 3.24 + GrowableArray<MonitorInfo*>* monitors = cvf->monitors(); 3.25 + if (monitors->is_nonempty()) { 3.26 + relock_objects(monitors, thread); 3.27 #ifndef PRODUCT 3.28 if (TraceDeoptimization) { 3.29 ttyLocker ttyl; 3.30 - tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, thread); 3.31 for (int j = 0; j < monitors->length(); j++) { 3.32 - MonitorValue* mv = monitors->at(j); 3.33 - if (mv->eliminated()) { 3.34 - StackValue* owner = StackValue::create_stack_value(&deoptee, &map, mv->owner()); 3.35 - tty->print_cr(" object <" INTPTR_FORMAT "> locked", owner->get_obj()()); 3.36 + MonitorInfo* mi = monitors->at(j); 3.37 + if (mi->eliminated()) { 3.38 + if (first) { 3.39 + first = false; 3.40 + tty->print_cr("RELOCK OBJECTS in thread " INTPTR_FORMAT, thread); 3.41 + } 3.42 + tty->print_cr(" object <" INTPTR_FORMAT "> locked", mi->owner()); 3.43 } 3.44 } 3.45 } 3.46 @@ -799,18 +807,27 @@ 3.47 3.48 3.49 // relock objects for which synchronization was eliminated 3.50 -void Deoptimization::relock_objects(frame* fr, RegisterMap* reg_map, GrowableArray<MonitorValue*>* monitors) { 3.51 +void Deoptimization::relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread) { 3.52 for (int i = 0; i < monitors->length(); i++) { 3.53 - MonitorValue* mv = monitors->at(i); 3.54 - StackValue* owner = StackValue::create_stack_value(fr, reg_map, mv->owner()); 3.55 - if (mv->eliminated()) { 3.56 - Handle obj = owner->get_obj(); 3.57 - assert(obj.not_null(), "reallocation was missed"); 3.58 - BasicLock* lock = StackValue::resolve_monitor_lock(fr, mv->basic_lock()); 3.59 - lock->set_displaced_header(obj->mark()); 3.60 - obj->set_mark((markOop) lock); 3.61 + MonitorInfo* mon_info = monitors->at(i); 3.62 + if (mon_info->eliminated()) { 3.63 + assert(mon_info->owner() != NULL, "reallocation was missed"); 3.64 + Handle obj = Handle(mon_info->owner()); 3.65 + markOop mark = obj->mark(); 3.66 + if (UseBiasedLocking && mark->has_bias_pattern()) { 3.67 + // New allocated objects may have the mark set to anonymously biased. 3.68 + // Also the deoptimized method may called methods with synchronization 3.69 + // where the thread-local object is bias locked to the current thread. 3.70 + assert(mark->is_biased_anonymously() || 3.71 + mark->biased_locker() == thread, "should be locked to current thread"); 3.72 + // Reset mark word to unbiased prototype. 3.73 + markOop unbiased_prototype = markOopDesc::prototype()->set_age(mark->age()); 3.74 + obj->set_mark(unbiased_prototype); 3.75 + } 3.76 + BasicLock* lock = mon_info->lock(); 3.77 + ObjectSynchronizer::slow_enter(obj, lock, thread); 3.78 } 3.79 - assert(owner->get_obj()->is_locked(), "object must be locked now"); 3.80 + assert(mon_info->owner()->is_locked(), "object must be locked now"); 3.81 } 3.82 } 3.83 3.84 @@ -916,7 +933,7 @@ 3.85 GrowableArray<MonitorInfo*>* monitors = cvf->monitors(); 3.86 for (int i = 0; i < monitors->length(); i++) { 3.87 MonitorInfo* mon_info = monitors->at(i); 3.88 - if (mon_info->owner() != NULL) { 3.89 + if (mon_info->owner() != NULL && !mon_info->eliminated()) { 3.90 objects_to_revoke->append(Handle(mon_info->owner())); 3.91 } 3.92 }
4.1 --- a/src/share/vm/runtime/deoptimization.hpp Thu Apr 03 12:21:06 2008 -0700 4.2 +++ b/src/share/vm/runtime/deoptimization.hpp Fri Apr 04 10:48:43 2008 -0400 4.3 @@ -105,7 +105,7 @@ 4.4 static void reassign_type_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, typeArrayOop obj, BasicType type); 4.5 static void reassign_object_array_elements(frame* fr, RegisterMap* reg_map, ObjectValue* sv, objArrayOop obj); 4.6 static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects); 4.7 - static void relock_objects(frame* fr, RegisterMap* reg_map, GrowableArray<MonitorValue*>* monitors); 4.8 + static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread); 4.9 NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects);) 4.10 #endif // COMPILER2 4.11
5.1 --- a/src/share/vm/runtime/vframe.cpp Thu Apr 03 12:21:06 2008 -0700 5.2 +++ b/src/share/vm/runtime/vframe.cpp Fri Apr 04 10:48:43 2008 -0400 5.3 @@ -206,7 +206,7 @@ 5.4 for (BasicObjectLock* current = (fr().previous_monitor_in_interpreter_frame(fr().interpreter_frame_monitor_begin())); 5.5 current >= fr().interpreter_frame_monitor_end(); 5.6 current = fr().previous_monitor_in_interpreter_frame(current)) { 5.7 - result->push(new MonitorInfo(current->obj(), current->lock())); 5.8 + result->push(new MonitorInfo(current->obj(), current->lock(), false)); 5.9 } 5.10 return result; 5.11 }
6.1 --- a/src/share/vm/runtime/vframe.hpp Thu Apr 03 12:21:06 2008 -0700 6.2 +++ b/src/share/vm/runtime/vframe.hpp Fri Apr 04 10:48:43 2008 -0400 6.3 @@ -230,15 +230,18 @@ 6.4 private: 6.5 oop _owner; // the object owning the monitor 6.6 BasicLock* _lock; 6.7 + bool _eliminated; 6.8 public: 6.9 // Constructor 6.10 - MonitorInfo(oop owner, BasicLock* lock) { 6.11 + MonitorInfo(oop owner, BasicLock* lock, bool eliminated) { 6.12 _owner = owner; 6.13 _lock = lock; 6.14 + _eliminated = eliminated; 6.15 } 6.16 // Accessors 6.17 oop owner() const { return _owner; } 6.18 BasicLock* lock() const { return _lock; } 6.19 + bool eliminated() const { return _eliminated; } 6.20 }; 6.21 6.22 class vframeStreamCommon : StackObj {
7.1 --- a/src/share/vm/runtime/vframe_hp.cpp Thu Apr 03 12:21:06 2008 -0700 7.2 +++ b/src/share/vm/runtime/vframe_hp.cpp Fri Apr 04 10:48:43 2008 -0400 7.3 @@ -190,7 +190,7 @@ 7.4 // Casting away const 7.5 frame& fr = (frame&) _fr; 7.6 MonitorInfo* info = new MonitorInfo(fr.compiled_synchronized_native_monitor_owner(nm), 7.7 - fr.compiled_synchronized_native_monitor(nm)); 7.8 + fr.compiled_synchronized_native_monitor(nm), false); 7.9 monitors->push(info); 7.10 return monitors; 7.11 } 7.12 @@ -202,7 +202,7 @@ 7.13 for (int index = 0; index < monitors->length(); index++) { 7.14 MonitorValue* mv = monitors->at(index); 7.15 StackValue *owner_sv = create_stack_value(mv->owner()); // it is an oop 7.16 - result->push(new MonitorInfo(owner_sv->get_obj()(), resolve_monitor_lock(mv->basic_lock()))); 7.17 + result->push(new MonitorInfo(owner_sv->get_obj()(), resolve_monitor_lock(mv->basic_lock()), mv->eliminated())); 7.18 } 7.19 return result; 7.20 }