Mon, 27 Jun 2016 16:08:34 +0800
[Code Reorganization] Removed compilation policy related modifications made by Loongson.
1.1 --- a/src/share/vm/compiler/compileBroker.cpp Fri Jun 24 17:12:13 2016 +0800 1.2 +++ b/src/share/vm/compiler/compileBroker.cpp Mon Jun 27 16:08:34 2016 +0800 1.3 @@ -22,12 +22,6 @@ 1.4 * 1.5 */ 1.6 1.7 -/* 1.8 - * This file has been modified by Loongson Technology in 2015. These 1.9 - * modifications are Copyright (c) 2015 Loongson Technology, and are made 1.10 - * available on the same license terms set forth above. 1.11 - */ 1.12 - 1.13 #include "precompiled.hpp" 1.14 #include "classfile/systemDictionary.hpp" 1.15 #include "classfile/vmSymbols.hpp" 1.16 @@ -263,12 +257,6 @@ 1.17 } 1.18 } 1.19 1.20 -#ifdef MIPS64 1.21 -void CompileTask::set_weight() { 1.22 - assert(FactorOfSizeScheduling >= 0 && FactorOfSizeScheduling <= 100, "FactorOfSizeScheduling should be in [0, 100]"); 1.23 - _weight = 100 * FactorOfSizeScheduling / (_method_code_size + 1) + 10 * (100 - FactorOfSizeScheduling) * _speed; 1.24 -} 1.25 -#endif 1.26 1.27 // ------------------------------------------------------------------ 1.28 // CompileTask::initialize 1.29 @@ -284,14 +272,6 @@ 1.30 1.31 _compile_id = compile_id; 1.32 _method = method(); 1.33 -#ifdef MIPS64 1.34 - _prev_time = os::javaTimeMillis(); 1.35 - _prev_ic_count = _method->interpreter_invocation_count(); 1.36 - _prev_bc_count = _method->backedge_count() + _method->get_decay_counter(); 1.37 - _speed = 10.0; 1.38 - _method_code_size = _method->code_size() >> 3; 1.39 - set_weight(); 1.40 -#endif 1.41 _method_holder = JNIHandles::make_global(method->method_holder()->klass_holder()); 1.42 _osr_bci = osr_bci; 1.43 _is_blocking = is_blocking; 1.44 @@ -627,13 +607,8 @@ 1.45 task->set_prev(_last); 1.46 _last = task; 1.47 } 1.48 - 1.49 ++_size; 1.50 1.51 -#ifdef MIPS64 1.52 - _queued_method_size += task->method()->code_size(); 1.53 -#endif 1.54 - 1.55 // Mark the method as being in the compile queue. 1.56 task->method()->set_queued_for_compilation(); 1.57 1.58 @@ -656,9 +631,6 @@ 1.59 delete task; 1.60 } 1.61 _first = NULL; 1.62 -#ifdef MIPS64 1.63 - _queued_method_size = 0; 1.64 -#endif 1.65 } 1.66 } 1.67 1.68 @@ -740,9 +712,6 @@ 1.69 _last = task->prev(); 1.70 } 1.71 --_size; 1.72 -#ifdef MIPS64 1.73 - _queued_method_size -= task->method()->code_size(); 1.74 -#endif 1.75 } 1.76 1.77 // methods in the compile queue need to be marked as used on the stack
2.1 --- a/src/share/vm/compiler/compileBroker.hpp Fri Jun 24 17:12:13 2016 +0800 2.2 +++ b/src/share/vm/compiler/compileBroker.hpp Mon Jun 27 16:08:34 2016 +0800 2.3 @@ -22,12 +22,6 @@ 2.4 * 2.5 */ 2.6 2.7 -/* 2.8 - * This file has been modified by Loongson Technology in 2015. These 2.9 - * modifications are Copyright (c) 2015 Loongson Technology, and are made 2.10 - * available on the same license terms set forth above. 2.11 - */ 2.12 - 2.13 #ifndef SHARE_VM_COMPILER_COMPILEBROKER_HPP 2.14 #define SHARE_VM_COMPILER_COMPILEBROKER_HPP 2.15 2.16 @@ -50,22 +44,12 @@ 2.17 uint _compile_id; 2.18 Method* _method; 2.19 jobject _method_holder; 2.20 -#ifdef MIPS64 2.21 - int _method_code_size; 2.22 -#endif 2.23 int _osr_bci; 2.24 bool _is_complete; 2.25 bool _is_success; 2.26 bool _is_blocking; 2.27 int _comp_level; 2.28 int _num_inlined_bytecodes; 2.29 -#ifdef MIPS64 2.30 - int _prev_ic_count; 2.31 - int _prev_bc_count; 2.32 - jlong _prev_time; 2.33 - double _speed; 2.34 - int _weight; 2.35 -#endif 2.36 nmethodLocker* _code_handle; // holder of eventual result 2.37 CompileTask* _next, *_prev; 2.38 2.39 @@ -87,19 +71,6 @@ 2.40 2.41 void free(); 2.42 2.43 -#ifdef MIPS64 2.44 - int prev_ic_count() const { return _prev_ic_count; } 2.45 - void set_prev_ic_count(int c) { _prev_ic_count = c; } 2.46 - int prev_bc_count() const { return _prev_bc_count; } 2.47 - void set_prev_bc_count(int c) { _prev_bc_count = c; } 2.48 - jlong prev_time() const { return _prev_time; } 2.49 - void set_prev_time(jlong t) { _prev_time = t; } 2.50 - double speed() const { return _speed; } 2.51 - void set_speed(double s) { _speed = s; }; 2.52 - int weight() const { return _weight;} 2.53 - void set_weight(); 2.54 - void set_weight(int w) { _weight = w;} 2.55 -#endif 2.56 int compile_id() const { return _compile_id; } 2.57 Method* method() const { return _method; } 2.58 int osr_bci() const { return _osr_bci; } 2.59 @@ -110,9 +81,6 @@ 2.60 nmethodLocker* code_handle() const { return _code_handle; } 2.61 void set_code_handle(nmethodLocker* l) { _code_handle = l; } 2.62 nmethod* code() const; // _code_handle->code() 2.63 -#ifdef MIPS64 2.64 - int method_code_size() const { return _method_code_size; } 2.65 -#endif 2.66 void set_code(nmethod* nm); // _code_handle->set_code(nm) 2.67 2.68 Monitor* lock() const { return _lock; } 2.69 @@ -221,9 +189,6 @@ 2.70 CompileTask* _last; 2.71 2.72 int _size; 2.73 -#ifdef MIPS64 2.74 - int _queued_method_size; 2.75 -#endif 2.76 public: 2.77 CompileQueue(const char* name, Monitor* lock) { 2.78 _name = name; 2.79 @@ -231,9 +196,6 @@ 2.80 _first = NULL; 2.81 _last = NULL; 2.82 _size = 0; 2.83 -#ifdef MIPS64 2.84 - _queued_method_size = 0; 2.85 -#endif 2.86 } 2.87 2.88 const char* name() const { return _name; }
3.1 --- a/src/share/vm/oops/method.cpp Fri Jun 24 17:12:13 2016 +0800 3.2 +++ b/src/share/vm/oops/method.cpp Mon Jun 27 16:08:34 2016 +0800 3.3 @@ -22,12 +22,6 @@ 3.4 * 3.5 */ 3.6 3.7 -/* 3.8 - * This file has been modified by Loongson Technology in 2015. These 3.9 - * modifications are Copyright (c) 2015 Loongson Technology, and are made 3.10 - * available on the same license terms set forth above. 3.11 - */ 3.12 - 3.13 #include "precompiled.hpp" 3.14 #include "classfile/metadataOnStackMark.hpp" 3.15 #include "classfile/systemDictionary.hpp" 3.16 @@ -110,10 +104,7 @@ 3.17 clear_native_function(); 3.18 set_signature_handler(NULL); 3.19 } 3.20 -#ifdef MIPS64 3.21 - set_num_of_requests(0); 3.22 - set_decay_counter(0); 3.23 -#endif 3.24 + 3.25 NOT_PRODUCT(set_compiled_invocation_count(0);) 3.26 } 3.27 3.28 @@ -847,10 +838,6 @@ 3.29 *native_function_addr() = NULL; 3.30 set_signature_handler(NULL); 3.31 } 3.32 -#ifdef MIPS64 3.33 - set_num_of_requests(0); 3.34 - set_decay_counter(0); 3.35 -#endif 3.36 NOT_PRODUCT(set_compiled_invocation_count(0);) 3.37 _adapter = NULL; 3.38 _from_compiled_entry = NULL;
4.1 --- a/src/share/vm/oops/method.hpp Fri Jun 24 17:12:13 2016 +0800 4.2 +++ b/src/share/vm/oops/method.hpp Mon Jun 27 16:08:34 2016 +0800 4.3 @@ -22,12 +22,6 @@ 4.4 * 4.5 */ 4.6 4.7 -/* 4.8 - * This file has been modified by Loongson Technology in 2015. These 4.9 - * modifications are Copyright (c) 2015 Loongson Technology, and are made 4.10 - * available on the same license terms set forth above. 4.11 - */ 4.12 - 4.13 #ifndef SHARE_VM_OOPS_METHODOOP_HPP 4.14 #define SHARE_VM_OOPS_METHODOOP_HPP 4.15 4.16 @@ -126,10 +120,6 @@ 4.17 #ifndef PRODUCT 4.18 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging) 4.19 #endif 4.20 -#ifdef MIPS64 4.21 - int _num_of_requests; 4.22 - int _decay_counter; 4.23 -#endif 4.24 // Entry point for calling both from and to the interpreter. 4.25 address _i2i_entry; // All-args-on-stack calling convention 4.26 // Adapter blob (i2c/c2i) for this Method*. Set once when method is linked. 4.27 @@ -172,15 +162,7 @@ 4.28 4.29 ConstMethod* constMethod() const { return _constMethod; } 4.30 void set_constMethod(ConstMethod* xconst) { _constMethod = xconst; } 4.31 -#ifdef MIPS64 4.32 - void incr_num_of_requests(int increment) { _num_of_requests += increment; } 4.33 - void set_num_of_requests(int new_num) { _num_of_requests = new_num; } 4.34 - int get_num_of_requests() const { return _num_of_requests; } 4.35 4.36 - void incr_decay_counter(int increment) { _decay_counter += increment; } 4.37 - void set_decay_counter(int new_num) { _decay_counter = new_num; } 4.38 - int get_decay_counter() const { return _decay_counter; } 4.39 -#endif 4.40 4.41 static address make_adapters(methodHandle mh, TRAPS); 4.42 volatile address from_compiled_entry() const { return (address)OrderAccess::load_ptr_acquire(&_from_compiled_entry); }
5.1 --- a/src/share/vm/runtime/compilationPolicy.cpp Fri Jun 24 17:12:13 2016 +0800 5.2 +++ b/src/share/vm/runtime/compilationPolicy.cpp Mon Jun 27 16:08:34 2016 +0800 5.3 @@ -22,12 +22,6 @@ 5.4 * 5.5 */ 5.6 5.7 -/* 5.8 - * This file has been modified by Loongson Technology in 2015. These 5.9 - * modifications are Copyright (c) 2015 Loongson Technology, and are made 5.10 - * available on the same license terms set forth above. 5.11 - */ 5.12 - 5.13 #include "precompiled.hpp" 5.14 #include "code/compiledIC.hpp" 5.15 #include "code/nmethod.hpp" 5.16 @@ -345,98 +339,8 @@ 5.17 } 5.18 } 5.19 5.20 -#ifdef MIPS64 5.21 -bool NonTieredCompPolicy::compare(CompileTask* task_x, CompileTask* task_y) { 5.22 - 5.23 - if (task_x->weight() > task_y->weight()) { 5.24 - return true; 5.25 - } 5.26 - 5.27 - return false; 5.28 -} 5.29 - 5.30 -void NonTieredCompPolicy::update_speed(jlong t, CompileTask* task) { 5.31 - jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint(); 5.32 - jlong delta_t = t - task->prev_time(); 5.33 - Method* m = task->method(); 5.34 - 5.35 - int ic = m->interpreter_invocation_count(); 5.36 - int bc = m->backedge_count() + m->get_decay_counter(); 5.37 - int pre_ic = task->prev_ic_count(); 5.38 - int pre_bc = task->prev_bc_count(); 5.39 - 5.40 - int delta_e = (ic + bc) - (pre_ic + pre_bc); 5.41 - 5.42 - if (delta_s >= MinUpdateTime) { 5.43 - if (delta_t >= MinUpdateTime && delta_e > 0) { 5.44 - task->set_prev_time(t); 5.45 - task->set_prev_ic_count(ic); 5.46 - task->set_prev_bc_count(bc); 5.47 - int delta_n = FactorOfSizeScheduling * (ic - pre_ic) / 100 + 10 * (bc - pre_bc) / 100; 5.48 - task->set_speed(delta_n * 1.0 / delta_t); 5.49 - task->set_weight(); 5.50 - } else 5.51 - if (delta_t > MaxUpdateTime && delta_e == 0) { 5.52 - task->set_speed(0); 5.53 - task->set_weight(); 5.54 - } 5.55 - } 5.56 -} 5.57 - 5.58 -bool NonTieredCompPolicy::task_should_be_removed(jlong t, jlong timeout, CompileTask* task) { 5.59 - jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint(); 5.60 - jlong delta_t = t - task->prev_time(); 5.61 - Method* m = task->method(); 5.62 - 5.63 - if (delta_t > timeout && delta_s > timeout) { 5.64 - int ic = m->interpreter_invocation_count(); 5.65 - int bc = m->backedge_count() + m->get_decay_counter(); 5.66 - 5.67 - if(ic > InvocationOldThreshold || bc > LoopOldThreshold) { 5.68 - // This task is old enough, do not remove it. 5.69 - return false; 5.70 - } 5.71 - 5.72 - return task->speed() < 0.001; 5.73 - } 5.74 - return false; 5.75 -} 5.76 - 5.77 -#endif 5.78 - 5.79 CompileTask* NonTieredCompPolicy::select_task(CompileQueue* compile_queue) { 5.80 -#ifndef MIPS64 5.81 return compile_queue->first(); 5.82 -#else 5.83 - CompileTask *max_task = NULL; 5.84 - jlong t = os::javaTimeMillis(); 5.85 - 5.86 - int counter = 1; 5.87 - for (CompileTask* task = compile_queue->first(); task != NULL;) { 5.88 - CompileTask* next_task = task->next(); 5.89 - counter++; 5.90 - if (counter > MaxCompileQueueSize) return max_task; 5.91 - update_speed(t, task); 5.92 - if (max_task == NULL) { 5.93 - max_task = task; 5.94 - } else { 5.95 - if (task_should_be_removed(t, MinWatchTime, task)) { 5.96 - CompileTaskWrapper ctw(task); // Frees the task 5.97 - compile_queue->remove(task); 5.98 - task->method()->clear_queued_for_compilation(); 5.99 - task = next_task; 5.100 - continue; 5.101 - } 5.102 - 5.103 - if (compare(task, max_task)) { 5.104 - max_task = task; 5.105 - } 5.106 - } 5.107 - task = next_task; 5.108 - } 5.109 - 5.110 - return max_task; 5.111 -#endif 5.112 } 5.113 5.114 bool NonTieredCompPolicy::is_mature(Method* method) { 5.115 @@ -458,9 +362,6 @@ 5.116 int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) { 5.117 assert(comp_level == CompLevel_none, "This should be only called from the interpreter"); 5.118 NOT_PRODUCT(trace_frequency_counter_overflow(method, branch_bci, bci)); 5.119 -#ifdef MIPS64 5.120 - method->incr_num_of_requests(1); 5.121 -#endif 5.122 if (JvmtiExport::can_post_interpreter_events() && thread->is_interp_only_mode()) { 5.123 // If certain JVMTI events (e.g. frame pop event) are requested then the 5.124 // thread is forced to remain in interpreted code. This is 5.125 @@ -563,21 +464,9 @@ 5.126 void SimpleCompPolicy::method_invocation_event(methodHandle m, JavaThread* thread) { 5.127 const int comp_level = CompLevel_highest_tier; 5.128 const int hot_count = m->invocation_count(); 5.129 -#ifdef MIPS64 5.130 - const int bc = m->backedge_count(); 5.131 -#endif 5.132 - 5.133 reset_counter_for_invocation_event(m); 5.134 -#ifdef MIPS64 5.135 - const int new_bc = m->backedge_count(); 5.136 - const int delta = bc - new_bc; 5.137 -#endif 5.138 const char* comment = "count"; 5.139 5.140 -#ifdef MIPS64 5.141 - if(delta > 0) m->incr_decay_counter(delta); 5.142 -#endif 5.143 - 5.144 if (is_compilation_enabled() && can_be_compiled(m, comp_level)) { 5.145 nmethod* nm = m->code(); 5.146 if (nm == NULL ) {
6.1 --- a/src/share/vm/runtime/compilationPolicy.hpp Fri Jun 24 17:12:13 2016 +0800 6.2 +++ b/src/share/vm/runtime/compilationPolicy.hpp Mon Jun 27 16:08:34 2016 +0800 6.3 @@ -22,12 +22,6 @@ 6.4 * 6.5 */ 6.6 6.7 -/* 6.8 - * This file has been modified by Loongson Technology in 2015. These 6.9 - * modifications are Copyright (c) 2015 Loongson Technology, and are made 6.10 - * available on the same license terms set forth above. 6.11 - */ 6.12 - 6.13 #ifndef SHARE_VM_RUNTIME_COMPILATIONPOLICY_HPP 6.14 #define SHARE_VM_RUNTIME_COMPILATIONPOLICY_HPP 6.15 6.16 @@ -116,11 +110,6 @@ 6.17 virtual nmethod* event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread); 6.18 virtual void method_invocation_event(methodHandle m, JavaThread* thread) = 0; 6.19 virtual void method_back_branch_event(methodHandle m, int bci, JavaThread* thread) = 0; 6.20 -#ifdef MIPS64 6.21 - inline bool compare(CompileTask* task_x, CompileTask* task_y); 6.22 - inline void update_speed(jlong t, CompileTask* task); 6.23 - inline bool task_should_be_removed(jlong t, jlong timeout, CompileTask* task); 6.24 -#endif 6.25 }; 6.26 6.27 class SimpleCompPolicy : public NonTieredCompPolicy {