From 5471bf0e8ae420b2199e22ed8d472453b710c871 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Tue, 3 Mar 2015 19:47:49 -0500 Subject: [PATCH 001/101] 8073994: STATIC_ASSERT use of __LINE__ is wrong Reviewed-by: dholmes, ehelin --- hotspot/src/share/vm/utilities/debug.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/utilities/debug.hpp b/hotspot/src/share/vm/utilities/debug.hpp index 381cfd63bae..414316990a0 100644 --- a/hotspot/src/share/vm/utilities/debug.hpp +++ b/hotspot/src/share/vm/utilities/debug.hpp @@ -222,9 +222,8 @@ void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2); template struct STATIC_ASSERT_FAILURE; template<> struct STATIC_ASSERT_FAILURE { enum { value = 1 }; }; -#define STATIC_ASSERT(Cond) \ - typedef char STATIC_ASSERT_FAILURE_ ## __LINE__ [ \ - STATIC_ASSERT_FAILURE< (Cond) >::value ] +#define STATIC_ASSERT(Cond) \ + typedef char STATIC_ASSERT_DUMMY_TYPE[ STATIC_ASSERT_FAILURE< (Cond) >::value ] // out of shared space reporting enum SharedSpaceType { From 395543dadca0a4a8552f5d66967602f12d66f46f Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Thu, 12 Mar 2015 10:11:20 +0100 Subject: [PATCH 002/101] 8074037: Refactor the G1GCPhaseTime logging to make it easier to add new phases Reviewed-by: tschatzl, mgerdin, ecaspole --- .../gc_implementation/g1/g1CollectedHeap.cpp | 63 ++- .../g1/g1CollectorPolicy.cpp | 38 +- .../gc_implementation/g1/g1GCPhaseTimes.cpp | 507 ++++++++++++------ .../gc_implementation/g1/g1GCPhaseTimes.hpp | 247 +++------ .../share/vm/gc_implementation/g1/g1Log.hpp | 6 + .../vm/gc_implementation/g1/g1RemSet.cpp | 9 +- .../vm/gc_implementation/g1/g1StringDedup.cpp | 42 +- .../vm/gc_implementation/g1/g1StringDedup.hpp | 3 +- 8 files changed, 496 insertions(+), 419 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 18deaa19b1b..0179bb4aa1a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2206,11 +2206,11 @@ void G1CollectedHeap::iterate_dirty_card_closure(CardTableEntryClosure* cl, hot_card_cache->drain(worker_i, g1_rem_set(), into_cset_dcq); DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); - int n_completed_buffers = 0; + size_t n_completed_buffers = 0; while (dcqs.apply_closure_to_completed_buffer(cl, worker_i, 0, true)) { n_completed_buffers++; } - g1_policy()->phase_times()->record_update_rs_processed_buffers(worker_i, n_completed_buffers); + g1_policy()->phase_times()->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, n_completed_buffers); dcqs.clear_n_completed_buffers(); assert(!dcqs.completed_buffers_exist_dirty(), "Completed buffers exist!"); } @@ -3751,9 +3751,9 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); - int active_workers = workers()->active_workers(); + uint active_workers = workers()->active_workers(); double pause_start_sec = os::elapsedTime(); - g1_policy()->phase_times()->note_gc_start(active_workers); + g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress()); log_gc_header(); TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); @@ -4486,8 +4486,7 @@ public: void work(uint worker_id) { if (worker_id >= _n_workers) return; // no work needed this round - double start_time_ms = os::elapsedTime() * 1000.0; - _g1h->g1_policy()->phase_times()->record_gc_worker_start_time(worker_id, start_time_ms); + _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::GCWorkerStart, worker_id, os::elapsedTime()); { ResourceMark rm; @@ -4567,10 +4566,11 @@ public: double start = os::elapsedTime(); G1ParEvacuateFollowersClosure evac(_g1h, &pss, _queues, &_terminator); evac.do_void(); - double elapsed_ms = (os::elapsedTime()-start)*1000.0; - double term_ms = pss.term_time()*1000.0; - _g1h->g1_policy()->phase_times()->add_obj_copy_time(worker_id, elapsed_ms-term_ms); - _g1h->g1_policy()->phase_times()->record_termination(worker_id, term_ms, pss.term_attempts()); + double elapsed_sec = os::elapsedTime() - start; + double term_sec = pss.term_time(); + _g1h->g1_policy()->phase_times()->add_time_secs(G1GCPhaseTimes::ObjCopy, worker_id, elapsed_sec - term_sec); + _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::Termination, worker_id, term_sec); + _g1h->g1_policy()->phase_times()->record_thread_work_item(G1GCPhaseTimes::Termination, worker_id, pss.term_attempts()); } _g1h->g1_policy()->record_thread_age_table(pss.age_table()); _g1h->update_surviving_young_words(pss.surviving_young_words()+1); @@ -4586,9 +4586,7 @@ public: // destructors are executed here and are included as part of the // "GC Worker Time". } - - double end_time_ms = os::elapsedTime() * 1000.0; - _g1h->g1_policy()->phase_times()->record_gc_worker_end_time(worker_id, end_time_ms); + _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::GCWorkerEnd, worker_id, os::elapsedTime()); } }; @@ -4650,27 +4648,20 @@ g1_process_roots(OopClosure* scan_non_heap_roots, double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds() + buf_scan_non_heap_weak_roots.closure_app_seconds(); - g1_policy()->phase_times()->record_obj_copy_time(worker_i, obj_copy_time_sec * 1000.0); + g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec); - double ext_root_time_ms = - ((os::elapsedTime() - ext_roots_start) - obj_copy_time_sec) * 1000.0; - - g1_policy()->phase_times()->record_ext_root_scan_time(worker_i, ext_root_time_ms); + double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec; + g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec); // During conc marking we have to filter the per-thread SATB buffers // to make sure we remove any oops into the CSet (which will show up // as implicitly live). - double satb_filtering_ms = 0.0; - if (!_process_strong_tasks->is_task_claimed(G1H_PS_filter_satb_buffers)) { - if (mark_in_progress()) { - double satb_filter_start = os::elapsedTime(); - + { + G1GCParPhaseTimesTracker x(g1_policy()->phase_times(), G1GCPhaseTimes::SATBFiltering, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1H_PS_filter_satb_buffers) && mark_in_progress()) { JavaThread::satb_mark_queue_set().filter_thread_buffers(); - - satb_filtering_ms = (os::elapsedTime() - satb_filter_start) * 1000.0; } } - g1_policy()->phase_times()->record_satb_filtering_time(worker_i, satb_filtering_ms); // Now scan the complement of the collection set. G1CodeBlobClosure scavenge_cs_nmethods(scan_non_heap_weak_roots); @@ -5073,14 +5064,13 @@ class G1RedirtyLoggedCardsTask : public AbstractGangTask { G1RedirtyLoggedCardsTask(DirtyCardQueueSet* queue) : AbstractGangTask("Redirty Cards"), _queue(queue) { } virtual void work(uint worker_id) { - double start_time = os::elapsedTime(); + G1GCPhaseTimes* phase_times = G1CollectedHeap::heap()->g1_policy()->phase_times(); + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::RedirtyCards, worker_id); RedirtyLoggedCardTableEntryClosure cl; _queue->par_apply_closure_to_all_completed_buffers(&cl); - G1GCPhaseTimes* timer = G1CollectedHeap::heap()->g1_policy()->phase_times(); - timer->record_redirty_logged_cards_time_ms(worker_id, (os::elapsedTime() - start_time) * 1000.0); - timer->record_redirty_logged_cards_processed_cards(worker_id, cl.num_processed()); + phase_times->record_thread_work_item(G1GCPhaseTimes::RedirtyCards, worker_id, cl.num_processed()); } }; @@ -5658,12 +5648,14 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) { // reported parallel time. } + G1GCPhaseTimes* phase_times = g1_policy()->phase_times(); + double par_time_ms = (end_par_time_sec - start_par_time_sec) * 1000.0; - g1_policy()->phase_times()->record_par_time(par_time_ms); + phase_times->record_par_time(par_time_ms); double code_root_fixup_time_ms = (os::elapsedTime() - end_par_time_sec) * 1000.0; - g1_policy()->phase_times()->record_code_root_fixup_time(code_root_fixup_time_ms); + phase_times->record_code_root_fixup_time(code_root_fixup_time_ms); set_par_threads(0); @@ -5675,9 +5667,14 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) { process_discovered_references(n_workers); if (G1StringDedup::is_enabled()) { + double fixup_start = os::elapsedTime(); + G1STWIsAliveClosure is_alive(this); G1KeepAliveClosure keep_alive(this); - G1StringDedup::unlink_or_oops_do(&is_alive, &keep_alive); + G1StringDedup::unlink_or_oops_do(&is_alive, &keep_alive, true, phase_times); + + double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0; + phase_times->record_string_dedup_fixup_time(fixup_time_ms); } _allocator->release_gc_alloc_regions(n_workers, evacuation_info); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index fbb52ad85e4..745ac129ca0 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1073,7 +1073,7 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua if (update_stats) { double cost_per_card_ms = 0.0; if (_pending_cards > 0) { - cost_per_card_ms = phase_times()->average_last_update_rs_time() / (double) _pending_cards; + cost_per_card_ms = phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS) / (double) _pending_cards; _cost_per_card_ms_seq->add(cost_per_card_ms); } @@ -1081,7 +1081,7 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua double cost_per_entry_ms = 0.0; if (cards_scanned > 10) { - cost_per_entry_ms = phase_times()->average_last_scan_rs_time() / (double) cards_scanned; + cost_per_entry_ms = phase_times()->average_time_ms(G1GCPhaseTimes::ScanRS) / (double) cards_scanned; if (_last_gc_was_young) { _cost_per_entry_ms_seq->add(cost_per_entry_ms); } else { @@ -1123,7 +1123,7 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua double cost_per_byte_ms = 0.0; if (copied_bytes > 0) { - cost_per_byte_ms = phase_times()->average_last_obj_copy_time() / (double) copied_bytes; + cost_per_byte_ms = phase_times()->average_time_ms(G1GCPhaseTimes::ObjCopy) / (double) copied_bytes; if (_in_marking_window) { _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms); } else { @@ -1132,8 +1132,8 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua } double all_other_time_ms = pause_time_ms - - (phase_times()->average_last_update_rs_time() + phase_times()->average_last_scan_rs_time() - + phase_times()->average_last_obj_copy_time() + phase_times()->average_last_termination_time()); + (phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS) + phase_times()->average_time_ms(G1GCPhaseTimes::ScanRS) + + phase_times()->average_time_ms(G1GCPhaseTimes::ObjCopy) + phase_times()->average_time_ms(G1GCPhaseTimes::Termination)); double young_other_time_ms = 0.0; if (young_cset_region_length() > 0) { @@ -1174,8 +1174,8 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua // Note that _mmu_tracker->max_gc_time() returns the time in seconds. double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0; - adjust_concurrent_refinement(phase_times()->average_last_update_rs_time(), - phase_times()->sum_last_update_rs_processed_buffers(), update_rs_time_goal_ms); + adjust_concurrent_refinement(phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS), + phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS), update_rs_time_goal_ms); _collectionSetChooser->verify(); } @@ -2114,19 +2114,19 @@ void TraceYoungGenTimeData::record_end_collection(double pause_time_ms, G1GCPhas _other.add(pause_time_ms - phase_times->accounted_time_ms()); _root_region_scan_wait.add(phase_times->root_region_scan_wait_time_ms()); _parallel.add(phase_times->cur_collection_par_time_ms()); - _ext_root_scan.add(phase_times->average_last_ext_root_scan_time()); - _satb_filtering.add(phase_times->average_last_satb_filtering_times_ms()); - _update_rs.add(phase_times->average_last_update_rs_time()); - _scan_rs.add(phase_times->average_last_scan_rs_time()); - _obj_copy.add(phase_times->average_last_obj_copy_time()); - _termination.add(phase_times->average_last_termination_time()); + _ext_root_scan.add(phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan)); + _satb_filtering.add(phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering)); + _update_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS)); + _scan_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::ScanRS)); + _obj_copy.add(phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy)); + _termination.add(phase_times->average_time_ms(G1GCPhaseTimes::Termination)); - double parallel_known_time = phase_times->average_last_ext_root_scan_time() + - phase_times->average_last_satb_filtering_times_ms() + - phase_times->average_last_update_rs_time() + - phase_times->average_last_scan_rs_time() + - phase_times->average_last_obj_copy_time() + - + phase_times->average_last_termination_time(); + double parallel_known_time = phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan) + + phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering) + + phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS) + + phase_times->average_time_ms(G1GCPhaseTimes::ScanRS) + + phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy) + + phase_times->average_time_ms(G1GCPhaseTimes::Termination); double parallel_other_time = phase_times->cur_collection_par_time_ms() - parallel_known_time; _parallel_other.add(parallel_other_time); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp index f9e892b3bb2..07b45338d9b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp @@ -22,13 +22,13 @@ * */ - #include "precompiled.hpp" #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" #include "gc_implementation/g1/g1GCPhaseTimes.hpp" #include "gc_implementation/g1/g1Log.hpp" #include "gc_implementation/g1/g1StringDedup.hpp" -#include "runtime/atomic.inline.hpp" +#include "memory/allocation.hpp" +#include "runtime/os.hpp" // Helper class for avoiding interleaved logging class LineBuffer: public StackObj { @@ -71,184 +71,243 @@ public: va_end(ap); } + void print_cr() { + gclog_or_tty->print_cr("%s", _buffer); + _cur = _indent_level * INDENT_CHARS; + } + void append_and_print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { va_list ap; va_start(ap, format); vappend(format, ap); va_end(ap); - gclog_or_tty->print_cr("%s", _buffer); - _cur = _indent_level * INDENT_CHARS; + print_cr(); } }; -PRAGMA_DIAG_PUSH -PRAGMA_FORMAT_NONLITERAL_IGNORED template -void WorkerDataArray::print(int level, const char* title) { - if (_length == 1) { - // No need for min, max, average and sum for only one worker - LineBuffer buf(level); - buf.append("[%s: ", title); - buf.append(_print_format, _data[0]); - buf.append_and_print_cr("]"); - return; +class WorkerDataArray : public CHeapObj { + friend class G1GCParPhasePrinter; + T* _data; + uint _length; + const char* _title; + bool _print_sum; + int _log_level; + uint _indent_level; + bool _enabled; + + WorkerDataArray* _thread_work_items; + + NOT_PRODUCT(T uninitialized();) + + // We are caching the sum and average to only have to calculate them once. + // This is not done in an MT-safe way. It is intended to allow single + // threaded code to call sum() and average() multiple times in any order + // without having to worry about the cost. + bool _has_new_data; + T _sum; + T _min; + T _max; + double _average; + + public: + WorkerDataArray(uint length, const char* title, bool print_sum, int log_level, uint indent_level) : + _title(title), _length(0), _print_sum(print_sum), _log_level(log_level), _indent_level(indent_level), + _has_new_data(true), _thread_work_items(NULL), _enabled(true) { + assert(length > 0, "Must have some workers to store data for"); + _length = length; + _data = NEW_C_HEAP_ARRAY(T, _length, mtGC); } - T min = _data[0]; - T max = _data[0]; - T sum = 0; + ~WorkerDataArray() { + FREE_C_HEAP_ARRAY(T, _data); + } - LineBuffer buf(level); - buf.append("[%s:", title); - for (uint i = 0; i < _length; ++i) { - T val = _data[i]; - min = MIN2(val, min); - max = MAX2(val, max); - sum += val; - if (G1Log::finest()) { - buf.append(" "); - buf.append(_print_format, val); + void link_thread_work_items(WorkerDataArray* thread_work_items) { + _thread_work_items = thread_work_items; + } + + WorkerDataArray* thread_work_items() { return _thread_work_items; } + + void set(uint worker_i, T value) { + assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); + assert(_data[worker_i] == WorkerDataArray::uninitialized(), err_msg("Overwriting data for worker %d in %s", worker_i, _title)); + _data[worker_i] = value; + _has_new_data = true; + } + + void set_thread_work_item(uint worker_i, size_t value) { + assert(_thread_work_items != NULL, "No sub count"); + _thread_work_items->set(worker_i, value); + } + + T get(uint worker_i) { + assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); + assert(_data[worker_i] != WorkerDataArray::uninitialized(), err_msg("No data added for worker %d", worker_i)); + return _data[worker_i]; + } + + void add(uint worker_i, T value) { + assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); + assert(_data[worker_i] != WorkerDataArray::uninitialized(), err_msg("No data to add to for worker %d", worker_i)); + _data[worker_i] += value; + _has_new_data = true; + } + + double average(){ + calculate_totals(); + return _average; + } + + T sum() { + calculate_totals(); + return _sum; + } + + T minimum() { + calculate_totals(); + return _min; + } + + T maximum() { + calculate_totals(); + return _max; + } + + void reset() PRODUCT_RETURN; + void verify() PRODUCT_RETURN; + + void set_enabled(bool enabled) { _enabled = enabled; } + + int log_level() { return _log_level; } + + private: + + void calculate_totals(){ + if (!_has_new_data) { + return; } - } - if (G1Log::finest()) { - buf.append_and_print_cr("%s", ""); + _sum = (T)0; + _min = _data[0]; + _max = _min; + for (uint i = 0; i < _length; ++i) { + T val = _data[i]; + _sum += val; + _min = MIN2(_min, val); + _max = MAX2(_max, val); + } + _average = (double)_sum / (double)_length; + _has_new_data = false; } +}; - double avg = (double)sum / (double)_length; - buf.append(" Min: "); - buf.append(_print_format, min); - buf.append(", Avg: "); - buf.append("%.1lf", avg); // Always print average as a double - buf.append(", Max: "); - buf.append(_print_format, max); - buf.append(", Diff: "); - buf.append(_print_format, max - min); - if (_print_sum) { - // for things like the start and end times the sum is not - // that relevant - buf.append(", Sum: "); - buf.append(_print_format, sum); - } - buf.append_and_print_cr("]"); -} -PRAGMA_DIAG_POP #ifndef PRODUCT -template <> const int WorkerDataArray::_uninitialized = -1; -template <> const double WorkerDataArray::_uninitialized = -1.0; -template <> const size_t WorkerDataArray::_uninitialized = (size_t)-1; +template <> +size_t WorkerDataArray::uninitialized() { + return (size_t)-1; +} + +template <> +double WorkerDataArray::uninitialized() { + return -1.0; +} template void WorkerDataArray::reset() { for (uint i = 0; i < _length; i++) { - _data[i] = (T)_uninitialized; + _data[i] = WorkerDataArray::uninitialized(); + } + if (_thread_work_items != NULL) { + _thread_work_items->reset(); } } template void WorkerDataArray::verify() { + if (!_enabled) { + return; + } + for (uint i = 0; i < _length; i++) { - assert(_data[i] != _uninitialized, - err_msg("Invalid data for worker %u, data: %lf, uninitialized: %lf", - i, (double)_data[i], (double)_uninitialized)); + assert(_data[i] != WorkerDataArray::uninitialized(), + err_msg("Invalid data for worker %u in '%s'", i, _title)); + } + if (_thread_work_items != NULL) { + _thread_work_items->verify(); } } #endif G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) : - _max_gc_threads(max_gc_threads), - _last_gc_worker_start_times_ms(_max_gc_threads, "%.1lf", false), - _last_ext_root_scan_times_ms(_max_gc_threads, "%.1lf"), - _last_satb_filtering_times_ms(_max_gc_threads, "%.1lf"), - _last_update_rs_times_ms(_max_gc_threads, "%.1lf"), - _last_update_rs_processed_buffers(_max_gc_threads, "%d"), - _last_scan_rs_times_ms(_max_gc_threads, "%.1lf"), - _last_strong_code_root_scan_times_ms(_max_gc_threads, "%.1lf"), - _last_obj_copy_times_ms(_max_gc_threads, "%.1lf"), - _last_termination_times_ms(_max_gc_threads, "%.1lf"), - _last_termination_attempts(_max_gc_threads, SIZE_FORMAT), - _last_gc_worker_end_times_ms(_max_gc_threads, "%.1lf", false), - _last_gc_worker_times_ms(_max_gc_threads, "%.1lf"), - _last_gc_worker_other_times_ms(_max_gc_threads, "%.1lf"), - _last_redirty_logged_cards_time_ms(_max_gc_threads, "%.1lf"), - _last_redirty_logged_cards_processed_cards(_max_gc_threads, SIZE_FORMAT), - _cur_string_dedup_queue_fixup_worker_times_ms(_max_gc_threads, "%.1lf"), - _cur_string_dedup_table_fixup_worker_times_ms(_max_gc_threads, "%.1lf") + _max_gc_threads(max_gc_threads) { assert(max_gc_threads > 0, "Must have some GC threads"); + + _gc_par_phases[GCWorkerStart] = new WorkerDataArray(max_gc_threads, "GC Worker Start (ms)", false, G1Log::LevelFiner, 2); + _gc_par_phases[ExtRootScan] = new WorkerDataArray(max_gc_threads, "Ext Root Scanning (ms)", true, G1Log::LevelFiner, 2); + _gc_par_phases[SATBFiltering] = new WorkerDataArray(max_gc_threads, "SATB Filtering (ms)", true, G1Log::LevelFiner, 2); + _gc_par_phases[UpdateRS] = new WorkerDataArray(max_gc_threads, "Update RS (ms)", true, G1Log::LevelFiner, 2); + _gc_par_phases[ScanRS] = new WorkerDataArray(max_gc_threads, "Scan RS (ms)", true, G1Log::LevelFiner, 2); + _gc_par_phases[CodeRoots] = new WorkerDataArray(max_gc_threads, "Code Root Scanning (ms)", true, G1Log::LevelFiner, 2); + _gc_par_phases[ObjCopy] = new WorkerDataArray(max_gc_threads, "Object Copy (ms)", true, G1Log::LevelFiner, 2); + _gc_par_phases[Termination] = new WorkerDataArray(max_gc_threads, "Termination (ms)", true, G1Log::LevelFiner, 2); + _gc_par_phases[GCWorkerTotal] = new WorkerDataArray(max_gc_threads, "GC Worker Total (ms)", true, G1Log::LevelFiner, 2); + _gc_par_phases[GCWorkerEnd] = new WorkerDataArray(max_gc_threads, "GC Worker End (ms)", false, G1Log::LevelFiner, 2); + _gc_par_phases[Other] = new WorkerDataArray(max_gc_threads, "GC Worker Other (ms)", true, G1Log::LevelFiner, 2); + + _update_rs_processed_buffers = new WorkerDataArray(max_gc_threads, "Processed Buffers", true, G1Log::LevelFiner, 3); + _gc_par_phases[UpdateRS]->link_thread_work_items(_update_rs_processed_buffers); + + _termination_attempts = new WorkerDataArray(max_gc_threads, "Termination Attempts", true, G1Log::LevelFinest, 3); + _gc_par_phases[Termination]->link_thread_work_items(_termination_attempts); + + _gc_par_phases[StringDedupQueueFixup] = new WorkerDataArray(max_gc_threads, "Queue Fixup (ms)", true, G1Log::LevelFiner, 2); + _gc_par_phases[StringDedupTableFixup] = new WorkerDataArray(max_gc_threads, "Table Fixup (ms)", true, G1Log::LevelFiner, 2); + + _gc_par_phases[RedirtyCards] = new WorkerDataArray(max_gc_threads, "Parallel Redirty", true, G1Log::LevelFinest, 3); + _redirtied_cards = new WorkerDataArray(max_gc_threads, "Redirtied Cards", true, G1Log::LevelFinest, 3); + _gc_par_phases[RedirtyCards]->link_thread_work_items(_redirtied_cards); } -void G1GCPhaseTimes::note_gc_start(uint active_gc_threads) { +void G1GCPhaseTimes::note_gc_start(uint active_gc_threads, bool mark_in_progress) { assert(active_gc_threads > 0, "The number of threads must be > 0"); - assert(active_gc_threads <= _max_gc_threads, "The number of active threads must be <= the max nubmer of threads"); + assert(active_gc_threads <= _max_gc_threads, "The number of active threads must be <= the max number of threads"); _active_gc_threads = active_gc_threads; - _last_gc_worker_start_times_ms.reset(); - _last_ext_root_scan_times_ms.reset(); - _last_satb_filtering_times_ms.reset(); - _last_update_rs_times_ms.reset(); - _last_update_rs_processed_buffers.reset(); - _last_scan_rs_times_ms.reset(); - _last_strong_code_root_scan_times_ms.reset(); - _last_obj_copy_times_ms.reset(); - _last_termination_times_ms.reset(); - _last_termination_attempts.reset(); - _last_gc_worker_end_times_ms.reset(); - _last_gc_worker_times_ms.reset(); - _last_gc_worker_other_times_ms.reset(); + for (int i = 0; i < GCParPhasesSentinel; i++) { + _gc_par_phases[i]->reset(); + } - _last_redirty_logged_cards_time_ms.reset(); - _last_redirty_logged_cards_processed_cards.reset(); + _gc_par_phases[SATBFiltering]->set_enabled(mark_in_progress); + _gc_par_phases[StringDedupQueueFixup]->set_enabled(G1StringDedup::is_enabled()); + _gc_par_phases[StringDedupTableFixup]->set_enabled(G1StringDedup::is_enabled()); } void G1GCPhaseTimes::note_gc_end() { - _last_gc_worker_start_times_ms.verify(); - _last_ext_root_scan_times_ms.verify(); - _last_satb_filtering_times_ms.verify(); - _last_update_rs_times_ms.verify(); - _last_update_rs_processed_buffers.verify(); - _last_scan_rs_times_ms.verify(); - _last_strong_code_root_scan_times_ms.verify(); - _last_obj_copy_times_ms.verify(); - _last_termination_times_ms.verify(); - _last_termination_attempts.verify(); - _last_gc_worker_end_times_ms.verify(); - for (uint i = 0; i < _active_gc_threads; i++) { - double worker_time = _last_gc_worker_end_times_ms.get(i) - _last_gc_worker_start_times_ms.get(i); - _last_gc_worker_times_ms.set(i, worker_time); + double worker_time = _gc_par_phases[GCWorkerEnd]->get(i) - _gc_par_phases[GCWorkerStart]->get(i); + record_time_secs(GCWorkerTotal, i , worker_time); - double worker_known_time = _last_ext_root_scan_times_ms.get(i) + - _last_satb_filtering_times_ms.get(i) + - _last_update_rs_times_ms.get(i) + - _last_scan_rs_times_ms.get(i) + - _last_strong_code_root_scan_times_ms.get(i) + - _last_obj_copy_times_ms.get(i) + - _last_termination_times_ms.get(i); + double worker_known_time = + _gc_par_phases[ExtRootScan]->get(i) + + _gc_par_phases[SATBFiltering]->get(i) + + _gc_par_phases[UpdateRS]->get(i) + + _gc_par_phases[ScanRS]->get(i) + + _gc_par_phases[CodeRoots]->get(i) + + _gc_par_phases[ObjCopy]->get(i) + + _gc_par_phases[Termination]->get(i); - double worker_other_time = worker_time - worker_known_time; - _last_gc_worker_other_times_ms.set(i, worker_other_time); + record_time_secs(Other, i, worker_time - worker_known_time); } - _last_gc_worker_times_ms.verify(); - _last_gc_worker_other_times_ms.verify(); - - _last_redirty_logged_cards_time_ms.verify(); - _last_redirty_logged_cards_processed_cards.verify(); -} - -void G1GCPhaseTimes::note_string_dedup_fixup_start() { - _cur_string_dedup_queue_fixup_worker_times_ms.reset(); - _cur_string_dedup_table_fixup_worker_times_ms.reset(); -} - -void G1GCPhaseTimes::note_string_dedup_fixup_end() { - _cur_string_dedup_queue_fixup_worker_times_ms.verify(); - _cur_string_dedup_table_fixup_worker_times_ms.verify(); + for (int i = 0; i < GCParPhasesSentinel; i++) { + _gc_par_phases[i]->verify(); + } } void G1GCPhaseTimes::print_stats(int level, const char* str, double value) { @@ -288,35 +347,172 @@ double G1GCPhaseTimes::accounted_time_ms() { return misc_time_ms; } +// record the time a phase took in seconds +void G1GCPhaseTimes::record_time_secs(GCParPhases phase, uint worker_i, double secs) { + _gc_par_phases[phase]->set(worker_i, secs); +} + +// add a number of seconds to a phase +void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_i, double secs) { + _gc_par_phases[phase]->add(worker_i, secs); +} + +void G1GCPhaseTimes::record_thread_work_item(GCParPhases phase, uint worker_i, size_t count) { + _gc_par_phases[phase]->set_thread_work_item(worker_i, count); +} + +// return the average time for a phase in milliseconds +double G1GCPhaseTimes::average_time_ms(GCParPhases phase) { + return _gc_par_phases[phase]->average() * 1000.0; +} + +double G1GCPhaseTimes::get_time_ms(GCParPhases phase, uint worker_i) { + return _gc_par_phases[phase]->get(worker_i) * 1000.0; +} + +double G1GCPhaseTimes::sum_time_ms(GCParPhases phase) { + return _gc_par_phases[phase]->sum() * 1000.0; +} + +double G1GCPhaseTimes::min_time_ms(GCParPhases phase) { + return _gc_par_phases[phase]->minimum() * 1000.0; +} + +double G1GCPhaseTimes::max_time_ms(GCParPhases phase) { + return _gc_par_phases[phase]->maximum() * 1000.0; +} + +size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_i) { + assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); + return _gc_par_phases[phase]->thread_work_items()->get(worker_i); +} + +size_t G1GCPhaseTimes::sum_thread_work_items(GCParPhases phase) { + assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); + return _gc_par_phases[phase]->thread_work_items()->sum(); +} + +double G1GCPhaseTimes::average_thread_work_items(GCParPhases phase) { + assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); + return _gc_par_phases[phase]->thread_work_items()->average(); +} + +size_t G1GCPhaseTimes::min_thread_work_items(GCParPhases phase) { + assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); + return _gc_par_phases[phase]->thread_work_items()->minimum(); +} + +size_t G1GCPhaseTimes::max_thread_work_items(GCParPhases phase) { + assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); + return _gc_par_phases[phase]->thread_work_items()->maximum(); +} + +class G1GCParPhasePrinter : public StackObj { + G1GCPhaseTimes* _phase_times; + public: + G1GCParPhasePrinter(G1GCPhaseTimes* phase_times) : _phase_times(phase_times) {} + + void print(G1GCPhaseTimes::GCParPhases phase_id) { + WorkerDataArray* phase = _phase_times->_gc_par_phases[phase_id]; + + if (phase->_log_level > G1Log::level() || !phase->_enabled) { + return; + } + + if (phase->_length == 1) { + print_single_length(phase_id, phase); + } else { + print_multi_length(phase_id, phase); + } + } + + private: + + void print_single_length(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray* phase) { + // No need for min, max, average and sum for only one worker + LineBuffer buf(phase->_indent_level); + buf.append_and_print_cr("[%s: %.1lf]", phase->_title, _phase_times->get_time_ms(phase_id, 0)); + + if (phase->_thread_work_items != NULL) { + LineBuffer buf2(phase->_thread_work_items->_indent_level); + buf2.append_and_print_cr("[%s: "SIZE_FORMAT"]", phase->_thread_work_items->_title, _phase_times->sum_thread_work_items(phase_id)); + } + } + + void print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray* phase) { + for (uint i = 0; i < phase->_length; ++i) { + buf.append(" %.1lf", _phase_times->get_time_ms(phase_id, i)); + } + buf.print_cr(); + } + + void print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray* thread_work_items) { + for (uint i = 0; i < thread_work_items->_length; ++i) { + buf.append(" " SIZE_FORMAT, _phase_times->get_thread_work_item(phase_id, i)); + } + buf.print_cr(); + } + + void print_thread_work_items(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray* thread_work_items) { + LineBuffer buf(thread_work_items->_indent_level); + buf.append("[%s:", thread_work_items->_title); + + if (G1Log::finest()) { + print_count_values(buf, phase_id, thread_work_items); + } + + assert(thread_work_items->_print_sum, err_msg("%s does not have print sum true even though it is a count", thread_work_items->_title)); + + buf.append_and_print_cr(" Min: " SIZE_FORMAT ", Avg: %.1lf, Max: " SIZE_FORMAT ", Diff: " SIZE_FORMAT ", Sum: " SIZE_FORMAT "]", + _phase_times->min_thread_work_items(phase_id), _phase_times->average_thread_work_items(phase_id), _phase_times->max_thread_work_items(phase_id), + _phase_times->max_thread_work_items(phase_id) - _phase_times->min_thread_work_items(phase_id), _phase_times->sum_thread_work_items(phase_id)); + } + + void print_multi_length(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray* phase) { + LineBuffer buf(phase->_indent_level); + buf.append("[%s:", phase->_title); + + if (G1Log::finest()) { + print_time_values(buf, phase_id, phase); + } + + buf.append(" Min: %.1lf, Avg: %.1lf, Max: %.1lf, Diff: %.1lf", + _phase_times->min_time_ms(phase_id), _phase_times->average_time_ms(phase_id), _phase_times->max_time_ms(phase_id), + _phase_times->max_time_ms(phase_id) - _phase_times->min_time_ms(phase_id)); + + if (phase->_print_sum) { + // for things like the start and end times the sum is not + // that relevant + buf.append(", Sum: %.1lf", _phase_times->sum_time_ms(phase_id)); + } + + buf.append_and_print_cr("]"); + + if (phase->_thread_work_items != NULL) { + print_thread_work_items(phase_id, phase->_thread_work_items); + } + } +}; + void G1GCPhaseTimes::print(double pause_time_sec) { + G1GCParPhasePrinter par_phase_printer(this); + if (_root_region_scan_wait_time_ms > 0.0) { print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms); } + print_stats(1, "Parallel Time", _cur_collection_par_time_ms, _active_gc_threads); - _last_gc_worker_start_times_ms.print(2, "GC Worker Start (ms)"); - _last_ext_root_scan_times_ms.print(2, "Ext Root Scanning (ms)"); - if (_last_satb_filtering_times_ms.sum() > 0.0) { - _last_satb_filtering_times_ms.print(2, "SATB Filtering (ms)"); + for (int i = 0; i <= GCMainParPhasesLast; i++) { + par_phase_printer.print((GCParPhases) i); } - _last_update_rs_times_ms.print(2, "Update RS (ms)"); - _last_update_rs_processed_buffers.print(3, "Processed Buffers"); - _last_scan_rs_times_ms.print(2, "Scan RS (ms)"); - _last_strong_code_root_scan_times_ms.print(2, "Code Root Scanning (ms)"); - _last_obj_copy_times_ms.print(2, "Object Copy (ms)"); - _last_termination_times_ms.print(2, "Termination (ms)"); - if (G1Log::finest()) { - _last_termination_attempts.print(3, "Termination Attempts"); - } - _last_gc_worker_other_times_ms.print(2, "GC Worker Other (ms)"); - _last_gc_worker_times_ms.print(2, "GC Worker Total (ms)"); - _last_gc_worker_end_times_ms.print(2, "GC Worker End (ms)"); print_stats(1, "Code Root Fixup", _cur_collection_code_root_fixup_time_ms); print_stats(1, "Code Root Purge", _cur_strong_code_root_purge_time_ms); if (G1StringDedup::is_enabled()) { print_stats(1, "String Dedup Fixup", _cur_string_dedup_fixup_time_ms, _active_gc_threads); - _cur_string_dedup_queue_fixup_worker_times_ms.print(2, "Queue Fixup (ms)"); - _cur_string_dedup_table_fixup_worker_times_ms.print(2, "Table Fixup (ms)"); + for (int i = StringDedupPhasesFirst; i <= StringDedupPhasesLast; i++) { + par_phase_printer.print((GCParPhases) i); + } } print_stats(1, "Clear CT", _cur_clear_ct_time_ms); double misc_time_ms = pause_time_sec * MILLIUNITS - accounted_time_ms(); @@ -340,10 +536,7 @@ void G1GCPhaseTimes::print(double pause_time_sec) { print_stats(2, "Ref Proc", _cur_ref_proc_time_ms); print_stats(2, "Ref Enq", _cur_ref_enq_time_ms); print_stats(2, "Redirty Cards", _recorded_redirty_logged_cards_time_ms); - if (G1Log::finest()) { - _last_redirty_logged_cards_time_ms.print(3, "Parallel Redirty"); - _last_redirty_logged_cards_processed_cards.print(3, "Redirtied Cards"); - } + par_phase_printer.print(RedirtyCards); if (G1EagerReclaimHumongousObjects) { print_stats(2, "Humongous Register", _cur_fast_reclaim_humongous_register_time_ms); if (G1Log::finest()) { @@ -366,3 +559,17 @@ void G1GCPhaseTimes::print(double pause_time_sec) { print_stats(2, "Verify After", _cur_verify_after_time_ms); } } + +G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id) : + _phase_times(phase_times), _phase(phase), _worker_id(worker_id) { + if (_phase_times != NULL) { + _start_time = os::elapsedTime(); + } +} + +G1GCParPhaseTimesTracker::~G1GCParPhaseTimesTracker() { + if (_phase_times != NULL) { + _phase_times->record_time_secs(_phase, _worker_id, os::elapsedTime() - _start_time); + } +} + diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp index 0c6c3312aa1..6eeb11c4dca 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp @@ -26,106 +26,46 @@ #define SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP #include "memory/allocation.hpp" -#include "gc_interface/gcCause.hpp" -template -class WorkerDataArray : public CHeapObj { - T* _data; - uint _length; - const char* _print_format; - bool _print_sum; +class LineBuffer; - NOT_PRODUCT(static const T _uninitialized;) - - // We are caching the sum and average to only have to calculate them once. - // This is not done in an MT-safe way. It is intended to allow single - // threaded code to call sum() and average() multiple times in any order - // without having to worry about the cost. - bool _has_new_data; - T _sum; - double _average; - - public: - WorkerDataArray(uint length, const char* print_format, bool print_sum = true) : - _length(length), _print_format(print_format), _print_sum(print_sum), _has_new_data(true) { - assert(length > 0, "Must have some workers to store data for"); - _data = NEW_C_HEAP_ARRAY(T, _length, mtGC); - } - - ~WorkerDataArray() { - FREE_C_HEAP_ARRAY(T, _data); - } - - void set(uint worker_i, T value) { - assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); - assert(_data[worker_i] == (T)-1, err_msg("Overwriting data for worker %d", worker_i)); - _data[worker_i] = value; - _has_new_data = true; - } - - T get(uint worker_i) { - assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); - assert(_data[worker_i] != (T)-1, err_msg("No data to add to for worker %d", worker_i)); - return _data[worker_i]; - } - - void add(uint worker_i, T value) { - assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); - assert(_data[worker_i] != (T)-1, err_msg("No data to add to for worker %d", worker_i)); - _data[worker_i] += value; - _has_new_data = true; - } - - double average(){ - if (_has_new_data) { - calculate_totals(); - } - return _average; - } - - T sum() { - if (_has_new_data) { - calculate_totals(); - } - return _sum; - } - - void print(int level, const char* title); - - void reset() PRODUCT_RETURN; - void verify() PRODUCT_RETURN; - - private: - - void calculate_totals(){ - _sum = (T)0; - for (uint i = 0; i < _length; ++i) { - _sum += _data[i]; - } - _average = (double)_sum / (double)_length; - _has_new_data = false; - } -}; +template class WorkerDataArray; class G1GCPhaseTimes : public CHeapObj { + friend class G1GCParPhasePrinter; - private: uint _active_gc_threads; uint _max_gc_threads; - WorkerDataArray _last_gc_worker_start_times_ms; - WorkerDataArray _last_ext_root_scan_times_ms; - WorkerDataArray _last_satb_filtering_times_ms; - WorkerDataArray _last_update_rs_times_ms; - WorkerDataArray _last_update_rs_processed_buffers; - WorkerDataArray _last_scan_rs_times_ms; - WorkerDataArray _last_strong_code_root_scan_times_ms; - WorkerDataArray _last_obj_copy_times_ms; - WorkerDataArray _last_termination_times_ms; - WorkerDataArray _last_termination_attempts; - WorkerDataArray _last_gc_worker_end_times_ms; - WorkerDataArray _last_gc_worker_times_ms; - WorkerDataArray _last_gc_worker_other_times_ms; + public: + enum GCParPhases { + GCWorkerStart, + ExtRootScan, + SATBFiltering, + UpdateRS, + ScanRS, + CodeRoots, + ObjCopy, + Termination, + Other, + GCWorkerTotal, + GCWorkerEnd, + StringDedupQueueFixup, + StringDedupTableFixup, + RedirtyCards, + GCParPhasesSentinel + }; + + private: + // Markers for grouping the phases in the GCPhases enum above + static const int GCMainParPhasesLast = GCWorkerEnd; + static const int StringDedupPhasesFirst = StringDedupQueueFixup; + static const int StringDedupPhasesLast = StringDedupTableFixup; + + WorkerDataArray* _gc_par_phases[GCParPhasesSentinel]; + WorkerDataArray* _update_rs_processed_buffers; + WorkerDataArray* _termination_attempts; + WorkerDataArray* _redirtied_cards; double _cur_collection_par_time_ms; double _cur_collection_code_root_fixup_time_ms; @@ -135,9 +75,7 @@ class G1GCPhaseTimes : public CHeapObj { double _cur_evac_fail_restore_remsets; double _cur_evac_fail_remove_self_forwards; - double _cur_string_dedup_fixup_time_ms; - WorkerDataArray _cur_string_dedup_queue_fixup_worker_times_ms; - WorkerDataArray _cur_string_dedup_table_fixup_worker_times_ms; + double _cur_string_dedup_fixup_time_ms; double _cur_clear_ct_time_ms; double _cur_ref_proc_time_ms; @@ -149,8 +87,6 @@ class G1GCPhaseTimes : public CHeapObj { double _recorded_young_cset_choice_time_ms; double _recorded_non_young_cset_choice_time_ms; - WorkerDataArray _last_redirty_logged_cards_time_ms; - WorkerDataArray _last_redirty_logged_cards_processed_cards; double _recorded_redirty_logged_cards_time_ms; double _recorded_young_free_cset_time_ms; @@ -172,54 +108,34 @@ class G1GCPhaseTimes : public CHeapObj { public: G1GCPhaseTimes(uint max_gc_threads); - void note_gc_start(uint active_gc_threads); + void note_gc_start(uint active_gc_threads, bool mark_in_progress); void note_gc_end(); void print(double pause_time_sec); - void record_gc_worker_start_time(uint worker_i, double ms) { - _last_gc_worker_start_times_ms.set(worker_i, ms); - } + // record the time a phase took in seconds + void record_time_secs(GCParPhases phase, uint worker_i, double secs); - void record_ext_root_scan_time(uint worker_i, double ms) { - _last_ext_root_scan_times_ms.set(worker_i, ms); - } + // add a number of seconds to a phase + void add_time_secs(GCParPhases phase, uint worker_i, double secs); - void record_satb_filtering_time(uint worker_i, double ms) { - _last_satb_filtering_times_ms.set(worker_i, ms); - } + void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count); - void record_update_rs_time(uint worker_i, double ms) { - _last_update_rs_times_ms.set(worker_i, ms); - } + // return the average time for a phase in milliseconds + double average_time_ms(GCParPhases phase); - void record_update_rs_processed_buffers(uint worker_i, int processed_buffers) { - _last_update_rs_processed_buffers.set(worker_i, processed_buffers); - } + size_t sum_thread_work_items(GCParPhases phase); - void record_scan_rs_time(uint worker_i, double ms) { - _last_scan_rs_times_ms.set(worker_i, ms); - } + private: + double get_time_ms(GCParPhases phase, uint worker_i); + double sum_time_ms(GCParPhases phase); + double min_time_ms(GCParPhases phase); + double max_time_ms(GCParPhases phase); + size_t get_thread_work_item(GCParPhases phase, uint worker_i); + double average_thread_work_items(GCParPhases phase); + size_t min_thread_work_items(GCParPhases phase); + size_t max_thread_work_items(GCParPhases phase); - void record_strong_code_root_scan_time(uint worker_i, double ms) { - _last_strong_code_root_scan_times_ms.set(worker_i, ms); - } - - void record_obj_copy_time(uint worker_i, double ms) { - _last_obj_copy_times_ms.set(worker_i, ms); - } - - void add_obj_copy_time(uint worker_i, double ms) { - _last_obj_copy_times_ms.add(worker_i, ms); - } - - void record_termination(uint worker_i, double ms, size_t attempts) { - _last_termination_times_ms.set(worker_i, ms); - _last_termination_attempts.set(worker_i, attempts); - } - - void record_gc_worker_end_time(uint worker_i, double ms) { - _last_gc_worker_end_times_ms.set(worker_i, ms); - } + public: void record_clear_ct_time(double ms) { _cur_clear_ct_time_ms = ms; @@ -249,21 +165,10 @@ class G1GCPhaseTimes : public CHeapObj { _cur_evac_fail_remove_self_forwards = ms; } - void note_string_dedup_fixup_start(); - void note_string_dedup_fixup_end(); - void record_string_dedup_fixup_time(double ms) { _cur_string_dedup_fixup_time_ms = ms; } - void record_string_dedup_queue_fixup_worker_time(uint worker_id, double ms) { - _cur_string_dedup_queue_fixup_worker_times_ms.set(worker_id, ms); - } - - void record_string_dedup_table_fixup_worker_time(uint worker_id, double ms) { - _cur_string_dedup_table_fixup_worker_times_ms.set(worker_id, ms); - } - void record_ref_proc_time(double ms) { _cur_ref_proc_time_ms = ms; } @@ -303,14 +208,6 @@ class G1GCPhaseTimes : public CHeapObj { _recorded_non_young_cset_choice_time_ms = time_ms; } - void record_redirty_logged_cards_time_ms(uint worker_i, double time_ms) { - _last_redirty_logged_cards_time_ms.set(worker_i, time_ms); - } - - void record_redirty_logged_cards_processed_cards(uint worker_i, size_t processed_buffers) { - _last_redirty_logged_cards_processed_cards.set(worker_i, processed_buffers); - } - void record_redirty_logged_cards_time_ms(double time_ms) { _recorded_redirty_logged_cards_time_ms = time_ms; } @@ -364,38 +261,16 @@ class G1GCPhaseTimes : public CHeapObj { double fast_reclaim_humongous_time_ms() { return _cur_fast_reclaim_humongous_time_ms; } +}; - double average_last_update_rs_time() { - return _last_update_rs_times_ms.average(); - } - - int sum_last_update_rs_processed_buffers() { - return _last_update_rs_processed_buffers.sum(); - } - - double average_last_scan_rs_time(){ - return _last_scan_rs_times_ms.average(); - } - - double average_last_strong_code_root_scan_time(){ - return _last_strong_code_root_scan_times_ms.average(); - } - - double average_last_obj_copy_time() { - return _last_obj_copy_times_ms.average(); - } - - double average_last_termination_time() { - return _last_termination_times_ms.average(); - } - - double average_last_ext_root_scan_time() { - return _last_ext_root_scan_times_ms.average(); - } - - double average_last_satb_filtering_times_ms() { - return _last_satb_filtering_times_ms.average(); - } +class G1GCParPhaseTimesTracker : public StackObj { + double _start_time; + G1GCPhaseTimes::GCParPhases _phase; + G1GCPhaseTimes* _phase_times; + uint _worker_id; +public: + G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id); + ~G1GCParPhaseTimesTracker(); }; #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1Log.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1Log.hpp index b8da001cfd6..6f72c8fbc8e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1Log.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1Log.hpp @@ -28,6 +28,7 @@ #include "memory/allocation.hpp" class G1Log : public AllStatic { + public: typedef enum { LevelNone, LevelFine, @@ -35,6 +36,7 @@ class G1Log : public AllStatic { LevelFinest } LogLevel; + private: static LogLevel _level; public: @@ -50,6 +52,10 @@ class G1Log : public AllStatic { return _level == LevelFinest; } + static LogLevel level() { + return _level; + } + static void init(); }; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp index 010a8dd7b80..e26daa7601d 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp @@ -248,9 +248,8 @@ void G1RemSet::scanRS(G1ParPushHeapRSClosure* oc, assert(_cards_scanned != NULL, "invariant"); _cards_scanned[worker_i] = scanRScl.cards_done(); - _g1p->phase_times()->record_scan_rs_time(worker_i, scan_rs_time_sec * 1000.0); - _g1p->phase_times()->record_strong_code_root_scan_time(worker_i, - scanRScl.strong_code_root_scan_time_sec() * 1000.0); + _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::ScanRS, worker_i, scan_rs_time_sec); + _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, scanRScl.strong_code_root_scan_time_sec()); } // Closure used for updating RSets and recording references that @@ -287,13 +286,11 @@ public: }; void G1RemSet::updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i) { - double start = os::elapsedTime(); + G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i); // Apply the given closure to all remaining log entries. RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq); _g1->iterate_dirty_card_closure(&into_cset_update_rs_cl, into_cset_dcq, false, worker_i); - - _g1p->phase_times()->record_update_rs_time(worker_i, (os::elapsedTime() - start) * 1000.0); } void G1RemSet::cleanupHRRS() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp index a929b0faa42..4b3819800c3 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp @@ -106,7 +106,7 @@ void G1StringDedup::deduplicate(oop java_string) { void G1StringDedup::oops_do(OopClosure* keep_alive) { assert(is_enabled(), "String deduplication not enabled"); - unlink_or_oops_do(NULL, keep_alive); + unlink_or_oops_do(NULL, keep_alive, true /* allow_resize_and_rehash */); } void G1StringDedup::unlink(BoolObjectClosure* is_alive) { @@ -123,45 +123,39 @@ void G1StringDedup::unlink(BoolObjectClosure* is_alive) { class G1StringDedupUnlinkOrOopsDoTask : public AbstractGangTask { private: G1StringDedupUnlinkOrOopsDoClosure _cl; + G1GCPhaseTimes* _phase_times; public: G1StringDedupUnlinkOrOopsDoTask(BoolObjectClosure* is_alive, OopClosure* keep_alive, - bool allow_resize_and_rehash) : + bool allow_resize_and_rehash, + G1GCPhaseTimes* phase_times) : AbstractGangTask("G1StringDedupUnlinkOrOopsDoTask"), - _cl(is_alive, keep_alive, allow_resize_and_rehash) { - } + _cl(is_alive, keep_alive, allow_resize_and_rehash), _phase_times(phase_times) { } virtual void work(uint worker_id) { - double queue_fixup_start = os::elapsedTime(); - G1StringDedupQueue::unlink_or_oops_do(&_cl); - - double table_fixup_start = os::elapsedTime(); - G1StringDedupTable::unlink_or_oops_do(&_cl, worker_id); - - double queue_fixup_time_ms = (table_fixup_start - queue_fixup_start) * 1000.0; - double table_fixup_time_ms = (os::elapsedTime() - table_fixup_start) * 1000.0; - G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); - g1p->phase_times()->record_string_dedup_queue_fixup_worker_time(worker_id, queue_fixup_time_ms); - g1p->phase_times()->record_string_dedup_table_fixup_worker_time(worker_id, table_fixup_time_ms); + { + G1GCParPhaseTimesTracker x(_phase_times, G1GCPhaseTimes::StringDedupQueueFixup, worker_id); + G1StringDedupQueue::unlink_or_oops_do(&_cl); + } + { + G1GCParPhaseTimesTracker x(_phase_times, G1GCPhaseTimes::StringDedupTableFixup, worker_id); + G1StringDedupTable::unlink_or_oops_do(&_cl, worker_id); + } } }; -void G1StringDedup::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, bool allow_resize_and_rehash) { +void G1StringDedup::unlink_or_oops_do(BoolObjectClosure* is_alive, + OopClosure* keep_alive, + bool allow_resize_and_rehash, + G1GCPhaseTimes* phase_times) { assert(is_enabled(), "String deduplication not enabled"); - G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); - g1p->phase_times()->note_string_dedup_fixup_start(); - double fixup_start = os::elapsedTime(); - G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash); + G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash, phase_times); G1CollectedHeap* g1h = G1CollectedHeap::heap(); g1h->set_par_threads(); g1h->workers()->run_task(&task); g1h->set_par_threads(0); - - double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0; - g1p->phase_times()->record_string_dedup_fixup_time(fixup_time_ms); - g1p->phase_times()->note_string_dedup_fixup_end(); } void G1StringDedup::threads_do(ThreadClosure* tc) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp index 80ee1fd02ad..71c75bc2bbf 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp @@ -91,6 +91,7 @@ class BoolObjectClosure; class ThreadClosure; class outputStream; class G1StringDedupTable; +class G1GCPhaseTimes; // // Main interface for interacting with string deduplication. @@ -131,7 +132,7 @@ public: static void oops_do(OopClosure* keep_alive); static void unlink(BoolObjectClosure* is_alive); static void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, - bool allow_resize_and_rehash = true); + bool allow_resize_and_rehash, G1GCPhaseTimes* phase_times = NULL); static void threads_do(ThreadClosure* tc); static void print_worker_threads_on(outputStream* st); From bcf9ea6cbf346719b6aa4eabfc763c952de91f19 Mon Sep 17 00:00:00 2001 From: David Lindholm Date: Thu, 12 Mar 2015 14:09:36 +0100 Subject: [PATCH 003/101] 8073463: G1 does not mangle freed heap regions Reviewed-by: mgerdin, jwilhelm --- .../concurrentMarkSweep/compactibleFreeListSpace.hpp | 4 ++++ .../src/share/vm/gc_implementation/g1/heapRegion.cpp | 10 ++++++++++ .../src/share/vm/gc_implementation/g1/heapRegion.hpp | 3 +++ hotspot/src/share/vm/memory/space.cpp | 9 --------- hotspot/src/share/vm/memory/space.hpp | 11 ++++------- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp index b33bdc71440..72eecc19fbc 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp @@ -396,6 +396,10 @@ class CompactibleFreeListSpace: public CompactibleSpace { // Resizing support void set_end(HeapWord* value); // override + // Never mangle CompactibleFreeListSpace + void mangle_unused_area() {} + void mangle_unused_area_complete() {} + // Mutual exclusion support Mutex* freelistLock() const { return &_freelistLock; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 2eb23388ef5..1ec43eae39c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -934,6 +934,16 @@ void G1OffsetTableContigSpace::set_end(HeapWord* new_end) { _offsets.resize(new_end - bottom()); } +#ifndef PRODUCT +void G1OffsetTableContigSpace::mangle_unused_area() { + mangle_unused_area_complete(); +} + +void G1OffsetTableContigSpace::mangle_unused_area_complete() { + SpaceMangler::mangle_region(MemRegion(top(), end())); +} +#endif + void G1OffsetTableContigSpace::print() const { print_short(); gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index 1d78eae7adf..93a149bdab1 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -155,6 +155,9 @@ class G1OffsetTableContigSpace: public CompactibleSpace { void set_bottom(HeapWord* value); void set_end(HeapWord* value); + void mangle_unused_area() PRODUCT_RETURN; + void mangle_unused_area_complete() PRODUCT_RETURN; + HeapWord* scan_top() const; void record_timestamp(); void reset_gc_time_stamp() { _gc_time_stamp = 0; } diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 288637750be..9211b051e76 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -353,15 +353,6 @@ void ContiguousSpace::mangle_unused_area() { void ContiguousSpace::mangle_unused_area_complete() { mangler()->mangle_unused_area_complete(); } -void ContiguousSpace::mangle_region(MemRegion mr) { - // Although this method uses SpaceMangler::mangle_region() which - // is not specific to a space, the when the ContiguousSpace version - // is called, it is always with regard to a space and this - // bounds checking is appropriate. - MemRegion space_mr(bottom(), end()); - assert(space_mr.contains(mr), "Mangling outside space"); - SpaceMangler::mangle_region(mr); -} #endif // NOT_PRODUCT void CompactibleSpace::initialize(MemRegion mr, diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index 4eb7669ac23..f5649764ffa 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -128,11 +128,10 @@ class Space: public CHeapObj { // For detecting GC bugs. Should only be called at GC boundaries, since // some unused space may be used as scratch space during GC's. - // Default implementation does nothing. We also call this when expanding - // a space to satisfy an allocation request. See bug #4668531 - virtual void mangle_unused_area() {} - virtual void mangle_unused_area_complete() {} - virtual void mangle_region(MemRegion mr) {} + // We also call this when expanding a space to satisfy an allocation + // request. See bug #4668531 + virtual void mangle_unused_area() = 0; + virtual void mangle_unused_area_complete() = 0; // Testers bool is_empty() const { return used() == 0; } @@ -559,8 +558,6 @@ class ContiguousSpace: public CompactibleSpace { void mangle_unused_area() PRODUCT_RETURN; // Mangle [top, end) void mangle_unused_area_complete() PRODUCT_RETURN; - // Mangle the given MemRegion. - void mangle_region(MemRegion mr) PRODUCT_RETURN; // Do some sparse checking on the area that should have been mangled. void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN; From 41455f243710abd2199d1d9e21f41c15dc0c4e00 Mon Sep 17 00:00:00 2001 From: Michail Chernov Date: Fri, 13 Mar 2015 17:47:34 +0400 Subject: [PATCH 004/101] 8026047: [TESTBUG] add regression test for DisableExplicitGC flag Reviewed-by: jwilhelm, brutisso --- hotspot/test/gc/TestDisableExplicitGC.java | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 hotspot/test/gc/TestDisableExplicitGC.java diff --git a/hotspot/test/gc/TestDisableExplicitGC.java b/hotspot/test/gc/TestDisableExplicitGC.java new file mode 100644 index 00000000000..45619568ab5 --- /dev/null +++ b/hotspot/test/gc/TestDisableExplicitGC.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test TestDisableExplicitGC + * @requires vm.opt.DisableExplicitGC == null + * @summary Verify GC behavior with DisableExplicitGC flag. + * @library /testlibrary + * @run main/othervm -XX:+PrintGCDetails TestDisableExplicitGC + * @run main/othervm/fail -XX:+DisableExplicitGC -XX:+PrintGCDetails TestDisableExplicitGC + * @run main/othervm -XX:-DisableExplicitGC -XX:+PrintGCDetails TestDisableExplicitGC + */ +import java.lang.management.GarbageCollectorMXBean; +import java.util.List; +import static com.oracle.java.testlibrary.Asserts.*; + +public class TestDisableExplicitGC { + + public static void main(String[] args) throws InterruptedException { + List list = java.lang.management.ManagementFactory.getGarbageCollectorMXBeans(); + long collectionCountBefore = getCollectionCount(list); + System.gc(); + long collectionCountAfter = getCollectionCount(list); + assertLT(collectionCountBefore, collectionCountAfter); + } + + private static long getCollectionCount(List list) { + int collectionCount = 0; + for (GarbageCollectorMXBean gcMXBean : list) { + collectionCount += gcMXBean.getCollectionCount(); + } + return collectionCount; + } +} From 7e86840f64daaffa6d0988c875deef8b79f08da9 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Thu, 5 Mar 2015 23:47:26 +0100 Subject: [PATCH 005/101] 8057632: Remove auxiliary code used to handle the generations array Removed next_gen(), prev_gen(), and get_gen(). Reviewed-by: kbarrett, tschatzl --- .../compactibleFreeListSpace.cpp | 5 +- .../concurrentMarkSweepGeneration.cpp | 13 ++--- .../parNew/parNewGeneration.cpp | 47 +++++++++---------- .../parNew/parNewGeneration.hpp | 6 +-- .../src/share/vm/memory/collectorPolicy.cpp | 22 +++++---- .../src/share/vm/memory/defNewGeneration.cpp | 29 ++++++------ .../src/share/vm/memory/defNewGeneration.hpp | 4 +- .../src/share/vm/memory/genCollectedHeap.cpp | 17 ++++--- .../src/share/vm/memory/genCollectedHeap.hpp | 23 +-------- hotspot/src/share/vm/memory/genMarkSweep.cpp | 29 +++++------- hotspot/src/share/vm/memory/generation.cpp | 5 +- hotspot/src/share/vm/memory/space.cpp | 2 +- hotspot/src/share/vm/runtime/vmStructs.cpp | 2 +- .../src/share/vm/services/memoryService.cpp | 6 +-- .../src/share/vm/services/memoryService.hpp | 9 +--- 15 files changed, 92 insertions(+), 127 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index 2264559e3b3..51e9a9f549c 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -186,7 +186,7 @@ HeapWord* CompactibleFreeListSpace::forward(oop q, size_t size, cp->space->set_compaction_top(compact_top); cp->space = cp->space->next_compaction_space(); if (cp->space == NULL) { - cp->gen = GenCollectedHeap::heap()->prev_gen(cp->gen); + cp->gen = GenCollectedHeap::heap()->young_gen(); assert(cp->gen != NULL, "compaction must succeed"); cp->space = cp->gen->first_compaction_space(); assert(cp->space != NULL, "generation must have a first compaction space"); @@ -900,7 +900,6 @@ void CompactibleFreeListSpace::object_iterate_mem(MemRegion mr, } } - // Callers of this iterator beware: The closure application should // be robust in the face of uninitialized objects and should (always) // return a correct size so that the next addr + size below gives us a diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index c89cbedda29..219763410d5 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -369,7 +369,7 @@ void CMSStats::adjust_cms_free_adjustment_factor(bool fail, size_t free) { double CMSStats::time_until_cms_gen_full() const { size_t cms_free = _cms_gen->cmsSpace()->free(); GenCollectedHeap* gch = GenCollectedHeap::heap(); - size_t expected_promotion = MIN2(gch->get_gen(0)->capacity(), + size_t expected_promotion = MIN2(gch->young_gen()->capacity(), (size_t) _cms_gen->gc_stats()->avg_promoted()->padded_average()); if (cms_free > expected_promotion) { // Start a cms collection if there isn't enough space to promote @@ -626,8 +626,8 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, // Support for parallelizing young gen rescan GenCollectedHeap* gch = GenCollectedHeap::heap(); - assert(gch->prev_gen(_cmsGen)->kind() == Generation::ParNew, "CMS can only be used with ParNew"); - _young_gen = (ParNewGeneration*)gch->prev_gen(_cmsGen); + assert(gch->young_gen()->kind() == Generation::ParNew, "CMS can only be used with ParNew"); + _young_gen = (ParNewGeneration*)gch->young_gen(); if (gch->supports_inline_contig_alloc()) { _top_addr = gch->top_addr(); _end_addr = gch->end_addr(); @@ -869,7 +869,7 @@ void ConcurrentMarkSweepGeneration::compute_new_size_free_list() { if (prev_level >= 0) { size_t prev_size = 0; GenCollectedHeap* gch = GenCollectedHeap::heap(); - Generation* prev_gen = gch->get_gen(prev_level); + Generation* prev_gen = gch->young_gen(); prev_size = prev_gen->capacity(); gclog_or_tty->print_cr(" Younger gen size "SIZE_FORMAT, prev_size/1000); @@ -1049,11 +1049,8 @@ oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) { // expand and retry size_t s = _cmsSpace->expansionSpaceRequired(obj_size); // HeapWords expand_for_gc_cause(s*HeapWordSize, MinHeapDeltaBytes, CMSExpansionCause::_satisfy_promotion); - // Since there's currently no next generation, we don't try to promote + // Since this is the old generation, we don't try to promote // into a more senior generation. - assert(next_gen() == NULL, "assumption, based upon which no attempt " - "is made to pass on a possibly failing " - "promotion to next generation"); res = _cmsSpace->promote(obj, obj_size); } if (res != NULL) { diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index a54864db074..1b9192962f8 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -325,7 +325,7 @@ public: private: ParallelTaskTerminator& _term; ParNewGeneration& _gen; - Generation& _next_gen; + Generation& _old_gen; public: bool is_valid(int id) const { return id < length(); } ParallelTaskTerminator* terminator() { return &_term; } @@ -338,7 +338,7 @@ ParScanThreadStateSet::ParScanThreadStateSet( Stack* overflow_stacks, size_t desired_plab_sz, ParallelTaskTerminator& term) : ResourceArray(sizeof(ParScanThreadState), num_threads), - _gen(gen), _next_gen(old_gen), _term(term) + _gen(gen), _old_gen(old_gen), _term(term) { assert(num_threads > 0, "sanity check!"); assert(ParGCUseLocalOverflow == (overflow_stacks != NULL), @@ -471,8 +471,8 @@ void ParScanThreadStateSet::flush() _gen.age_table()->merge(local_table); // Inform old gen that we're done. - _next_gen.par_promote_alloc_done(i); - _next_gen.par_oop_since_save_marks_iterate_done(i); + _old_gen.par_promote_alloc_done(i); + _old_gen.par_oop_since_save_marks_iterate_done(i); } if (UseConcMarkSweepGC) { @@ -574,10 +574,10 @@ void ParEvacuateFollowersClosure::do_void() { par_scan_state()->end_term_time(); } -ParNewGenTask::ParNewGenTask(ParNewGeneration* gen, Generation* next_gen, - HeapWord* young_old_boundary, ParScanThreadStateSet* state_set) : +ParNewGenTask::ParNewGenTask(ParNewGeneration* gen, Generation* old_gen, + HeapWord* young_old_boundary, ParScanThreadStateSet* state_set) : AbstractGangTask("ParNewGeneration collection"), - _gen(gen), _next_gen(next_gen), + _gen(gen), _old_gen(old_gen), _young_old_boundary(young_old_boundary), _state_set(state_set) {} @@ -601,8 +601,6 @@ void ParNewGenTask::work(uint worker_id) { // We would need multiple old-gen queues otherwise. assert(gch->n_gens() == 2, "Par young collection currently only works with one older gen."); - Generation* old_gen = gch->next_gen(_gen); - ParScanThreadState& par_scan_state = _state_set->thread_state(worker_id); assert(_state_set->is_valid(worker_id), "Should not have been called"); @@ -763,8 +761,9 @@ void ScanClosureWithParBarrier::do_oop(narrowOop* p) { ScanClosureWithParBarrier class ParNewRefProcTaskProxy: public AbstractGangTask { typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask; public: - ParNewRefProcTaskProxy(ProcessTask& task, ParNewGeneration& gen, - Generation& next_gen, + ParNewRefProcTaskProxy(ProcessTask& task, + ParNewGeneration& gen, + Generation& old_gen, HeapWord* young_old_boundary, ParScanThreadStateSet& state_set); @@ -776,20 +775,20 @@ private: private: ParNewGeneration& _gen; ProcessTask& _task; - Generation& _next_gen; + Generation& _old_gen; HeapWord* _young_old_boundary; ParScanThreadStateSet& _state_set; }; -ParNewRefProcTaskProxy::ParNewRefProcTaskProxy( - ProcessTask& task, ParNewGeneration& gen, - Generation& next_gen, - HeapWord* young_old_boundary, - ParScanThreadStateSet& state_set) +ParNewRefProcTaskProxy::ParNewRefProcTaskProxy(ProcessTask& task, + ParNewGeneration& gen, + Generation& old_gen, + HeapWord* young_old_boundary, + ParScanThreadStateSet& state_set) : AbstractGangTask("ParNewGeneration parallel reference processing"), _gen(gen), _task(task), - _next_gen(next_gen), + _old_gen(old_gen), _young_old_boundary(young_old_boundary), _state_set(state_set) { @@ -893,7 +892,7 @@ void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThr from()->set_next_compaction_space(to()); gch->set_incremental_collection_failed(); // Inform the next generation that a promotion failure occurred. - _next_gen->promotion_failure_occurred(); + _old_gen->promotion_failure_occurred(); // Trace promotion failure in the parallel GC threads thread_state_set.trace_promotion_failed(gc_tracer()); @@ -927,7 +926,7 @@ void ParNewGeneration::collect(bool full, workers->set_active_workers(active_workers); assert(gch->n_gens() == 2, "Par collection currently only works with single older gen."); - _next_gen = gch->next_gen(this); + _old_gen = gch->old_gen(); // If the next generation is too full to accommodate worst-case promotion // from this generation, pass on collection; let the next generation @@ -968,10 +967,10 @@ void ParNewGeneration::collect(bool full, // because only those workers go through the termination protocol. ParallelTaskTerminator _term(n_workers, task_queues()); ParScanThreadStateSet thread_state_set(workers->active_workers(), - *to(), *this, *_next_gen, *task_queues(), + *to(), *this, *_old_gen, *task_queues(), _overflow_stacks, desired_plab_sz(), _term); - ParNewGenTask tsk(this, _next_gen, reserved().end(), &thread_state_set); + ParNewGenTask tsk(this, _old_gen, reserved().end(), &thread_state_set); gch->set_par_threads(n_workers); gch->rem_set()->prepare_for_younger_refs_iterate(true); // It turns out that even when we're using 1 thread, doing the work in a @@ -1191,8 +1190,8 @@ oop ParNewGeneration::copy_to_survivor_space( } if (!_promotion_failed) { - new_obj = _next_gen->par_promote(par_scan_state->thread_num(), - old, m, sz); + new_obj = _old_gen->par_promote(par_scan_state->thread_num(), + old, m, sz); } if (new_obj == NULL) { diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp index ef0b0581765..f14f6a6d354 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -233,13 +233,13 @@ class ParScanThreadState { class ParNewGenTask: public AbstractGangTask { private: ParNewGeneration* _gen; - Generation* _next_gen; + Generation* _old_gen; HeapWord* _young_old_boundary; class ParScanThreadStateSet* _state_set; public: ParNewGenTask(ParNewGeneration* gen, - Generation* next_gen, + Generation* old_gen, HeapWord* young_old_boundary, ParScanThreadStateSet* state_set); diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp index 28ef44f8f42..216e799d9ae 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp @@ -601,7 +601,7 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, HandleMark hm; // Discard any handles allocated in each iteration. // First allocation attempt is lock-free. - Generation *young = gch->get_gen(0); + Generation *young = gch->young_gen(); assert(young->supports_inline_contig_alloc(), "Otherwise, must do alloc within heap lock"); if (young->should_allocate(size, is_tlab)) { @@ -615,8 +615,8 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, { MutexLocker ml(Heap_lock); if (PrintGC && Verbose) { - gclog_or_tty->print_cr("TwoGenerationCollectorPolicy::mem_allocate_work:" - " attempting locked slow path allocation"); + gclog_or_tty->print_cr("GenCollectorPolicy::mem_allocate_work:" + " attempting locked slow path allocation"); } // Note that only large objects get a shot at being // allocated in later generations. @@ -705,7 +705,7 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, // Give a warning if we seem to be looping forever. if ((QueuedAllocationWarningCount > 0) && (try_count % QueuedAllocationWarningCount == 0)) { - warning("TwoGenerationCollectorPolicy::mem_allocate_work retries %d times \n\t" + warning("GenCollectorPolicy::mem_allocate_work retries %d times \n\t" " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : ""); } } @@ -715,10 +715,14 @@ HeapWord* GenCollectorPolicy::expand_heap_and_allocate(size_t size, bool is_tlab) { GenCollectedHeap *gch = GenCollectedHeap::heap(); HeapWord* result = NULL; - for (int i = number_of_generations() - 1; i >= 0 && result == NULL; i--) { - Generation *gen = gch->get_gen(i); - if (gen->should_allocate(size, is_tlab)) { - result = gen->expand_and_allocate(size, is_tlab); + Generation *old = gch->old_gen(); + if (old->should_allocate(size, is_tlab)) { + result = old->expand_and_allocate(size, is_tlab); + } + if (result == NULL) { + Generation *young = gch->young_gen(); + if (young->should_allocate(size, is_tlab)) { + result = young->expand_and_allocate(size, is_tlab); } } assert(result == NULL || gch->is_in_reserved(result), "result not in heap"); @@ -891,7 +895,7 @@ MetaWord* CollectorPolicy::satisfy_failed_metadata_allocation( bool GenCollectorPolicy::should_try_older_generation_allocation( size_t word_size) const { GenCollectedHeap* gch = GenCollectedHeap::heap(); - size_t young_capacity = gch->get_gen(0)->capacity_before_gc(); + size_t young_capacity = gch->young_gen()->capacity_before_gc(); return (word_size > heap_word_size(young_capacity)) || GC_locker::is_active_and_needs_gc() || gch->incremental_collection_failed(); diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 053fe03b15d..43aceeb6942 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -226,7 +226,7 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs, compute_space_boundaries(0, SpaceDecorator::Clear, SpaceDecorator::Mangle); update_counters(); - _next_gen = NULL; + _old_gen = NULL; _tenuring_threshold = MaxTenuringThreshold; _pretenure_size_threshold_words = PretenureSizeThreshold >> LogHeapWordSize; @@ -383,8 +383,8 @@ void DefNewGeneration::compute_new_size() { assert(next_level < gch->_n_gens, "DefNewGeneration cannot be an oldest gen"); - Generation* next_gen = gch->get_gen(next_level); - size_t old_size = next_gen->capacity(); + Generation* old_gen = gch->old_gen(); + size_t old_size = old_gen->capacity(); size_t new_size_before = _virtual_space.committed_size(); size_t min_new_size = spec()->init_size(); size_t max_new_size = reserved().byte_size(); @@ -568,7 +568,7 @@ void DefNewGeneration::collect(bool full, DefNewTracer gc_tracer; gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start()); - _next_gen = gch->next_gen(this); + _old_gen = gch->old_gen(); // If the next generation is too full to accommodate promotion // from this generation, pass on collection; let the next generation @@ -688,7 +688,7 @@ void DefNewGeneration::collect(bool full, gch->set_incremental_collection_failed(); // Inform the next generation that a promotion failure occurred. - _next_gen->promotion_failure_occurred(); + _old_gen->promotion_failure_occurred(); gc_tracer.report_promotion_failed(_promotion_failed_info); // Reset the PromotionFailureALot counters. @@ -793,7 +793,7 @@ oop DefNewGeneration::copy_to_survivor_space(oop old) { // Otherwise try allocating obj tenured if (obj == NULL) { - obj = _next_gen->promote(old, s); + obj = _old_gen->promote(old, s); if (obj == NULL) { handle_promotion_failure(old); return old; @@ -898,11 +898,11 @@ bool DefNewGeneration::collection_attempt_is_safe() { } return false; } - if (_next_gen == NULL) { + if (_old_gen == NULL) { GenCollectedHeap* gch = GenCollectedHeap::heap(); - _next_gen = gch->next_gen(this); + _old_gen = gch->old_gen(); } - return _next_gen->promotion_attempt_is_safe(used()); + return _old_gen->promotion_attempt_is_safe(used()); } void DefNewGeneration::gc_epilogue(bool full) { @@ -1022,8 +1022,7 @@ CompactibleSpace* DefNewGeneration::first_compaction_space() const { return eden(); } -HeapWord* DefNewGeneration::allocate(size_t word_size, - bool is_tlab) { +HeapWord* DefNewGeneration::allocate(size_t word_size, bool is_tlab) { // This is the slow-path allocation for the DefNewGeneration. // Most allocations are fast-path in compiled code. // We try to allocate from the eden. If that works, we are happy. @@ -1031,8 +1030,8 @@ HeapWord* DefNewGeneration::allocate(size_t word_size, // have to use it here, as well. HeapWord* result = eden()->par_allocate(word_size); if (result != NULL) { - if (CMSEdenChunksRecordAlways && _next_gen != NULL) { - _next_gen->sample_eden_chunk(); + if (CMSEdenChunksRecordAlways && _old_gen != NULL) { + _old_gen->sample_eden_chunk(); } } else { // If the eden is full and the last collection bailed out, we are running @@ -1047,8 +1046,8 @@ HeapWord* DefNewGeneration::allocate(size_t word_size, HeapWord* DefNewGeneration::par_allocate(size_t word_size, bool is_tlab) { HeapWord* res = eden()->par_allocate(word_size); - if (CMSEdenChunksRecordAlways && _next_gen != NULL) { - _next_gen->sample_eden_chunk(); + if (CMSEdenChunksRecordAlways && _old_gen != NULL) { + _old_gen->sample_eden_chunk(); } return res; } diff --git a/hotspot/src/share/vm/memory/defNewGeneration.hpp b/hotspot/src/share/vm/memory/defNewGeneration.hpp index 105c029be14..4e7899eb229 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.hpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ class DefNewGeneration: public Generation { friend class VMStructs; protected: - Generation* _next_gen; + Generation* _old_gen; uint _tenuring_threshold; // Tenuring threshold for next collection. ageTable _age_table; // Size of object to pretenure in words; command line provides bytes diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 58a492c752e..20d9afe5036 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -177,18 +177,17 @@ void GenCollectedHeap::post_initialize() { SharedHeap::post_initialize(); GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy(); guarantee(policy->is_generation_policy(), "Illegal policy type"); - assert((get_gen(0)->kind() == Generation::DefNew) || - (get_gen(0)->kind() == Generation::ParNew), + assert((_young_gen->kind() == Generation::DefNew) || + (_young_gen->kind() == Generation::ParNew), "Wrong youngest generation type"); - DefNewGeneration* def_new_gen = (DefNewGeneration*)get_gen(0); + DefNewGeneration* def_new_gen = (DefNewGeneration*)_young_gen; - Generation* old_gen = get_gen(1); - assert(old_gen->kind() == Generation::ConcurrentMarkSweep || - old_gen->kind() == Generation::MarkSweepCompact, + assert(_old_gen->kind() == Generation::ConcurrentMarkSweep || + _old_gen->kind() == Generation::MarkSweepCompact, "Wrong generation kind"); policy->initialize_size_policy(def_new_gen->eden()->capacity(), - old_gen->capacity(), + _old_gen->capacity(), def_new_gen->from()->capacity()); policy->initialize_gc_policy_counters(); } @@ -1113,10 +1112,10 @@ void GenCollectedHeap::print_on_error(outputStream* st) const { void GenCollectedHeap::print_tracing_info() const { if (TraceYoungGenTime) { - get_gen(0)->print_summary_info(); + _young_gen->print_summary_info(); } if (TraceOldGenTime) { - get_gen(1)->print_summary_info(); + _old_gen->print_summary_info(); } } diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index 7de4a46517c..e9b3d744a32 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -373,27 +373,6 @@ public: // collection. virtual bool is_maximal_no_gc() const; - // Return the generation before "gen". - Generation* prev_gen(Generation* gen) const { - guarantee(gen->level() == 1, "Out of bounds"); - return _young_gen; - } - - // Return the generation after "gen". - Generation* next_gen(Generation* gen) const { - guarantee(gen->level() == 0, "Out of bounds"); - return _old_gen; - } - - Generation* get_gen(int i) const { - guarantee(i == 0 || i == 1, "Out of bounds"); - if (i == 0) { - return _young_gen; - } else { - return _old_gen; - } - } - int n_gens() const { assert(_n_gens == gen_policy()->number_of_generations(), "Sanity"); return _n_gens; @@ -486,7 +465,7 @@ public: assert(heap()->collector_policy()->is_generation_policy(), "the following definition may not be suitable for an n(>2)-generation system"); return incremental_collection_failed() || - (consult_young && !get_gen(0)->collection_attempt_is_safe()); + (consult_young && !_young_gen->collection_attempt_is_safe()); } // If a generation bails out of an incremental collection, diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index a85ddf01aae..32a59301f79 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -109,20 +109,16 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool c deallocate_stacks(); - // If compaction completely evacuated all generations younger than this - // one, then we can clear the card table. Otherwise, we must invalidate + // If compaction completely evacuated the young generation then we + // can clear the card table. Otherwise, we must invalidate // it (consider all cards dirty). In the future, we might consider doing // compaction within generations only, and doing card-table sliding. - bool all_empty = true; - for (int i = 0; all_empty && i < level; i++) { - Generation* g = gch->get_gen(i); - all_empty = all_empty && gch->get_gen(i)->used() == 0; - } GenRemSet* rs = gch->rem_set(); - Generation* old_gen = gch->get_gen(level); + Generation* old_gen = gch->old_gen(); + // Clear/invalidate below make use of the "prev_used_regions" saved earlier. - if (all_empty) { - // We've evacuated all generations below us. + if (gch->young_gen()->used() == 0) { + // We've evacuated the young generation. rs->clear_into_younger(old_gen); } else { // Invalidate the cards corresponding to the currently used @@ -157,9 +153,8 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool c void GenMarkSweep::allocate_stacks() { GenCollectedHeap* gch = GenCollectedHeap::heap(); - // Scratch request on behalf of oldest generation; will do no - // allocation. - ScratchBlock* scratch = gch->gather_scratch(gch->get_gen(gch->_n_gens-1), 0); + // Scratch request on behalf of old generation; will do no allocation. + ScratchBlock* scratch = gch->gather_scratch(gch->old_gen(), 0); // $$$ To cut a corner, we'll only use the first scratch block, and then // revert to malloc. @@ -188,7 +183,7 @@ void GenMarkSweep::deallocate_stacks() { } void GenMarkSweep::mark_sweep_phase1(int level, - bool clear_all_softrefs) { + bool clear_all_softrefs) { // Recursively traverse all live objects and mark them GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id()); trace(" 1"); @@ -199,7 +194,8 @@ void GenMarkSweep::mark_sweep_phase1(int level, // use OopsInGenClosure constructor which takes a generation, // as the Universe has not been created when the static constructors // are run. - follow_root_closure.set_orig_generation(gch->get_gen(level)); + assert(level == 1, "We don't use mark-sweep on young generations"); + follow_root_closure.set_orig_generation(gch->old_gen()); // Need new claim bits before marking starts. ClassLoaderDataGraph::clear_claimed_marks(); @@ -287,7 +283,8 @@ void GenMarkSweep::mark_sweep_phase3(int level) { // use OopsInGenClosure constructor which takes a generation, // as the Universe has not been created when the static constructors // are run. - adjust_pointer_closure.set_orig_generation(gch->get_gen(level)); + assert(level == 1, "We don't use mark-sweep on young generations."); + adjust_pointer_closure.set_orig_generation(gch->old_gen()); gch->gen_process_roots(level, false, // Younger gens are not roots. diff --git a/hotspot/src/share/vm/memory/generation.cpp b/hotspot/src/share/vm/memory/generation.cpp index b93d1422353..6bed336c174 100644 --- a/hotspot/src/share/vm/memory/generation.cpp +++ b/hotspot/src/share/vm/memory/generation.cpp @@ -153,9 +153,8 @@ bool Generation::is_in(const void* p) const { Generation* Generation::next_gen() const { GenCollectedHeap* gch = GenCollectedHeap::heap(); - int next = level() + 1; - if (next < gch->_n_gens) { - return gch->get_gen(next); + if (level() == 0) { + return gch->old_gen(); } else { return NULL; } diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 9211b051e76..a7ea1b648f0 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -379,7 +379,7 @@ HeapWord* CompactibleSpace::forward(oop q, size_t size, cp->space->set_compaction_top(compact_top); cp->space = cp->space->next_compaction_space(); if (cp->space == NULL) { - cp->gen = GenCollectedHeap::heap()->prev_gen(cp->gen); + cp->gen = GenCollectedHeap::heap()->young_gen(); assert(cp->gen != NULL, "compaction must succeed"); cp->space = cp->gen->first_compaction_space(); assert(cp->space != NULL, "generation must have a first compaction space"); diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 631e5308a08..7357dc8c516 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -536,7 +536,7 @@ typedef CompactHashtable SymbolCompactHashTable; nonstatic_field(ContiguousSpace, _concurrent_iteration_safe_limit, HeapWord*) \ nonstatic_field(ContiguousSpace, _saved_mark_word, HeapWord*) \ \ - nonstatic_field(DefNewGeneration, _next_gen, Generation*) \ + nonstatic_field(DefNewGeneration, _old_gen, Generation*) \ nonstatic_field(DefNewGeneration, _tenuring_threshold, uint) \ nonstatic_field(DefNewGeneration, _age_table, ageTable) \ nonstatic_field(DefNewGeneration, _eden_space, ContiguousSpace*) \ diff --git a/hotspot/src/share/vm/services/memoryService.cpp b/hotspot/src/share/vm/services/memoryService.cpp index c2ad06e5578..794f4621ca5 100644 --- a/hotspot/src/share/vm/services/memoryService.cpp +++ b/hotspot/src/share/vm/services/memoryService.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -160,8 +160,8 @@ void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) { _managers_list->append(_minor_gc_manager); _managers_list->append(_major_gc_manager); - add_generation_memory_pool(heap->get_gen(minor), _major_gc_manager, _minor_gc_manager); - add_generation_memory_pool(heap->get_gen(major), _major_gc_manager); + add_generation_memory_pool(heap->young_gen(), _major_gc_manager, _minor_gc_manager); + add_generation_memory_pool(heap->old_gen(), _major_gc_manager); } #if INCLUDE_ALL_GCS diff --git a/hotspot/src/share/vm/services/memoryService.hpp b/hotspot/src/share/vm/services/memoryService.hpp index ca2210e7796..e24cce73c57 100644 --- a/hotspot/src/share/vm/services/memoryService.hpp +++ b/hotspot/src/share/vm/services/memoryService.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,13 +57,6 @@ private: init_code_heap_pools_size = 9 }; - // index for minor and major generations - enum { - minor = 0, - major = 1, - n_gens = 2 - }; - static GrowableArray* _pools_list; static GrowableArray* _managers_list; From 9272128a461cb877be76ab5218c00e17e4a70c25 Mon Sep 17 00:00:00 2001 From: Andrey Zakharov Date: Mon, 16 Mar 2015 17:51:28 +0300 Subject: [PATCH 006/101] 8061715: gc/g1/TestShrinkAuxiliaryData15.java fails with java.lang.RuntimeException: heap decommit failed - after > before Added WhiteBox methods to count regions and exact aux data sizes Reviewed-by: tschatzl, jwilhelm, mgerdin --- .../gc_implementation/g1/g1CollectedHeap.hpp | 4 + .../g1/g1RegionToSpaceMapper.hpp | 5 +- .../g1/heapRegionManager.cpp | 20 ++- .../g1/heapRegionManager.hpp | 5 +- hotspot/src/share/vm/prims/whitebox.cpp | 17 ++ .../test/gc/g1/TestShrinkAuxiliaryData.java | 162 ++++++++++++------ .../test/gc/g1/TestShrinkAuxiliaryData00.java | 10 +- .../test/gc/g1/TestShrinkAuxiliaryData05.java | 9 +- .../test/gc/g1/TestShrinkAuxiliaryData10.java | 7 +- .../test/gc/g1/TestShrinkAuxiliaryData15.java | 7 +- .../test/gc/g1/TestShrinkAuxiliaryData20.java | 7 +- .../test/gc/g1/TestShrinkAuxiliaryData25.java | 7 +- .../test/gc/g1/TestShrinkAuxiliaryData30.java | 7 +- 13 files changed, 192 insertions(+), 75 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index edf78a141b7..3d83853698a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -1118,6 +1118,10 @@ public: // The number of regions that are completely free. uint num_free_regions() const { return _hrm.num_free_regions(); } + MemoryUsage get_auxiliary_data_memory_usage() const { + return _hrm.get_auxiliary_data_memory_usage(); + } + // The number of regions that are not completely free. uint num_used_regions() const { return num_regions() - num_free_regions(); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp index 6b34206495e..e46877785d7 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,6 +57,9 @@ class G1RegionToSpaceMapper : public CHeapObj { public: MemRegion reserved() { return _storage.reserved(); } + size_t reserved_size() { return _storage.reserved_size(); } + size_t committed_size() { return _storage.committed_size(); } + void set_mapping_changed_listener(G1MappingChangedListener* listener) { _listener = listener; } virtual ~G1RegionToSpaceMapper() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp index a1156d8913e..419fe25c2ec 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -145,6 +145,24 @@ void HeapRegionManager::make_regions_available(uint start, uint num_regions) { } } +MemoryUsage HeapRegionManager::get_auxiliary_data_memory_usage() const { + size_t used_sz = + _prev_bitmap_mapper->committed_size() + + _next_bitmap_mapper->committed_size() + + _bot_mapper->committed_size() + + _cardtable_mapper->committed_size() + + _card_counts_mapper->committed_size(); + + size_t committed_sz = + _prev_bitmap_mapper->reserved_size() + + _next_bitmap_mapper->reserved_size() + + _bot_mapper->reserved_size() + + _cardtable_mapper->reserved_size() + + _card_counts_mapper->reserved_size(); + + return MemoryUsage(0, used_sz, committed_sz, committed_sz); +} + uint HeapRegionManager::expand_by(uint num_regions) { return expand_at(0, num_regions); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp index 10fc349bb1f..1ac538608d3 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ #include "gc_implementation/g1/g1BiasedArray.hpp" #include "gc_implementation/g1/g1RegionToSpaceMapper.hpp" #include "gc_implementation/g1/heapRegionSet.hpp" +#include "services/memoryUsage.hpp" class HeapRegion; class HeapRegionClosure; @@ -196,6 +197,8 @@ public: // Return the maximum number of regions in the heap. uint max_length() const { return (uint)_regions.length(); } + MemoryUsage get_auxiliary_data_memory_usage() const; + MemRegion reserved() const { return MemRegion(heap_bottom(), heap_end()); } // Expand the sequence to reflect that the heap has grown. Either create new diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index d469831b37e..3b8ad5e03ab 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -295,6 +295,12 @@ WB_ENTRY(jboolean, WB_G1IsHumongous(JNIEnv* env, jobject o, jobject obj)) return hr->is_humongous(); WB_END +WB_ENTRY(jlong, WB_G1NumMaxRegions(JNIEnv* env, jobject o)) + G1CollectedHeap* g1 = G1CollectedHeap::heap(); + size_t nr = g1->max_regions(); + return (jlong)nr; +WB_END + WB_ENTRY(jlong, WB_G1NumFreeRegions(JNIEnv* env, jobject o)) G1CollectedHeap* g1 = G1CollectedHeap::heap(); size_t nr = g1->num_free_regions(); @@ -318,6 +324,14 @@ WB_END WB_ENTRY(jint, WB_G1RegionSize(JNIEnv* env, jobject o)) return (jint)HeapRegion::GrainBytes; WB_END + +WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env)) + ResourceMark rm(THREAD); + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + MemoryUsage usage = g1h->get_auxiliary_data_memory_usage(); + Handle h = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL); + return JNIHandles::make_local(env, h()); +WB_END #endif // INCLUDE_ALL_GCS #if INCLUDE_NMT @@ -1240,9 +1254,12 @@ static JNINativeMethod methods[] = { #if INCLUDE_ALL_GCS {CC"g1InConcurrentMark", CC"()Z", (void*)&WB_G1InConcurrentMark}, {CC"g1IsHumongous", CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous }, + {CC"g1NumMaxRegions", CC"()J", (void*)&WB_G1NumMaxRegions }, {CC"g1NumFreeRegions", CC"()J", (void*)&WB_G1NumFreeRegions }, {CC"g1RegionSize", CC"()I", (void*)&WB_G1RegionSize }, {CC"g1StartConcMarkCycle", CC"()Z", (void*)&WB_G1StartMarkCycle }, + {CC"g1AuxiliaryMemoryUsage", CC"()Ljava/lang/management/MemoryUsage;", + (void*)&WB_G1AuxiliaryMemoryUsage }, #endif // INCLUDE_ALL_GCS #if INCLUDE_NMT {CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc }, diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java index 7ee231674d6..3145eb63854 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -import static com.oracle.java.testlibrary.Asserts.assertLessThanOrEqual; +import com.oracle.java.testlibrary.Asserts; import com.oracle.java.testlibrary.OutputAnalyzer; import com.oracle.java.testlibrary.Platform; import com.oracle.java.testlibrary.ProcessTools; @@ -36,23 +36,29 @@ import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; -import sun.misc.Unsafe; +import sun.misc.Unsafe; // for ADDRESS_SIZE +import sun.hotspot.WhiteBox; public class TestShrinkAuxiliaryData { + private static final int REGION_SIZE = 1024 * 1024; + private final static String[] initialOpts = new String[]{ "-XX:MinHeapFreeRatio=10", "-XX:MaxHeapFreeRatio=11", "-XX:+UseG1GC", - "-XX:G1HeapRegionSize=1m", + "-XX:G1HeapRegionSize=" + REGION_SIZE, "-XX:-ExplicitGCInvokesConcurrent", - "-XX:+PrintGCDetails" + "-XX:+PrintGCDetails", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+WhiteBoxAPI", + "-Xbootclasspath/a:.", }; - private final int RSetCacheSize; + private final int hotCardTableSize; - protected TestShrinkAuxiliaryData(int RSetCacheSize) { - this.RSetCacheSize = RSetCacheSize; + protected TestShrinkAuxiliaryData(int hotCardTableSize) { + this.hotCardTableSize = hotCardTableSize; } protected void test() throws Exception { @@ -60,16 +66,16 @@ public class TestShrinkAuxiliaryData { Collections.addAll(vmOpts, initialOpts); int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize())); - if (maxCacheSize < RSetCacheSize) { + if (maxCacheSize < hotCardTableSize) { System.out.format("Skiping test for %d cache size due max cache size %d", - RSetCacheSize, maxCacheSize + hotCardTableSize, maxCacheSize ); return; } printTestInfo(maxCacheSize); - vmOpts.add("-XX:G1ConcRSLogCacheSize=" + RSetCacheSize); + vmOpts.add("-XX:G1ConcRSLogCacheSize=" + hotCardTableSize); vmOpts.addAll(Arrays.asList(Utils.getTestJavaOpts())); // for 32 bits ObjectAlignmentInBytes is not a option @@ -92,11 +98,13 @@ public class TestShrinkAuxiliaryData { private void performTest(List opts) throws Exception { ProcessBuilder pb - = ProcessTools.createJavaProcessBuilder( - opts.toArray(new String[opts.size()]) - ); + = ProcessTools.createJavaProcessBuilder( + opts.toArray(new String[opts.size()]) + ); OutputAnalyzer output = new OutputAnalyzer(pb.start()); + System.out.println(output.getStdout()); + System.err.println(output.getStderr()); output.shouldHaveExitValue(0); } @@ -107,12 +115,13 @@ public class TestShrinkAuxiliaryData { formatSymbols.setGroupingSeparator(' '); grouped.setDecimalFormatSymbols(formatSymbols); - System.out.format("Test will use %s bytes of memory of %s available%n" + System.out.format( + "Test will use %s bytes of memory of %s available%n" + "Available memory is %s with %d bytes pointer size - can save %s pointers%n" + "Max cache size: 2^%d = %s elements%n", grouped.format(ShrinkAuxiliaryDataTest.getMemoryUsedByTest()), - grouped.format(Runtime.getRuntime().freeMemory()), - grouped.format(Runtime.getRuntime().freeMemory() + grouped.format(Runtime.getRuntime().maxMemory()), + grouped.format(Runtime.getRuntime().maxMemory() - ShrinkAuxiliaryDataTest.getMemoryUsedByTest()), Unsafe.ADDRESS_SIZE, grouped.format((Runtime.getRuntime().freeMemory() @@ -135,6 +144,7 @@ public class TestShrinkAuxiliaryData { if (availableMemory <= 0) { return 0; } + long availablePointersCount = availableMemory / Unsafe.ADDRESS_SIZE; return (63 - (int) Long.numberOfLeadingZeros(availablePointersCount)); } @@ -142,17 +152,48 @@ public class TestShrinkAuxiliaryData { static class ShrinkAuxiliaryDataTest { public static void main(String[] args) throws IOException { - int iterateCount = DEFAULT_ITERATION_COUNT; - if (args.length > 0) { - try { - iterateCount = Integer.parseInt(args[0]); - } catch (NumberFormatException e) { - //num_iterate remains default - } + ShrinkAuxiliaryDataTest testCase = new ShrinkAuxiliaryDataTest(); + + if (!testCase.checkEnvApplicability()) { + return; } - new ShrinkAuxiliaryDataTest().test(iterateCount); + testCase.test(); + } + + /** + * Checks is this environment suitable to run this test + * - memory is enough to decommit (page size is not big) + * - RSet cache size is not too big + * + * @return true if test could run, false if test should be skipped + */ + protected boolean checkEnvApplicability() { + + int pageSize = WhiteBox.getWhiteBox().getVMPageSize(); + System.out.println( "Page size = " + pageSize + + " region size = " + REGION_SIZE + + " aux data ~= " + (REGION_SIZE * 3 / 100)); + // If auxdata size will be less than page size it wouldn't decommit. + // Auxiliary data size is about ~3.6% of heap size. + if (pageSize >= REGION_SIZE * 3 / 100) { + System.out.format("Skipping test for too large page size = %d", + pageSize + ); + return false; + } + + if (REGION_SIZE * REGIONS_TO_ALLOCATE > Runtime.getRuntime().maxMemory()) { + System.out.format("Skipping test for too low available memory. " + + "Need %d, available %d", + REGION_SIZE * REGIONS_TO_ALLOCATE, + Runtime.getRuntime().maxMemory() + ); + return false; + } + + return true; } class GarbageObject { @@ -177,41 +218,54 @@ public class TestShrinkAuxiliaryData { private final List garbage = new ArrayList(); - public void test(int num_iterate) throws IOException { + public void test() throws IOException { + + MemoryUsage muFull, muFree, muAuxDataFull, muAuxDataFree; + float auxFull, auxFree; allocate(); link(); mutate(); + + muFull = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); + long numUsedRegions = WhiteBox.getWhiteBox().g1NumMaxRegions() + - WhiteBox.getWhiteBox().g1NumFreeRegions(); + muAuxDataFull = WhiteBox.getWhiteBox().g1AuxiliaryMemoryUsage(); + auxFull = (float)muAuxDataFull.getUsed() / numUsedRegions; + + System.out.format("Full aux data ratio= %f, regions max= %d, used= %d\n", + auxFull, WhiteBox.getWhiteBox().g1NumMaxRegions(), numUsedRegions + ); + deallocate(); - - MemoryUsage muBeforeHeap - = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); - MemoryUsage muBeforeNonHeap - = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage(); - - for (int i = 0; i < num_iterate; i++) { - allocate(); - link(); - mutate(); - deallocate(); - } - System.gc(); - MemoryUsage muAfterHeap - = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); - MemoryUsage muAfterNonHeap - = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage(); - assertLessThanOrEqual(muAfterHeap.getCommitted(), muBeforeHeap.getCommitted(), - String.format("heap decommit failed - after > before: %d > %d", - muAfterHeap.getCommitted(), muBeforeHeap.getCommitted() + muFree = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); + muAuxDataFree = WhiteBox.getWhiteBox().g1AuxiliaryMemoryUsage(); + + numUsedRegions = WhiteBox.getWhiteBox().g1NumMaxRegions() + - WhiteBox.getWhiteBox().g1NumFreeRegions(); + auxFree = (float)muAuxDataFree.getUsed() / numUsedRegions; + + System.out.format("Free aux data ratio= %f, regions max= %d, used= %d\n", + auxFree, WhiteBox.getWhiteBox().g1NumMaxRegions(), numUsedRegions + ); + + Asserts.assertLessThanOrEqual(muFree.getCommitted(), muFull.getCommitted(), + String.format("heap decommit failed - full > free: %d > %d", + muFree.getCommitted(), muFull.getCommitted() ) ); - if (muAfterHeap.getCommitted() < muBeforeHeap.getCommitted()) { - assertLessThanOrEqual(muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted(), - String.format("non-heap decommit failed - after > before: %d > %d", - muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted() + System.out.format("State used committed\n"); + System.out.format("Full aux data: %10d %10d\n", muAuxDataFull.getUsed(), muAuxDataFull.getCommitted()); + System.out.format("Free aux data: %10d %10d\n", muAuxDataFree.getUsed(), muAuxDataFree.getCommitted()); + + // if decommited check that aux data has same ratio + if (muFree.getCommitted() < muFull.getCommitted()) { + Asserts.assertLessThanOrEqual(auxFree, auxFull, + String.format("auxiliary data decommit failed - full > free: %f > %f", + auxFree, auxFull ) ); } @@ -238,8 +292,7 @@ public class TestShrinkAuxiliaryData { for (int i = 0; i < NUM_LINKS; i++) { int regionToLink; do { - regionToLink = (int) (Math.random() - * REGIONS_TO_ALLOCATE); + regionToLink = (int) (Math.random() * REGIONS_TO_ALLOCATE); } while (regionToLink == regionNumber); // get random garbage object from random region @@ -265,11 +318,8 @@ public class TestShrinkAuxiliaryData { return REGIONS_TO_ALLOCATE * REGION_SIZE; } - private static final int REGION_SIZE = 1024 * 1024; - private static final int DEFAULT_ITERATION_COUNT = 1; // iterate main scenario - private static final int REGIONS_TO_ALLOCATE = 5; + private static final int REGIONS_TO_ALLOCATE = 100; private static final int NUM_OBJECTS_PER_REGION = 10; private static final int NUM_LINKS = 20; // how many links create for each object - } } diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java index 7d36e821048..9fb54377274 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,11 +23,15 @@ /** * @test TestShrinkAuxiliaryData00 - * @bug 8038423 + * @bug 8038423 8061715 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib - * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData00 + * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox + * TestShrinkAuxiliaryData TestShrinkAuxiliaryData00 + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver/timeout=720 TestShrinkAuxiliaryData00 */ public class TestShrinkAuxiliaryData00 { diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java index 403b7bfe5aa..8ffc4fb201a 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,12 +23,15 @@ /** * @test TestShrinkAuxiliaryData05 - * @bug 8038423 + * @bug 8038423 8061715 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib - * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData05 + * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox + * TestShrinkAuxiliaryData TestShrinkAuxiliaryData05 + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver/timeout=720 TestShrinkAuxiliaryData05 */ public class TestShrinkAuxiliaryData05 { diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java index ad2ab4155b8..c66b243d565 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,12 +23,15 @@ /** * @test TestShrinkAuxiliaryData10 - * @bug 8038423 + * @bug 8038423 8061715 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10 + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver/timeout=720 TestShrinkAuxiliaryData10 */ public class TestShrinkAuxiliaryData10 { diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java index 76d54ae67e9..1889636a4f7 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,12 +23,15 @@ /** * @test TestShrinkAuxiliaryData15 - * @bug 8038423 + * @bug 8038423 8061715 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15 + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver/timeout=720 TestShrinkAuxiliaryData15 */ public class TestShrinkAuxiliaryData15 { diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java index 43c349e6c63..de59f1204f8 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,12 +23,15 @@ /** * @test TestShrinkAuxiliaryData20 - * @bug 8038423 + * @bug 8038423 8061715 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20 + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver/timeout=720 TestShrinkAuxiliaryData20 */ public class TestShrinkAuxiliaryData20 { diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java index e86d75a20ee..530fd790f07 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,12 +23,15 @@ /** * @test TestShrinkAuxiliaryData25 - * @bug 8038423 + * @bug 8038423 8061715 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25 + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver/timeout=720 TestShrinkAuxiliaryData25 */ public class TestShrinkAuxiliaryData25 { diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java index 08904841ad9..76bbd795951 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,12 +23,15 @@ /** * @test TestShrinkAuxiliaryData30 - * @bug 8038423 + * @bug 8038423 8061715 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30 + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run driver/timeout=720 TestShrinkAuxiliaryData30 */ public class TestShrinkAuxiliaryData30 { From 426a345fec15d7a44d20020b2391e86c06785073 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 17 Mar 2015 13:23:49 +0100 Subject: [PATCH 007/101] 8075242: Remove SpecializationStats Reviewed-by: brutisso, mgerdin --- .../concurrentMarkSweepGeneration.cpp | 4 - .../gc_implementation/g1/g1CollectedHeap.cpp | 5 - .../parNew/parNewGeneration.cpp | 4 - .../src/share/vm/memory/defNewGeneration.cpp | 3 - .../vm/memory/specialized_oop_closures.cpp | 115 ------------------ .../vm/memory/specialized_oop_closures.hpp | 88 +------------- .../src/share/vm/memory/tenuredGeneration.cpp | 3 - .../vm/oops/instanceClassLoaderKlass.cpp | 4 - hotspot/src/share/vm/oops/instanceKlass.cpp | 7 -- .../src/share/vm/oops/instanceMirrorKlass.cpp | 6 - .../src/share/vm/oops/instanceRefKlass.cpp | 9 -- hotspot/src/share/vm/oops/objArrayKlass.cpp | 3 - hotspot/src/share/vm/oops/objArrayOop.cpp | 1 - hotspot/src/share/vm/oops/oop.inline.hpp | 3 - 14 files changed, 2 insertions(+), 253 deletions(-) delete mode 100644 hotspot/src/share/vm/memory/specialized_oop_closures.cpp diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 219763410d5..f48a34c1748 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -2997,7 +2997,6 @@ void CMSCollector::checkpointRootsInitial() { report_heap_summary(GCWhen::BeforeGC); ReferenceProcessor* rp = ref_processor(); - SpecializationStats::clear(); assert(_restart_addr == NULL, "Control point invariant"); { // acquire locks for subsequent manipulations @@ -3008,7 +3007,6 @@ void CMSCollector::checkpointRootsInitial() { rp->enable_discovery(); _collectorState = Marking; } - SpecializationStats::print(); } void CMSCollector::checkpointRootsInitialWork() { @@ -4326,7 +4324,6 @@ void CMSCollector::checkpointRootsFinal() { verify_work_stacks_empty(); verify_overflow_empty(); - SpecializationStats::clear(); if (PrintGCDetails) { gclog_or_tty->print("[YG occupancy: "SIZE_FORMAT" K ("SIZE_FORMAT" K)]", _young_gen->used() / K, @@ -4357,7 +4354,6 @@ void CMSCollector::checkpointRootsFinal() { } verify_work_stacks_empty(); verify_overflow_empty(); - SpecializationStats::print(); } void CMSCollector::checkpointRootsFinalWork() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 0179bb4aa1a..ed964c52e8c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2026,10 +2026,6 @@ jint G1CollectedHeap::initialize() { Shared_DirtyCardQ_lock, &JavaThread::dirty_card_queue_set()); - // In case we're keeping closure specialization stats, initialize those - // counts and that mechanism. - SpecializationStats::clear(); - // Here we allocate the dummy HeapRegion that is required by the // G1AllocRegion class. HeapRegion* dummy_region = _hrm.get_dummy_region(); @@ -3321,7 +3317,6 @@ void G1CollectedHeap::print_tracing_info() const { concurrent_mark()->print_summary_info(); } g1_policy()->print_yg_surv_rate_info(); - SpecializationStats::print(); } #ifndef PRODUCT diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 1b9192962f8..9ffe68a1b58 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -951,8 +951,6 @@ void ParNewGeneration::collect(bool full, // Capture heap used before collection (for printing). size_t gch_prev_used = gch->used(); - SpecializationStats::clear(); - age_table()->clear(); to()->clear(SpaceDecorator::Mangle); @@ -1072,8 +1070,6 @@ void ParNewGeneration::collect(bool full, jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC; update_time_of_last_gc(now); - SpecializationStats::print(); - rp->set_enqueuing_is_done(true); if (rp->processing_is_mt()) { ParNewRefProcTaskExecutor task_executor(*this, thread_state_set); diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 43aceeb6942..1f3fbe687e8 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -590,8 +590,6 @@ void DefNewGeneration::collect(bool full, gch->trace_heap_before_gc(&gc_tracer); - SpecializationStats::clear(); - // These can be shared for all code paths IsAliveClosure is_alive(this); ScanWeakRefClosure scan_weak_ref(this); @@ -700,7 +698,6 @@ void DefNewGeneration::collect(bool full, // set new iteration safe limit for the survivor spaces from()->set_concurrent_iteration_safe_limit(from()->top()); to()->set_concurrent_iteration_safe_limit(to()->top()); - SpecializationStats::print(); // We need to use a monotonically non-decreasing time in ms // or we will see time-warp warnings and os::javaTimeMillis() diff --git a/hotspot/src/share/vm/memory/specialized_oop_closures.cpp b/hotspot/src/share/vm/memory/specialized_oop_closures.cpp deleted file mode 100644 index 467eba1ef6a..00000000000 --- a/hotspot/src/share/vm/memory/specialized_oop_closures.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "memory/specialized_oop_closures.hpp" -#include "utilities/ostream.hpp" - -// For keeping stats on effectiveness. -#ifndef PRODUCT -#if ENABLE_SPECIALIZATION_STATS - -int SpecializationStats::_numCallsAll; - -int SpecializationStats::_numCallsTotal[NUM_Kinds]; -int SpecializationStats::_numCalls_nv[NUM_Kinds]; - -int SpecializationStats::_numDoOopCallsTotal[NUM_Kinds]; -int SpecializationStats::_numDoOopCalls_nv[NUM_Kinds]; - -void SpecializationStats::clear() { - _numCallsAll = 0; - for (int k = ik; k < NUM_Kinds; k++) { - _numCallsTotal[k] = 0; - _numCalls_nv[k] = 0; - - _numDoOopCallsTotal[k] = 0; - _numDoOopCalls_nv[k] = 0; - } -} - -void SpecializationStats::print() { - const char* header_format = " %20s %10s %11s %10s"; - const char* line_format = " %20s %10d %11d %9.2f%%"; - int all_numCallsTotal = - _numCallsTotal[ik] + _numCallsTotal[irk] + _numCallsTotal[oa]; - int all_numCalls_nv = - _numCalls_nv[ik] + _numCalls_nv[irk] + _numCalls_nv[oa]; - gclog_or_tty->print_cr("\nOf %d oop_oop_iterate calls %d (%6.3f%%) are in (ik, irk, oa).", - _numCallsAll, all_numCallsTotal, - 100.0 * (float)all_numCallsTotal / (float)_numCallsAll); - // irk calls are double-counted. - int real_ik_numCallsTotal = _numCallsTotal[ik] - _numCallsTotal[irk]; - int real_ik_numCalls_nv = _numCalls_nv[ik] - _numCalls_nv[irk]; - gclog_or_tty->print_cr(""); - gclog_or_tty->print_cr(header_format, "oop_oop_iterate:", "calls", "non-virtual", "pct"); - gclog_or_tty->print_cr(header_format, - "----------", - "----------", - "-----------", - "----------"); - gclog_or_tty->print_cr(line_format, "all", - all_numCallsTotal, - all_numCalls_nv, - 100.0 * (float)all_numCalls_nv / (float)all_numCallsTotal); - gclog_or_tty->print_cr(line_format, "ik", - real_ik_numCallsTotal, real_ik_numCalls_nv, - 100.0 * (float)real_ik_numCalls_nv / - (float)real_ik_numCallsTotal); - gclog_or_tty->print_cr(line_format, "irk", - _numCallsTotal[irk], _numCalls_nv[irk], - 100.0 * (float)_numCalls_nv[irk] / (float)_numCallsTotal[irk]); - gclog_or_tty->print_cr(line_format, "oa", - _numCallsTotal[oa], _numCalls_nv[oa], - 100.0 * (float)_numCalls_nv[oa] / (float)_numCallsTotal[oa]); - - - gclog_or_tty->print_cr(""); - gclog_or_tty->print_cr(header_format, "do_oop:", "calls", "non-virtual", "pct"); - gclog_or_tty->print_cr(header_format, - "----------", - "----------", - "-----------", - "----------"); - int all_numDoOopCallsTotal = - _numDoOopCallsTotal[ik] + _numDoOopCallsTotal[irk] + _numDoOopCallsTotal[oa]; - int all_numDoOopCalls_nv = - _numDoOopCalls_nv[ik] + _numDoOopCalls_nv[irk] + _numDoOopCalls_nv[oa]; - gclog_or_tty->print_cr(line_format, "all", - all_numDoOopCallsTotal, all_numDoOopCalls_nv, - 100.0 * (float)all_numDoOopCalls_nv / - (float)all_numDoOopCallsTotal); - const char* kind_names[] = { "ik", "irk", "oa" }; - for (int k = ik; k < NUM_Kinds; k++) { - gclog_or_tty->print_cr(line_format, kind_names[k], - _numDoOopCallsTotal[k], _numDoOopCalls_nv[k], - (_numDoOopCallsTotal[k] > 0 ? - 100.0 * (float)_numDoOopCalls_nv[k] / - (float)_numDoOopCallsTotal[k] - : 0.0)); - } -} - -#endif // ENABLE_SPECIALIZATION_STATS -#endif // !PRODUCT diff --git a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp index b4e2fa33a22..4fbd0b11935 100644 --- a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp +++ b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp @@ -60,10 +60,10 @@ class NoHeaderExtendedOopClosure; // This macro applies an argument macro to all OopClosures for which we // want specialized bodies of "oop_oop_iterate". The arguments to "f" are: // "f(closureType, non_virtual)" -// where "closureType" is the name of the particular subclass of OopClosure, +// where "closureType" is the name of the particular subclass of ExtendedOopClosure, // and "non_virtual" will be the string "_nv" if the closure type should // have its "do_oop" method invoked non-virtually, or else the -// string "_v". ("OopClosure" itself will be the only class in the latter +// string "_v". ("ExtendedOopClosure" itself will be the only class in the latter // category.) // This is split into several because of a Visual C++ 6.0 compiler bug @@ -174,93 +174,9 @@ class NoHeaderExtendedOopClosure; // We separate these out, because sometime the general one has // a different definition from the specialized ones, and sometimes it // doesn't. -// NOTE: One of the valid criticisms of this -// specialize-oop_oop_iterate-for-specific-closures idiom is that it is -// easy to have a silent performance bug: if you fail to de-virtualize, -// things still work, just slower. The "SpecializationStats" mode is -// intended to at least make such a failure easy to detect. -// *Not* using the ALL_SINCE_SAVE_MARKS_CLOSURES(f) macro defined -// below means that *only* closures for which oop_oop_iterate specializations -// exist above may be applied to "oops_since_save_marks". That is, -// this form of the performance bug is caught statically. When you add -// a definition for the general type, this property goes away. -// Make sure you test with SpecializationStats to find such bugs -// when introducing a new closure where you don't want virtual dispatch. #define ALL_SINCE_SAVE_MARKS_CLOSURES(f) \ f(OopsInGenClosure,_v) \ SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) -// For keeping stats on effectiveness. -#define ENABLE_SPECIALIZATION_STATS 0 - - -class SpecializationStats { -public: - enum Kind { - ik, // InstanceKlass - irk, // InstanceRefKlass - oa, // ObjArrayKlass - NUM_Kinds - }; - -#if ENABLE_SPECIALIZATION_STATS -private: - static bool _init; - static bool _wrapped; - static jint _numCallsAll; - - static jint _numCallsTotal[NUM_Kinds]; - static jint _numCalls_nv[NUM_Kinds]; - - static jint _numDoOopCallsTotal[NUM_Kinds]; - static jint _numDoOopCalls_nv[NUM_Kinds]; -public: -#endif - static void clear() PRODUCT_RETURN; - - static inline void record_call() PRODUCT_RETURN; - static inline void record_iterate_call_v(Kind k) PRODUCT_RETURN; - static inline void record_iterate_call_nv(Kind k) PRODUCT_RETURN; - static inline void record_do_oop_call_v(Kind k) PRODUCT_RETURN; - static inline void record_do_oop_call_nv(Kind k) PRODUCT_RETURN; - - static void print() PRODUCT_RETURN; -}; - -#ifndef PRODUCT -#if ENABLE_SPECIALIZATION_STATS - -inline void SpecializationStats::record_call() { - Atomic::inc(&_numCallsAll); -} -inline void SpecializationStats::record_iterate_call_v(Kind k) { - Atomic::inc(&_numCallsTotal[k]); -} -inline void SpecializationStats::record_iterate_call_nv(Kind k) { - Atomic::inc(&_numCallsTotal[k]); - Atomic::inc(&_numCalls_nv[k]); -} - -inline void SpecializationStats::record_do_oop_call_v(Kind k) { - Atomic::inc(&_numDoOopCallsTotal[k]); -} -inline void SpecializationStats::record_do_oop_call_nv(Kind k) { - Atomic::inc(&_numDoOopCallsTotal[k]); - Atomic::inc(&_numDoOopCalls_nv[k]); -} - -#else // !ENABLE_SPECIALIZATION_STATS - -inline void SpecializationStats::record_call() {} -inline void SpecializationStats::record_iterate_call_v(Kind k) {} -inline void SpecializationStats::record_iterate_call_nv(Kind k) {} -inline void SpecializationStats::record_do_oop_call_v(Kind k) {} -inline void SpecializationStats::record_do_oop_call_nv(Kind k) {} -inline void SpecializationStats::clear() {} -inline void SpecializationStats::print() {} - -#endif // ENABLE_SPECIALIZATION_STATS -#endif // !PRODUCT - #endif // SHARE_VM_MEMORY_SPECIALIZED_OOP_CLOSURES_HPP diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.cpp b/hotspot/src/share/vm/memory/tenuredGeneration.cpp index fff78747791..e300ee43eea 100644 --- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp +++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp @@ -178,7 +178,6 @@ void TenuredGeneration::collect(bool full, bool is_tlab) { GenCollectedHeap* gch = GenCollectedHeap::heap(); - SpecializationStats::clear(); // Temporarily expand the span of our ref processor, so // refs discovery is over the entire heap, not just this generation ReferenceProcessorSpanMutator @@ -195,8 +194,6 @@ void TenuredGeneration::collect(bool full, gc_timer->register_gc_end(); gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions()); - - SpecializationStats::print(); } HeapWord* diff --git a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp index 181db6e675a..209113db164 100644 --- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp @@ -54,7 +54,6 @@ int InstanceClassLoaderKlass:: \ oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ /* Get size before changing pointers */ \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ int size = InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \ \ if_do_metadata_checked(closure, nv_suffix) { \ @@ -74,7 +73,6 @@ oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { int InstanceClassLoaderKlass:: \ oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ /* Get size before changing pointers */ \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ int size = InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \ return size; \ } @@ -87,8 +85,6 @@ int InstanceClassLoaderKlass:: oop_oop_iterate##nv_suffix##_m(oop obj, \ OopClosureType* closure, \ MemRegion mr) { \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ - \ int size = InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \ \ if_do_metadata_checked(closure, nv_suffix) { \ diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 91843cdb2f5..a539bb7e7f1 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -2209,15 +2209,12 @@ void InstanceKlass::oop_follow_contents(ParCompactionManager* cm, #define InstanceKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ \ int InstanceKlass::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik);\ /* header */ \ if_do_metadata_checked(closure, nv_suffix) { \ closure->do_klass##nv_suffix(obj->klass()); \ } \ InstanceKlass_OOP_MAP_ITERATE( \ obj, \ - SpecializationStats:: \ - record_do_oop_call##nv_suffix(SpecializationStats::ik); \ (closure)->do_oop##nv_suffix(p), \ assert_is_in_closed_subset) \ return size_helper(); \ @@ -2228,14 +2225,11 @@ int InstanceKlass::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) \ int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj, \ OopClosureType* closure) { \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik); \ - \ assert_should_ignore_metadata(closure, nv_suffix); \ \ /* instance variables */ \ InstanceKlass_OOP_MAP_REVERSE_ITERATE( \ obj, \ - SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::ik);\ (closure)->do_oop##nv_suffix(p), \ assert_is_in_closed_subset) \ return size_helper(); \ @@ -2247,7 +2241,6 @@ int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj, int InstanceKlass::oop_oop_iterate##nv_suffix##_m(oop obj, \ OopClosureType* closure, \ MemRegion mr) { \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik);\ if_do_metadata_checked(closure, nv_suffix) { \ if (mr.contains(obj)) { \ closure->do_klass##nv_suffix(obj->klass()); \ diff --git a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp index 09a73f79de5..694b0f4ccad 100644 --- a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp @@ -250,8 +250,6 @@ int InstanceMirrorKlass::oop_adjust_pointers(oop obj) { int InstanceMirrorKlass:: \ oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ /* Get size before changing pointers */ \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk); \ - \ InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \ \ if_do_metadata_checked(closure, nv_suffix) { \ @@ -275,8 +273,6 @@ oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { int InstanceMirrorKlass:: \ oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ /* Get size before changing pointers */ \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk); \ - \ InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \ \ if (UseCompressedOops) { \ @@ -294,8 +290,6 @@ int InstanceMirrorKlass:: oop_oop_iterate##nv_suffix##_m(oop obj, \ OopClosureType* closure, \ MemRegion mr) { \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk); \ - \ InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \ \ if_do_metadata_checked(closure, nv_suffix) { \ diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.cpp b/hotspot/src/share/vm/oops/instanceRefKlass.cpp index a149893148c..af960aab651 100644 --- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp @@ -260,7 +260,6 @@ int InstanceRefKlass::oop_adjust_pointers(oop obj) { return size; \ } else if (contains(referent_addr)) { \ /* treat referent as normal oop */ \ - SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk);\ closure->do_oop##nv_suffix(referent_addr); \ } \ } \ @@ -276,7 +275,6 @@ int InstanceRefKlass::oop_adjust_pointers(oop obj) { INTPTR_FORMAT, disc_addr); \ } \ ) \ - SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk);\ closure->do_oop##nv_suffix(disc_addr); \ } \ } else { \ @@ -293,7 +291,6 @@ int InstanceRefKlass::oop_adjust_pointers(oop obj) { } \ /* treat next as normal oop */ \ if (contains(next_addr)) { \ - SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk); \ closure->do_oop##nv_suffix(next_addr); \ } \ return size; \ @@ -309,8 +306,6 @@ template bool contains(T *t) { return true; } int InstanceRefKlass:: \ oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ /* Get size before changing pointers */ \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ - \ int size = InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure); \ \ if (UseCompressedOops) { \ @@ -326,8 +321,6 @@ oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { int InstanceRefKlass:: \ oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ /* Get size before changing pointers */ \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ - \ int size = InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \ \ if (UseCompressedOops) { \ @@ -345,8 +338,6 @@ int InstanceRefKlass:: oop_oop_iterate##nv_suffix##_m(oop obj, \ OopClosureType* closure, \ MemRegion mr) { \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ - \ int size = InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr); \ if (UseCompressedOops) { \ InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr.contains); \ diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp index 002196fe0b1..84990ebe967 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp @@ -479,7 +479,6 @@ void ObjArrayKlass::oop_follow_contents(ParCompactionManager* cm, \ int ObjArrayKlass::oop_oop_iterate##nv_suffix(oop obj, \ OopClosureType* closure) { \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \ assert (obj->is_array(), "obj must be array"); \ objArrayOop a = objArrayOop(obj); \ /* Get size before changing pointers. */ \ @@ -497,7 +496,6 @@ int ObjArrayKlass::oop_oop_iterate##nv_suffix(oop obj, int ObjArrayKlass::oop_oop_iterate##nv_suffix##_m(oop obj, \ OopClosureType* closure, \ MemRegion mr) { \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \ assert(obj->is_array(), "obj must be array"); \ objArrayOop a = objArrayOop(obj); \ /* Get size before changing pointers. */ \ @@ -519,7 +517,6 @@ int ObjArrayKlass::oop_oop_iterate##nv_suffix##_m(oop obj, int ObjArrayKlass::oop_oop_iterate_range##nv_suffix(oop obj, \ OopClosureType* closure, \ int start, int end) { \ - SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \ assert(obj->is_array(), "obj must be array"); \ objArrayOop a = objArrayOop(obj); \ /* Get size before changing pointers. */ \ diff --git a/hotspot/src/share/vm/oops/objArrayOop.cpp b/hotspot/src/share/vm/oops/objArrayOop.cpp index 2d91b46a680..90dcce5cb7a 100644 --- a/hotspot/src/share/vm/oops/objArrayOop.cpp +++ b/hotspot/src/share/vm/oops/objArrayOop.cpp @@ -46,7 +46,6 @@ oop objArrayOopDesc::atomic_compare_exchange_oop(int index, oop exchange_value, #define ObjArrayOop_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ \ int objArrayOopDesc::oop_iterate_range(OopClosureType* blk, int start, int end) { \ - SpecializationStats::record_call(); \ return ((ObjArrayKlass*)klass())->oop_oop_iterate_range##nv_suffix(this, blk, start, end); \ } diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp index 8c9949d1bd6..8adee1393e8 100644 --- a/hotspot/src/share/vm/oops/oop.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.inline.hpp @@ -692,12 +692,10 @@ inline int oopDesc::adjust_pointers() { #define OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ \ inline int oopDesc::oop_iterate(OopClosureType* blk) { \ - SpecializationStats::record_call(); \ return klass()->oop_oop_iterate##nv_suffix(this, blk); \ } \ \ inline int oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) { \ - SpecializationStats::record_call(); \ return klass()->oop_oop_iterate##nv_suffix##_m(this, blk, mr); \ } @@ -721,7 +719,6 @@ ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_DEFN) #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ \ inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) { \ - SpecializationStats::record_call(); \ return klass()->oop_oop_iterate_backwards##nv_suffix(this, blk); \ } From 366bf9ff0978f654f3e866e749e3360c187f9b32 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 17 Mar 2015 14:18:52 +0100 Subject: [PATCH 008/101] 8075247: Cleanup specialized_oop_closures.hpp Reviewed-by: mgerdin, brutisso, tschatzl --- .../vm/gc_implementation/g1/g1OopClosures.hpp | 12 +++++ .../g1/g1_specialized_oop_closures.hpp | 47 +++++-------------- .../vm/gc_implementation/g1/heapRegion.hpp | 1 - .../vm/memory/specialized_oop_closures.hpp | 27 ++++------- .../vm/oops/instanceClassLoaderKlass.cpp | 1 + .../vm/oops/instanceClassLoaderKlass.hpp | 1 + hotspot/src/share/vm/oops/instanceKlass.cpp | 1 + hotspot/src/share/vm/oops/instanceKlass.hpp | 1 + .../src/share/vm/oops/instanceMirrorKlass.cpp | 1 + .../src/share/vm/oops/instanceMirrorKlass.hpp | 1 + .../src/share/vm/oops/instanceRefKlass.cpp | 1 + .../src/share/vm/oops/instanceRefKlass.hpp | 1 + hotspot/src/share/vm/oops/objArrayKlass.cpp | 1 + hotspot/src/share/vm/oops/objArrayOop.cpp | 1 + hotspot/src/share/vm/oops/objArrayOop.hpp | 1 + .../src/share/vm/precompiled/precompiled.hpp | 2 - 16 files changed, 43 insertions(+), 57 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp index 4f6e655b511..44a6c1220d2 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp @@ -109,6 +109,18 @@ protected: template void do_klass_barrier(T* p, oop new_obj); }; +enum G1Barrier { + G1BarrierNone, + G1BarrierEvac, + G1BarrierKlass +}; + +enum G1Mark { + G1MarkNone, + G1MarkFromRoot, + G1MarkPromotedFromRoot +}; + template class G1ParCopyClosure : public G1ParCopyHelper { private: diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp index 309392cc0ce..f3c49d7fc15 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,23 +30,8 @@ // non-virtually, using a mechanism defined in this file. Extend these // macros in the obvious way to add specializations for new closures. -enum G1Barrier { - G1BarrierNone, - G1BarrierEvac, - G1BarrierKlass -}; - -enum G1Mark { - G1MarkNone, - G1MarkFromRoot, - G1MarkPromotedFromRoot -}; - // Forward declarations. -template -class G1ParCopyClosure; - class G1ParScanClosure; class G1ParPushHeapRSClosure; @@ -61,26 +46,16 @@ class G1TriggerClosure; class G1InvokeIfNotTriggeredClosure; class G1UpdateRSOrPushRefOopClosure; -#ifdef FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES -#error "FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES already defined." -#endif - -#define FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) \ - f(G1ParScanClosure,_nv) \ - f(G1ParPushHeapRSClosure,_nv) \ - f(FilterIntoCSClosure,_nv) \ - f(FilterOutOfRegionClosure,_nv) \ - f(G1CMOopClosure,_nv) \ - f(G1RootRegionScanClosure,_nv) \ - f(G1Mux2Closure,_nv) \ - f(G1TriggerClosure,_nv) \ - f(G1InvokeIfNotTriggeredClosure,_nv) \ +#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f) \ + f(G1ParScanClosure,_nv) \ + f(G1ParPushHeapRSClosure,_nv) \ + f(FilterIntoCSClosure,_nv) \ + f(FilterOutOfRegionClosure,_nv) \ + f(G1CMOopClosure,_nv) \ + f(G1RootRegionScanClosure,_nv) \ + f(G1Mux2Closure,_nv) \ + f(G1TriggerClosure,_nv) \ + f(G1InvokeIfNotTriggeredClosure,_nv) \ f(G1UpdateRSOrPushRefOopClosure,_nv) -#ifdef FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES -#error "FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES already defined." -#endif - -#define FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) - #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1_SPECIALIZED_OOP_CLOSURES_HPP diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index 93a149bdab1..ec5fb14e116 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -27,7 +27,6 @@ #include "gc_implementation/g1/g1AllocationContext.hpp" #include "gc_implementation/g1/g1BlockOffsetTable.hpp" -#include "gc_implementation/g1/g1_specialized_oop_closures.hpp" #include "gc_implementation/g1/heapRegionType.hpp" #include "gc_implementation/g1/survRateGroup.hpp" #include "gc_implementation/shared/ageTable.hpp" diff --git a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp index 4fbd0b11935..5373ad8dcf3 100644 --- a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp +++ b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp @@ -69,12 +69,6 @@ class NoHeaderExtendedOopClosure; // This is split into several because of a Visual C++ 6.0 compiler bug // where very long macros cause the compiler to crash -// Some other heap might define further specialized closures. -#ifndef FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES -#define FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) \ - /* None */ -#endif - #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_S(f) \ f(ScanClosure,_nv) \ f(FastScanClosure,_nv) \ @@ -94,7 +88,7 @@ class NoHeaderExtendedOopClosure; SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f) #if INCLUDE_ALL_GCS -#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) \ +#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_CMS(f) \ f(MarkRefsIntoAndScanClosure,_nv) \ f(Par_MarkRefsIntoAndScanClosure,_nv) \ f(PushAndMarkClosure,_nv) \ @@ -102,8 +96,13 @@ class NoHeaderExtendedOopClosure; f(PushOrMarkClosure,_nv) \ f(Par_PushOrMarkClosure,_nv) \ f(CMSKeepAliveClosure,_nv) \ - f(CMSInnerParMarkAndPushClosure,_nv) \ - FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) + f(CMSInnerParMarkAndPushClosure,_nv) +#endif + +#if INCLUDE_ALL_GCS +#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) \ + SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_CMS(f) \ + SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f) #else // INCLUDE_ALL_GCS #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) #endif // INCLUDE_ALL_GCS @@ -144,13 +143,6 @@ class NoHeaderExtendedOopClosure; // The "root_class" is the most general class to define; this may be // "OopClosure" in some applications and "OopsInGenClosure" in others. - -// Some other heap might define further specialized closures. -#ifndef FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES -#define FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) \ - /* None */ -#endif - #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_S(f) \ f(ScanClosure,_nv) \ f(FastScanClosure,_nv) @@ -158,8 +150,7 @@ class NoHeaderExtendedOopClosure; #if INCLUDE_ALL_GCS #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f) \ f(ParScanWithBarrierClosure,_nv) \ - f(ParScanWithoutBarrierClosure,_nv) \ - FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) + f(ParScanWithoutBarrierClosure,_nv) #else // INCLUDE_ALL_GCS #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f) #endif // INCLUDE_ALL_GCS diff --git a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp index 209113db164..f49e376cbfc 100644 --- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp @@ -30,6 +30,7 @@ #include "memory/genOopClosures.inline.hpp" #include "memory/iterator.inline.hpp" #include "memory/oopFactory.hpp" +#include "memory/specialized_oop_closures.hpp" #include "oops/instanceKlass.hpp" #include "oops/instanceClassLoaderKlass.hpp" #include "oops/instanceMirrorKlass.hpp" diff --git a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp index 309ebf96c19..2cec4827ddf 100644 --- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_VM_OOPS_INSTANCECLASSLOADERKLASS_HPP #define SHARE_VM_OOPS_INSTANCECLASSLOADERKLASS_HPP +#include "memory/specialized_oop_closures.hpp" #include "oops/instanceKlass.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index a539bb7e7f1..607ae834600 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -38,6 +38,7 @@ #include "memory/iterator.inline.hpp" #include "memory/metadataFactory.hpp" #include "memory/oopFactory.hpp" +#include "memory/specialized_oop_closures.hpp" #include "oops/fieldStreams.hpp" #include "oops/instanceClassLoaderKlass.hpp" #include "oops/instanceKlass.hpp" diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index 507454e18b9..f163ed248dc 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -27,6 +27,7 @@ #include "classfile/classLoaderData.hpp" #include "memory/referenceType.hpp" +#include "memory/specialized_oop_closures.hpp" #include "oops/annotations.hpp" #include "oops/constMethod.hpp" #include "oops/fieldInfo.hpp" diff --git a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp index 694b0f4ccad..73d6e439d6d 100644 --- a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp @@ -30,6 +30,7 @@ #include "memory/genOopClosures.inline.hpp" #include "memory/iterator.inline.hpp" #include "memory/oopFactory.hpp" +#include "memory/specialized_oop_closures.hpp" #include "oops/instanceKlass.hpp" #include "oops/instanceMirrorKlass.hpp" #include "oops/instanceOop.hpp" diff --git a/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp index b861639ee0f..368b41de9b4 100644 --- a/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp @@ -26,6 +26,7 @@ #define SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP #include "classfile/systemDictionary.hpp" +#include "memory/specialized_oop_closures.hpp" #include "oops/instanceKlass.hpp" #include "runtime/handles.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.cpp b/hotspot/src/share/vm/oops/instanceRefKlass.cpp index af960aab651..12804db3508 100644 --- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp @@ -30,6 +30,7 @@ #include "gc_interface/collectedHeap.inline.hpp" #include "memory/genCollectedHeap.hpp" #include "memory/genOopClosures.inline.hpp" +#include "memory/specialized_oop_closures.hpp" #include "oops/instanceRefKlass.hpp" #include "oops/oop.inline.hpp" #include "utilities/preserveException.hpp" diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.hpp b/hotspot/src/share/vm/oops/instanceRefKlass.hpp index 3140977b471..2f5b459d800 100644 --- a/hotspot/src/share/vm/oops/instanceRefKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceRefKlass.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP #define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP +#include "memory/specialized_oop_closures.hpp" #include "oops/instanceKlass.hpp" #include "utilities/macros.hpp" diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp index 84990ebe967..8c2670c5214 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp @@ -32,6 +32,7 @@ #include "memory/iterator.inline.hpp" #include "memory/metadataFactory.hpp" #include "memory/resourceArea.hpp" +#include "memory/specialized_oop_closures.hpp" #include "memory/universe.inline.hpp" #include "oops/instanceKlass.hpp" #include "oops/klass.inline.hpp" diff --git a/hotspot/src/share/vm/oops/objArrayOop.cpp b/hotspot/src/share/vm/oops/objArrayOop.cpp index 90dcce5cb7a..a0265ee5cba 100644 --- a/hotspot/src/share/vm/oops/objArrayOop.cpp +++ b/hotspot/src/share/vm/oops/objArrayOop.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "memory/specialized_oop_closures.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" diff --git a/hotspot/src/share/vm/oops/objArrayOop.hpp b/hotspot/src/share/vm/oops/objArrayOop.hpp index 3b32e5bafc2..5ffc0d7aab9 100644 --- a/hotspot/src/share/vm/oops/objArrayOop.hpp +++ b/hotspot/src/share/vm/oops/objArrayOop.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_VM_OOPS_OBJARRAYOOP_HPP #define SHARE_VM_OOPS_OBJARRAYOOP_HPP +#include "memory/specialized_oop_closures.hpp" #include "oops/arrayOop.hpp" // An objArrayOop is an array containing oops. diff --git a/hotspot/src/share/vm/precompiled/precompiled.hpp b/hotspot/src/share/vm/precompiled/precompiled.hpp index 400ad459a40..a2ae0465c3d 100644 --- a/hotspot/src/share/vm/precompiled/precompiled.hpp +++ b/hotspot/src/share/vm/precompiled/precompiled.hpp @@ -136,7 +136,6 @@ # include "memory/sharedHeap.hpp" # include "memory/space.hpp" # include "memory/space.inline.hpp" -# include "memory/specialized_oop_closures.hpp" # include "memory/threadLocalAllocBuffer.hpp" # include "memory/threadLocalAllocBuffer.inline.hpp" # include "memory/universe.hpp" @@ -310,7 +309,6 @@ # include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp" # include "gc_implementation/g1/g1OopClosures.hpp" # include "gc_implementation/g1/g1_globals.hpp" -# include "gc_implementation/g1/g1_specialized_oop_closures.hpp" # include "gc_implementation/g1/ptrQueue.hpp" # include "gc_implementation/g1/satbQueue.hpp" # include "gc_implementation/parNew/parOopClosures.hpp" From 28adfbf0bed68f397836151e5caa8fc6d4c5bcbf Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 17 Mar 2015 15:53:55 +0100 Subject: [PATCH 009/101] 8075249: Cleanup forward_to_atomic and ClaimedForwardPtr Reviewed-by: kbarrett, brutisso --- .../g1/g1ParScanThreadState.cpp | 4 ++- .../parNew/parNewGeneration.cpp | 9 +------ .../parNew/parNewGeneration.hpp | 2 -- hotspot/src/share/vm/oops/oop.inline.hpp | 24 +++++++++++++++++ hotspot/src/share/vm/oops/oop.pcgc.inline.hpp | 26 +------------------ 5 files changed, 29 insertions(+), 36 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp index 8849d42dd78..2ec726e744e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -226,6 +226,8 @@ oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state, } assert(obj_ptr != NULL, "when we get here, allocation should have succeeded"); + assert(_g1h->is_in_reserved(obj_ptr), "Allocated memory should be in the heap"); + #ifndef PRODUCT // Should this evacuation fail? if (_g1h->evacuation_should_fail()) { diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 9ffe68a1b58..9df8c4e8c1c 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -1122,14 +1122,6 @@ oop ParNewGeneration::real_forwardee_slow(oop obj) { return forward_ptr; } -#ifdef ASSERT -bool ParNewGeneration::is_legal_forward_ptr(oop p) { - return - (p == ClaimedForwardPtr) - || Universe::heap()->is_in_reserved(p); -} -#endif - void ParNewGeneration::preserve_mark_if_necessary(oop obj, markOop m) { if (m->must_be_preserved_for_promotion_failure(obj)) { // We should really have separate per-worker stacks, rather @@ -1204,6 +1196,7 @@ oop ParNewGeneration::copy_to_survivor_space( } else { // Is in to-space; do copying ourselves. Copy::aligned_disjoint_words((HeapWord*)old, (HeapWord*)new_obj, sz); + assert(Universe::heap()->is_in_reserved(new_obj), "illegal forwarding pointer value."); forward_ptr = old->forward_to_atomic(new_obj); // Restore the mark word copied above. new_obj->set_mark(m); diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp index f14f6a6d354..aa97271ac85 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp @@ -419,8 +419,6 @@ class ParNewGeneration: public DefNewGeneration { } static oop real_forwardee(oop obj); - - DEBUG_ONLY(static bool is_legal_forward_ptr(oop p);) }; #endif // SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp index 8adee1393e8..dfc5ac385aa 100644 --- a/hotspot/src/share/vm/oops/oop.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.inline.hpp @@ -630,6 +630,30 @@ inline bool oopDesc::cas_forward_to(oop p, markOop compare) { return cas_set_mark(m, compare) == compare; } +#if INCLUDE_ALL_GCS +inline oop oopDesc::forward_to_atomic(oop p) { + markOop oldMark = mark(); + markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p); + markOop curMark; + + assert(forwardPtrMark->decode_pointer() == p, "encoding must be reversable"); + assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this."); + + while (!oldMark->is_marked()) { + curMark = (markOop)Atomic::cmpxchg_ptr(forwardPtrMark, &_mark, oldMark); + assert(is_forwarded(), "object should have been forwarded"); + if (curMark == oldMark) { + return NULL; + } + // If the CAS was unsuccessful then curMark->is_marked() + // should return true as another thread has CAS'd in another + // forwarding pointer. + oldMark = curMark; + } + return forwardee(); +} +#endif + // Note that the forwardee is not the same thing as the displaced_mark. // The forwardee is used when copying during scavenge and mark-sweep. // It does need to clear the low two locking- and GC-related bits. diff --git a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp index a361e3bcc77..930a770f63b 100644 --- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,28 +54,4 @@ inline void oopDesc::follow_contents(ParCompactionManager* cm) { klass()->oop_follow_contents(cm, this); } -inline oop oopDesc::forward_to_atomic(oop p) { - assert(ParNewGeneration::is_legal_forward_ptr(p), - "illegal forwarding pointer value."); - markOop oldMark = mark(); - markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p); - markOop curMark; - - assert(forwardPtrMark->decode_pointer() == p, "encoding must be reversable"); - assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this."); - - while (!oldMark->is_marked()) { - curMark = (markOop)Atomic::cmpxchg_ptr(forwardPtrMark, &_mark, oldMark); - assert(is_forwarded(), "object should have been forwarded"); - if (curMark == oldMark) { - return NULL; - } - // If the CAS was unsuccessful then curMark->is_marked() - // should return true as another thread has CAS'd in another - // forwarding pointer. - oldMark = curMark; - } - return forwardee(); -} - #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP From 207fadd39e3301cb169b3ae5c400a670f34db23e Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 18 Mar 2015 10:51:00 +0100 Subject: [PATCH 010/101] 8075416: Cleanup GC include dependencies in memoryPool.hpp Reviewed-by: ehelin, mgerdin --- .../parNew/parNewGeneration.cpp | 1 + hotspot/src/share/vm/memory/cardTableRS.cpp | 2 +- .../share/vm/services/lowMemoryDetector.hpp | 1 + hotspot/src/share/vm/services/memoryPool.cpp | 27 ++++++++++++++++++- hotspot/src/share/vm/services/memoryPool.hpp | 22 +++++---------- 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 9df8c4e8c1c..1712e4edc94 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp" #include "gc_implementation/parNew/parNewGeneration.hpp" #include "gc_implementation/parNew/parOopClosures.inline.hpp" diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp index 45e20deec48..be98f7a70a7 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.cpp +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp @@ -27,7 +27,7 @@ #include "memory/cardTableRS.hpp" #include "memory/genCollectedHeap.hpp" #include "memory/generation.hpp" -#include "memory/space.hpp" +#include "memory/space.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/java.hpp" diff --git a/hotspot/src/share/vm/services/lowMemoryDetector.hpp b/hotspot/src/share/vm/services/lowMemoryDetector.hpp index 3dda4f1ba5a..16c306f5301 100644 --- a/hotspot/src/share/vm/services/lowMemoryDetector.hpp +++ b/hotspot/src/share/vm/services/lowMemoryDetector.hpp @@ -28,6 +28,7 @@ #include "memory/allocation.hpp" #include "services/memoryPool.hpp" #include "services/memoryService.hpp" +#include "services/memoryUsage.hpp" // Low Memory Detection Support // Two memory alarms in the JDK (we called them sensors). diff --git a/hotspot/src/share/vm/services/memoryPool.cpp b/hotspot/src/share/vm/services/memoryPool.cpp index 2d686cbdc9a..e9bc4d0542b 100644 --- a/hotspot/src/share/vm/services/memoryPool.cpp +++ b/hotspot/src/share/vm/services/memoryPool.cpp @@ -25,7 +25,9 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "memory/defNewGeneration.hpp" #include "memory/metaspace.hpp" +#include "memory/space.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/javaCalls.hpp" @@ -34,8 +36,11 @@ #include "services/management.hpp" #include "services/memoryManager.hpp" #include "services/memoryPool.hpp" -#include "utilities/macros.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" +#if INCLUDE_ALL_GCS +#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" +#endif MemoryPool::MemoryPool(const char* name, PoolType type, @@ -187,6 +192,10 @@ ContiguousSpacePool::ContiguousSpacePool(ContiguousSpace* space, support_usage_threshold), _space(space) { } +size_t ContiguousSpacePool::used_in_bytes() { + return space()->used(); +} + MemoryUsage ContiguousSpacePool::get_memory_usage() { size_t maxSize = (available_for_allocation() ? max_size() : 0); size_t used = used_in_bytes(); @@ -204,6 +213,14 @@ SurvivorContiguousSpacePool::SurvivorContiguousSpacePool(DefNewGeneration* gen, support_usage_threshold), _gen(gen) { } +size_t SurvivorContiguousSpacePool::used_in_bytes() { + return _gen->from()->used(); +} + +size_t SurvivorContiguousSpacePool::committed_in_bytes() { + return _gen->from()->capacity(); +} + MemoryUsage SurvivorContiguousSpacePool::get_memory_usage() { size_t maxSize = (available_for_allocation() ? max_size() : 0); size_t used = used_in_bytes(); @@ -222,6 +239,10 @@ CompactibleFreeListSpacePool::CompactibleFreeListSpacePool(CompactibleFreeListSp support_usage_threshold), _space(space) { } +size_t CompactibleFreeListSpacePool::used_in_bytes() { + return _space->used(); +} + MemoryUsage CompactibleFreeListSpacePool::get_memory_usage() { size_t maxSize = (available_for_allocation() ? max_size() : 0); size_t used = used_in_bytes(); @@ -239,6 +260,10 @@ GenerationPool::GenerationPool(Generation* gen, support_usage_threshold), _gen(gen) { } +size_t GenerationPool::used_in_bytes() { + return _gen->used(); +} + MemoryUsage GenerationPool::get_memory_usage() { size_t used = used_in_bytes(); size_t committed = _gen->capacity(); diff --git a/hotspot/src/share/vm/services/memoryPool.hpp b/hotspot/src/share/vm/services/memoryPool.hpp index 007366e0bd6..f9b7a0a4080 100644 --- a/hotspot/src/share/vm/services/memoryPool.hpp +++ b/hotspot/src/share/vm/services/memoryPool.hpp @@ -25,15 +25,9 @@ #ifndef SHARE_VM_SERVICES_MEMORYPOOL_HPP #define SHARE_VM_SERVICES_MEMORYPOOL_HPP -#include "gc_implementation/shared/mutableSpace.hpp" -#include "memory/defNewGeneration.hpp" #include "memory/heap.hpp" -#include "memory/space.hpp" #include "services/memoryUsage.hpp" #include "utilities/macros.hpp" -#if INCLUDE_ALL_GCS -#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" -#endif // INCLUDE_ALL_GCS // A memory pool represents the memory area that the VM manages. // The Java virtual machine has at least one memory pool @@ -43,6 +37,8 @@ // both heap and non-heap memory. // Forward declaration +class CompactibleFreeListSpace; +class ContiguousSpace; class MemoryManager; class SensorInfo; class Generation; @@ -162,7 +158,7 @@ public: ContiguousSpace* space() { return _space; } MemoryUsage get_memory_usage(); - size_t used_in_bytes() { return space()->used(); } + size_t used_in_bytes(); }; class SurvivorContiguousSpacePool : public CollectedMemoryPool { @@ -178,12 +174,8 @@ public: MemoryUsage get_memory_usage(); - size_t used_in_bytes() { - return _gen->from()->used(); - } - size_t committed_in_bytes() { - return _gen->from()->capacity(); - } + size_t used_in_bytes(); + size_t committed_in_bytes(); }; #if INCLUDE_ALL_GCS @@ -198,7 +190,7 @@ public: bool support_usage_threshold); MemoryUsage get_memory_usage(); - size_t used_in_bytes() { return _space->used(); } + size_t used_in_bytes(); }; #endif // INCLUDE_ALL_GCS @@ -210,7 +202,7 @@ public: GenerationPool(Generation* gen, const char* name, PoolType type, bool support_usage_threshold); MemoryUsage get_memory_usage(); - size_t used_in_bytes() { return _gen->used(); } + size_t used_in_bytes(); }; class CodeHeapPool: public MemoryPool { From f5292016eeaa1bf5065f28a21144d9b5231529da Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Mon, 1 Dec 2014 15:24:56 +0100 Subject: [PATCH 011/101] 8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap Create a G1RootProcessor and move SharedHeap root processing to GenCollectedHeap Reviewed-by: brutisso, tschatzl, ehelin --- .../concurrentMarkSweepGeneration.cpp | 22 +- .../gc_implementation/g1/g1CollectedHeap.cpp | 210 ++----------- .../gc_implementation/g1/g1CollectedHeap.hpp | 41 +-- .../vm/gc_implementation/g1/g1MarkSweep.cpp | 37 ++- .../vm/gc_implementation/g1/g1RemSet.cpp | 2 - .../vm/gc_implementation/g1/g1RemSet.hpp | 1 - .../gc_implementation/g1/g1RootProcessor.cpp | 290 ++++++++++++++++++ .../gc_implementation/g1/g1RootProcessor.hpp | 116 +++++++ .../parNew/parNewGeneration.cpp | 2 +- .../src/share/vm/memory/defNewGeneration.cpp | 2 +- .../src/share/vm/memory/genCollectedHeap.cpp | 199 ++++++++---- .../src/share/vm/memory/genCollectedHeap.hpp | 22 +- hotspot/src/share/vm/memory/genMarkSweep.cpp | 4 +- hotspot/src/share/vm/memory/sharedHeap.cpp | 215 +------------ hotspot/src/share/vm/memory/sharedHeap.hpp | 78 +---- 15 files changed, 645 insertions(+), 596 deletions(-) create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index f48a34c1748..e273c205a37 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -506,7 +506,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, _collector_policy(cp), _should_unload_classes(CMSClassUnloadingEnabled), _concurrent_cycles_since_last_unload(0), - _roots_scanning_options(SharedHeap::SO_None), + _roots_scanning_options(GenCollectedHeap::SO_None), _inter_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding), _intra_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding), _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) CMSTracer()), @@ -2496,7 +2496,7 @@ void CMSCollector::verify_after_remark_work_1() { gch->gen_process_roots(_cmsGen->level(), true, // younger gens are roots true, // activate StrongRootsScope - SharedHeap::ScanningOption(roots_scanning_options()), + GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), ¬Older, NULL, @@ -2564,7 +2564,7 @@ void CMSCollector::verify_after_remark_work_2() { gch->gen_process_roots(_cmsGen->level(), true, // younger gens are roots true, // activate StrongRootsScope - SharedHeap::ScanningOption(roots_scanning_options()), + GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), ¬Older, NULL, @@ -2748,7 +2748,7 @@ bool ConcurrentMarkSweepGeneration::is_too_full() const { void CMSCollector::setup_cms_unloading_and_verification_state() { const bool should_verify = VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC || VerifyBeforeExit; - const int rso = SharedHeap::SO_AllCodeCache; + const int rso = GenCollectedHeap::SO_AllCodeCache; // We set the proper root for this CMS cycle here. if (should_unload_classes()) { // Should unload classes this cycle @@ -3087,7 +3087,7 @@ void CMSCollector::checkpointRootsInitialWork() { gch->gen_process_roots(_cmsGen->level(), true, // younger gens are roots true, // activate StrongRootsScope - SharedHeap::ScanningOption(roots_scanning_options()), + GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), ¬Older, NULL, @@ -4521,13 +4521,13 @@ void CMSParInitialMarkTask::work(uint worker_id) { gch->gen_process_roots(_collector->_cmsGen->level(), false, // yg was scanned above false, // this is parallel code - SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), + GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), _collector->should_unload_classes(), &par_mri_cl, NULL, &cld_closure); assert(_collector->should_unload_classes() - || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_AllCodeCache), + || (_collector->CMSCollector::roots_scanning_options() & GenCollectedHeap::SO_AllCodeCache), "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops"); _timer.stop(); if (PrintCMSStatistics != 0) { @@ -4657,14 +4657,14 @@ void CMSParRemarkTask::work(uint worker_id) { gch->gen_process_roots(_collector->_cmsGen->level(), false, // yg was scanned above false, // this is parallel code - SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), + GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()), _collector->should_unload_classes(), &par_mrias_cl, NULL, NULL); // The dirty klasses will be handled below assert(_collector->should_unload_classes() - || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_AllCodeCache), + || (_collector->CMSCollector::roots_scanning_options() & GenCollectedHeap::SO_AllCodeCache), "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops"); _timer.stop(); if (PrintCMSStatistics != 0) { @@ -5248,14 +5248,14 @@ void CMSCollector::do_remark_non_parallel() { gch->gen_process_roots(_cmsGen->level(), true, // younger gens as roots false, // use the local StrongRootsScope - SharedHeap::ScanningOption(roots_scanning_options()), + GenCollectedHeap::ScanningOption(roots_scanning_options()), should_unload_classes(), &mrias_cl, NULL, NULL); // The dirty klasses will be handled below assert(should_unload_classes() - || (roots_scanning_options() & SharedHeap::SO_AllCodeCache), + || (roots_scanning_options() & GenCollectedHeap::SO_AllCodeCache), "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops"); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index ed964c52e8c..18b2770207b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -48,6 +48,7 @@ #include "gc_implementation/g1/g1ParScanThreadState.inline.hpp" #include "gc_implementation/g1/g1RegionToSpaceMapper.hpp" #include "gc_implementation/g1/g1RemSet.inline.hpp" +#include "gc_implementation/g1/g1RootProcessor.hpp" #include "gc_implementation/g1/g1StringDedup.hpp" #include "gc_implementation/g1/g1YCTypes.hpp" #include "gc_implementation/g1/heapRegion.inline.hpp" @@ -89,18 +90,6 @@ size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0; // apply to TLAB allocation, which is not part of this interface: it // is done by clients of this interface.) -// Notes on implementation of parallelism in different tasks. -// -// G1ParVerifyTask uses heap_region_par_iterate() for parallelism. -// The number of GC workers is passed to heap_region_par_iterate(). -// It does use run_task() which sets _n_workers in the task. -// G1ParTask executes g1_process_roots() -> -// SharedHeap::process_roots() which calls eventually to -// CardTableModRefBS::par_non_clean_card_iterate_work() which uses -// SequentialSubTasksDone. SharedHeap::process_roots() also -// directly uses SubTasksDone (_process_strong_tasks field in SharedHeap). -// - // Local to this file. class RefineCardTableEntryClosure: public CardTableEntryClosure { @@ -1767,7 +1756,6 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) : _is_alive_closure_stw(this), _ref_processor_cm(NULL), _ref_processor_stw(NULL), - _process_strong_tasks(new SubTasksDone(G1H_PS_NumElements)), _bot_shared(NULL), _evac_failure_scan_stack(NULL), _mark_in_progress(false), @@ -1801,9 +1789,6 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) : _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) G1OldTracer()) { _g1h = this; - if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) { - vm_exit_during_initialization("Failed necessary allocation."); - } _allocator = G1Allocator::create_allocator(_g1h); _humongous_object_threshold_in_words = HeapRegion::GrainWords / 2; @@ -3107,11 +3092,12 @@ void G1CollectedHeap::verify(bool silent, VerifyOption vo) { G1VerifyCodeRootOopClosure codeRootsCl(this, &rootsCl, vo); G1VerifyCodeRootBlobClosure blobsCl(&codeRootsCl); - process_all_roots(true, // activate StrongRootsScope - SO_AllCodeCache, // roots scanning options - &rootsCl, - &cldCl, - &blobsCl); + { + G1RootProcessor root_processor(this); + root_processor.process_all_roots(&rootsCl, + &cldCl, + &blobsCl); + } bool failures = rootsCl.failures() || codeRootsCl.failures(); @@ -4360,60 +4346,11 @@ class G1KlassScanClosure : public KlassClosure { } }; -class G1CodeBlobClosure : public CodeBlobClosure { - class HeapRegionGatheringOopClosure : public OopClosure { - G1CollectedHeap* _g1h; - OopClosure* _work; - nmethod* _nm; - - template - void do_oop_work(T* p) { - _work->do_oop(p); - T oop_or_narrowoop = oopDesc::load_heap_oop(p); - if (!oopDesc::is_null(oop_or_narrowoop)) { - oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop); - HeapRegion* hr = _g1h->heap_region_containing_raw(o); - assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in CS then evacuation failed and nm must already be in the remset"); - hr->add_strong_code_root(_nm); - } - } - - public: - HeapRegionGatheringOopClosure(OopClosure* oc) : _g1h(G1CollectedHeap::heap()), _work(oc), _nm(NULL) {} - - void do_oop(oop* o) { - do_oop_work(o); - } - - void do_oop(narrowOop* o) { - do_oop_work(o); - } - - void set_nm(nmethod* nm) { - _nm = nm; - } - }; - - HeapRegionGatheringOopClosure _oc; -public: - G1CodeBlobClosure(OopClosure* oc) : _oc(oc) {} - - void do_code_blob(CodeBlob* cb) { - nmethod* nm = cb->as_nmethod_or_null(); - if (nm != NULL) { - if (!nm->test_set_oops_do_mark()) { - _oc.set_nm(nm); - nm->oops_do(&_oc); - nm->fix_oop_relocations(); - } - } - } -}; - class G1ParTask : public AbstractGangTask { protected: G1CollectedHeap* _g1h; RefToScanQueueSet *_queues; + G1RootProcessor* _root_processor; ParallelTaskTerminator _terminator; uint _n_workers; @@ -4421,10 +4358,11 @@ protected: Mutex* stats_lock() { return &_stats_lock; } public: - G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues) + G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues, G1RootProcessor* root_processor) : AbstractGangTask("G1 collection"), _g1h(g1h), _queues(task_queues), + _root_processor(root_processor), _terminator(0, _queues), _stats_lock(Mutex::leaf, "parallel G1 stats lock", true) {} @@ -4438,13 +4376,7 @@ public: ParallelTaskTerminator* terminator() { return &_terminator; } virtual void set_for_termination(int active_workers) { - // This task calls set_n_termination() in par_non_clean_card_iterate_work() - // in the young space (_par_seq_tasks) in the G1 heap - // for SequentialSubTasksDone. - // This task also uses SubTasksDone in SharedHeap and G1CollectedHeap - // both of which need setting by set_n_termination(). - _g1h->SharedHeap::set_n_termination(active_workers); - _g1h->set_n_termination(active_workers); + _root_processor->set_num_workers(active_workers); terminator()->reset_for_reuse(active_workers); _n_workers = active_workers; } @@ -4513,24 +4445,21 @@ public: false, // Process all klasses. true); // Need to claim CLDs. - G1CodeBlobClosure scan_only_code_cl(&scan_only_root_cl); - G1CodeBlobClosure scan_mark_code_cl(&scan_mark_root_cl); - // IM Weak code roots are handled later. - OopClosure* strong_root_cl; OopClosure* weak_root_cl; CLDClosure* strong_cld_cl; CLDClosure* weak_cld_cl; - CodeBlobClosure* strong_code_cl; + + bool trace_metadata = false; if (_g1h->g1_policy()->during_initial_mark_pause()) { // We also need to mark copied objects. strong_root_cl = &scan_mark_root_cl; strong_cld_cl = &scan_mark_cld_cl; - strong_code_cl = &scan_mark_code_cl; if (ClassUnloadingWithConcurrentMark) { weak_root_cl = &scan_mark_weak_root_cl; weak_cld_cl = &scan_mark_weak_cld_cl; + trace_metadata = true; } else { weak_root_cl = &scan_mark_root_cl; weak_cld_cl = &scan_mark_cld_cl; @@ -4540,21 +4469,21 @@ public: weak_root_cl = &scan_only_root_cl; strong_cld_cl = &scan_only_cld_cl; weak_cld_cl = &scan_only_cld_cl; - strong_code_cl = &scan_only_code_cl; } - - G1ParPushHeapRSClosure push_heap_rs_cl(_g1h, &pss); - pss.start_strong_roots(); - _g1h->g1_process_roots(strong_root_cl, - weak_root_cl, - &push_heap_rs_cl, - strong_cld_cl, - weak_cld_cl, - strong_code_cl, - worker_id); + _root_processor->evacuate_roots(strong_root_cl, + weak_root_cl, + strong_cld_cl, + weak_cld_cl, + trace_metadata, + worker_id); + + G1ParPushHeapRSClosure push_heap_rs_cl(_g1h, &pss); + _root_processor->scan_remembered_sets(&push_heap_rs_cl, + weak_root_cl, + worker_id); pss.end_strong_roots(); { @@ -4585,87 +4514,6 @@ public: } }; -// *** Common G1 Evacuation Stuff - -// This method is run in a GC worker. - -void -G1CollectedHeap:: -g1_process_roots(OopClosure* scan_non_heap_roots, - OopClosure* scan_non_heap_weak_roots, - G1ParPushHeapRSClosure* scan_rs, - CLDClosure* scan_strong_clds, - CLDClosure* scan_weak_clds, - CodeBlobClosure* scan_strong_code, - uint worker_i) { - - // First scan the shared roots. - double ext_roots_start = os::elapsedTime(); - double closure_app_time_sec = 0.0; - - bool during_im = _g1h->g1_policy()->during_initial_mark_pause(); - bool trace_metadata = during_im && ClassUnloadingWithConcurrentMark; - - BufferingOopClosure buf_scan_non_heap_roots(scan_non_heap_roots); - BufferingOopClosure buf_scan_non_heap_weak_roots(scan_non_heap_weak_roots); - - process_roots(false, // no scoping; this is parallel code - SharedHeap::SO_None, - &buf_scan_non_heap_roots, - &buf_scan_non_heap_weak_roots, - scan_strong_clds, - // Unloading Initial Marks handle the weak CLDs separately. - (trace_metadata ? NULL : scan_weak_clds), - scan_strong_code); - - // Now the CM ref_processor roots. - if (!_process_strong_tasks->is_task_claimed(G1H_PS_refProcessor_oops_do)) { - // We need to treat the discovered reference lists of the - // concurrent mark ref processor as roots and keep entries - // (which are added by the marking threads) on them live - // until they can be processed at the end of marking. - ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots); - } - - if (trace_metadata) { - // Barrier to make sure all workers passed - // the strong CLD and strong nmethods phases. - active_strong_roots_scope()->wait_until_all_workers_done_with_threads(n_par_threads()); - - // Now take the complement of the strong CLDs. - ClassLoaderDataGraph::roots_cld_do(NULL, scan_weak_clds); - } - - // Finish up any enqueued closure apps (attributed as object copy time). - buf_scan_non_heap_roots.done(); - buf_scan_non_heap_weak_roots.done(); - - double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds() - + buf_scan_non_heap_weak_roots.closure_app_seconds(); - - g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec); - - double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec; - g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec); - - // During conc marking we have to filter the per-thread SATB buffers - // to make sure we remove any oops into the CSet (which will show up - // as implicitly live). - { - G1GCParPhaseTimesTracker x(g1_policy()->phase_times(), G1GCPhaseTimes::SATBFiltering, worker_i); - if (!_process_strong_tasks->is_task_claimed(G1H_PS_filter_satb_buffers) && mark_in_progress()) { - JavaThread::satb_mark_queue_set().filter_thread_buffers(); - } - } - - // Now scan the complement of the collection set. - G1CodeBlobClosure scavenge_cs_nmethods(scan_non_heap_weak_roots); - - g1_rem_set()->oops_into_collection_set_do(scan_rs, &scavenge_cs_nmethods, worker_i); - - _process_strong_tasks->all_tasks_completed(); -} - class G1StringSymbolTableUnlinkTask : public AbstractGangTask { private: BoolObjectClosure* _is_alive; @@ -5612,7 +5460,6 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) { workers()->set_active_workers(n_workers); set_par_threads(n_workers); - G1ParTask g1_par_task(this, _task_queues); init_for_evac_failure(NULL); @@ -5621,7 +5468,8 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) { double end_par_time_sec; { - StrongRootsScope srs(this); + G1RootProcessor root_processor(this); + G1ParTask g1_par_task(this, _task_queues, &root_processor); // InitialMark needs claim bits to keep track of the marked-through CLDs. if (g1_policy()->during_initial_mark_pause()) { ClassLoaderDataGraph::clear_claimed_marks(); @@ -5637,9 +5485,9 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) { end_par_time_sec = os::elapsedTime(); // Closing the inner scope will execute the destructor - // for the StrongRootsScope object. We record the current + // for the G1RootProcessor object. We record the current // elapsed time before closing the scope so that time - // taken for the SRS destructor is NOT included in the + // taken for the destructor is NOT included in the // reported parallel time. } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 3d83853698a..91b47100797 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -780,22 +780,6 @@ protected: // statistics or updating free lists. void abandon_collection_set(HeapRegion* cs_head); - // Applies "scan_non_heap_roots" to roots outside the heap, - // "scan_rs" to roots inside the heap (having done "set_region" to - // indicate the region in which the root resides), - // and does "scan_metadata" If "scan_rs" is - // NULL, then this step is skipped. The "worker_i" - // param is for use with parallel roots processing, and should be - // the "i" of the calling parallel worker thread's work(i) function. - // In the sequential case this param will be ignored. - void g1_process_roots(OopClosure* scan_non_heap_roots, - OopClosure* scan_non_heap_weak_roots, - G1ParPushHeapRSClosure* scan_rs, - CLDClosure* scan_strong_clds, - CLDClosure* scan_weak_clds, - CodeBlobClosure* scan_strong_code, - uint worker_i); - // The concurrent marker (and the thread it runs in.) ConcurrentMark* _cm; ConcurrentMarkThread* _cmThread; @@ -982,21 +966,10 @@ protected: // of G1CollectedHeap::_gc_time_stamp. uint* _worker_cset_start_region_time_stamp; - enum G1H_process_roots_tasks { - G1H_PS_filter_satb_buffers, - G1H_PS_refProcessor_oops_do, - // Leave this one last. - G1H_PS_NumElements - }; - - SubTasksDone* _process_strong_tasks; - volatile bool _free_regions_coming; public: - SubTasksDone* process_strong_tasks() { return _process_strong_tasks; } - void set_refine_cte_cl_concurrency(bool concurrent); RefToScanQueue *task_queue(int i) const; @@ -1029,21 +1002,11 @@ public: // Initialize weak reference processing. virtual void ref_processing_init(); - void set_par_threads(uint t) { - SharedHeap::set_par_threads(t); - // Done in SharedHeap but oddly there are - // two _process_strong_tasks's in a G1CollectedHeap - // so do it here too. - _process_strong_tasks->set_n_threads(t); - } - + // Explicitly import set_par_threads into this scope + using SharedHeap::set_par_threads; // Set _n_par_threads according to a policy TBD. void set_par_threads(); - void set_n_termination(int t) { - _process_strong_tasks->set_n_threads(t); - } - virtual CollectedHeap::Name kind() const { return CollectedHeap::G1CollectedHeap; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp index 7ea825d9db2..29020bc8782 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -31,6 +31,7 @@ #include "code/icBuffer.hpp" #include "gc_implementation/g1/g1Log.hpp" #include "gc_implementation/g1/g1MarkSweep.hpp" +#include "gc_implementation/g1/g1RootProcessor.hpp" #include "gc_implementation/g1/g1StringDedup.hpp" #include "gc_implementation/shared/gcHeapSummary.hpp" #include "gc_implementation/shared/gcTimer.hpp" @@ -125,21 +126,22 @@ void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, GCTraceTime tm("phase 1", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); GenMarkSweep::trace(" 1"); - SharedHeap* sh = SharedHeap::heap(); + G1CollectedHeap* g1h = G1CollectedHeap::heap(); // Need cleared claim bits for the roots processing ClassLoaderDataGraph::clear_claimed_marks(); MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations); - sh->process_strong_roots(true, // activate StrongRootsScope - SharedHeap::SO_None, - &GenMarkSweep::follow_root_closure, - &GenMarkSweep::follow_cld_closure, - &follow_code_closure); + { + G1RootProcessor root_processor(g1h); + root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure, + &GenMarkSweep::follow_cld_closure, + &follow_code_closure); + } // Process reference objects found during marking ReferenceProcessor* rp = GenMarkSweep::ref_processor(); - assert(rp == G1CollectedHeap::heap()->ref_processor_stw(), "Sanity"); + assert(rp == g1h->ref_processor_stw(), "Sanity"); rp->setup_policy(clear_all_softrefs); const ReferenceProcessorStats& stats = @@ -225,6 +227,12 @@ class G1AdjustPointersClosure: public HeapRegionClosure { } }; +class G1AlwaysTrueClosure: public BoolObjectClosure { +public: + bool do_object_b(oop p) { return true; } +}; +static G1AlwaysTrueClosure always_true; + void G1MarkSweep::mark_sweep_phase3() { G1CollectedHeap* g1h = G1CollectedHeap::heap(); @@ -232,24 +240,23 @@ void G1MarkSweep::mark_sweep_phase3() { GCTraceTime tm("phase 3", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id()); GenMarkSweep::trace("3"); - SharedHeap* sh = SharedHeap::heap(); - // Need cleared claim bits for the roots processing ClassLoaderDataGraph::clear_claimed_marks(); CodeBlobToOopClosure adjust_code_closure(&GenMarkSweep::adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations); - sh->process_all_roots(true, // activate StrongRootsScope - SharedHeap::SO_AllCodeCache, - &GenMarkSweep::adjust_pointer_closure, - &GenMarkSweep::adjust_cld_closure, - &adjust_code_closure); + { + G1RootProcessor root_processor(g1h); + root_processor.process_all_roots(&GenMarkSweep::adjust_pointer_closure, + &GenMarkSweep::adjust_cld_closure, + &adjust_code_closure); + } assert(GenMarkSweep::ref_processor() == g1h->ref_processor_stw(), "Sanity"); g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_pointer_closure); // Now adjust pointers in remaining weak roots. (All of which should // have been cleared if they pointed to non-surviving objects.) - sh->process_weak_roots(&GenMarkSweep::adjust_pointer_closure); + JNIHandles::weak_oops_do(&always_true, &GenMarkSweep::adjust_pointer_closure); if (G1StringDedup::is_enabled()) { G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp index e26daa7601d..fe28cc28c55 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp @@ -79,7 +79,6 @@ G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) _cards_scanned(NULL), _total_cards_scanned(0), _prev_period_summary() { - _seq_task = new SubTasksDone(NumSeqTasks); _cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC); for (uint i = 0; i < n_workers(); i++) { _cset_rs_update_cl[i] = NULL; @@ -90,7 +89,6 @@ G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) } G1RemSet::~G1RemSet() { - delete _seq_task; for (uint i = 0; i < n_workers(); i++) { assert(_cset_rs_update_cl[i] == NULL, "it should be"); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp index fb9d348789e..77eed43ac87 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp @@ -58,7 +58,6 @@ protected: }; CardTableModRefBS* _ct_bs; - SubTasksDone* _seq_task; G1CollectorPolicy* _g1p; ConcurrentG1Refine* _cg1r; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp new file mode 100644 index 00000000000..37d9dd7cad6 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp @@ -0,0 +1,290 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" + +#include "classfile/stringTable.hpp" +#include "classfile/systemDictionary.hpp" +#include "code/codeCache.hpp" +#include "gc_implementation/g1/bufferingOopClosure.hpp" +#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" +#include "gc_implementation/g1/g1CollectorPolicy.hpp" +#include "gc_implementation/g1/g1GCPhaseTimes.hpp" +#include "gc_implementation/g1/g1RemSet.inline.hpp" +#include "gc_implementation/g1/g1RootProcessor.hpp" +#include "memory/allocation.inline.hpp" +#include "runtime/fprofiler.hpp" +#include "runtime/mutex.hpp" +#include "services/management.hpp" + +class G1CodeBlobClosure : public CodeBlobClosure { + class HeapRegionGatheringOopClosure : public OopClosure { + G1CollectedHeap* _g1h; + OopClosure* _work; + nmethod* _nm; + + template + void do_oop_work(T* p) { + _work->do_oop(p); + T oop_or_narrowoop = oopDesc::load_heap_oop(p); + if (!oopDesc::is_null(oop_or_narrowoop)) { + oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop); + HeapRegion* hr = _g1h->heap_region_containing_raw(o); + assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in CS then evacuation failed and nm must already be in the remset"); + hr->add_strong_code_root(_nm); + } + } + + public: + HeapRegionGatheringOopClosure(OopClosure* oc) : _g1h(G1CollectedHeap::heap()), _work(oc), _nm(NULL) {} + + void do_oop(oop* o) { + do_oop_work(o); + } + + void do_oop(narrowOop* o) { + do_oop_work(o); + } + + void set_nm(nmethod* nm) { + _nm = nm; + } + }; + + HeapRegionGatheringOopClosure _oc; +public: + G1CodeBlobClosure(OopClosure* oc) : _oc(oc) {} + + void do_code_blob(CodeBlob* cb) { + nmethod* nm = cb->as_nmethod_or_null(); + if (nm != NULL) { + if (!nm->test_set_oops_do_mark()) { + _oc.set_nm(nm); + nm->oops_do(&_oc); + nm->fix_oop_relocations(); + } + } + } +}; + + +void G1RootProcessor::worker_has_discovered_all_strong_classes() { + uint n_workers = _g1h->n_par_threads(); + assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); + + uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes); + if (new_value == n_workers) { + // This thread is last. Notify the others. + MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); + _lock.notify_all(); + } +} + +void G1RootProcessor::wait_until_all_strong_classes_discovered() { + uint n_workers = _g1h->n_par_threads(); + assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); + + if ((uint)_n_workers_discovered_strong_classes != n_workers) { + MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); + while ((uint)_n_workers_discovered_strong_classes != n_workers) { + _lock.wait(Mutex::_no_safepoint_check_flag, 0, false); + } + } +} + +G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h) : + _g1h(g1h), + _process_strong_tasks(new SubTasksDone(G1RP_PS_NumElements)), + _srs(g1h), + _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false, Monitor::_safepoint_check_never), + _n_workers_discovered_strong_classes(0) {} + +void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, + OopClosure* scan_non_heap_weak_roots, + CLDClosure* scan_strong_clds, + CLDClosure* scan_weak_clds, + bool trace_metadata, + uint worker_i) { + // First scan the shared roots. + double ext_roots_start = os::elapsedTime(); + + BufferingOopClosure buf_scan_non_heap_roots(scan_non_heap_roots); + BufferingOopClosure buf_scan_non_heap_weak_roots(scan_non_heap_weak_roots); + + OopClosure* const weak_roots = &buf_scan_non_heap_weak_roots; + OopClosure* const strong_roots = &buf_scan_non_heap_roots; + + // CodeBlobClosures are not interoperable with BufferingOopClosures + G1CodeBlobClosure root_code_blobs(scan_non_heap_roots); + + process_java_roots(strong_roots, + trace_metadata ? scan_strong_clds : NULL, + scan_strong_clds, + trace_metadata ? NULL : scan_weak_clds, + &root_code_blobs); + + // This is the point where this worker thread will not find more strong CLDs/nmethods. + // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing. + if (trace_metadata) { + worker_has_discovered_all_strong_classes(); + } + + process_vm_roots(strong_roots, weak_roots); + + // Now the CM ref_processor roots. + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_refProcessor_oops_do)) { + // We need to treat the discovered reference lists of the + // concurrent mark ref processor as roots and keep entries + // (which are added by the marking threads) on them live + // until they can be processed at the end of marking. + _g1h->ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots); + } + + if (trace_metadata) { + // Barrier to make sure all workers passed + // the strong CLD and strong nmethods phases. + wait_until_all_strong_classes_discovered(); + + // Now take the complement of the strong CLDs. + ClassLoaderDataGraph::roots_cld_do(NULL, scan_weak_clds); + } + + // Finish up any enqueued closure apps (attributed as object copy time). + buf_scan_non_heap_roots.done(); + buf_scan_non_heap_weak_roots.done(); + + double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds() + + buf_scan_non_heap_weak_roots.closure_app_seconds(); + + G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times(); + phase_times->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec); + + double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec; + + phase_times->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec); + + // During conc marking we have to filter the per-thread SATB buffers + // to make sure we remove any oops into the CSet (which will show up + // as implicitly live). + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->mark_in_progress()) { + JavaThread::satb_mark_queue_set().filter_thread_buffers(); + } + } + + _process_strong_tasks->all_tasks_completed(); +} + +void G1RootProcessor::process_strong_roots(OopClosure* oops, + CLDClosure* clds, + CodeBlobClosure* blobs) { + + process_java_roots(oops, clds, clds, NULL, blobs); + process_vm_roots(oops, NULL); + + _process_strong_tasks->all_tasks_completed(); +} + +void G1RootProcessor::process_all_roots(OopClosure* oops, + CLDClosure* clds, + CodeBlobClosure* blobs) { + + process_java_roots(oops, NULL, clds, clds, NULL); + process_vm_roots(oops, oops); + + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_CodeCache_oops_do)) { + CodeCache::blobs_do(blobs); + } + + _process_strong_tasks->all_tasks_completed(); +} + +void G1RootProcessor::process_java_roots(OopClosure* strong_roots, + CLDClosure* thread_stack_clds, + CLDClosure* strong_clds, + CLDClosure* weak_clds, + CodeBlobClosure* strong_code) { + assert(thread_stack_clds == NULL || weak_clds == NULL, "There is overlap between those, only one may be set"); + // Iterating over the CLDG and the Threads are done early to allow us to + // first process the strong CLDs and nmethods and then, after a barrier, + // let the thread process the weak CLDs and nmethods. + + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_ClassLoaderDataGraph_oops_do)) { + ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds); + } + + Threads::possibly_parallel_oops_do(strong_roots, thread_stack_clds, strong_code); +} + +void G1RootProcessor::process_vm_roots(OopClosure* strong_roots, + OopClosure* weak_roots) { + + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Universe_oops_do)) { + Universe::oops_do(strong_roots); + } + + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_JNIHandles_oops_do)) { + JNIHandles::oops_do(strong_roots); + } + + if (!_process_strong_tasks-> is_task_claimed(G1RP_PS_ObjectSynchronizer_oops_do)) { + ObjectSynchronizer::oops_do(strong_roots); + } + + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) { + FlatProfiler::oops_do(strong_roots); + } + + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Management_oops_do)) { + Management::oops_do(strong_roots); + } + + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_jvmti_oops_do)) { + JvmtiExport::oops_do(strong_roots); + } + + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) { + SystemDictionary::roots_oops_do(strong_roots, weak_roots); + } + + // All threads execute the following. A specific chunk of buckets + // from the StringTable are the individual tasks. + if (weak_roots != NULL) { + StringTable::possibly_parallel_oops_do(weak_roots); + } +} + +void G1RootProcessor::scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs, + OopClosure* scan_non_heap_weak_roots, + uint worker_i) { + // Now scan the complement of the collection set. + G1CodeBlobClosure scavenge_cs_nmethods(scan_non_heap_weak_roots); + + _g1h->g1_rem_set()->oops_into_collection_set_do(scan_rs, &scavenge_cs_nmethods, worker_i); +} + +void G1RootProcessor::set_num_workers(int active_workers) { + _process_strong_tasks->set_n_threads(active_workers); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp new file mode 100644 index 00000000000..47c484b5294 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_ROOTPROCESSOR_HPP +#define SHARE_VM_GC_IMPLEMENTATION_G1_ROOTPROCESSOR_HPP + +#include "memory/allocation.hpp" +#include "memory/sharedHeap.hpp" +#include "runtime/mutex.hpp" + +class CLDClosure; +class CodeBlobClosure; +class G1CollectedHeap; +class G1ParPushHeapRSClosure; +class Monitor; +class OopClosure; +class SubTasksDone; + +// Scoped object to assist in applying oop, CLD and code blob closures to +// root locations. Handles claiming of different root scanning tasks +// and takes care of global state for root scanning via a StrongRootsScope. +// In the parallel case there is a shared G1RootProcessor object where all +// worker thread call the process_roots methods. +class G1RootProcessor : public StackObj { + G1CollectedHeap* _g1h; + SubTasksDone* _process_strong_tasks; + SharedHeap::StrongRootsScope _srs; + + // Used to implement the Thread work barrier. + Monitor _lock; + volatile jint _n_workers_discovered_strong_classes; + + enum G1H_process_roots_tasks { + G1RP_PS_Universe_oops_do, + G1RP_PS_JNIHandles_oops_do, + G1RP_PS_ObjectSynchronizer_oops_do, + G1RP_PS_FlatProfiler_oops_do, + G1RP_PS_Management_oops_do, + G1RP_PS_SystemDictionary_oops_do, + G1RP_PS_ClassLoaderDataGraph_oops_do, + G1RP_PS_jvmti_oops_do, + G1RP_PS_CodeCache_oops_do, + G1RP_PS_filter_satb_buffers, + G1RP_PS_refProcessor_oops_do, + // Leave this one last. + G1RP_PS_NumElements + }; + + void worker_has_discovered_all_strong_classes(); + void wait_until_all_strong_classes_discovered(); + + void process_java_roots(OopClosure* scan_non_heap_roots, + CLDClosure* thread_stack_clds, + CLDClosure* scan_strong_clds, + CLDClosure* scan_weak_clds, + CodeBlobClosure* scan_strong_code); + + void process_vm_roots(OopClosure* scan_non_heap_roots, + OopClosure* scan_non_heap_weak_roots); + +public: + G1RootProcessor(G1CollectedHeap* g1h); + + // Apply closures to the strongly and weakly reachable roots in the system + // in a single pass. + // Record and report timing measurements for sub phases using the worker_i + void evacuate_roots(OopClosure* scan_non_heap_roots, + OopClosure* scan_non_heap_weak_roots, + CLDClosure* scan_strong_clds, + CLDClosure* scan_weak_clds, + bool trace_metadata, + uint worker_i); + + // Apply oops, clds and blobs to all strongly reachable roots in the system + void process_strong_roots(OopClosure* oops, + CLDClosure* clds, + CodeBlobClosure* blobs); + + // Apply oops, clds and blobs to strongly and weakly reachable roots in the system + void process_all_roots(OopClosure* oops, + CLDClosure* clds, + CodeBlobClosure* blobs); + + // Apply scan_rs to all locations in the union of the remembered sets for all + // regions in the collection set + // (having done "set_region" to indicate the region in which the root resides), + void scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs, + OopClosure* scan_non_heap_weak_roots, + uint worker_i); + + // Inform the root processor about the number of worker threads + void set_num_workers(int active_workers); +}; + +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_ROOTPROCESSOR_HPP diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 1712e4edc94..11465b12ef3 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -618,7 +618,7 @@ void ParNewGenTask::work(uint worker_id) { true, // Process younger gens, if any, // as strong roots. false, // no scope; this is parallel code - SharedHeap::SO_ScavengeCodeCache, + GenCollectedHeap::SO_ScavengeCodeCache, GenCollectedHeap::StrongAndWeakRoots, &par_scan_state.to_space_root_closure(), &par_scan_state.older_gen_closure(), diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 1f3fbe687e8..0f5b2236555 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -626,7 +626,7 @@ void DefNewGeneration::collect(bool full, true, // Process younger gens, if any, // as strong roots. true, // activate StrongRootsScope - SharedHeap::SO_ScavengeCodeCache, + GenCollectedHeap::SO_ScavengeCodeCache, GenCollectedHeap::StrongAndWeakRoots, &fsc_with_no_gc_barrier, &fsc_with_gc_barrier, diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 20d9afe5036..704291f0d94 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -26,6 +26,7 @@ #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "code/codeCache.hpp" #include "code/icBuffer.hpp" #include "gc_implementation/shared/collectorCounters.hpp" #include "gc_implementation/shared/gcTrace.hpp" @@ -47,6 +48,7 @@ #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" #include "runtime/vmThread.hpp" +#include "services/management.hpp" #include "services/memoryService.hpp" #include "utilities/vmError.hpp" #include "utilities/workgroup.hpp" @@ -61,7 +63,15 @@ NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;) // The set of potentially parallel tasks in root scanning. enum GCH_strong_roots_tasks { - // We probably want to parallelize both of these internally, but for now... + GCH_PS_Universe_oops_do, + GCH_PS_JNIHandles_oops_do, + GCH_PS_ObjectSynchronizer_oops_do, + GCH_PS_FlatProfiler_oops_do, + GCH_PS_Management_oops_do, + GCH_PS_SystemDictionary_oops_do, + GCH_PS_ClassLoaderDataGraph_oops_do, + GCH_PS_jvmti_oops_do, + GCH_PS_CodeCache_oops_do, GCH_PS_younger_gens, // Leave this one last. GCH_PS_NumElements @@ -71,13 +81,9 @@ GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) : SharedHeap(policy), _rem_set(NULL), _gen_policy(policy), - _gen_process_roots_tasks(new SubTasksDone(GCH_PS_NumElements)), + _process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)), _full_collections_completed(0) { - if (_gen_process_roots_tasks == NULL || - !_gen_process_roots_tasks->valid()) { - vm_exit_during_initialization("Failed necessary allocation."); - } assert(policy != NULL, "Sanity check"); } @@ -569,29 +575,137 @@ HeapWord* GenCollectedHeap::satisfy_failed_allocation(size_t size, bool is_tlab) void GenCollectedHeap::set_par_threads(uint t) { SharedHeap::set_par_threads(t); - _gen_process_roots_tasks->set_n_threads(t); + set_n_termination(t); } -void GenCollectedHeap:: -gen_process_roots(int level, - bool younger_gens_as_roots, - bool activate_scope, - SharedHeap::ScanningOption so, - OopsInGenClosure* not_older_gens, - OopsInGenClosure* weak_roots, - OopsInGenClosure* older_gens, - CLDClosure* cld_closure, - CLDClosure* weak_cld_closure, - CodeBlobClosure* code_closure) { +void GenCollectedHeap::set_n_termination(uint t) { + _process_strong_tasks->set_n_threads(t); +} + +#ifdef ASSERT +class AssertNonScavengableClosure: public OopClosure { +public: + virtual void do_oop(oop* p) { + assert(!Universe::heap()->is_in_partial_collection(*p), + "Referent should not be scavengable."); } + virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } +}; +static AssertNonScavengableClosure assert_is_non_scavengable_closure; +#endif + +void GenCollectedHeap::process_roots(bool activate_scope, + ScanningOption so, + OopClosure* strong_roots, + OopClosure* weak_roots, + CLDClosure* strong_cld_closure, + CLDClosure* weak_cld_closure, + CodeBlobClosure* code_roots) { + StrongRootsScope srs(this, activate_scope); // General roots. - SharedHeap::process_roots(activate_scope, so, - not_older_gens, weak_roots, - cld_closure, weak_cld_closure, - code_closure); + assert(_strong_roots_parity != 0, "must have called prologue code"); + assert(code_roots != NULL, "code root closure should always be set"); + // _n_termination for _process_strong_tasks should be set up stream + // in a method not running in a GC worker. Otherwise the GC worker + // could be trying to change the termination condition while the task + // is executing in another GC worker. + + if (!_process_strong_tasks->is_task_claimed(GCH_PS_ClassLoaderDataGraph_oops_do)) { + ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure); + } + + // Some CLDs contained in the thread frames should be considered strong. + // Don't process them if they will be processed during the ClassLoaderDataGraph phase. + CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL; + // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway + CodeBlobClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots; + + Threads::possibly_parallel_oops_do(strong_roots, roots_from_clds_p, roots_from_code_p); + + if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) { + Universe::oops_do(strong_roots); + } + // Global (strong) JNI handles + if (!_process_strong_tasks->is_task_claimed(GCH_PS_JNIHandles_oops_do)) { + JNIHandles::oops_do(strong_roots); + } + + if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) { + ObjectSynchronizer::oops_do(strong_roots); + } + if (!_process_strong_tasks->is_task_claimed(GCH_PS_FlatProfiler_oops_do)) { + FlatProfiler::oops_do(strong_roots); + } + if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) { + Management::oops_do(strong_roots); + } + if (!_process_strong_tasks->is_task_claimed(GCH_PS_jvmti_oops_do)) { + JvmtiExport::oops_do(strong_roots); + } + + if (!_process_strong_tasks->is_task_claimed(GCH_PS_SystemDictionary_oops_do)) { + SystemDictionary::roots_oops_do(strong_roots, weak_roots); + } + + // All threads execute the following. A specific chunk of buckets + // from the StringTable are the individual tasks. + if (weak_roots != NULL) { + if (CollectedHeap::use_parallel_gc_threads()) { + StringTable::possibly_parallel_oops_do(weak_roots); + } else { + StringTable::oops_do(weak_roots); + } + } + + if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) { + if (so & SO_ScavengeCodeCache) { + assert(code_roots != NULL, "must supply closure for code cache"); + + // We only visit parts of the CodeCache when scavenging. + CodeCache::scavenge_root_nmethods_do(code_roots); + } + if (so & SO_AllCodeCache) { + assert(code_roots != NULL, "must supply closure for code cache"); + + // CMSCollector uses this to do intermediate-strength collections. + // We scan the entire code cache, since CodeCache::do_unloading is not called. + CodeCache::blobs_do(code_roots); + } + // Verify that the code cache contents are not subject to + // movement by a scavenging collection. + DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, !CodeBlobToOopClosure::FixRelocations)); + DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable)); + } + +} + +void GenCollectedHeap::gen_process_roots(int level, + bool younger_gens_as_roots, + bool activate_scope, + ScanningOption so, + bool only_strong_roots, + OopsInGenClosure* not_older_gens, + OopsInGenClosure* older_gens, + CLDClosure* cld_closure) { + const bool is_adjust_phase = !only_strong_roots && !younger_gens_as_roots; + + bool is_moving_collection = false; + if (level == 0 || is_adjust_phase) { + // young collections are always moving + is_moving_collection = true; + } + + MarkingCodeBlobClosure mark_code_closure(not_older_gens, is_moving_collection); + OopsInGenClosure* weak_roots = only_strong_roots ? NULL : not_older_gens; + CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure; + + process_roots(activate_scope, so, + not_older_gens, weak_roots, + cld_closure, weak_cld_closure, + &mark_code_closure); if (younger_gens_as_roots) { - if (!_gen_process_roots_tasks->is_task_claimed(GCH_PS_younger_gens)) { + if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) { if (level == 1) { not_older_gens->set_generation(_young_gen); _young_gen->oop_iterate(not_older_gens); @@ -607,43 +721,18 @@ gen_process_roots(int level, older_gens->reset_generation(); } - _gen_process_roots_tasks->all_tasks_completed(); + _process_strong_tasks->all_tasks_completed(); } -void GenCollectedHeap:: -gen_process_roots(int level, - bool younger_gens_as_roots, - bool activate_scope, - SharedHeap::ScanningOption so, - bool only_strong_roots, - OopsInGenClosure* not_older_gens, - OopsInGenClosure* older_gens, - CLDClosure* cld_closure) { - const bool is_adjust_phase = !only_strong_roots && !younger_gens_as_roots; - - bool is_moving_collection = false; - if (level == 0 || is_adjust_phase) { - // young collections are always moving - is_moving_collection = true; - } - - MarkingCodeBlobClosure mark_code_closure(not_older_gens, is_moving_collection); - CodeBlobClosure* code_closure = &mark_code_closure; - - gen_process_roots(level, - younger_gens_as_roots, - activate_scope, so, - not_older_gens, only_strong_roots ? NULL : not_older_gens, - older_gens, - cld_closure, only_strong_roots ? NULL : cld_closure, - code_closure); - -} +class AlwaysTrueClosure: public BoolObjectClosure { +public: + bool do_object_b(oop p) { return true; } +}; +static AlwaysTrueClosure always_true; void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) { - SharedHeap::process_weak_roots(root_closure); - // "Local" "weak" refs + JNIHandles::weak_oops_do(&always_true, root_closure); _young_gen->ref_processor()->weak_oops_do(root_closure); _old_gen->ref_processor()->weak_oops_do(root_closure); } diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index e9b3d744a32..d6193770905 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -85,8 +85,7 @@ public: // Data structure for claiming the (potentially) parallel tasks in // (gen-specific) roots processing. - SubTasksDone* _gen_process_roots_tasks; - SubTasksDone* gen_process_roots_tasks() { return _gen_process_roots_tasks; } + SubTasksDone* _process_strong_tasks; // Collects the given generation. void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab, @@ -387,6 +386,7 @@ public: static GenCollectedHeap* heap(); void set_par_threads(uint t); + void set_n_termination(uint t); // Invoke the "do_oop" method of one of the closures "not_older_gens" // or "older_gens" on root locations for the generation at @@ -400,11 +400,25 @@ public: // The "so" argument determines which of the roots // the closure is applied to: // "SO_None" does none; + enum ScanningOption { + SO_None = 0x0, + SO_AllCodeCache = 0x8, + SO_ScavengeCodeCache = 0x10 + }; + private: + void process_roots(bool activate_scope, + ScanningOption so, + OopClosure* strong_roots, + OopClosure* weak_roots, + CLDClosure* strong_cld_closure, + CLDClosure* weak_cld_closure, + CodeBlobClosure* code_roots); + void gen_process_roots(int level, bool younger_gens_as_roots, bool activate_scope, - SharedHeap::ScanningOption so, + ScanningOption so, OopsInGenClosure* not_older_gens, OopsInGenClosure* weak_roots, OopsInGenClosure* older_gens, @@ -419,7 +433,7 @@ public: void gen_process_roots(int level, bool younger_gens_as_roots, bool activate_scope, - SharedHeap::ScanningOption so, + ScanningOption so, bool only_strong_roots, OopsInGenClosure* not_older_gens, OopsInGenClosure* older_gens, diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index 32a59301f79..eac303540f2 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -203,7 +203,7 @@ void GenMarkSweep::mark_sweep_phase1(int level, gch->gen_process_roots(level, false, // Younger gens are not roots. true, // activate StrongRootsScope - SharedHeap::SO_None, + GenCollectedHeap::SO_None, GenCollectedHeap::StrongRootsOnly, &follow_root_closure, &follow_root_closure, @@ -289,7 +289,7 @@ void GenMarkSweep::mark_sweep_phase3(int level) { gch->gen_process_roots(level, false, // Younger gens are not roots. true, // activate StrongRootsScope - SharedHeap::SO_AllCodeCache, + GenCollectedHeap::SO_AllCodeCache, GenCollectedHeap::StrongAndWeakRoots, &adjust_pointer_closure, &adjust_pointer_closure, diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index d6617af237e..27672c8168d 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -32,7 +32,6 @@ #include "runtime/atomic.inline.hpp" #include "runtime/fprofiler.hpp" #include "runtime/java.hpp" -#include "services/management.hpp" #include "utilities/copy.hpp" #include "utilities/workgroup.hpp" @@ -40,32 +39,12 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC SharedHeap* SharedHeap::_sh; -// The set of potentially parallel tasks in root scanning. -enum SH_process_roots_tasks { - SH_PS_Universe_oops_do, - SH_PS_JNIHandles_oops_do, - SH_PS_ObjectSynchronizer_oops_do, - SH_PS_FlatProfiler_oops_do, - SH_PS_Management_oops_do, - SH_PS_SystemDictionary_oops_do, - SH_PS_ClassLoaderDataGraph_oops_do, - SH_PS_jvmti_oops_do, - SH_PS_CodeCache_oops_do, - // Leave this one last. - SH_PS_NumElements -}; - SharedHeap::SharedHeap(CollectorPolicy* policy_) : CollectedHeap(), _collector_policy(policy_), - _strong_roots_scope(NULL), _strong_roots_parity(0), - _process_strong_tasks(new SubTasksDone(SH_PS_NumElements)), _workers(NULL) { - if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) { - vm_exit_during_initialization("Failed necessary allocation."); - } _sh = this; // ch is static, should be set only once. if (UseConcMarkSweepGC || UseG1GC) { _workers = new FlexibleWorkGang("GC Thread", ParallelGCThreads, @@ -79,14 +58,6 @@ SharedHeap::SharedHeap(CollectorPolicy* policy_) : } } -int SharedHeap::n_termination() { - return _process_strong_tasks->n_threads(); -} - -void SharedHeap::set_n_termination(int t) { - _process_strong_tasks->set_n_threads(t); -} - bool SharedHeap::heap_lock_held_for_gc() { Thread* t = Thread::current(); return Heap_lock->owned_by_self() @@ -97,31 +68,6 @@ bool SharedHeap::heap_lock_held_for_gc() { void SharedHeap::set_par_threads(uint t) { assert(t == 0 || !UseSerialGC, "Cannot have parallel threads"); _n_par_threads = t; - _process_strong_tasks->set_n_threads(t); -} - -#ifdef ASSERT -class AssertNonScavengableClosure: public OopClosure { -public: - virtual void do_oop(oop* p) { - assert(!Universe::heap()->is_in_partial_collection(*p), - "Referent should not be scavengable."); } - virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } -}; -static AssertNonScavengableClosure assert_is_non_scavengable_closure; -#endif - -SharedHeap::StrongRootsScope* SharedHeap::active_strong_roots_scope() const { - return _strong_roots_scope; -} -void SharedHeap::register_strong_roots_scope(SharedHeap::StrongRootsScope* scope) { - assert(_strong_roots_scope == NULL, "Should only have one StrongRootsScope active"); - assert(scope != NULL, "Illegal argument"); - _strong_roots_scope = scope; -} -void SharedHeap::unregister_strong_roots_scope(SharedHeap::StrongRootsScope* scope) { - assert(_strong_roots_scope == scope, "Wrong scope unregistered"); - _strong_roots_scope = NULL; } void SharedHeap::change_strong_roots_parity() { @@ -135,174 +81,15 @@ void SharedHeap::change_strong_roots_parity() { } SharedHeap::StrongRootsScope::StrongRootsScope(SharedHeap* heap, bool activate) - : MarkScope(activate), _sh(heap), _n_workers_done_with_threads(0) + : MarkScope(activate), _sh(heap) { if (_active) { - _sh->register_strong_roots_scope(this); _sh->change_strong_roots_parity(); // Zero the claimed high water mark in the StringTable StringTable::clear_parallel_claimed_index(); } } -SharedHeap::StrongRootsScope::~StrongRootsScope() { - if (_active) { - _sh->unregister_strong_roots_scope(this); - } -} - -Monitor* SharedHeap::StrongRootsScope::_lock = new Monitor(Mutex::leaf, "StrongRootsScope lock", false, Monitor::_safepoint_check_never); - -void SharedHeap::StrongRootsScope::mark_worker_done_with_threads(uint n_workers) { - // The Thread work barrier is only needed by G1 Class Unloading. - // No need to use the barrier if this is single-threaded code. - if (UseG1GC && ClassUnloadingWithConcurrentMark && n_workers > 0) { - uint new_value = (uint)Atomic::add(1, &_n_workers_done_with_threads); - if (new_value == n_workers) { - // This thread is last. Notify the others. - MonitorLockerEx ml(_lock, Mutex::_no_safepoint_check_flag); - _lock->notify_all(); - } - } -} - -void SharedHeap::StrongRootsScope::wait_until_all_workers_done_with_threads(uint n_workers) { - assert(UseG1GC, "Currently only used by G1"); - assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); - - // No need to use the barrier if this is single-threaded code. - if (n_workers > 0 && (uint)_n_workers_done_with_threads != n_workers) { - MonitorLockerEx ml(_lock, Mutex::_no_safepoint_check_flag); - while ((uint)_n_workers_done_with_threads != n_workers) { - _lock->wait(Mutex::_no_safepoint_check_flag, 0, false); - } - } -} - -void SharedHeap::process_roots(bool activate_scope, - ScanningOption so, - OopClosure* strong_roots, - OopClosure* weak_roots, - CLDClosure* strong_cld_closure, - CLDClosure* weak_cld_closure, - CodeBlobClosure* code_roots) { - StrongRootsScope srs(this, activate_scope); - - // General roots. - assert(_strong_roots_parity != 0, "must have called prologue code"); - assert(code_roots != NULL, "code root closure should always be set"); - // _n_termination for _process_strong_tasks should be set up stream - // in a method not running in a GC worker. Otherwise the GC worker - // could be trying to change the termination condition while the task - // is executing in another GC worker. - - // Iterating over the CLDG and the Threads are done early to allow G1 to - // first process the strong CLDs and nmethods and then, after a barrier, - // let the thread process the weak CLDs and nmethods. - - if (!_process_strong_tasks->is_task_claimed(SH_PS_ClassLoaderDataGraph_oops_do)) { - ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure); - } - - // Some CLDs contained in the thread frames should be considered strong. - // Don't process them if they will be processed during the ClassLoaderDataGraph phase. - CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL; - // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway - CodeBlobClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots; - - Threads::possibly_parallel_oops_do(strong_roots, roots_from_clds_p, roots_from_code_p); - - // This is the point where this worker thread will not find more strong CLDs/nmethods. - // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing. - active_strong_roots_scope()->mark_worker_done_with_threads(n_par_threads()); - - if (!_process_strong_tasks->is_task_claimed(SH_PS_Universe_oops_do)) { - Universe::oops_do(strong_roots); - } - // Global (strong) JNI handles - if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do)) - JNIHandles::oops_do(strong_roots); - - if (!_process_strong_tasks-> is_task_claimed(SH_PS_ObjectSynchronizer_oops_do)) - ObjectSynchronizer::oops_do(strong_roots); - if (!_process_strong_tasks->is_task_claimed(SH_PS_FlatProfiler_oops_do)) - FlatProfiler::oops_do(strong_roots); - if (!_process_strong_tasks->is_task_claimed(SH_PS_Management_oops_do)) - Management::oops_do(strong_roots); - if (!_process_strong_tasks->is_task_claimed(SH_PS_jvmti_oops_do)) - JvmtiExport::oops_do(strong_roots); - - if (!_process_strong_tasks->is_task_claimed(SH_PS_SystemDictionary_oops_do)) { - SystemDictionary::roots_oops_do(strong_roots, weak_roots); - } - - // All threads execute the following. A specific chunk of buckets - // from the StringTable are the individual tasks. - if (weak_roots != NULL) { - if (CollectedHeap::use_parallel_gc_threads()) { - StringTable::possibly_parallel_oops_do(weak_roots); - } else { - StringTable::oops_do(weak_roots); - } - } - - if (!_process_strong_tasks->is_task_claimed(SH_PS_CodeCache_oops_do)) { - if (so & SO_ScavengeCodeCache) { - assert(code_roots != NULL, "must supply closure for code cache"); - - // We only visit parts of the CodeCache when scavenging. - CodeCache::scavenge_root_nmethods_do(code_roots); - } - if (so & SO_AllCodeCache) { - assert(code_roots != NULL, "must supply closure for code cache"); - - // CMSCollector uses this to do intermediate-strength collections. - // We scan the entire code cache, since CodeCache::do_unloading is not called. - CodeCache::blobs_do(code_roots); - } - // Verify that the code cache contents are not subject to - // movement by a scavenging collection. - DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, !CodeBlobToOopClosure::FixRelocations)); - DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable)); - } - - _process_strong_tasks->all_tasks_completed(); -} - -void SharedHeap::process_all_roots(bool activate_scope, - ScanningOption so, - OopClosure* roots, - CLDClosure* cld_closure, - CodeBlobClosure* code_closure) { - process_roots(activate_scope, so, - roots, roots, - cld_closure, cld_closure, - code_closure); -} - -void SharedHeap::process_strong_roots(bool activate_scope, - ScanningOption so, - OopClosure* roots, - CLDClosure* cld_closure, - CodeBlobClosure* code_closure) { - process_roots(activate_scope, so, - roots, NULL, - cld_closure, NULL, - code_closure); -} - - -class AlwaysTrueClosure: public BoolObjectClosure { -public: - bool do_object_b(oop p) { return true; } -}; -static AlwaysTrueClosure always_true; - -void SharedHeap::process_weak_roots(OopClosure* root_closure) { - // Global (weak) JNI handles - JNIHandles::weak_oops_do(&always_true, root_closure); -} - void SharedHeap::set_barrier_set(BarrierSet* bs) { _barrier_set = bs; // Cached barrier set for fast access in oops diff --git a/hotspot/src/share/vm/memory/sharedHeap.hpp b/hotspot/src/share/vm/memory/sharedHeap.hpp index 91735f1cdaa..80717520249 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.hpp +++ b/hotspot/src/share/vm/memory/sharedHeap.hpp @@ -61,18 +61,18 @@ class KlassClosure; // counts the number of tasks that have been done and then reset // the SubTasksDone so that it can be used again. When the number of // tasks is set to the number of GC workers, then _n_threads must -// be set to the number of active GC workers. G1CollectedHeap, -// HRInto_G1RemSet, GenCollectedHeap and SharedHeap have SubTasksDone. -// This seems too many. +// be set to the number of active GC workers. G1RootProcessor and +// GenCollectedHeap have SubTasksDone. // 3) SequentialSubTasksDone has an _n_threads that is used in // a way similar to SubTasksDone and has the same dependency on the // number of active GC workers. CompactibleFreeListSpace and Space // have SequentialSubTasksDone's. -// Example of using SubTasksDone and SequentialSubTasksDone -// G1CollectedHeap::g1_process_roots() -// to SharedHeap::process_roots() and uses -// SubTasksDone* _process_strong_tasks to claim tasks. -// process_roots() calls +// +// Examples of using SubTasksDone and SequentialSubTasksDone: +// G1RootProcessor and GenCollectedHeap::process_roots() use +// SubTasksDone* _process_strong_tasks to claim tasks for workers +// +// GenCollectedHeap::gen_process_roots() calls // rem_set()->younger_refs_iterate() // to scan the card table and which eventually calls down into // CardTableModRefBS::par_non_clean_card_iterate_work(). This method @@ -104,10 +104,6 @@ class SharedHeap : public CollectedHeap { friend class VM_GC_Operation; friend class VM_CGC_Operation; -private: - // For claiming strong_roots tasks. - SubTasksDone* _process_strong_tasks; - protected: // There should be only a single instance of "SharedHeap" in a program. // This is enforced with the protected constructor below, which will also @@ -140,7 +136,6 @@ public: static SharedHeap* heap() { return _sh; } void set_barrier_set(BarrierSet* bs); - SubTasksDone* process_strong_tasks() { return _process_strong_tasks; } // Does operations required after initialization has been done. virtual void post_initialize(); @@ -193,69 +188,19 @@ public: // strong_roots_prologue calls change_strong_roots_parity, if // parallel tasks are enabled. class StrongRootsScope : public MarkingCodeBlobClosure::MarkScope { - // Used to implement the Thread work barrier. - static Monitor* _lock; - SharedHeap* _sh; - volatile jint _n_workers_done_with_threads; public: StrongRootsScope(SharedHeap* heap, bool activate = true); - ~StrongRootsScope(); - - // Mark that this thread is done with the Threads work. - void mark_worker_done_with_threads(uint n_workers); - // Wait until all n_workers are done with the Threads work. - void wait_until_all_workers_done_with_threads(uint n_workers); }; friend class StrongRootsScope; - // The current active StrongRootScope - StrongRootsScope* _strong_roots_scope; - - StrongRootsScope* active_strong_roots_scope() const; - private: - void register_strong_roots_scope(StrongRootsScope* scope); - void unregister_strong_roots_scope(StrongRootsScope* scope); void change_strong_roots_parity(); public: - enum ScanningOption { - SO_None = 0x0, - SO_AllCodeCache = 0x8, - SO_ScavengeCodeCache = 0x10 - }; - FlexibleWorkGang* workers() const { return _workers; } - // Invoke the "do_oop" method the closure "roots" on all root locations. - // The "so" argument determines which roots the closure is applied to: - // "SO_None" does none; - // "SO_AllCodeCache" applies the closure to all elements of the CodeCache. - // "SO_ScavengeCodeCache" applies the closure to elements on the scavenge root list in the CodeCache. - void process_roots(bool activate_scope, - ScanningOption so, - OopClosure* strong_roots, - OopClosure* weak_roots, - CLDClosure* strong_cld_closure, - CLDClosure* weak_cld_closure, - CodeBlobClosure* code_roots); - void process_all_roots(bool activate_scope, - ScanningOption so, - OopClosure* roots, - CLDClosure* cld_closure, - CodeBlobClosure* code_roots); - void process_strong_roots(bool activate_scope, - ScanningOption so, - OopClosure* roots, - CLDClosure* cld_closure, - CodeBlobClosure* code_roots); - - - // Apply "root_closure" to the JNI weak roots.. - void process_weak_roots(OopClosure* root_closure); - // The functions below are helper functions that a subclass of // "SharedHeap" can use in the implementation of its virtual // functions. @@ -270,9 +215,6 @@ public: // (such as process roots) subsequently. virtual void set_par_threads(uint t); - int n_termination(); - void set_n_termination(int t); - // // New methods from CollectedHeap // @@ -284,8 +226,4 @@ public: size_t capacity); }; -inline SharedHeap::ScanningOption operator|(SharedHeap::ScanningOption so0, SharedHeap::ScanningOption so1) { - return static_cast(static_cast(so0) | static_cast(so1)); -} - #endif // SHARE_VM_MEMORY_SHAREDHEAP_HPP From 8c7781ec72f45ff7b77dbabba37be4d13c244c46 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Thu, 19 Mar 2015 15:25:54 +0100 Subject: [PATCH 012/101] 8027962: Per-phase timing measurements for strong roots processing Reviewed-by: tschatzl, ecaspole --- .../gc_implementation/g1/g1GCPhaseTimes.cpp | 21 +- .../gc_implementation/g1/g1GCPhaseTimes.hpp | 14 + .../gc_implementation/g1/g1RootProcessor.cpp | 131 ++++++--- .../gc_implementation/g1/g1RootProcessor.hpp | 9 +- hotspot/test/gc/g1/TestGCLogMessages.java | 278 ++++++++++-------- 5 files changed, 281 insertions(+), 172 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp index 07b45338d9b..24379ffd5b8 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp @@ -249,7 +249,24 @@ G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) : _gc_par_phases[GCWorkerStart] = new WorkerDataArray(max_gc_threads, "GC Worker Start (ms)", false, G1Log::LevelFiner, 2); _gc_par_phases[ExtRootScan] = new WorkerDataArray(max_gc_threads, "Ext Root Scanning (ms)", true, G1Log::LevelFiner, 2); - _gc_par_phases[SATBFiltering] = new WorkerDataArray(max_gc_threads, "SATB Filtering (ms)", true, G1Log::LevelFiner, 2); + + // Root scanning phases + _gc_par_phases[ThreadRoots] = new WorkerDataArray(max_gc_threads, "Thread Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[StringTableRoots] = new WorkerDataArray(max_gc_threads, "StringTable Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[UniverseRoots] = new WorkerDataArray(max_gc_threads, "Universe Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[JNIRoots] = new WorkerDataArray(max_gc_threads, "JNI Handles Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray(max_gc_threads, "ObjectSynchronizer Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[FlatProfilerRoots] = new WorkerDataArray(max_gc_threads, "FlatProfiler Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[ManagementRoots] = new WorkerDataArray(max_gc_threads, "Management Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray(max_gc_threads, "SystemDictionary Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[CLDGRoots] = new WorkerDataArray(max_gc_threads, "CLDG Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[JVMTIRoots] = new WorkerDataArray(max_gc_threads, "JVMTI Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[CodeCacheRoots] = new WorkerDataArray(max_gc_threads, "CodeCache Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[CMRefRoots] = new WorkerDataArray(max_gc_threads, "CM RefProcessor Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[WaitForStrongCLD] = new WorkerDataArray(max_gc_threads, "Wait For Strong CLD (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[WeakCLDRoots] = new WorkerDataArray(max_gc_threads, "Weak CLD Roots (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[SATBFiltering] = new WorkerDataArray(max_gc_threads, "SATB Filtering (ms)", true, G1Log::LevelFinest, 3); + _gc_par_phases[UpdateRS] = new WorkerDataArray(max_gc_threads, "Update RS (ms)", true, G1Log::LevelFiner, 2); _gc_par_phases[ScanRS] = new WorkerDataArray(max_gc_threads, "Scan RS (ms)", true, G1Log::LevelFiner, 2); _gc_par_phases[CodeRoots] = new WorkerDataArray(max_gc_threads, "Code Root Scanning (ms)", true, G1Log::LevelFiner, 2); @@ -282,8 +299,6 @@ void G1GCPhaseTimes::note_gc_start(uint active_gc_threads, bool mark_in_progress _gc_par_phases[i]->reset(); } - _gc_par_phases[SATBFiltering]->set_enabled(mark_in_progress); - _gc_par_phases[StringDedupQueueFixup]->set_enabled(G1StringDedup::is_enabled()); _gc_par_phases[StringDedupTableFixup]->set_enabled(G1StringDedup::is_enabled()); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp index 6eeb11c4dca..54165cafd3b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp @@ -41,6 +41,20 @@ class G1GCPhaseTimes : public CHeapObj { enum GCParPhases { GCWorkerStart, ExtRootScan, + ThreadRoots, + StringTableRoots, + UniverseRoots, + JNIRoots, + ObjectSynchronizerRoots, + FlatProfilerRoots, + ManagementRoots, + SystemDictionaryRoots, + CLDGRoots, + JVMTIRoots, + CodeCacheRoots, + CMRefRoots, + WaitForStrongCLD, + WeakCLDRoots, SATBFiltering, UpdateRS, ScanRS, diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp index 37d9dd7cad6..0a31dc72111 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp @@ -128,6 +128,7 @@ void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, uint worker_i) { // First scan the shared roots. double ext_roots_start = os::elapsedTime(); + G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times(); BufferingOopClosure buf_scan_non_heap_roots(scan_non_heap_roots); BufferingOopClosure buf_scan_non_heap_weak_roots(scan_non_heap_weak_roots); @@ -142,7 +143,9 @@ void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, trace_metadata ? scan_strong_clds : NULL, scan_strong_clds, trace_metadata ? NULL : scan_weak_clds, - &root_code_blobs); + &root_code_blobs, + phase_times, + worker_i); // This is the point where this worker thread will not find more strong CLDs/nmethods. // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing. @@ -150,24 +153,34 @@ void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, worker_has_discovered_all_strong_classes(); } - process_vm_roots(strong_roots, weak_roots); + process_vm_roots(strong_roots, weak_roots, phase_times, worker_i); - // Now the CM ref_processor roots. - if (!_process_strong_tasks->is_task_claimed(G1RP_PS_refProcessor_oops_do)) { - // We need to treat the discovered reference lists of the - // concurrent mark ref processor as roots and keep entries - // (which are added by the marking threads) on them live - // until they can be processed at the end of marking. - _g1h->ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots); + { + // Now the CM ref_processor roots. + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_refProcessor_oops_do)) { + // We need to treat the discovered reference lists of the + // concurrent mark ref processor as roots and keep entries + // (which are added by the marking threads) on them live + // until they can be processed at the end of marking. + _g1h->ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots); + } } if (trace_metadata) { - // Barrier to make sure all workers passed - // the strong CLD and strong nmethods phases. - wait_until_all_strong_classes_discovered(); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WaitForStrongCLD, worker_i); + // Barrier to make sure all workers passed + // the strong CLD and strong nmethods phases. + wait_until_all_strong_classes_discovered(); + } // Now take the complement of the strong CLDs. + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WeakCLDRoots, worker_i); ClassLoaderDataGraph::roots_cld_do(NULL, scan_weak_clds); + } else { + phase_times->record_time_secs(G1GCPhaseTimes::WaitForStrongCLD, worker_i, 0.0); + phase_times->record_time_secs(G1GCPhaseTimes::WeakCLDRoots, worker_i, 0.0); } // Finish up any enqueued closure apps (attributed as object copy time). @@ -177,7 +190,6 @@ void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds() + buf_scan_non_heap_weak_roots.closure_app_seconds(); - G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times(); phase_times->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec); double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec; @@ -201,8 +213,8 @@ void G1RootProcessor::process_strong_roots(OopClosure* oops, CLDClosure* clds, CodeBlobClosure* blobs) { - process_java_roots(oops, clds, clds, NULL, blobs); - process_vm_roots(oops, NULL); + process_java_roots(oops, clds, clds, NULL, blobs, NULL, 0); + process_vm_roots(oops, NULL, NULL, 0); _process_strong_tasks->all_tasks_completed(); } @@ -211,8 +223,8 @@ void G1RootProcessor::process_all_roots(OopClosure* oops, CLDClosure* clds, CodeBlobClosure* blobs) { - process_java_roots(oops, NULL, clds, clds, NULL); - process_vm_roots(oops, oops); + process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0); + process_vm_roots(oops, oops, NULL, 0); if (!_process_strong_tasks->is_task_claimed(G1RP_PS_CodeCache_oops_do)) { CodeCache::blobs_do(blobs); @@ -225,60 +237,95 @@ void G1RootProcessor::process_java_roots(OopClosure* strong_roots, CLDClosure* thread_stack_clds, CLDClosure* strong_clds, CLDClosure* weak_clds, - CodeBlobClosure* strong_code) { + CodeBlobClosure* strong_code, + G1GCPhaseTimes* phase_times, + uint worker_i) { assert(thread_stack_clds == NULL || weak_clds == NULL, "There is overlap between those, only one may be set"); // Iterating over the CLDG and the Threads are done early to allow us to // first process the strong CLDs and nmethods and then, after a barrier, // let the thread process the weak CLDs and nmethods. - - if (!_process_strong_tasks->is_task_claimed(G1RP_PS_ClassLoaderDataGraph_oops_do)) { - ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_ClassLoaderDataGraph_oops_do)) { + ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds); + } } - Threads::possibly_parallel_oops_do(strong_roots, thread_stack_clds, strong_code); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_i); + Threads::possibly_parallel_oops_do(strong_roots, thread_stack_clds, strong_code); + } } void G1RootProcessor::process_vm_roots(OopClosure* strong_roots, - OopClosure* weak_roots) { - - if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Universe_oops_do)) { - Universe::oops_do(strong_roots); + OopClosure* weak_roots, + G1GCPhaseTimes* phase_times, + uint worker_i) { + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Universe_oops_do)) { + Universe::oops_do(strong_roots); + } } - if (!_process_strong_tasks->is_task_claimed(G1RP_PS_JNIHandles_oops_do)) { - JNIHandles::oops_do(strong_roots); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_JNIHandles_oops_do)) { + JNIHandles::oops_do(strong_roots); + } } - if (!_process_strong_tasks-> is_task_claimed(G1RP_PS_ObjectSynchronizer_oops_do)) { - ObjectSynchronizer::oops_do(strong_roots); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_i); + if (!_process_strong_tasks-> is_task_claimed(G1RP_PS_ObjectSynchronizer_oops_do)) { + ObjectSynchronizer::oops_do(strong_roots); + } } - if (!_process_strong_tasks->is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) { - FlatProfiler::oops_do(strong_roots); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::FlatProfilerRoots, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) { + FlatProfiler::oops_do(strong_roots); + } } - if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Management_oops_do)) { - Management::oops_do(strong_roots); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Management_oops_do)) { + Management::oops_do(strong_roots); + } } - if (!_process_strong_tasks->is_task_claimed(G1RP_PS_jvmti_oops_do)) { - JvmtiExport::oops_do(strong_roots); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_jvmti_oops_do)) { + JvmtiExport::oops_do(strong_roots); + } } - if (!_process_strong_tasks->is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) { - SystemDictionary::roots_oops_do(strong_roots, weak_roots); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i); + if (!_process_strong_tasks->is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) { + SystemDictionary::roots_oops_do(strong_roots, weak_roots); + } } - // All threads execute the following. A specific chunk of buckets - // from the StringTable are the individual tasks. - if (weak_roots != NULL) { - StringTable::possibly_parallel_oops_do(weak_roots); + { + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::StringTableRoots, worker_i); + // All threads execute the following. A specific chunk of buckets + // from the StringTable are the individual tasks. + if (weak_roots != NULL) { + StringTable::possibly_parallel_oops_do(weak_roots); + } } } void G1RootProcessor::scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs, OopClosure* scan_non_heap_weak_roots, uint worker_i) { + G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times(); + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CodeCacheRoots, worker_i); + // Now scan the complement of the collection set. G1CodeBlobClosure scavenge_cs_nmethods(scan_non_heap_weak_roots); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp index 47c484b5294..ee7b00f22ae 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp @@ -32,6 +32,7 @@ class CLDClosure; class CodeBlobClosure; class G1CollectedHeap; +class G1GCPhaseTimes; class G1ParPushHeapRSClosure; class Monitor; class OopClosure; @@ -74,10 +75,14 @@ class G1RootProcessor : public StackObj { CLDClosure* thread_stack_clds, CLDClosure* scan_strong_clds, CLDClosure* scan_weak_clds, - CodeBlobClosure* scan_strong_code); + CodeBlobClosure* scan_strong_code, + G1GCPhaseTimes* phase_times, + uint worker_i); void process_vm_roots(OopClosure* scan_non_heap_roots, - OopClosure* scan_non_heap_weak_roots); + OopClosure* scan_non_heap_weak_roots, + G1GCPhaseTimes* phase_times, + uint worker_i); public: G1RootProcessor(G1CollectedHeap* g1h); diff --git a/hotspot/test/gc/g1/TestGCLogMessages.java b/hotspot/test/gc/g1/TestGCLogMessages.java index 938d17bfec4..5f3f8f347b6 100644 --- a/hotspot/test/gc/g1/TestGCLogMessages.java +++ b/hotspot/test/gc/g1/TestGCLogMessages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test TestGCLogMessages - * @bug 8035406 8027295 8035398 8019342 8027959 8048179 + * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 * @summary Ensure that the PrintGCDetails output for a minor GC with G1 * includes the expected necessary messages. * @key gc @@ -34,131 +34,159 @@ import com.oracle.java.testlibrary.ProcessTools; import com.oracle.java.testlibrary.OutputAnalyzer; public class TestGCLogMessages { - public static void main(String[] args) throws Exception { - testNormalLogs(); - testWithToSpaceExhaustionLogs(); - } - private static void testNormalLogs() throws Exception { - - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx10M", - GCTest.class.getName()); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - - output.shouldNotContain("[Redirty Cards"); - output.shouldNotContain("[Parallel Redirty"); - output.shouldNotContain("[Redirtied Cards"); - output.shouldNotContain("[Code Root Purge"); - output.shouldNotContain("[String Dedup Fixup"); - output.shouldNotContain("[Young Free CSet"); - output.shouldNotContain("[Non-Young Free CSet"); - output.shouldNotContain("[Humongous Register"); - output.shouldNotContain("[Humongous Reclaim"); - output.shouldHaveExitValue(0); - - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-XX:+UseStringDeduplication", - "-Xmx10M", - "-XX:+PrintGCDetails", - GCTest.class.getName()); - - output = new OutputAnalyzer(pb.start()); - - output.shouldContain("[Redirty Cards"); - output.shouldNotContain("[Parallel Redirty"); - output.shouldNotContain("[Redirtied Cards"); - output.shouldContain("[Code Root Purge"); - output.shouldContain("[String Dedup Fixup"); - output.shouldNotContain("[Young Free CSet"); - output.shouldNotContain("[Non-Young Free CSet"); - output.shouldContain("[Humongous Register"); - output.shouldNotContain("[Humongous Total"); - output.shouldNotContain("[Humongous Candidate"); - output.shouldContain("[Humongous Reclaim"); - output.shouldNotContain("[Humongous Reclaimed"); - output.shouldHaveExitValue(0); - - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-XX:+UseStringDeduplication", - "-Xmx10M", - "-XX:+PrintGCDetails", - "-XX:+UnlockExperimentalVMOptions", - "-XX:G1LogLevel=finest", - GCTest.class.getName()); - - output = new OutputAnalyzer(pb.start()); - - output.shouldContain("[Redirty Cards"); - output.shouldContain("[Parallel Redirty"); - output.shouldContain("[Redirtied Cards"); - output.shouldContain("[Code Root Purge"); - output.shouldContain("[String Dedup Fixup"); - output.shouldContain("[Young Free CSet"); - output.shouldContain("[Non-Young Free CSet"); - output.shouldContain("[Humongous Register"); - output.shouldContain("[Humongous Total"); - output.shouldContain("[Humongous Candidate"); - output.shouldContain("[Humongous Reclaim"); - output.shouldContain("[Humongous Reclaimed"); - output.shouldHaveExitValue(0); - } - - private static void testWithToSpaceExhaustionLogs() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx32M", - "-Xmn16M", - "-XX:+PrintGCDetails", - GCTestWithToSpaceExhaustion.class.getName()); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("[Evacuation Failure"); - output.shouldNotContain("[Recalculate Used"); - output.shouldNotContain("[Remove Self Forwards"); - output.shouldNotContain("[Restore RemSet"); - output.shouldHaveExitValue(0); - - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", - "-Xmx32M", - "-Xmn16M", - "-XX:+PrintGCDetails", - "-XX:+UnlockExperimentalVMOptions", - "-XX:G1LogLevel=finest", - GCTestWithToSpaceExhaustion.class.getName()); - - output = new OutputAnalyzer(pb.start()); - output.shouldContain("[Evacuation Failure"); - output.shouldContain("[Recalculate Used"); - output.shouldContain("[Remove Self Forwards"); - output.shouldContain("[Restore RemSet"); - output.shouldHaveExitValue(0); - } - - static class GCTest { - private static byte[] garbage; - public static void main(String [] args) { - System.out.println("Creating garbage"); - // create 128MB of garbage. This should result in at least one GC - for (int i = 0; i < 1024; i++) { - garbage = new byte[128 * 1024]; - } - System.out.println("Done"); + private enum Level { + OFF, FINER, FINEST; + public boolean lessOrEqualTo(Level other) { + return this.compareTo(other) < 0; + } } - } - static class GCTestWithToSpaceExhaustion { - private static byte[] garbage; - private static byte[] largeObject; - public static void main(String [] args) { - largeObject = new byte[16*1024*1024]; - System.out.println("Creating garbage"); - // create 128MB of garbage. This should result in at least one GC, - // some of them with to-space exhaustion. - for (int i = 0; i < 1024; i++) { - garbage = new byte[128 * 1024]; - } - System.out.println("Done"); + private class LogMessageWithLevel { + String message; + Level level; + + public LogMessageWithLevel(String message, Level level) { + this.message = message; + this.level = level; + } + }; + + private LogMessageWithLevel allLogMessages[] = new LogMessageWithLevel[] { + // Ext Root Scan + new LogMessageWithLevel("Thread Roots (ms)", Level.FINEST), + new LogMessageWithLevel("StringTable Roots (ms)", Level.FINEST), + new LogMessageWithLevel("Universe Roots (ms)", Level.FINEST), + new LogMessageWithLevel("JNI Handles Roots (ms)", Level.FINEST), + new LogMessageWithLevel("ObjectSynchronizer Roots (ms)", Level.FINEST), + new LogMessageWithLevel("FlatProfiler Roots", Level.FINEST), + new LogMessageWithLevel("Management Roots", Level.FINEST), + new LogMessageWithLevel("SystemDictionary Roots", Level.FINEST), + new LogMessageWithLevel("CLDG Roots", Level.FINEST), + new LogMessageWithLevel("JVMTI Roots", Level.FINEST), + new LogMessageWithLevel("CodeCache Roots", Level.FINEST), + new LogMessageWithLevel("SATB Filtering", Level.FINEST), + new LogMessageWithLevel("CM RefProcessor Roots", Level.FINEST), + new LogMessageWithLevel("Wait For Strong CLD", Level.FINEST), + new LogMessageWithLevel("Weak CLD Roots", Level.FINEST), + // Redirty Cards + new LogMessageWithLevel("Redirty Cards", Level.FINER), + new LogMessageWithLevel("Parallel Redirty", Level.FINEST), + new LogMessageWithLevel("Redirtied Cards", Level.FINEST), + // Misc Top-level + new LogMessageWithLevel("Code Root Purge", Level.FINER), + new LogMessageWithLevel("String Dedup Fixup", Level.FINER), + // Free CSet + new LogMessageWithLevel("Young Free CSet", Level.FINEST), + new LogMessageWithLevel("Non-Young Free CSet", Level.FINEST), + // Humongous Eager Reclaim + new LogMessageWithLevel("Humongous Reclaim", Level.FINER), + new LogMessageWithLevel("Humongous Register", Level.FINER), + }; + + void checkMessagesAtLevel(OutputAnalyzer output, LogMessageWithLevel messages[], Level level) throws Exception { + for (LogMessageWithLevel l : messages) { + if (level.lessOrEqualTo(l.level)) { + output.shouldNotContain(l.message); + } else { + output.shouldContain(l.message); + } + } + } + + public static void main(String[] args) throws Exception { + new TestGCLogMessages().testNormalLogs(); + new TestGCLogMessages().testWithToSpaceExhaustionLogs(); + } + + private void testNormalLogs() throws Exception { + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx10M", + GCTest.class.getName()); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + checkMessagesAtLevel(output, allLogMessages, Level.OFF); + output.shouldHaveExitValue(0); + + pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", + "-XX:+UseStringDeduplication", + "-Xmx10M", + "-XX:+PrintGCDetails", + GCTest.class.getName()); + + output = new OutputAnalyzer(pb.start()); + checkMessagesAtLevel(output, allLogMessages, Level.FINER); + + pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", + "-XX:+UseStringDeduplication", + "-Xmx10M", + "-XX:+PrintGCDetails", + "-XX:+UnlockExperimentalVMOptions", + "-XX:G1LogLevel=finest", + GCTest.class.getName()); + + output = new OutputAnalyzer(pb.start()); + checkMessagesAtLevel(output, allLogMessages, Level.FINEST); + output.shouldHaveExitValue(0); + } + + LogMessageWithLevel exhFailureMessages[] = new LogMessageWithLevel[] { + new LogMessageWithLevel("Evacuation Failure", Level.FINER), + new LogMessageWithLevel("Recalculate Used", Level.FINEST), + new LogMessageWithLevel("Remove Self Forwards", Level.FINEST), + new LogMessageWithLevel("Restore RemSet", Level.FINEST), + }; + + private void testWithToSpaceExhaustionLogs() throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx32M", + "-Xmn16M", + "-XX:+PrintGCDetails", + GCTestWithToSpaceExhaustion.class.getName()); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + checkMessagesAtLevel(output, exhFailureMessages, Level.FINER); + output.shouldHaveExitValue(0); + + pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx32M", + "-Xmn16M", + "-XX:+PrintGCDetails", + "-XX:+UnlockExperimentalVMOptions", + "-XX:G1LogLevel=finest", + GCTestWithToSpaceExhaustion.class.getName()); + + output = new OutputAnalyzer(pb.start()); + checkMessagesAtLevel(output, exhFailureMessages, Level.FINEST); + output.shouldHaveExitValue(0); + } + + static class GCTest { + private static byte[] garbage; + public static void main(String [] args) { + System.out.println("Creating garbage"); + // create 128MB of garbage. This should result in at least one GC + for (int i = 0; i < 1024; i++) { + garbage = new byte[128 * 1024]; + } + System.out.println("Done"); + } + } + + static class GCTestWithToSpaceExhaustion { + private static byte[] garbage; + private static byte[] largeObject; + public static void main(String [] args) { + largeObject = new byte[16*1024*1024]; + System.out.println("Creating garbage"); + // create 128MB of garbage. This should result in at least one GC, + // some of them with to-space exhaustion. + for (int i = 0; i < 1024; i++) { + garbage = new byte[128 * 1024]; + } + System.out.println("Done"); + } } - } } + From 67fb17a6588c430ccc52d6117d937fade56dab0c Mon Sep 17 00:00:00 2001 From: Joseph Provino Date: Mon, 23 Mar 2015 12:18:20 +0100 Subject: [PATCH 013/101] 8067891: Remove vestigal G1SATBCT barrier set kind Remove all case statements specifying G1SATBCT Reviewed-by: tschatzl, kbarrett --- hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp | 4 +--- hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp | 3 +-- hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp | 2 -- hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp | 1 - hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp | 2 -- hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp | 3 +-- hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp | 2 -- hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp | 2 -- hotspot/src/cpu/x86/vm/templateTable_x86.cpp | 1 - hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 2 -- hotspot/src/share/vm/opto/graphKit.cpp | 3 --- 11 files changed, 3 insertions(+), 22 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp index 6663c7fffbf..7e70f8d7754 100644 --- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -673,7 +673,6 @@ class StubGenerator: public StubCodeGenerator { void gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) { BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: // With G1, don't generate the call if we statically know that the target in uninitialized if (!dest_uninitialized) { @@ -719,7 +718,6 @@ class StubGenerator: public StubCodeGenerator { assert_different_registers(start, end, scratch); BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { diff --git a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp index 041d9958897..19b0b3759aa 100644 --- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -150,7 +150,6 @@ static void do_oop_store(InterpreterMacroAssembler* _masm, assert(val == noreg || val == r0, "parameter is just for looks"); switch (barrier) { #if INCLUDE_ALL_GCS - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { // flatten object address if needed diff --git a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp index 6c085197515..c7a9d06627d 100644 --- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp @@ -608,7 +608,6 @@ class StubGenerator: public StubCodeGenerator { void gen_write_ref_array_pre_barrier(Register from, Register to, Register count, bool dest_uninitialized, Register Rtmp1) { BarrierSet* const bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: // With G1, don't generate the call if we statically know that the target in uninitialized if (!dest_uninitialized) { @@ -665,7 +664,6 @@ class StubGenerator: public StubCodeGenerator { BarrierSet* const bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { if (branchToEnd) { diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp index 70d1420022d..a6505333fc6 100644 --- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp @@ -66,7 +66,6 @@ static void do_oop_store(InterpreterMacroAssembler* _masm, switch (barrier) { #if INCLUDE_ALL_GCS - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { // Load and record the previous value. diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp index 196bc8d4840..2fffa66159f 100644 --- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp @@ -957,7 +957,6 @@ class StubGenerator: public StubCodeGenerator { void gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) { BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: // With G1, don't generate the call if we statically know that the target in uninitialized if (!dest_uninitialized) { @@ -1005,7 +1004,6 @@ class StubGenerator: public StubCodeGenerator { BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { // Get some new fresh output registers. diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index fe58233ced1..342f69b49ca 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,7 +56,6 @@ static void do_oop_store(InterpreterMacroAssembler* _masm, assert(index == noreg || offset == 0, "only one offset"); switch (barrier) { #if INCLUDE_ALL_GCS - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { // Load and record the previous value. diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp index 086ac2f2ba6..3d8370f2c5e 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp @@ -706,7 +706,6 @@ class StubGenerator: public StubCodeGenerator { assert_different_registers(start, count); BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: // With G1, don't generate the call if we statically know that the target in uninitialized if (!uninitialized_target) { @@ -739,7 +738,6 @@ class StubGenerator: public StubCodeGenerator { BarrierSet* bs = Universe::heap()->barrier_set(); assert_different_registers(start, count); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { __ pusha(); // push registers diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index 7f6dbc83847..122f94b5d20 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -1207,7 +1207,6 @@ class StubGenerator: public StubCodeGenerator { void gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) { BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: // With G1, don't generate the call if we statically know that the target in uninitialized if (!dest_uninitialized) { @@ -1252,7 +1251,6 @@ class StubGenerator: public StubCodeGenerator { assert_different_registers(start, count, scratch); BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { __ pusha(); // push registers (overkill) diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86.cpp index 7b6696efeed..f43903c7ae4 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86.cpp @@ -156,7 +156,6 @@ static void do_oop_store(InterpreterMacroAssembler* _masm, assert(val == noreg || val == rax, "parameter is just for looks"); switch (barrier) { #if INCLUDE_ALL_GCS - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { // flatten object address if needed diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index ea745dd60f1..d040ccadd6b 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -1421,7 +1421,6 @@ void LIRGenerator::pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, // Do the pre-write barrier, if any. switch (_bs->kind()) { #if INCLUDE_ALL_GCS - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: G1SATBCardTableModRef_pre_barrier(addr_opr, pre_val, do_load, patch, info); break; @@ -1442,7 +1441,6 @@ void LIRGenerator::pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, void LIRGenerator::post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) { switch (_bs->kind()) { #if INCLUDE_ALL_GCS - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: G1SATBCardTableModRef_post_barrier(addr, new_val); break; diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index 5a90b50f71b..d2bf7b4abac 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -1518,7 +1518,6 @@ void GraphKit::pre_barrier(bool do_load, BarrierSet* bs = Universe::heap()->barrier_set(); set_control(ctl); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt); break; @@ -1537,7 +1536,6 @@ void GraphKit::pre_barrier(bool do_load, bool GraphKit::can_move_pre_barrier() const { BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: return true; // Can move it if no safepoint @@ -1563,7 +1561,6 @@ void GraphKit::post_barrier(Node* ctl, BarrierSet* bs = Universe::heap()->barrier_set(); set_control(ctl); switch (bs->kind()) { - case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise); break; From 9f7fa061c53849fe3de4b14d5c659a1bbe33da65 Mon Sep 17 00:00:00 2001 From: Stefan Johansson Date: Mon, 2 Mar 2015 11:08:09 +0100 Subject: [PATCH 014/101] 8073944: Simplify ArgumentsExt and remove unneeded functionallity Reviewed-by: kbarrett, dholmes --- hotspot/src/share/vm/runtime/arguments.cpp | 8 ++++---- hotspot/src/share/vm/runtime/arguments.hpp | 7 +------ hotspot/src/share/vm/runtime/arguments_ext.hpp | 10 ---------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index f50ed30938b..d14cf2cc030 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1612,7 +1612,7 @@ void Arguments::select_gc_ergonomically() { void Arguments::select_gc() { if (!gc_selected()) { - ArgumentsExt::select_gc_ergonomically(); + select_gc_ergonomically(); } } @@ -2121,7 +2121,7 @@ bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_hea } // Check consistency of GC selection -bool Arguments::check_gc_consistency_user() { +bool Arguments::check_gc_consistency() { check_gclog_consistency(); // Ensure that the user has not selected conflicting sets // of collectors. @@ -2265,7 +2265,7 @@ bool Arguments::check_vm_args_consistency() { FLAG_SET_DEFAULT(UseGCOverheadLimit, false); } - status = status && check_gc_consistency_user(); + status = status && check_gc_consistency(); status = status && check_stack_pages(); status = status && verify_percentage(CMSIncrementalSafetyFactor, @@ -3900,7 +3900,7 @@ jint Arguments::apply_ergo() { set_shared_spaces_flags(); // Check the GC selections again. - if (!ArgumentsExt::check_gc_consistency_ergo()) { + if (!check_gc_consistency()) { return JNI_EINVAL; } diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp index 44831dc359c..1fb5e8c6739 100644 --- a/hotspot/src/share/vm/runtime/arguments.hpp +++ b/hotspot/src/share/vm/runtime/arguments.hpp @@ -477,8 +477,7 @@ class Arguments : AllStatic { static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio); // Check for consistency in the selection of the garbage collector. - static bool check_gc_consistency_user(); // Check user-selected gc - static inline bool check_gc_consistency_ergo(); // Check ergonomic-selected gc + static bool check_gc_consistency(); // Check user-selected gc static void check_deprecated_gc_flags(); // Check consistency or otherwise of VM argument settings static bool check_vm_args_consistency(); @@ -618,10 +617,6 @@ bool Arguments::gc_selected() { return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC || UseSerialGC; } -bool Arguments::check_gc_consistency_ergo() { - return check_gc_consistency_user(); -} - // Disable options not supported in this release, with a warning if they // were explicitly requested on the command-line #define UNSUPPORTED_OPTION(opt, description) \ diff --git a/hotspot/src/share/vm/runtime/arguments_ext.hpp b/hotspot/src/share/vm/runtime/arguments_ext.hpp index 9c716bc6581..a43a4b908cc 100644 --- a/hotspot/src/share/vm/runtime/arguments_ext.hpp +++ b/hotspot/src/share/vm/runtime/arguments_ext.hpp @@ -30,9 +30,7 @@ class ArgumentsExt: AllStatic { public: - static inline void select_gc_ergonomically(); static inline void set_gc_specific_flags(); - static inline bool check_gc_consistency_ergo(); // The argument processing extension. Returns true if there is // no additional parsing needed in Arguments::parse() for the option. // Otherwise returns false. @@ -40,16 +38,8 @@ public: static inline void report_unsupported_options() { } }; -void ArgumentsExt::select_gc_ergonomically() { - Arguments::select_gc_ergonomically(); -} - void ArgumentsExt::set_gc_specific_flags() { Arguments::set_gc_specific_flags(); } -bool ArgumentsExt::check_gc_consistency_ergo() { - return Arguments::check_gc_consistency_ergo(); -} - #endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP From c1bc0a31b243a49334d89e563349697b74917e11 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Tue, 3 Mar 2015 18:01:27 +0100 Subject: [PATCH 015/101] 8074459: Flags handling memory sizes should be of type size_t Changed the type to size_t for flags that handles memory sizes Reviewed-by: kbarrett, tschatzl --- hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp | 8 +- hotspot/src/cpu/ppc/vm/globals_ppc.hpp | 4 +- hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp | 8 +- hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp | 8 +- hotspot/src/cpu/sparc/vm/globals_sparc.hpp | 4 +- hotspot/src/cpu/x86/vm/c1_globals_x86.hpp | 64 ++++++------ hotspot/src/cpu/x86/vm/c2_globals_x86.hpp | 12 +-- hotspot/src/cpu/x86/vm/globals_x86.hpp | 2 +- hotspot/src/cpu/zero/vm/globals_zero.hpp | 4 +- .../src/cpu/zero/vm/shark_globals_zero.hpp | 6 +- .../src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp | 6 +- .../src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp | 6 +- .../os_cpu/bsd_zero/vm/globals_bsd_zero.hpp | 6 +- .../os_cpu/linux_ppc/vm/globals_linux_ppc.hpp | 6 +- .../linux_sparc/vm/globals_linux_sparc.hpp | 6 +- .../os_cpu/linux_x86/vm/globals_linux_x86.hpp | 6 +- .../linux_zero/vm/globals_linux_zero.hpp | 6 +- .../vm/globals_solaris_sparc.hpp | 8 +- .../solaris_x86/vm/globals_solaris_x86.hpp | 8 +- .../windows_x86/vm/globals_windows_x86.hpp | 6 +- .../compactibleFreeListSpace.cpp | 4 +- .../gc_implementation/g1/concurrentMark.cpp | 24 ++--- .../g1/g1CollectorPolicy.cpp | 4 +- .../vm/gc_implementation/g1/g1RemSet.cpp | 6 +- .../vm/gc_implementation/g1/g1_globals.hpp | 12 +-- .../vm/gc_implementation/g1/heapRegion.cpp | 8 +- .../shared/vmGCOperations.cpp | 2 +- .../src/share/vm/memory/collectorPolicy.cpp | 90 ++++++++--------- hotspot/src/share/vm/memory/metaspace.cpp | 2 +- .../src/share/vm/memory/metaspaceShared.cpp | 4 +- hotspot/src/share/vm/prims/jvm.cpp | 2 +- hotspot/src/share/vm/runtime/arguments.cpp | 78 +++++++-------- hotspot/src/share/vm/runtime/arguments.hpp | 4 +- hotspot/src/share/vm/runtime/globals.hpp | 98 +++++++++---------- hotspot/src/share/vm/runtime/handles.cpp | 4 +- hotspot/src/share/vm/services/heapDumper.cpp | 2 +- hotspot/src/share/vm/utilities/debug.cpp | 2 +- hotspot/src/share/vm/utilities/ostream.hpp | 4 +- 38 files changed, 267 insertions(+), 267 deletions(-) diff --git a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp index f031c8abfd2..3b4b9e3660b 100644 --- a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -49,7 +49,7 @@ define_pd_global(intx, FreqInlineSize, 175); define_pd_global(intx, MinJumpTableSize, 10); define_pd_global(intx, INTPRESSURE, 25); define_pd_global(intx, InteriorEntryAlignment, 16); -define_pd_global(intx, NewSizeThreadIncrease, ScaleForWordSize(4*K)); +define_pd_global(size_t, NewSizeThreadIncrease, ScaleForWordSize(4*K)); define_pd_global(intx, RegisterCostAreaRatio, 16000); define_pd_global(bool, UseTLAB, true); define_pd_global(bool, ResizeTLAB, true); @@ -85,14 +85,14 @@ define_pd_global(intx, NonNMethodCodeHeapSize, 5*M ); define_pd_global(intx, CodeCacheExpansionSize, 64*K); // Ergonomics related flags -define_pd_global(uint64_t,MaxRAM, 4ULL*G); +define_pd_global(uint64_t, MaxRAM, 4ULL*G); define_pd_global(uintx, CodeCacheMinBlockLength, 4); define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); define_pd_global(bool, TrapBasedRangeChecks, true); // Heap related flags -define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M)); +define_pd_global(size_t, MetaspaceSize, ScaleForWordSize(16*M)); // Ergonomics related flags define_pd_global(bool, NeverActAsServerClassMachine, false); diff --git a/hotspot/src/cpu/ppc/vm/globals_ppc.hpp b/hotspot/src/cpu/ppc/vm/globals_ppc.hpp index 36bdf7325a5..f2391d251eb 100644 --- a/hotspot/src/cpu/ppc/vm/globals_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/globals_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2013 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -56,7 +56,7 @@ define_pd_global(bool, RewriteFrequentPairs, true); define_pd_global(bool, UseMembar, false); // GC Ergo Flags -define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // Default max size of CMS young gen, per GC worker thread. +define_pd_global(size_t, CMSYoungGenPerWorker, 16*M); // Default max size of CMS young gen, per GC worker thread. define_pd_global(uintx, TypeProfileLevel, 0); diff --git a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp index b3f070950e0..85021bc6933 100644 --- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,10 +53,10 @@ define_pd_global(intx, NonNMethodCodeHeapSize, 5*M ); define_pd_global(intx, CodeCacheExpansionSize, 32*K ); define_pd_global(uintx, CodeCacheMinBlockLength, 1); define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); -define_pd_global(uintx, MetaspaceSize, 12*M ); +define_pd_global(size_t, MetaspaceSize, 12*M ); define_pd_global(bool, NeverActAsServerClassMachine, true ); -define_pd_global(intx, NewSizeThreadIncrease, 16*K ); -define_pd_global(uint64_t,MaxRAM, 1ULL*G); +define_pd_global(size_t, NewSizeThreadIncrease, 16*K ); +define_pd_global(uint64_t, MaxRAM, 1ULL*G); define_pd_global(intx, InitialCodeCacheSize, 160*K); #endif // !TIERED diff --git a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp index f8658f88dac..3fc18fa4dd0 100644 --- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ define_pd_global(intx, FLOATPRESSURE, 52); // C2 on V9 gets to u define_pd_global(intx, FreqInlineSize, 175); define_pd_global(intx, INTPRESSURE, 48); // large register set define_pd_global(intx, InteriorEntryAlignment, 16); // = CodeEntryAlignment -define_pd_global(intx, NewSizeThreadIncrease, ScaleForWordSize(4*K)); +define_pd_global(size_t, NewSizeThreadIncrease, ScaleForWordSize(4*K)); define_pd_global(intx, RegisterCostAreaRatio, 12000); define_pd_global(bool, UseTLAB, true); define_pd_global(bool, ResizeTLAB, true); @@ -90,7 +90,7 @@ define_pd_global(intx, ProfiledCodeHeapSize, 14*M); define_pd_global(intx, NonNMethodCodeHeapSize, 5*M ); define_pd_global(intx, CodeCacheExpansionSize, 32*K); // Ergonomics related flags -define_pd_global(uint64_t,MaxRAM, 4ULL*G); +define_pd_global(uint64_t, MaxRAM, 4ULL*G); #endif define_pd_global(uintx, CodeCacheMinBlockLength, 4); define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); @@ -98,7 +98,7 @@ define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); define_pd_global(bool, TrapBasedRangeChecks, false); // Not needed on sparc. // Heap related flags -define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M)); +define_pd_global(size_t, MetaspaceSize, ScaleForWordSize(16*M)); // Ergonomics related flags define_pd_global(bool, NeverActAsServerClassMachine, false); diff --git a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp index 95f731abe3b..2873f441f9d 100644 --- a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,7 +75,7 @@ define_pd_global(bool, RewriteFrequentPairs, true); define_pd_global(bool, UseMembar, false); // GC Ergo Flags -define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread +define_pd_global(size_t, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread define_pd_global(uintx, TypeProfileLevel, 0); diff --git a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp index 56516849e1a..2935a24d306 100644 --- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,39 +32,39 @@ // (see c1_globals.hpp) #ifndef TIERED -define_pd_global(bool, BackgroundCompilation, true ); -define_pd_global(bool, UseTLAB, true ); -define_pd_global(bool, ResizeTLAB, true ); -define_pd_global(bool, InlineIntrinsics, true ); -define_pd_global(bool, PreferInterpreterNativeStubs, false); -define_pd_global(bool, ProfileTraps, false); -define_pd_global(bool, UseOnStackReplacement, true ); -define_pd_global(bool, TieredCompilation, false); -define_pd_global(intx, CompileThreshold, 1500 ); +define_pd_global(bool, BackgroundCompilation, true ); +define_pd_global(bool, UseTLAB, true ); +define_pd_global(bool, ResizeTLAB, true ); +define_pd_global(bool, InlineIntrinsics, true ); +define_pd_global(bool, PreferInterpreterNativeStubs, false); +define_pd_global(bool, ProfileTraps, false); +define_pd_global(bool, UseOnStackReplacement, true ); +define_pd_global(bool, TieredCompilation, false); +define_pd_global(intx, CompileThreshold, 1500 ); -define_pd_global(intx, OnStackReplacePercentage, 933 ); -define_pd_global(intx, FreqInlineSize, 325 ); -define_pd_global(intx, NewSizeThreadIncrease, 4*K ); -define_pd_global(intx, InitialCodeCacheSize, 160*K); -define_pd_global(intx, ReservedCodeCacheSize, 32*M ); -define_pd_global(intx, NonProfiledCodeHeapSize, 13*M ); -define_pd_global(intx, ProfiledCodeHeapSize, 14*M ); -define_pd_global(intx, NonNMethodCodeHeapSize, 5*M ); -define_pd_global(bool, ProfileInterpreter, false); -define_pd_global(intx, CodeCacheExpansionSize, 32*K ); -define_pd_global(uintx, CodeCacheMinBlockLength, 1); -define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); -define_pd_global(uintx, MetaspaceSize, 12*M ); -define_pd_global(bool, NeverActAsServerClassMachine, true ); -define_pd_global(uint64_t,MaxRAM, 1ULL*G); -define_pd_global(bool, CICompileOSR, true ); +define_pd_global(intx, OnStackReplacePercentage, 933 ); +define_pd_global(intx, FreqInlineSize, 325 ); +define_pd_global(size_t, NewSizeThreadIncrease, 4*K ); +define_pd_global(intx, InitialCodeCacheSize, 160*K); +define_pd_global(intx, ReservedCodeCacheSize, 32*M ); +define_pd_global(intx, NonProfiledCodeHeapSize, 13*M ); +define_pd_global(intx, ProfiledCodeHeapSize, 14*M ); +define_pd_global(intx, NonNMethodCodeHeapSize, 5*M ); +define_pd_global(bool, ProfileInterpreter, false); +define_pd_global(intx, CodeCacheExpansionSize, 32*K ); +define_pd_global(uintx, CodeCacheMinBlockLength, 1 ); +define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); +define_pd_global(size_t, MetaspaceSize, 12*M ); +define_pd_global(bool, NeverActAsServerClassMachine, true ); +define_pd_global(uint64_t, MaxRAM, 1ULL*G); +define_pd_global(bool, CICompileOSR, true ); #endif // !TIERED -define_pd_global(bool, UseTypeProfile, false); -define_pd_global(bool, RoundFPResults, true ); +define_pd_global(bool, UseTypeProfile, false); +define_pd_global(bool, RoundFPResults, true ); -define_pd_global(bool, LIRFillDelaySlots, false); -define_pd_global(bool, OptimizeSinglePrecision, true ); -define_pd_global(bool, CSEArrayLength, false); -define_pd_global(bool, TwoOperandLIRForm, true ); +define_pd_global(bool, LIRFillDelaySlots, false); +define_pd_global(bool, OptimizeSinglePrecision, true ); +define_pd_global(bool, CSEArrayLength, false); +define_pd_global(bool, TwoOperandLIRForm, true ); #endif // CPU_X86_VM_C1_GLOBALS_X86_HPP diff --git a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp index 461c5d19299..a32e0a0bae6 100644 --- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,25 +54,25 @@ define_pd_global(intx, MinJumpTableSize, 10); #ifdef AMD64 define_pd_global(intx, INTPRESSURE, 13); define_pd_global(intx, InteriorEntryAlignment, 16); -define_pd_global(intx, NewSizeThreadIncrease, ScaleForWordSize(4*K)); +define_pd_global(size_t, NewSizeThreadIncrease, ScaleForWordSize(4*K)); define_pd_global(intx, LoopUnrollLimit, 60); // InitialCodeCacheSize derived from specjbb2000 run. define_pd_global(intx, InitialCodeCacheSize, 2496*K); // Integral multiple of CodeCacheExpansionSize define_pd_global(intx, CodeCacheExpansionSize, 64*K); // Ergonomics related flags -define_pd_global(uint64_t,MaxRAM, 128ULL*G); +define_pd_global(uint64_t, MaxRAM, 128ULL*G); #else define_pd_global(intx, INTPRESSURE, 6); define_pd_global(intx, InteriorEntryAlignment, 4); -define_pd_global(intx, NewSizeThreadIncrease, 4*K); +define_pd_global(size_t, NewSizeThreadIncrease, 4*K); define_pd_global(intx, LoopUnrollLimit, 50); // Design center runs on 1.3.1 // InitialCodeCacheSize derived from specjbb2000 run. define_pd_global(intx, InitialCodeCacheSize, 2304*K); // Integral multiple of CodeCacheExpansionSize define_pd_global(intx, CodeCacheExpansionSize, 32*K); // Ergonomics related flags -define_pd_global(uint64_t,MaxRAM, 4ULL*G); +define_pd_global(uint64_t, MaxRAM, 4ULL*G); #endif // AMD64 define_pd_global(intx, RegisterCostAreaRatio, 16000); @@ -93,7 +93,7 @@ define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); define_pd_global(bool, TrapBasedRangeChecks, false); // Not needed on x86. // Heap related flags -define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M)); +define_pd_global(size_t, MetaspaceSize, ScaleForWordSize(16*M)); // Ergonomics related flags define_pd_global(bool, NeverActAsServerClassMachine, false); diff --git a/hotspot/src/cpu/x86/vm/globals_x86.hpp b/hotspot/src/cpu/x86/vm/globals_x86.hpp index 81b3b81a36c..a6d0fbbb336 100644 --- a/hotspot/src/cpu/x86/vm/globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp @@ -78,7 +78,7 @@ define_pd_global(bool, UseMembar, false); #endif // GC Ergo Flags -define_pd_global(uintx, CMSYoungGenPerWorker, 64*M); // default max size of CMS young gen, per GC worker thread +define_pd_global(size_t, CMSYoungGenPerWorker, 64*M); // default max size of CMS young gen, per GC worker thread define_pd_global(uintx, TypeProfileLevel, 111); diff --git a/hotspot/src/cpu/zero/vm/globals_zero.hpp b/hotspot/src/cpu/zero/vm/globals_zero.hpp index 7698a7a2480..9e2020ea159 100644 --- a/hotspot/src/cpu/zero/vm/globals_zero.hpp +++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -57,7 +57,7 @@ define_pd_global(bool, RewriteFrequentPairs, true); define_pd_global(bool, UseMembar, true); // GC Ergo Flags -define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread +define_pd_global(size_t, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread define_pd_global(uintx, TypeProfileLevel, 0); diff --git a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp index 744a6ac5a03..9d478114520 100644 --- a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp +++ b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -50,7 +50,7 @@ define_pd_global(intx, Tier4BackEdgeThreshold, 100000); define_pd_global(intx, OnStackReplacePercentage, 933 ); define_pd_global(intx, FreqInlineSize, 325 ); define_pd_global(uintx, NewRatio, 12 ); -define_pd_global(intx, NewSizeThreadIncrease, 4*K ); +define_pd_global(size_t, NewSizeThreadIncrease, 4*K ); define_pd_global(intx, InitialCodeCacheSize, 160*K); define_pd_global(intx, ReservedCodeCacheSize, 32*M ); define_pd_global(intx, NonProfiledCodeHeapSize, 13*M ); @@ -61,7 +61,7 @@ define_pd_global(intx, CodeCacheExpansionSize, 32*K ); define_pd_global(uintx, CodeCacheMinBlockLength, 1 ); define_pd_global(uintx, CodeCacheMinimumUseSpace, 200*K); -define_pd_global(uintx, MetaspaceSize, 12*M ); +define_pd_global(size_t, MetaspaceSize, 12*M ); define_pd_global(bool, NeverActAsServerClassMachine, true ); define_pd_global(uint64_t, MaxRAM, 1ULL*G); define_pd_global(bool, CICompileOSR, true ); diff --git a/hotspot/src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp b/hotspot/src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp index e3203e1f529..003f99c42d6 100644 --- a/hotspot/src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp +++ b/hotspot/src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2013 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -40,14 +40,14 @@ define_pd_global(intx, VMThreadStackSize, 2048); define_pd_global(intx, CompilerThreadStackSize, 4096); // Allow extra space in DEBUG builds for asserts. -define_pd_global(uintx,JVMInvokeMethodSlack, 8192); +define_pd_global(size_t, JVMInvokeMethodSlack, 8192); define_pd_global(intx, StackYellowPages, 6); define_pd_global(intx, StackRedPages, 1); define_pd_global(intx, StackShadowPages, 6 DEBUG_ONLY(+2)); // Only used on 64 bit platforms -define_pd_global(uintx,HeapBaseMinAddress, 2*G); +define_pd_global(size_t, HeapBaseMinAddress, 2*G); // Only used on 64 bit Windows platforms define_pd_global(bool, UseVectoredExceptions, false); diff --git a/hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp b/hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp index 4bc678e9d59..3711f37f6d0 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,9 +43,9 @@ define_pd_global(intx, VMThreadStackSize, 512); define_pd_global(intx, CompilerThreadStackSize, 0); -define_pd_global(uintx, JVMInvokeMethodSlack, 8192); +define_pd_global(size_t, JVMInvokeMethodSlack, 8192); // Used on 64 bit platforms for UseCompressedOops base address -define_pd_global(uintx, HeapBaseMinAddress, 2*G); +define_pd_global(size_t, HeapBaseMinAddress, 2*G); #endif // OS_CPU_BSD_X86_VM_GLOBALS_BSD_X86_HPP diff --git a/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp b/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp index e7b7f55d03d..057d4ac1c69 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -39,9 +39,9 @@ define_pd_global(intx, VMThreadStackSize, 1024); define_pd_global(intx, VMThreadStackSize, 512); #endif // _LP64 define_pd_global(intx, CompilerThreadStackSize, 0); -define_pd_global(uintx, JVMInvokeMethodSlack, 8192); +define_pd_global(size_t, JVMInvokeMethodSlack, 8192); // Used on 64 bit platforms for UseCompressedOops base address -define_pd_global(uintx, HeapBaseMinAddress, 2*G); +define_pd_global(size_t, HeapBaseMinAddress, 2*G); #endif // OS_CPU_BSD_ZERO_VM_GLOBALS_BSD_ZERO_HPP diff --git a/hotspot/src/os_cpu/linux_ppc/vm/globals_linux_ppc.hpp b/hotspot/src/os_cpu/linux_ppc/vm/globals_linux_ppc.hpp index 783ca9afb0b..9f52b560af7 100644 --- a/hotspot/src/os_cpu/linux_ppc/vm/globals_linux_ppc.hpp +++ b/hotspot/src/os_cpu/linux_ppc/vm/globals_linux_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2013 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -40,14 +40,14 @@ define_pd_global(intx, VMThreadStackSize, 2048); define_pd_global(intx, CompilerThreadStackSize, 4096); // Allow extra space in DEBUG builds for asserts. -define_pd_global(uintx,JVMInvokeMethodSlack, 8192); +define_pd_global(size_t, JVMInvokeMethodSlack, 8192); define_pd_global(intx, StackYellowPages, 6); define_pd_global(intx, StackRedPages, 1); define_pd_global(intx, StackShadowPages, 6 DEBUG_ONLY(+2)); // Only used on 64 bit platforms -define_pd_global(uintx,HeapBaseMinAddress, 2*G); +define_pd_global(size_t, HeapBaseMinAddress, 2*G); // Only used on 64 bit Windows platforms define_pd_global(bool, UseVectoredExceptions, false); diff --git a/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp b/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp index b3a215d2b83..bc3c7f0ec7d 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,10 +30,10 @@ // runtime system. (see globals.hpp) // -define_pd_global(uintx, JVMInvokeMethodSlack, 12288); +define_pd_global(size_t, JVMInvokeMethodSlack, 12288); define_pd_global(intx, CompilerThreadStackSize, 0); // Used on 64 bit platforms for UseCompressedOops base address -define_pd_global(uintx, HeapBaseMinAddress, CONST64(4)*G); +define_pd_global(size_t, HeapBaseMinAddress, CONST64(4)*G); #endif // OS_CPU_LINUX_SPARC_VM_GLOBALS_LINUX_SPARC_HPP diff --git a/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp b/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp index 4ecaeee3354..b123d90c994 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp +++ b/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,9 +42,9 @@ define_pd_global(intx, VMThreadStackSize, 512); define_pd_global(intx, CompilerThreadStackSize, 0); -define_pd_global(uintx,JVMInvokeMethodSlack, 8192); +define_pd_global(size_t, JVMInvokeMethodSlack, 8192); // Used on 64 bit platforms for UseCompressedOops base address -define_pd_global(uintx,HeapBaseMinAddress, 2*G); +define_pd_global(size_t, HeapBaseMinAddress, 2*G); #endif // OS_CPU_LINUX_X86_VM_GLOBALS_LINUX_X86_HPP diff --git a/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp b/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp index 663f0ac45c6..f1b6d212a8f 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp +++ b/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -39,9 +39,9 @@ define_pd_global(intx, VMThreadStackSize, 1024); define_pd_global(intx, VMThreadStackSize, 512); #endif // _LP64 define_pd_global(intx, CompilerThreadStackSize, 0); -define_pd_global(uintx, JVMInvokeMethodSlack, 8192); +define_pd_global(size_t, JVMInvokeMethodSlack, 8192); // Used on 64 bit platforms for UseCompressedOops base address -define_pd_global(uintx, HeapBaseMinAddress, 2*G); +define_pd_global(size_t, HeapBaseMinAddress, 2*G); #endif // OS_CPU_LINUX_ZERO_VM_GLOBALS_LINUX_ZERO_HPP diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp b/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp index 30c955debca..fa63ce0fc12 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,16 +30,16 @@ // (see globals.hpp) // -define_pd_global(uintx, JVMInvokeMethodSlack, 12288); +define_pd_global(size_t, JVMInvokeMethodSlack, 12288); define_pd_global(intx, CompilerThreadStackSize, 0); // Used on 64 bit platforms for UseCompressedOops base address #ifdef _LP64 // use 6G as default base address because by default the OS maps the application // to 4G on Solaris-Sparc. This leaves at least 2G for the native heap. -define_pd_global(uintx, HeapBaseMinAddress, CONST64(6)*G); +define_pd_global(size_t, HeapBaseMinAddress, CONST64(6)*G); #else -define_pd_global(uintx, HeapBaseMinAddress, 2*G); +define_pd_global(size_t, HeapBaseMinAddress, 2*G); #endif diff --git a/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp b/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp index e6329c28942..0c3016edffe 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,18 +32,18 @@ define_pd_global(bool, DontYieldALot, true); // Determined in the des #ifdef AMD64 define_pd_global(intx, ThreadStackSize, 1024); // 0 => use system default define_pd_global(intx, VMThreadStackSize, 1024); -define_pd_global(uintx,JVMInvokeMethodSlack, 8*K); +define_pd_global(size_t, JVMInvokeMethodSlack, 8*K); #else // ThreadStackSize 320 allows a couple of test cases to run while // keeping the number of threads that can be created high. define_pd_global(intx, ThreadStackSize, 320); define_pd_global(intx, VMThreadStackSize, 512); -define_pd_global(uintx,JVMInvokeMethodSlack, 10*K); +define_pd_global(size_t, JVMInvokeMethodSlack, 10*K); #endif // AMD64 define_pd_global(intx, CompilerThreadStackSize, 0); // Used on 64 bit platforms for UseCompressedOops base address -define_pd_global(uintx,HeapBaseMinAddress, 2*G); +define_pd_global(size_t, HeapBaseMinAddress, 2*G); #endif // OS_CPU_SOLARIS_X86_VM_GLOBALS_SOLARIS_X86_HPP diff --git a/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp index de91c32ad33..aa1734e1f7e 100644 --- a/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp +++ b/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,9 +43,9 @@ define_pd_global(intx, CompilerThreadStackSize, 1024); define_pd_global(intx, CompilerThreadStackSize, 0); #endif -define_pd_global(uintx, JVMInvokeMethodSlack, 8192); +define_pd_global(size_t, JVMInvokeMethodSlack, 8192); // Used on 64 bit platforms for UseCompressedOops base address -define_pd_global(uintx, HeapBaseMinAddress, 2*G); +define_pd_global(size_t, HeapBaseMinAddress, 2*G); #endif // OS_CPU_WINDOWS_X86_VM_GLOBALS_WINDOWS_X86_HPP diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index 51e9a9f549c..a64ca88cd7b 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -2662,8 +2662,8 @@ void CFLS_LAB::compute_desired_plab_size() { // Need to smooth wrt historical average if (ResizeOldPLAB) { _blocks_to_claim[i].sample( - MAX2((size_t)CMSOldPLABMin, - MIN2((size_t)CMSOldPLABMax, + MAX2(CMSOldPLABMin, + MIN2(CMSOldPLABMax, _global_num_blocks[i]/(_global_num_workers[i]*CMSOldPLABNumRefills)))); } // Reset counters for next round diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index 6d7197c060a..8af6c7ccb44 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -696,32 +696,32 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper* prev } if (FLAG_IS_DEFAULT(MarkStackSize)) { - uintx mark_stack_size = + size_t mark_stack_size = MIN2(MarkStackSizeMax, - MAX2(MarkStackSize, (uintx) (parallel_marking_threads() * TASKQUEUE_SIZE))); + MAX2(MarkStackSize, (size_t) (parallel_marking_threads() * TASKQUEUE_SIZE))); // Verify that the calculated value for MarkStackSize is in range. // It would be nice to use the private utility routine from Arguments. if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) { - warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): " - "must be between " UINTX_FORMAT " and " UINTX_FORMAT, - mark_stack_size, (uintx) 1, MarkStackSizeMax); + warning("Invalid value calculated for MarkStackSize (" SIZE_FORMAT "): " + "must be between 1 and " SIZE_FORMAT, + mark_stack_size, MarkStackSizeMax); return; } - FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size); + FLAG_SET_ERGO(size_t, MarkStackSize, mark_stack_size); } else { // Verify MarkStackSize is in range. if (FLAG_IS_CMDLINE(MarkStackSize)) { if (FLAG_IS_DEFAULT(MarkStackSizeMax)) { if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { - warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): " - "must be between " UINTX_FORMAT " and " UINTX_FORMAT, - MarkStackSize, (uintx) 1, MarkStackSizeMax); + warning("Invalid value specified for MarkStackSize (" SIZE_FORMAT "): " + "must be between 1 and " SIZE_FORMAT, + MarkStackSize, MarkStackSizeMax); return; } } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) { if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { - warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT ")" - " or for MarkStackSizeMax (" UINTX_FORMAT ")", + warning("Invalid value specified for MarkStackSize (" SIZE_FORMAT ")" + " or for MarkStackSizeMax (" SIZE_FORMAT ")", MarkStackSize, MarkStackSizeMax); return; } @@ -745,7 +745,7 @@ ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper* prev // so that the assertion in MarkingTaskQueue::task_queue doesn't fail _active_tasks = _max_worker_id; - size_t max_regions = (size_t) _g1h->max_regions(); + uint max_regions = _g1h->max_regions(); for (uint i = 0; i < _max_worker_id; ++i) { CMTaskQueue* task_queue = new CMTaskQueue(); task_queue->initialize(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 745ac129ca0..bbb23748bf7 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -321,7 +321,7 @@ void G1CollectorPolicy::initialize_alignments() { void G1CollectorPolicy::initialize_flags() { if (G1HeapRegionSize != HeapRegion::GrainBytes) { - FLAG_SET_ERGO(uintx, G1HeapRegionSize, HeapRegion::GrainBytes); + FLAG_SET_ERGO(size_t, G1HeapRegionSize, HeapRegion::GrainBytes); } if (SurvivorRatio < 1) { @@ -335,7 +335,7 @@ void G1CollectorPolicy::post_heap_initialize() { uintx max_regions = G1CollectedHeap::heap()->max_regions(); size_t max_young_size = (size_t)_young_gen_sizer->max_young_length(max_regions) * HeapRegion::GrainBytes; if (max_young_size != MaxNewSize) { - FLAG_SET_ERGO(uintx, MaxNewSize, max_young_size); + FLAG_SET_ERGO(size_t, MaxNewSize, max_young_size); } } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp index fe28cc28c55..eff64c4cd08 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -107,7 +107,7 @@ class ScanRSClosure : public HeapRegionClosure { double _strong_code_root_scan_time_sec; uint _worker_i; - int _block_size; + size_t _block_size; bool _try_claimed; public: @@ -125,7 +125,7 @@ public: _g1h = G1CollectedHeap::heap(); _bot_shared = _g1h->bot_shared(); _ct_bs = _g1h->g1_barrier_set(); - _block_size = MAX2(G1RSetScanBlockSize, 1); + _block_size = MAX2(G1RSetScanBlockSize, 1); } void set_try_claimed() { _try_claimed = true; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp index 303296812a7..d1da538bacc 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,7 +86,7 @@ "If true, enable reference discovery during concurrent " \ "marking and reference processing at the end of remark.") \ \ - product(intx, G1SATBBufferSize, 1*K, \ + product(size_t, G1SATBBufferSize, 1*K, \ "Number of entries in an SATB log buffer.") \ \ develop(intx, G1SATBProcessCompletedThreshold, 20, \ @@ -112,7 +112,7 @@ "Prints the liveness information for all regions in the heap " \ "at the end of a marking cycle.") \ \ - product(intx, G1UpdateBufferSize, 256, \ + product(size_t, G1UpdateBufferSize, 256, \ "Size of an update buffer") \ \ product(intx, G1ConcRefinementYellowZone, 0, \ @@ -148,7 +148,7 @@ "Select green, yellow and red zones adaptively to meet the " \ "the pause requirements.") \ \ - product(uintx, G1ConcRSLogCacheSize, 10, \ + product(size_t, G1ConcRSLogCacheSize, 10, \ "Log base 2 of the length of conc RS hot-card cache.") \ \ product(uintx, G1ConcRSHotCardLimit, 4, \ @@ -210,7 +210,7 @@ "When set, G1 will fail when it encounters an FP 'error', " \ "so as to allow debugging") \ \ - product(uintx, G1HeapRegionSize, 0, \ + product(size_t, G1HeapRegionSize, 0, \ "Size of the G1 regions.") \ \ product(uintx, G1ConcRefinementThreads, 0, \ @@ -220,7 +220,7 @@ develop(bool, G1VerifyCTCleanup, false, \ "Verify card table cleanup.") \ \ - product(uintx, G1RSetScanBlockSize, 64, \ + product(size_t, G1RSetScanBlockSize, 64, \ "Size of a work unit of cards claimed by a worker thread" \ "during RSet scanning.") \ \ diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 1ec43eae39c..c3d0ba78871 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -106,18 +106,18 @@ size_t HeapRegion::max_region_size() { } void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_heap_size) { - uintx region_size = G1HeapRegionSize; + size_t region_size = G1HeapRegionSize; if (FLAG_IS_DEFAULT(G1HeapRegionSize)) { size_t average_heap_size = (initial_heap_size + max_heap_size) / 2; region_size = MAX2(average_heap_size / HeapRegionBounds::target_number(), - (uintx) HeapRegionBounds::min_size()); + HeapRegionBounds::min_size()); } int region_size_log = log2_long((jlong) region_size); // Recalculate the region size to make sure it's a power of // 2. This means that region_size is the largest power of 2 that's // <= what we've calculated so far. - region_size = ((uintx)1 << region_size_log); + region_size = ((size_t)1 << region_size_log); // Now make sure that we don't go over or under our limits. if (region_size < HeapRegionBounds::min_size()) { @@ -139,7 +139,7 @@ void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_hea guarantee(GrainBytes == 0, "we should only set it once"); // The cast to int is safe, given that we've bounded region_size by // MIN_REGION_SIZE and MAX_REGION_SIZE. - GrainBytes = (size_t)region_size; + GrainBytes = region_size; guarantee(GrainWords == 0, "we should only set it once"); GrainWords = GrainBytes >> LogHeapWordSize; diff --git a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp index 3e610f5513a..dbfbb08cdfc 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp @@ -98,7 +98,7 @@ bool VM_GC_Operation::doit_prologue() { if (!is_init_completed()) { vm_exit_during_initialization( err_msg("GC triggered before VM initialization completed. Try increasing " - "NewSize, current value " UINTX_FORMAT "%s.", + "NewSize, current value " SIZE_FORMAT "%s.", byte_size_in_proper_unit(NewSize), proper_unit_for_byte_size(NewSize))); } diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp index 216e799d9ae..d20c2536e32 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp @@ -104,15 +104,15 @@ void CollectorPolicy::initialize_flags() { // User inputs from -Xmx and -Xms must be aligned _min_heap_byte_size = align_size_up(_min_heap_byte_size, _heap_alignment); - uintx aligned_initial_heap_size = align_size_up(InitialHeapSize, _heap_alignment); - uintx aligned_max_heap_size = align_size_up(MaxHeapSize, _heap_alignment); + size_t aligned_initial_heap_size = align_size_up(InitialHeapSize, _heap_alignment); + size_t aligned_max_heap_size = align_size_up(MaxHeapSize, _heap_alignment); // Write back to flags if the values changed if (aligned_initial_heap_size != InitialHeapSize) { - FLAG_SET_ERGO(uintx, InitialHeapSize, aligned_initial_heap_size); + FLAG_SET_ERGO(size_t, InitialHeapSize, aligned_initial_heap_size); } if (aligned_max_heap_size != MaxHeapSize) { - FLAG_SET_ERGO(uintx, MaxHeapSize, aligned_max_heap_size); + FLAG_SET_ERGO(size_t, MaxHeapSize, aligned_max_heap_size); } if (FLAG_IS_CMDLINE(InitialHeapSize) && _min_heap_byte_size != 0 && @@ -120,9 +120,9 @@ void CollectorPolicy::initialize_flags() { vm_exit_during_initialization("Incompatible minimum and initial heap sizes specified"); } if (!FLAG_IS_DEFAULT(InitialHeapSize) && InitialHeapSize > MaxHeapSize) { - FLAG_SET_ERGO(uintx, MaxHeapSize, InitialHeapSize); + FLAG_SET_ERGO(size_t, MaxHeapSize, InitialHeapSize); } else if (!FLAG_IS_DEFAULT(MaxHeapSize) && InitialHeapSize > MaxHeapSize) { - FLAG_SET_ERGO(uintx, InitialHeapSize, MaxHeapSize); + FLAG_SET_ERGO(size_t, InitialHeapSize, MaxHeapSize); if (InitialHeapSize < _min_heap_byte_size) { _min_heap_byte_size = InitialHeapSize; } @@ -131,7 +131,7 @@ void CollectorPolicy::initialize_flags() { _initial_heap_byte_size = InitialHeapSize; _max_heap_byte_size = MaxHeapSize; - FLAG_SET_ERGO(uintx, MinHeapDeltaBytes, align_size_up(MinHeapDeltaBytes, _space_alignment)); + FLAG_SET_ERGO(size_t, MinHeapDeltaBytes, align_size_up(MinHeapDeltaBytes, _space_alignment)); DEBUG_ONLY(CollectorPolicy::assert_flags();) } @@ -282,18 +282,18 @@ void GenCollectorPolicy::initialize_flags() { // All generational heaps have a youngest gen; handle those flags here // Make sure the heap is large enough for two generations - uintx smallest_new_size = young_gen_size_lower_bound(); - uintx smallest_heap_size = align_size_up(smallest_new_size + align_size_up(_space_alignment, _gen_alignment), + size_t smallest_new_size = young_gen_size_lower_bound(); + size_t smallest_heap_size = align_size_up(smallest_new_size + align_size_up(_space_alignment, _gen_alignment), _heap_alignment); if (MaxHeapSize < smallest_heap_size) { - FLAG_SET_ERGO(uintx, MaxHeapSize, smallest_heap_size); + FLAG_SET_ERGO(size_t, MaxHeapSize, smallest_heap_size); _max_heap_byte_size = MaxHeapSize; } // If needed, synchronize _min_heap_byte size and _initial_heap_byte_size if (_min_heap_byte_size < smallest_heap_size) { _min_heap_byte_size = smallest_heap_size; if (InitialHeapSize < _min_heap_byte_size) { - FLAG_SET_ERGO(uintx, InitialHeapSize, smallest_heap_size); + FLAG_SET_ERGO(size_t, InitialHeapSize, smallest_heap_size); _initial_heap_byte_size = smallest_heap_size; } } @@ -306,8 +306,8 @@ void GenCollectorPolicy::initialize_flags() { // Now take the actual NewSize into account. We will silently increase NewSize // if the user specified a smaller or unaligned value. - uintx bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize); - bounded_new_size = MAX2(smallest_new_size, (uintx)align_size_down(bounded_new_size, _gen_alignment)); + size_t bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize); + bounded_new_size = MAX2(smallest_new_size, (size_t)align_size_down(bounded_new_size, _gen_alignment)); if (bounded_new_size != NewSize) { // Do not use FLAG_SET_ERGO to update NewSize here, since this will override // if NewSize was set on the command line or not. This information is needed @@ -320,21 +320,21 @@ void GenCollectorPolicy::initialize_flags() { if (!FLAG_IS_DEFAULT(MaxNewSize)) { if (MaxNewSize >= MaxHeapSize) { // Make sure there is room for an old generation - uintx smaller_max_new_size = MaxHeapSize - _gen_alignment; + size_t smaller_max_new_size = MaxHeapSize - _gen_alignment; if (FLAG_IS_CMDLINE(MaxNewSize)) { warning("MaxNewSize (" SIZE_FORMAT "k) is equal to or greater than the entire " "heap (" SIZE_FORMAT "k). A new max generation size of " SIZE_FORMAT "k will be used.", MaxNewSize/K, MaxHeapSize/K, smaller_max_new_size/K); } - FLAG_SET_ERGO(uintx, MaxNewSize, smaller_max_new_size); + FLAG_SET_ERGO(size_t, MaxNewSize, smaller_max_new_size); if (NewSize > MaxNewSize) { - FLAG_SET_ERGO(uintx, NewSize, MaxNewSize); + FLAG_SET_ERGO(size_t, NewSize, MaxNewSize); _initial_young_size = NewSize; } } else if (MaxNewSize < _initial_young_size) { - FLAG_SET_ERGO(uintx, MaxNewSize, _initial_young_size); + FLAG_SET_ERGO(size_t, MaxNewSize, _initial_young_size); } else if (!is_size_aligned(MaxNewSize, _gen_alignment)) { - FLAG_SET_ERGO(uintx, MaxNewSize, align_size_down(MaxNewSize, _gen_alignment)); + FLAG_SET_ERGO(size_t, MaxNewSize, align_size_down(MaxNewSize, _gen_alignment)); } _max_young_size = MaxNewSize; } @@ -347,7 +347,7 @@ void GenCollectorPolicy::initialize_flags() { "A new max generation size of " SIZE_FORMAT "k will be used.", NewSize/K, MaxNewSize/K, NewSize/K); } - FLAG_SET_ERGO(uintx, MaxNewSize, NewSize); + FLAG_SET_ERGO(size_t, MaxNewSize, NewSize); _max_young_size = MaxNewSize; } @@ -369,9 +369,9 @@ void GenCollectorPolicy::initialize_flags() { size_t calculated_heapsize = (OldSize / NewRatio) * (NewRatio + 1); calculated_heapsize = align_size_up(calculated_heapsize, _heap_alignment); - FLAG_SET_ERGO(uintx, MaxHeapSize, calculated_heapsize); + FLAG_SET_ERGO(size_t, MaxHeapSize, calculated_heapsize); _max_heap_byte_size = MaxHeapSize; - FLAG_SET_ERGO(uintx, InitialHeapSize, calculated_heapsize); + FLAG_SET_ERGO(size_t, InitialHeapSize, calculated_heapsize); _initial_heap_byte_size = InitialHeapSize; } @@ -380,19 +380,19 @@ void GenCollectorPolicy::initialize_flags() { if (_max_heap_size_cmdline) { // Somebody has set a maximum heap size with the intention that we should not // exceed it. Adjust New/OldSize as necessary. - uintx calculated_size = NewSize + OldSize; + size_t calculated_size = NewSize + OldSize; double shrink_factor = (double) MaxHeapSize / calculated_size; - uintx smaller_new_size = align_size_down((uintx)(NewSize * shrink_factor), _gen_alignment); - FLAG_SET_ERGO(uintx, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size)); + size_t smaller_new_size = align_size_down((size_t)(NewSize * shrink_factor), _gen_alignment); + FLAG_SET_ERGO(size_t, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size)); _initial_young_size = NewSize; // OldSize is already aligned because above we aligned MaxHeapSize to // _heap_alignment, and we just made sure that NewSize is aligned to // _gen_alignment. In initialize_flags() we verified that _heap_alignment // is a multiple of _gen_alignment. - FLAG_SET_ERGO(uintx, OldSize, MaxHeapSize - NewSize); + FLAG_SET_ERGO(size_t, OldSize, MaxHeapSize - NewSize); } else { - FLAG_SET_ERGO(uintx, MaxHeapSize, align_size_up(NewSize + OldSize, _heap_alignment)); + FLAG_SET_ERGO(size_t, MaxHeapSize, align_size_up(NewSize + OldSize, _heap_alignment)); _max_heap_byte_size = MaxHeapSize; } } @@ -405,7 +405,7 @@ void GenCollectorPolicy::initialize_flags() { // Need to compare against the flag value for max since _max_young_size // might not have been set yet. if (new_size >= _min_young_size && new_size <= MaxNewSize) { - FLAG_SET_ERGO(uintx, NewSize, new_size); + FLAG_SET_ERGO(size_t, NewSize, new_size); _initial_young_size = NewSize; } } @@ -561,15 +561,15 @@ void GenCollectorPolicy::initialize_size_info() { // Write back to flags if necessary. if (NewSize != _initial_young_size) { - FLAG_SET_ERGO(uintx, NewSize, _initial_young_size); + FLAG_SET_ERGO(size_t, NewSize, _initial_young_size); } if (MaxNewSize != _max_young_size) { - FLAG_SET_ERGO(uintx, MaxNewSize, _max_young_size); + FLAG_SET_ERGO(size_t, MaxNewSize, _max_young_size); } if (OldSize != _initial_old_size) { - FLAG_SET_ERGO(uintx, OldSize, _initial_old_size); + FLAG_SET_ERGO(size_t, OldSize, _initial_old_size); } if (PrintGCDetails && Verbose) { @@ -907,7 +907,7 @@ bool GenCollectorPolicy::should_try_older_generation_allocation( // void MarkSweepPolicy::initialize_alignments() { - _space_alignment = _gen_alignment = (uintx)Generation::GenGrain; + _space_alignment = _gen_alignment = (size_t)Generation::GenGrain; _heap_alignment = compute_heap_alignment(); } @@ -939,18 +939,18 @@ public: // for both min and initial young size if less than min heap. flag_value = 20 * M; set_basic_flag_values(); - FLAG_SET_CMDLINE(uintx, NewSize, flag_value); + FLAG_SET_CMDLINE(size_t, NewSize, flag_value); verify_young_min(flag_value); set_basic_flag_values(); - FLAG_SET_CMDLINE(uintx, NewSize, flag_value); + FLAG_SET_CMDLINE(size_t, NewSize, flag_value); verify_young_initial(flag_value); // If NewSize is set on command line, but is larger than the min // heap size, it should only be used for initial young size. flag_value = 80 * M; set_basic_flag_values(); - FLAG_SET_CMDLINE(uintx, NewSize, flag_value); + FLAG_SET_CMDLINE(size_t, NewSize, flag_value); verify_young_initial(flag_value); // If NewSize has been ergonomically set, the collector policy @@ -958,11 +958,11 @@ public: // using NewRatio. flag_value = 20 * M; set_basic_flag_values(); - FLAG_SET_ERGO(uintx, NewSize, flag_value); + FLAG_SET_ERGO(size_t, NewSize, flag_value); verify_young_min(flag_value); set_basic_flag_values(); - FLAG_SET_ERGO(uintx, NewSize, flag_value); + FLAG_SET_ERGO(size_t, NewSize, flag_value); verify_scaled_young_initial(InitialHeapSize); restore_flags(); @@ -978,11 +978,11 @@ public: // for both min and initial old size if less than min heap. flag_value = 20 * M; set_basic_flag_values(); - FLAG_SET_CMDLINE(uintx, OldSize, flag_value); + FLAG_SET_CMDLINE(size_t, OldSize, flag_value); verify_old_min(flag_value); set_basic_flag_values(); - FLAG_SET_CMDLINE(uintx, OldSize, flag_value); + FLAG_SET_CMDLINE(size_t, OldSize, flag_value); // Calculate what we expect the flag to be. size_t expected_old_initial = align_size_up(InitialHeapSize, heap_alignment) - MaxNewSize; verify_old_initial(expected_old_initial); @@ -993,10 +993,10 @@ public: // We intentionally set MaxNewSize + OldSize > MaxHeapSize (see over_size). flag_value = 30 * M; set_basic_flag_values(); - FLAG_SET_CMDLINE(uintx, OldSize, flag_value); + FLAG_SET_CMDLINE(size_t, OldSize, flag_value); size_t over_size = 20*M; size_t new_size_value = align_size_up(MaxHeapSize, heap_alignment) - flag_value + over_size; - FLAG_SET_CMDLINE(uintx, MaxNewSize, new_size_value); + FLAG_SET_CMDLINE(size_t, MaxNewSize, new_size_value); // Calculate what we expect the flag to be. expected_old_initial = align_size_up(MaxHeapSize, heap_alignment) - MaxNewSize; verify_old_initial(expected_old_initial); @@ -1057,11 +1057,11 @@ private: static size_t original_OldSize; static void set_basic_flag_values() { - FLAG_SET_ERGO(uintx, MaxHeapSize, 180 * M); - FLAG_SET_ERGO(uintx, InitialHeapSize, 100 * M); - FLAG_SET_ERGO(uintx, OldSize, 4 * M); - FLAG_SET_ERGO(uintx, NewSize, 1 * M); - FLAG_SET_ERGO(uintx, MaxNewSize, 80 * M); + FLAG_SET_ERGO(size_t, MaxHeapSize, 180 * M); + FLAG_SET_ERGO(size_t, InitialHeapSize, 100 * M); + FLAG_SET_ERGO(size_t, OldSize, 4 * M); + FLAG_SET_ERGO(size_t, NewSize, 1 * M); + FLAG_SET_ERGO(size_t, MaxNewSize, 80 * M); Arguments::set_min_heap_size(40 * M); } diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index c8099b079bb..8f7476d8469 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -3131,7 +3131,7 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a void Metaspace::initialize_class_space(ReservedSpace rs) { // The reserved space size may be bigger because of alignment, esp with UseLargePages assert(rs.size() >= CompressedClassSpaceSize, - err_msg(SIZE_FORMAT " != " UINTX_FORMAT, rs.size(), CompressedClassSpaceSize)); + err_msg(SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize)); assert(using_class_space(), "Must be using class space"); _class_space_list = new VirtualSpaceList(rs); _chunk_manager_class = new ChunkManager(SpecializedChunk, ClassSmallChunk, ClassMediumChunk); diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp index b66061e5f6d..ecfa27fa3f4 100644 --- a/hotspot/src/share/vm/memory/metaspaceShared.cpp +++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -410,7 +410,7 @@ public: // Split up and initialize the misc code and data spaces ReservedSpace* shared_rs = MetaspaceShared::shared_rs(); - int metadata_size = SharedReadOnlySize+SharedReadWriteSize; + size_t metadata_size = SharedReadOnlySize + SharedReadWriteSize; ReservedSpace shared_ro_rw = shared_rs->first_part(metadata_size); ReservedSpace misc_section = shared_rs->last_part(metadata_size); diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index 50f8dc46841..e4204b200f2 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -402,7 +402,7 @@ JVM_ENTRY(jobject, JVM_InitProperties(JNIEnv *env, jobject properties)) PUTPROP(props, "sun.nio.MaxDirectMemorySize", "-1"); } else { char as_chars[256]; - jio_snprintf(as_chars, sizeof(as_chars), UINTX_FORMAT, MaxDirectMemorySize); + jio_snprintf(as_chars, sizeof(as_chars), SIZE_FORMAT, MaxDirectMemorySize); PUTPROP(props, "sun.nio.MaxDirectMemorySize", as_chars); } } diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index d14cf2cc030..320f67e9262 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -67,16 +67,16 @@ do { \ } \ } while(0) -char** Arguments::_jvm_flags_array = NULL; -int Arguments::_num_jvm_flags = 0; -char** Arguments::_jvm_args_array = NULL; -int Arguments::_num_jvm_args = 0; +char** Arguments::_jvm_flags_array = NULL; +int Arguments::_num_jvm_flags = 0; +char** Arguments::_jvm_args_array = NULL; +int Arguments::_num_jvm_args = 0; char* Arguments::_java_command = NULL; SystemProperty* Arguments::_system_properties = NULL; const char* Arguments::_gc_log_filename = NULL; bool Arguments::_has_profile = false; size_t Arguments::_conservative_max_heap_alignment = 0; -uintx Arguments::_min_heap_size = 0; +size_t Arguments::_min_heap_size = 0; uintx Arguments::_min_heap_free_ratio = 0; uintx Arguments::_max_heap_free_ratio = 0; Arguments::Mode Arguments::_mode = _mixed; @@ -1343,9 +1343,9 @@ void Arguments::set_cms_and_parnew_gc_flags() { // NewSize was set on the command line and it is larger than // preferred_max_new_size. if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line - FLAG_SET_ERGO(uintx, MaxNewSize, MAX2(NewSize, preferred_max_new_size)); + FLAG_SET_ERGO(size_t, MaxNewSize, MAX2(NewSize, preferred_max_new_size)); } else { - FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size); + FLAG_SET_ERGO(size_t, MaxNewSize, preferred_max_new_size); } if (PrintGCDetails && Verbose) { // Too early to use gclog_or_tty @@ -1368,8 +1368,8 @@ void Arguments::set_cms_and_parnew_gc_flags() { // Unless explicitly requested otherwise, make young gen // at least min_new, and at most preferred_max_new_size. if (FLAG_IS_DEFAULT(NewSize)) { - FLAG_SET_ERGO(uintx, NewSize, MAX2(NewSize, min_new)); - FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize)); + FLAG_SET_ERGO(size_t, NewSize, MAX2(NewSize, min_new)); + FLAG_SET_ERGO(size_t, NewSize, MIN2(preferred_max_new_size, NewSize)); if (PrintGCDetails && Verbose) { // Too early to use gclog_or_tty tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize); @@ -1379,7 +1379,7 @@ void Arguments::set_cms_and_parnew_gc_flags() { // so it's NewRatio x of NewSize. if (FLAG_IS_DEFAULT(OldSize)) { if (max_heap > NewSize) { - FLAG_SET_ERGO(uintx, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize)); + FLAG_SET_ERGO(size_t, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize)); if (PrintGCDetails && Verbose) { // Too early to use gclog_or_tty tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize); @@ -1410,7 +1410,7 @@ void Arguments::set_cms_and_parnew_gc_flags() { // OldPLAB sizing manually turned off: Use a larger default setting, // unless it was manually specified. This is because a too-low value // will slow down scavenges. - FLAG_SET_ERGO(uintx, OldPLABSize, CFLS_LAB::_default_static_old_plab_size); // default value before 6631166 + FLAG_SET_ERGO(size_t, OldPLABSize, CFLS_LAB::_default_static_old_plab_size); // default value before 6631166 } else { FLAG_SET_DEFAULT(OldPLABSize, CFLS_LAB::_default_dynamic_old_plab_size); // old CMSParPromoteBlocksToClaim default } @@ -1790,7 +1790,7 @@ julong Arguments::limit_by_allocatable_memory(julong limit) { } // Use static initialization to get the default before parsing -static const uintx DefaultHeapBaseMinAddress = HeapBaseMinAddress; +static const size_t DefaultHeapBaseMinAddress = HeapBaseMinAddress; void Arguments::set_heap_size() { if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) { @@ -1830,14 +1830,14 @@ void Arguments::set_heap_size() { // matches compressed oops printing flags if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) { jio_fprintf(defaultStream::error_stream(), - "HeapBaseMinAddress must be at least " UINTX_FORMAT - " (" UINTX_FORMAT "G) which is greater than value given " - UINTX_FORMAT "\n", + "HeapBaseMinAddress must be at least " SIZE_FORMAT + " (" SIZE_FORMAT "G) which is greater than value given " + SIZE_FORMAT "\n", DefaultHeapBaseMinAddress, DefaultHeapBaseMinAddress/G, HeapBaseMinAddress); } - FLAG_SET_ERGO(uintx, HeapBaseMinAddress, DefaultHeapBaseMinAddress); + FLAG_SET_ERGO(size_t, HeapBaseMinAddress, DefaultHeapBaseMinAddress); } } @@ -1862,7 +1862,7 @@ void Arguments::set_heap_size() { // Cannot use gclog_or_tty yet. tty->print_cr(" Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max); } - FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx)reasonable_max); + FLAG_SET_ERGO(size_t, MaxHeapSize, (size_t)reasonable_max); } // If the minimum or initial heap_size have not been set or requested to be set @@ -1884,14 +1884,14 @@ void Arguments::set_heap_size() { if (PrintGCDetails && Verbose) { // Cannot use gclog_or_tty yet. - tty->print_cr(" Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial); + tty->print_cr(" Initial heap size " SIZE_FORMAT, (size_t)reasonable_initial); } - FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx)reasonable_initial); + FLAG_SET_ERGO(size_t, InitialHeapSize, (size_t)reasonable_initial); } // If the minimum heap size has not been set (via -Xms), // synchronize with InitialHeapSize to avoid errors with the default value. if (min_heap_size() == 0) { - set_min_heap_size(MIN2((uintx)reasonable_minimum, InitialHeapSize)); + set_min_heap_size(MIN2((size_t)reasonable_minimum, InitialHeapSize)); if (PrintGCDetails && Verbose) { // Cannot use gclog_or_tty yet. tty->print_cr(" Minimum heap size " SIZE_FORMAT, min_heap_size()); @@ -2037,7 +2037,7 @@ void check_gclog_consistency() { } if (UseGCLogFileRotation && (GCLogFileSize != 0) && (GCLogFileSize < 8*K)) { - FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K); + FLAG_SET_CMDLINE(size_t, GCLogFileSize, 8*K); jio_fprintf(defaultStream::output_stream(), "GCLogFileSize changed to minimum 8K\n"); } @@ -2394,7 +2394,7 @@ bool Arguments::check_vm_args_consistency() { status = status && verify_min_value(LogEventsBufferEntries, 1, "LogEventsBufferEntries"); - status = status && verify_min_value(HeapSizePerGCThread, (uintx) os::vm_page_size(), "HeapSizePerGCThread"); + status = status && verify_min_value(HeapSizePerGCThread, (size_t) os::vm_page_size(), "HeapSizePerGCThread"); status = status && verify_min_value(GCTaskTimeStampEntries, 1, "GCTaskTimeStampEntries"); @@ -2809,8 +2809,8 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, describe_range_error(errcode); return JNI_EINVAL; } - FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size); - FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size); + FLAG_SET_CMDLINE(size_t, MaxNewSize, (size_t)long_initial_young_size); + FLAG_SET_CMDLINE(size_t, NewSize, (size_t)long_initial_young_size); // -Xms } else if (match_option(option, "-Xms", &tail)) { julong long_initial_heap_size = 0; @@ -2822,10 +2822,10 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, describe_range_error(errcode); return JNI_EINVAL; } - set_min_heap_size((uintx)long_initial_heap_size); + set_min_heap_size((size_t)long_initial_heap_size); // Currently the minimum size and the initial heap sizes are the same. // Can be overridden with -XX:InitialHeapSize. - FLAG_SET_CMDLINE(uintx, InitialHeapSize, (uintx)long_initial_heap_size); + FLAG_SET_CMDLINE(size_t, InitialHeapSize, (size_t)long_initial_heap_size); // -Xmx } else if (match_option(option, "-Xmx", &tail) || match_option(option, "-XX:MaxHeapSize=", &tail)) { julong long_max_heap_size = 0; @@ -2836,7 +2836,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, describe_range_error(errcode); return JNI_EINVAL; } - FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size); + FLAG_SET_CMDLINE(size_t, MaxHeapSize, (size_t)long_max_heap_size); // Xmaxf } else if (match_option(option, "-Xmaxf", &tail)) { char* err; @@ -2977,7 +2977,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1); FLAG_SET_CMDLINE(bool, UseTLAB, false); - FLAG_SET_CMDLINE(uintx, NewSizeThreadIncrease, 16 * K); // 20Kb per thread added to new generation + FLAG_SET_CMDLINE(size_t, NewSizeThreadIncrease, 16 * K); // 20Kb per thread added to new generation // -Xinternalversion } else if (match_option(option, "-Xinternalversion")) { @@ -3138,16 +3138,16 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, initHeapSize = limit_by_allocatable_memory(initHeapSize); if (FLAG_IS_DEFAULT(MaxHeapSize)) { - FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize); - FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize); + FLAG_SET_CMDLINE(size_t, MaxHeapSize, initHeapSize); + FLAG_SET_CMDLINE(size_t, InitialHeapSize, initHeapSize); // Currently the minimum size and the initial heap sizes are the same. set_min_heap_size(initHeapSize); } if (FLAG_IS_DEFAULT(NewSize)) { // Make the young generation 3/8ths of the total heap. - FLAG_SET_CMDLINE(uintx, NewSize, + FLAG_SET_CMDLINE(size_t, NewSize, ((julong)MaxHeapSize / (julong)8) * (julong)3); - FLAG_SET_CMDLINE(uintx, MaxNewSize, NewSize); + FLAG_SET_CMDLINE(size_t, MaxNewSize, NewSize); } #ifndef _ALLBSD_SOURCE // UseLargePages is not yet supported on BSD. @@ -3155,14 +3155,14 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, #endif // Increase some data structure sizes for efficiency - FLAG_SET_CMDLINE(uintx, BaseFootPrintEstimate, MaxHeapSize); + FLAG_SET_CMDLINE(size_t, BaseFootPrintEstimate, MaxHeapSize); FLAG_SET_CMDLINE(bool, ResizeTLAB, false); - FLAG_SET_CMDLINE(uintx, TLABSize, 256*K); + FLAG_SET_CMDLINE(size_t, TLABSize, 256*K); // See the OldPLABSize comment below, but replace 'after promotion' // with 'after copying'. YoungPLABSize is the size of the survivor // space per-gc-thread buffers. The default is 4kw. - FLAG_SET_CMDLINE(uintx, YoungPLABSize, 256*K); // Note: this is in words + FLAG_SET_CMDLINE(size_t, YoungPLABSize, 256*K); // Note: this is in words // OldPLABSize is the size of the buffers in the old gen that // UseParallelGC uses to promote live data that doesn't fit in the @@ -3177,7 +3177,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, // locality. A minor effect may be that larger PLABs reduce the // number of PLAB allocation events during gc. The value of 8kw // was arrived at by experimenting with specjbb. - FLAG_SET_CMDLINE(uintx, OldPLABSize, 8*K); // Note: this is in words + FLAG_SET_CMDLINE(size_t, OldPLABSize, 8*K); // Note: this is in words // Enable parallel GC and adaptive generation sizing FLAG_SET_CMDLINE(bool, UseParallelGC, true); @@ -3256,7 +3256,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, jio_fprintf(defaultStream::error_stream(), "Please use -XX:MarkStackSize in place of " "-XX:CMSMarkStackSize or -XX:G1MarkStackSize in the future\n"); - FLAG_SET_CMDLINE(uintx, MarkStackSize, stack_size); + FLAG_SET_CMDLINE(size_t, MarkStackSize, stack_size); } else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) { julong max_stack_size = 0; ArgsRange errcode = parse_memory_size(tail, &max_stack_size, 1); @@ -3270,7 +3270,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, jio_fprintf(defaultStream::error_stream(), "Please use -XX:MarkStackSizeMax in place of " "-XX:CMSMarkStackSizeMax in the future\n"); - FLAG_SET_CMDLINE(uintx, MarkStackSizeMax, max_stack_size); + FLAG_SET_CMDLINE(size_t, MarkStackSizeMax, max_stack_size); } else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) || match_option(option, "-XX:ParallelCMSThreads=", &tail)) { uintx conc_threads = 0; @@ -3293,7 +3293,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, describe_range_error(errcode); return JNI_EINVAL; } - FLAG_SET_CMDLINE(uintx, MaxDirectMemorySize, max_direct_memory_size); + FLAG_SET_CMDLINE(size_t, MaxDirectMemorySize, max_direct_memory_size); #if !INCLUDE_MANAGEMENT } else if (match_option(option, "-XX:+ManagementServer")) { jio_fprintf(defaultStream::error_stream(), diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp index 1fb5e8c6739..99ecdd0d89a 100644 --- a/hotspot/src/share/vm/runtime/arguments.hpp +++ b/hotspot/src/share/vm/runtime/arguments.hpp @@ -530,8 +530,8 @@ class Arguments : AllStatic { static bool has_profile() { return _has_profile; } // -Xms - static uintx min_heap_size() { return _min_heap_size; } - static void set_min_heap_size(uintx v) { _min_heap_size = v; } + static size_t min_heap_size() { return _min_heap_size; } + static void set_min_heap_size(size_t v) { _min_heap_size = v; } // Returns the original values of -XX:MinHeapFreeRatio and -XX:MaxHeapFreeRatio static uintx min_heap_free_ratio() { return _min_heap_free_ratio; } diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 539f9a40e7e..2e350964f3a 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -193,19 +193,19 @@ define_pd_global(intx, CompileThreshold, 0); define_pd_global(intx, OnStackReplacePercentage, 0); define_pd_global(bool, ResizeTLAB, false); define_pd_global(intx, FreqInlineSize, 0); -define_pd_global(intx, NewSizeThreadIncrease, 4*K); +define_pd_global(size_t, NewSizeThreadIncrease, 4*K); define_pd_global(intx, InlineClassNatives, true); define_pd_global(intx, InlineUnsafeOps, true); define_pd_global(intx, InitialCodeCacheSize, 160*K); define_pd_global(intx, ReservedCodeCacheSize, 32*M); define_pd_global(intx, NonProfiledCodeHeapSize, 0); define_pd_global(intx, ProfiledCodeHeapSize, 0); -define_pd_global(intx, NonNMethodCodeHeapSize, 32*M); +define_pd_global(intx, NonNMethodCodeHeapSize, 32*M); define_pd_global(intx, CodeCacheExpansionSize, 32*K); define_pd_global(intx, CodeCacheMinBlockLength, 1); define_pd_global(intx, CodeCacheMinimumUseSpace, 200*K); -define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(4*M)); +define_pd_global(size_t, MetaspaceSize, ScaleForWordSize(4*M)); define_pd_global(bool, NeverActAsServerClassMachine, true); define_pd_global(uint64_t,MaxRAM, 1ULL*G); #define CI_COMPILER_COUNT 0 @@ -468,7 +468,7 @@ class CommandLineFlags { // notproduct flags are settable / visible only during development and are not declared in the PRODUCT version // A flag must be declared with one of the following types: -// bool, intx, uintx, ccstr, double, or uint64_t. +// bool, intx, uintx, size_t, ccstr, double, or uint64_t. // The type "ccstr" is an alias for "const char*" and is used // only in this file, because the macrology requires single-token type names. @@ -540,7 +540,7 @@ class CommandLineFlags { notproduct(bool, CheckCompressedOops, true, \ "Generate checks in encoding/decoding code in debug VM") \ \ - product_pd(uintx, HeapBaseMinAddress, \ + product_pd(size_t, HeapBaseMinAddress, \ "OS specific low limit for heap base address") \ \ product(uintx, HeapSearchSteps, 3 PPC64_ONLY(+17), \ @@ -606,7 +606,7 @@ class CommandLineFlags { product(bool, UseNUMAInterleaving, false, \ "Interleave memory across NUMA nodes if available") \ \ - product(uintx, NUMAInterleaveGranularity, 2*M, \ + product(size_t, NUMAInterleaveGranularity, 2*M, \ "Granularity to use for NUMA interleaving on Windows OS") \ \ product(bool, ForceNUMA, false, \ @@ -617,7 +617,7 @@ class CommandLineFlags { "computing exponentially decaying average for " \ "AdaptiveNUMAChunkSizing") \ \ - product(uintx, NUMASpaceResizeRate, 1*G, \ + product(size_t, NUMASpaceResizeRate, 1*G, \ "Do not reallocate more than this amount per collection") \ \ product(bool, UseAdaptiveNUMAChunkSizing, true, \ @@ -641,10 +641,10 @@ class CommandLineFlags { product(bool, UseSHA, false, \ "Control whether SHA instructions can be used on SPARC") \ \ - product(uintx, LargePageSizeInBytes, 0, \ + product(size_t, LargePageSizeInBytes, 0, \ "Large page size (0 to let VM choose the page size)") \ \ - product(uintx, LargePageHeapSizeThreshold, 128*M, \ + product(size_t, LargePageHeapSizeThreshold, 128*M, \ "Use large pages if maximum heap is at least this big") \ \ product(bool, ForceTimeHighResolution, false, \ @@ -963,11 +963,11 @@ class CommandLineFlags { "directory) of the dump file (defaults to java_pid.hprof " \ "in the working directory)") \ \ - develop(uintx, SegmentedHeapDumpThreshold, 2*G, \ + develop(size_t, SegmentedHeapDumpThreshold, 2*G, \ "Generate a segmented heap dump (JAVA PROFILE 1.0.2 format) " \ "when the heap usage is larger than this") \ \ - develop(uintx, HeapDumpSegmentSize, 1*G, \ + develop(size_t, HeapDumpSegmentSize, 1*G, \ "Approximate segment size when generating a segmented heap dump") \ \ develop(bool, BreakAtWarning, false, \ @@ -1465,7 +1465,7 @@ class CommandLineFlags { "Force dynamic selection of the number of " \ "parallel threads parallel gc will use to aid debugging") \ \ - product(uintx, HeapSizePerGCThread, ScaleForWordSize(64*M), \ + product(size_t, HeapSizePerGCThread, ScaleForWordSize(64*M), \ "Size of heap (bytes) per GC thread used in calculating the " \ "number of GC threads") \ \ @@ -1482,10 +1482,10 @@ class CommandLineFlags { product(uintx, ConcGCThreads, 0, \ "Number of threads concurrent gc will use") \ \ - product(uintx, YoungPLABSize, 4096, \ + product(size_t, YoungPLABSize, 4096, \ "Size of young gen promotion LAB's (in HeapWords)") \ \ - product(uintx, OldPLABSize, 1024, \ + product(size_t, OldPLABSize, 1024, \ "Size of old gen promotion LAB's (in HeapWords), or Number \ of blocks to attempt to claim when refilling CMS LAB's") \ \ @@ -1604,11 +1604,11 @@ class CommandLineFlags { product(bool, PrintOldPLAB, false, \ "Print (old gen) promotion LAB's sizing decisions") \ \ - product(uintx, CMSOldPLABMin, 16, \ + product(size_t, CMSOldPLABMin, 16, \ "Minimum size of CMS gen promotion LAB caches per worker " \ "per block size") \ \ - product(uintx, CMSOldPLABMax, 1024, \ + product(size_t, CMSOldPLABMax, 1024, \ "Maximum size of CMS gen promotion LAB caches per worker " \ "per block size") \ \ @@ -1631,7 +1631,7 @@ class CommandLineFlags { product(bool, AlwaysPreTouch, false, \ "Force all freshly committed pages to be pre-touched") \ \ - product_pd(uintx, CMSYoungGenPerWorker, \ + product_pd(size_t, CMSYoungGenPerWorker, \ "The maximum size of young gen chosen by default per GC worker " \ "thread available") \ \ @@ -1723,10 +1723,10 @@ class CommandLineFlags { develop(bool, CMSOverflowEarlyRestoration, false, \ "Restore preserved marks early") \ \ - product(uintx, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \ + product(size_t, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), \ "Size of marking stack") \ \ - product(uintx, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \ + product(size_t, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), \ "Maximum size of marking stack") \ \ notproduct(bool, CMSMarkStackOverflowALot, false, \ @@ -1749,10 +1749,10 @@ class CommandLineFlags { "Time that we sleep between iterations when not given " \ "enough work per iteration") \ \ - product(uintx, CMSRescanMultiple, 32, \ + product(size_t, CMSRescanMultiple, 32, \ "Size (in cards) of CMS parallel rescan task") \ \ - product(uintx, CMSConcMarkMultiple, 32, \ + product(size_t, CMSConcMarkMultiple, 32, \ "Size (in cards) of CMS concurrent MT marking task") \ \ product(bool, CMSAbortSemantics, false, \ @@ -1819,7 +1819,7 @@ class CommandLineFlags { product(uintx, CMSRemarkVerifyVariant, 1, \ "Choose variant (1,2) of verification following remark") \ \ - product(uintx, CMSScheduleRemarkEdenSizeThreshold, 2*M, \ + product(size_t, CMSScheduleRemarkEdenSizeThreshold, 2*M, \ "If Eden size is below this, do not try to schedule remark") \ \ product(uintx, CMSScheduleRemarkEdenPenetration, 50, \ @@ -1853,7 +1853,7 @@ class CommandLineFlags { product(bool, CMSYield, true, \ "Yield between steps of CMS") \ \ - product(uintx, CMSBitMapYieldQuantum, 10*M, \ + product(size_t, CMSBitMapYieldQuantum, 10*M, \ "Bitmap operations should process at most this many bits " \ "between yields") \ \ @@ -2033,7 +2033,7 @@ class CommandLineFlags { product_pd(uint64_t, MaxRAM, \ "Real memory size (in bytes) used to set maximum heap size") \ \ - product(uintx, ErgoHeapSizeLimit, 0, \ + product(size_t, ErgoHeapSizeLimit, 0, \ "Maximum ergonomically set heap size (in bytes); zero means use " \ "MaxRAM / MaxRAMFraction") \ \ @@ -2176,7 +2176,7 @@ class CommandLineFlags { product(uintx, InitialSurvivorRatio, 8, \ "Initial ratio of young generation/survivor space size") \ \ - product(uintx, BaseFootPrintEstimate, 256*M, \ + product(size_t, BaseFootPrintEstimate, 256*M, \ "Estimate of footprint other than Java Heap") \ \ product(bool, UseGCOverheadLimit, true, \ @@ -2327,7 +2327,7 @@ class CommandLineFlags { develop(bool, TraceClassLoaderData, false, \ "Trace class loader loader_data lifetime") \ \ - product(uintx, InitialBootClassLoaderMetaspaceSize, \ + product(size_t, InitialBootClassLoaderMetaspaceSize, \ NOT_LP64(2200*K) LP64_ONLY(4*M), \ "Initial size of the boot class loader data metaspace") \ \ @@ -2417,7 +2417,7 @@ class CommandLineFlags { "Number of gclog files in rotation " \ "(default: 0, no rotation)") \ \ - product(uintx, GCLogFileSize, 8*K, \ + product(size_t, GCLogFileSize, 8*K, \ "GC log file size, requires UseGCLogFileRotation. " \ "Set to 0 to only trigger rotation via jcmd") \ \ @@ -2955,11 +2955,11 @@ class CommandLineFlags { notproduct(ccstrlist, SuppressErrorAt, "", \ "List of assertions (file:line) to muzzle") \ \ - notproduct(uintx, HandleAllocationLimit, 1024, \ + notproduct(size_t, HandleAllocationLimit, 1024, \ "Threshold for HandleMark allocation when +TraceHandleAllocation "\ "is used") \ \ - develop(uintx, TotalHandleAllocationLimit, 1024, \ + develop(size_t, TotalHandleAllocationLimit, 1024, \ "Threshold for total handle allocation when " \ "+TraceHandleAllocation is used") \ \ @@ -3103,30 +3103,30 @@ class CommandLineFlags { "Number of times to spin wait before inflation") \ \ /* gc parameters */ \ - product(uintx, InitialHeapSize, 0, \ + product(size_t, InitialHeapSize, 0, \ "Initial heap size (in bytes); zero means use ergonomics") \ \ - product(uintx, MaxHeapSize, ScaleForWordSize(96*M), \ + product(size_t, MaxHeapSize, ScaleForWordSize(96*M), \ "Maximum heap size (in bytes)") \ \ - product(uintx, OldSize, ScaleForWordSize(4*M), \ + product(size_t, OldSize, ScaleForWordSize(4*M), \ "Initial tenured generation size (in bytes)") \ \ - product(uintx, NewSize, ScaleForWordSize(1*M), \ + product(size_t, NewSize, ScaleForWordSize(1*M), \ "Initial new generation size (in bytes)") \ \ - product(uintx, MaxNewSize, max_uintx, \ + product(size_t, MaxNewSize, max_uintx, \ "Maximum new generation size (in bytes), max_uintx means set " \ "ergonomically") \ \ - product(uintx, PretenureSizeThreshold, 0, \ + product(size_t, PretenureSizeThreshold, 0, \ "Maximum size in bytes of objects allocated in DefNew " \ "generation; zero means no maximum") \ \ - product(uintx, TLABSize, 0, \ + product(size_t, TLABSize, 0, \ "Starting TLAB size (in bytes); zero means set ergonomically") \ \ - product(uintx, MinTLABSize, 2*K, \ + product(size_t, MinTLABSize, 2*K, \ "Minimum allowed TLAB size (in bytes)") \ \ product(uintx, TLABAllocationWeight, 35, \ @@ -3147,17 +3147,17 @@ class CommandLineFlags { product(uintx, NewRatio, 2, \ "Ratio of old/new generation sizes") \ \ - product_pd(uintx, NewSizeThreadIncrease, \ + product_pd(size_t, NewSizeThreadIncrease, \ "Additional size added to desired new generation size per " \ "non-daemon thread (in bytes)") \ \ - product_pd(uintx, MetaspaceSize, \ + product_pd(size_t, MetaspaceSize, \ "Initial size of Metaspaces (in bytes)") \ \ - product(uintx, MaxMetaspaceSize, max_uintx, \ + product(size_t, MaxMetaspaceSize, max_uintx, \ "Maximum size of Metaspaces (in bytes)") \ \ - product(uintx, CompressedClassSpaceSize, 1*G, \ + product(size_t, CompressedClassSpaceSize, 1*G, \ "Maximum size of class area in Metaspace when compressed " \ "class pointers are used") \ \ @@ -3174,10 +3174,10 @@ class CommandLineFlags { product(intx, SoftRefLRUPolicyMSPerMB, 1000, \ "Number of milliseconds per MB of free space in the heap") \ \ - product(uintx, MinHeapDeltaBytes, ScaleForWordSize(128*K), \ + product(size_t, MinHeapDeltaBytes, ScaleForWordSize(128*K), \ "The minimum change in heap space due to GC (in bytes)") \ \ - product(uintx, MinMetaspaceExpansion, ScaleForWordSize(256*K), \ + product(size_t, MinMetaspaceExpansion, ScaleForWordSize(256*K), \ "The minimum expansion of Metaspace (in bytes)") \ \ product(uintx, MinMetaspaceFreeRatio, 40, \ @@ -3188,7 +3188,7 @@ class CommandLineFlags { "The maximum percentage of Metaspace free after GC to avoid " \ "shrinking") \ \ - product(uintx, MaxMetaspaceExpansion, ScaleForWordSize(4*M), \ + product(size_t, MaxMetaspaceExpansion, ScaleForWordSize(4*M), \ "The maximum expansion of Metaspace without full GC (in bytes)") \ \ product(uintx, QueuedAllocationWarningCount, 0, \ @@ -3279,10 +3279,10 @@ class CommandLineFlags { product_pd(intx, CompilerThreadStackSize, \ "Compiler Thread Stack Size (in Kbytes)") \ \ - develop_pd(uintx, JVMInvokeMethodSlack, \ + develop_pd(size_t, JVMInvokeMethodSlack, \ "Stack space (bytes) required for JVM_InvokeMethod to complete") \ \ - product(uintx, ThreadSafetyMargin, 50*M, \ + product(size_t, ThreadSafetyMargin, 50*M, \ "Thread safety margin is used on fixed-stack LinuxThreads (on " \ "Linux/x86 only) to prevent heap-stack collision. Set to 0 to " \ "disable this feature") \ @@ -3670,7 +3670,7 @@ class CommandLineFlags { \ /* Properties for Java libraries */ \ \ - product(uintx, MaxDirectMemorySize, 0, \ + product(size_t, MaxDirectMemorySize, 0, \ "Maximum total size of NIO direct-buffer allocations") \ \ /* Flags used for temporary code during development */ \ @@ -3774,10 +3774,10 @@ class CommandLineFlags { "If PrintSharedArchiveAndExit is true, also print the shared " \ "dictionary") \ \ - product(uintx, SharedReadWriteSize, NOT_LP64(12*M) LP64_ONLY(16*M), \ + product(size_t, SharedReadWriteSize, NOT_LP64(12*M) LP64_ONLY(16*M), \ "Size of read-write space for metadata (in bytes)") \ \ - product(uintx, SharedReadOnlySize, NOT_LP64(12*M) LP64_ONLY(16*M), \ + product(size_t, SharedReadOnlySize, NOT_LP64(12*M) LP64_ONLY(16*M), \ "Size of read-only space for metadata (in bytes)") \ \ product(uintx, SharedMiscDataSize, NOT_LP64(2*M) LP64_ONLY(4*M), \ diff --git a/hotspot/src/share/vm/runtime/handles.cpp b/hotspot/src/share/vm/runtime/handles.cpp index 2e00c93aaf3..a9b1dcad326 100644 --- a/hotspot/src/share/vm/runtime/handles.cpp +++ b/hotspot/src/share/vm/runtime/handles.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,7 +83,7 @@ void HandleArea::oops_do(OopClosure* f) { } // The thread local handle areas should not get very large - if (TraceHandleAllocation && handles_visited > TotalHandleAllocationLimit) { + if (TraceHandleAllocation && (size_t)handles_visited > TotalHandleAllocationLimit) { #ifdef ASSERT warning("%d: Visited in HandleMark : %d", _nof_handlemarks, handles_visited); diff --git a/hotspot/src/share/vm/services/heapDumper.cpp b/hotspot/src/share/vm/services/heapDumper.cpp index 2c5699d06b7..2cee37ab358 100644 --- a/hotspot/src/share/vm/services/heapDumper.cpp +++ b/hotspot/src/share/vm/services/heapDumper.cpp @@ -1721,7 +1721,7 @@ void VM_HeapDumper::doit() { // Write the file header - use 1.0.2 for large heaps, otherwise 1.0.1 size_t used = ch->used(); const char* header; - if (used > (size_t)SegmentedHeapDumpThreshold) { + if (used > SegmentedHeapDumpThreshold) { set_segmented_dump(); header = "JAVA PROFILE 1.0.2"; } else { diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp index 39a0c60e965..3a0c9cc6d1a 100644 --- a/hotspot/src/share/vm/utilities/debug.cpp +++ b/hotspot/src/share/vm/utilities/debug.cpp @@ -273,7 +273,7 @@ void report_out_of_shared_space(SharedSpaceType shared_space) { } void report_insufficient_metaspace(size_t required_size) { - warning("\nThe MaxMetaspaceSize of " UINTX_FORMAT " bytes is not large enough.\n" + warning("\nThe MaxMetaspaceSize of " SIZE_FORMAT " bytes is not large enough.\n" "Either don't specify the -XX:MaxMetaspaceSize=\n" "or increase the size to at least " SIZE_FORMAT ".\n", MaxMetaspaceSize, required_size); diff --git a/hotspot/src/share/vm/utilities/ostream.hpp b/hotspot/src/share/vm/utilities/ostream.hpp index 5bf1ce43828..29cc6b991f1 100644 --- a/hotspot/src/share/vm/utilities/ostream.hpp +++ b/hotspot/src/share/vm/utilities/ostream.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -250,7 +250,7 @@ class gcLogFileStream : public fileStream { /* If "force" sets true, force log file rotation from outside JVM */ bool should_rotate(bool force) { return force || - ((GCLogFileSize != 0) && ((uintx)_bytes_written >= GCLogFileSize)); + ((GCLogFileSize != 0) && (_bytes_written >= (jlong)GCLogFileSize)); } }; From ba1d121fe0ddc0f2b9f830bd9dcf872b3f05d331 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Thu, 26 Mar 2015 11:28:19 +0100 Subject: [PATCH 016/101] 8075957: Reduce calls to the GC specific object visitors in oopDesc Reviewed-by: brutisso, mgerdin, pliden --- .../gc_implementation/g1/g1CollectedHeap.cpp | 1 - .../vm/gc_implementation/g1/g1MarkSweep.cpp | 5 ++-- .../g1/g1ParScanThreadState.cpp | 1 - .../parNew/parNewGeneration.cpp | 1 - .../parallelScavenge/cardTableExtension.cpp | 7 +++-- .../parallelScavenge/pcTasks.cpp | 7 +++-- .../parallelScavenge/psCompactionManager.cpp | 12 ++++----- .../parallelScavenge/psCompactionManager.hpp | 6 ++++- .../psCompactionManager.inline.hpp | 17 +++++++++++- .../parallelScavenge/psMarkSweepDecorator.cpp | 6 ++--- .../parallelScavenge/psParallelCompact.cpp | 10 ++++--- .../parallelScavenge/psParallelCompact.hpp | 26 ------------------- .../parallelScavenge/psPromotionManager.cpp | 3 +-- .../parallelScavenge/psPromotionManager.hpp | 4 ++- .../psPromotionManager.inline.hpp | 7 +++-- .../parallelScavenge/psScavenge.cpp | 1 - .../parallelScavenge/psTasks.cpp | 1 - .../vm/gc_implementation/shared/markSweep.cpp | 10 ++++--- .../vm/gc_implementation/shared/markSweep.hpp | 6 +++++ .../shared/markSweep.inline.hpp | 12 +++++++-- hotspot/src/share/vm/memory/space.inline.hpp | 4 +-- .../vm/oops/instanceClassLoaderKlass.cpp | 3 +-- hotspot/src/share/vm/oops/instanceKlass.cpp | 1 - .../src/share/vm/oops/instanceMirrorKlass.cpp | 3 +-- .../src/share/vm/oops/instanceRefKlass.cpp | 3 +-- hotspot/src/share/vm/oops/objArrayKlass.cpp | 1 - 26 files changed, 82 insertions(+), 76 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index a9ef5dcad69..deb2e2af927 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -66,7 +66,6 @@ #include "memory/iterator.hpp" #include "memory/referenceProcessor.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/vmThread.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp index 29020bc8782..38ec4a96c7e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ #include "gc_implementation/g1/g1MarkSweep.hpp" #include "gc_implementation/g1/g1RootProcessor.hpp" #include "gc_implementation/g1/g1StringDedup.hpp" +#include "gc_implementation/shared/markSweep.inline.hpp" #include "gc_implementation/shared/gcHeapSummary.hpp" #include "gc_implementation/shared/gcTimer.hpp" #include "gc_implementation/shared/gcTrace.hpp" @@ -217,7 +218,7 @@ class G1AdjustPointersClosure: public HeapRegionClosure { // We must adjust the pointers on the single H object. oop obj = oop(r->bottom()); // point all the oops to the new location - obj->adjust_pointers(); + MarkSweep::adjust_pointers(obj); } } else { // This really ought to be "as_CompactibleSpace"... diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp index 2ec726e744e..6ffb5fe5902 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp @@ -27,7 +27,6 @@ #include "gc_implementation/g1/g1OopClosures.inline.hpp" #include "gc_implementation/g1/g1ParScanThreadState.inline.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #include "runtime/prefetch.inline.hpp" G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp) diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 11465b12ef3..f1be6547dd6 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -46,7 +46,6 @@ #include "memory/space.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/handles.hpp" #include "runtime/handles.inline.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp index 7448978578c..3523ff514d8 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp @@ -26,12 +26,11 @@ #include "gc_implementation/parallelScavenge/cardTableExtension.hpp" #include "gc_implementation/parallelScavenge/gcTaskManager.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" -#include "gc_implementation/parallelScavenge/psPromotionManager.hpp" +#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" #include "gc_implementation/parallelScavenge/psScavenge.hpp" #include "gc_implementation/parallelScavenge/psTasks.hpp" #include "gc_implementation/parallelScavenge/psYoungGen.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.psgc.inline.hpp" #include "runtime/prefetch.inline.hpp" // Checks an individual oop for missing precise marks. Mark @@ -291,7 +290,7 @@ void CardTableExtension::scavenge_contents_parallel(ObjectStartArray* start_arra Prefetch::write(p, interval); oop m = oop(p); assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m))); - m->push_contents(pm); + pm->push_contents(m); p += m->size(); } pm->drain_stacks_cond_depth(); @@ -299,7 +298,7 @@ void CardTableExtension::scavenge_contents_parallel(ObjectStartArray* start_arra while (p < to) { oop m = oop(p); assert(m->is_oop_or_null(), err_msg("Expected an oop or NULL for header field at " PTR_FORMAT, p2i(m))); - m->push_contents(pm); + pm->push_contents(m); p += m->size(); } pm->drain_stacks_cond_depth(); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp index c277038c904..13ccf71c28c 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp @@ -27,6 +27,7 @@ #include "code/codeCache.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #include "gc_implementation/parallelScavenge/pcTasks.hpp" +#include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp" #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" #include "gc_implementation/shared/gcTimer.hpp" #include "gc_implementation/shared/gcTraceTime.hpp" @@ -34,7 +35,6 @@ #include "memory/universe.hpp" #include "oops/objArrayKlass.inline.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #include "prims/jvmtiExport.hpp" #include "runtime/fprofiler.hpp" #include "runtime/jniHandles.hpp" @@ -221,12 +221,11 @@ void StealMarkingTask::do_it(GCTaskManager* manager, uint which) { int random_seed = 17; do { while (ParCompactionManager::steal_objarray(which, &random_seed, task)) { - ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass(); - k->oop_follow_contents(cm, task.obj(), task.index()); + cm->follow_contents((objArrayOop)task.obj(), task.index()); cm->follow_marking_stacks(); } while (ParCompactionManager::steal(which, &random_seed, obj)) { - obj->follow_contents(cm); + cm->follow_contents(obj); cm->follow_marking_stacks(); } } while (!terminator()->offer_termination()); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp index f838787bfdc..70b619f813d 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,12 +28,11 @@ #include "gc_implementation/parallelScavenge/objectStartArray.hpp" #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp" #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" -#include "gc_implementation/parallelScavenge/psCompactionManager.hpp" +#include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp" #include "gc_implementation/parallelScavenge/psOldGen.hpp" #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" #include "oops/objArrayKlass.inline.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #include "runtime/atomic.inline.hpp" #include "utilities/stack.inline.hpp" @@ -180,17 +179,16 @@ void ParCompactionManager::follow_marking_stacks() { // Drain the overflow stack first, to allow stealing from the marking stack. oop obj; while (marking_stack()->pop_overflow(obj)) { - obj->follow_contents(this); + follow_contents(obj); } while (marking_stack()->pop_local(obj)) { - obj->follow_contents(this); + follow_contents(obj); } // Process ObjArrays one at a time to avoid marking stack bloat. ObjArrayTask task; if (_objarray_stack.pop_overflow(task) || _objarray_stack.pop_local(task)) { - ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass(); - k->oop_follow_contents(this, task.obj(), task.index()); + follow_contents((objArrayOop)task.obj(), task.index()); } } while (!marking_stacks_empty()); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp index 7d7a9f495a1..4e5544da50d 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -196,6 +196,10 @@ private: // Process tasks remaining on any stack void drain_region_stacks(); + void follow_contents(oop obj); + void follow_contents(objArrayOop array, int index); + + void update_contents(oop obj); }; inline ParCompactionManager* ParCompactionManager::manager_array(int index) { diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp index 6cf76353d9c..90c22306e7d 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ #include "gc_implementation/parallelScavenge/psCompactionManager.hpp" #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" +#include "oops/objArrayKlass.inline.hpp" +#include "oops/oop.pcgc.inline.hpp" void ParCompactionManager::push_objarray(oop obj, size_t index) { @@ -46,4 +48,17 @@ void ParCompactionManager::push_region(size_t index) region_stack()->push(index); } +inline void ParCompactionManager::follow_contents(oop obj) { + obj->follow_contents(this); +} + +inline void ParCompactionManager::follow_contents(objArrayOop obj, int index) { + ObjArrayKlass* k = (ObjArrayKlass*)obj->klass(); + k->oop_follow_contents(this, obj, index); +} + +inline void ParCompactionManager::update_contents(oop obj) { + obj->update_contents(this); +} + #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSCOMPACTIONMANAGER_INLINE_HPP diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp index dc79821cb37..2cf025452b1 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -303,7 +303,7 @@ void PSMarkSweepDecorator::adjust_pointers() { while (q < end) { // point all the oops to the new location - size_t size = oop(q)->adjust_pointers(); + size_t size = MarkSweep::adjust_pointers(oop(q)); q += size; } @@ -324,7 +324,7 @@ void PSMarkSweepDecorator::adjust_pointers() { if (oop(q)->is_gc_marked()) { // q is alive // point all the oops to the new location - size_t size = oop(q)->adjust_pointers(); + size_t size = MarkSweep::adjust_pointers(oop(q)); debug_only(prev_q = q); q += size; } else { diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 3e89b0a98e0..c262b0b5c95 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -50,7 +50,6 @@ #include "memory/referenceProcessor.hpp" #include "oops/methodData.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/fprofiler.hpp" #include "runtime/safepoint.hpp" @@ -2776,6 +2775,11 @@ void PSParallelCompact::verify_complete(SpaceId space_id) { } #endif // #ifdef ASSERT +inline void UpdateOnlyClosure::do_addr(HeapWord* addr) { + _start_array->allocate_block(addr); + compaction_manager()->update_contents(oop(addr)); +} + // Update interior oops in the ranges of regions [beg_region, end_region). void PSParallelCompact::update_and_deadwood_in_dense_prefix(ParCompactionManager* cm, @@ -2876,7 +2880,7 @@ void PSParallelCompact::update_deferred_objects(ParCompactionManager* cm, if (start_array != NULL) { start_array->allocate_block(addr); } - oop(addr)->update_contents(cm); + cm->update_contents(oop(addr)); assert(oop(addr)->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr)))); } } @@ -3360,7 +3364,7 @@ MoveAndUpdateClosure::do_addr(HeapWord* addr, size_t words) { } oop moved_oop = (oop) destination(); - moved_oop->update_contents(compaction_manager()); + compaction_manager()->update_contents(moved_oop); assert(moved_oop->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(moved_oop))); update_state(words); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp index d402309851f..3e1f9198c57 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp @@ -1025,9 +1025,6 @@ class PSParallelCompact : AllStatic { bool maximum_heap_compaction, ParallelOldTracer *gc_tracer); - template - static inline void follow_root(ParCompactionManager* cm, T* p); - // Compute the dense prefix for the designated space. This is an experimental // implementation currently not used in production. static HeapWord* compute_dense_prefix_via_density(const SpaceId id, @@ -1335,23 +1332,6 @@ inline bool PSParallelCompact::is_marked(oop obj) { return mark_bitmap()->is_marked(obj); } -template -inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) { - assert(!Universe::heap()->is_in_reserved(p), - "roots shouldn't be things within the heap"); - - T heap_oop = oopDesc::load_heap_oop(p); - if (!oopDesc::is_null(heap_oop)) { - oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); - if (mark_bitmap()->is_unmarked(obj)) { - if (mark_obj(obj)) { - obj->follow_contents(cm); - } - } - } - cm->follow_marking_stacks(); -} - template inline void PSParallelCompact::mark_and_push(ParCompactionManager* cm, T* p) { T heap_oop = oopDesc::load_heap_oop(p); @@ -1524,12 +1504,6 @@ class UpdateOnlyClosure: public ParMarkBitMapClosure { inline void do_addr(HeapWord* addr); }; -inline void UpdateOnlyClosure::do_addr(HeapWord* addr) -{ - _start_array->allocate_block(addr); - oop(addr)->update_contents(compaction_manager()); -} - class FillClosure: public ParMarkBitMapClosure { public: diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp index 33d300fcbb7..cf79af15c4e 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @@ -33,7 +33,6 @@ #include "memory/memRegion.hpp" #include "memory/padded.inline.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.psgc.inline.hpp" #include "utilities/stack.inline.hpp" PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC @@ -325,7 +324,7 @@ oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) { _promotion_failed_info.register_copy_failure(obj->size()); - obj->push_contents(this); + push_contents(obj); // Save the mark if needed PSScavenge::oop_promotion_failed(obj, obj_mark); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp index b111ff2765a..d98ed220efd 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -212,6 +212,8 @@ class PSPromotionManager VALUE_OBJ_CLASS_SPEC { template inline void claim_or_forward_depth(T* p); TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);) + + void push_contents(oop obj); }; #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_HPP diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp index 0ffe2df0788..cb6445fe13f 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,6 +91,9 @@ inline void PSPromotionManager::promotion_trace_event(oop new_obj, oop old_obj, } } +inline void PSPromotionManager::push_contents(oop obj) { + obj->push_contents(this); +} // // This method is pretty bulky. It would be nice to split it up // into smaller submethods, but we need to be careful not to hurt @@ -227,7 +230,7 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) { TASKQUEUE_STATS_ONLY(++_arrays_chunked; ++_masked_pushes); } else { // we'll just push its contents - new_obj->push_contents(this); + push_contents(new_obj); } } else { // We lost, someone else "owns" this object diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index 3c0542f3b80..205170b8c65 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -46,7 +46,6 @@ #include "memory/referenceProcessor.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.psgc.inline.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp index e944dfea010..5739331ab6a 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp @@ -35,7 +35,6 @@ #include "memory/iterator.hpp" #include "memory/universe.hpp" #include "oops/oop.inline.hpp" -#include "oops/oop.psgc.inline.hpp" #include "runtime/fprofiler.hpp" #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp index 01e7e88f5b8..dadffdf01b5 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp @@ -64,18 +64,22 @@ void MarkSweep::follow_class_loader(ClassLoaderData* cld) { MarkSweep::follow_cld_closure.do_cld(cld); } +void MarkSweep::follow_array(objArrayOop array, int index) { + ObjArrayKlass* k = (ObjArrayKlass*)array->klass(); + k->oop_follow_contents(array, index); +} + void MarkSweep::follow_stack() { do { while (!_marking_stack.is_empty()) { oop obj = _marking_stack.pop(); assert (obj->is_gc_marked(), "p must be marked"); - obj->follow_contents(); + follow_object(obj); } // Process ObjArrays one at a time to avoid marking stack bloat. if (!_objarray_stack.is_empty()) { ObjArrayTask task = _objarray_stack.pop(); - ObjArrayKlass* k = (ObjArrayKlass*)task.obj()->klass(); - k->oop_follow_contents(task.obj(), task.index()); + follow_array(objArrayOop(task.obj()), task.index()); } } while (!_marking_stack.is_empty() || !_objarray_stack.is_empty()); } diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp index 37928ea2ac6..724d212940c 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp @@ -160,10 +160,16 @@ class MarkSweep : AllStatic { static void follow_stack(); // Empty marking stack. + static void follow_object(oop obj); + + static void follow_array(objArrayOop array, int index); + static void follow_klass(Klass* klass); static void follow_class_loader(ClassLoaderData* cld); + static int adjust_pointers(oop obj); + static void preserve_mark(oop p, markOop mark); // Save the mark word so it can be restored later static void adjust_marks(); // Adjust the pointers in the preserved marks table diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp index ebc89061a32..196dcad7a7f 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,6 +58,10 @@ inline void MarkSweep::follow_klass(Klass* klass) { MarkSweep::mark_and_push(&op); } +inline void MarkSweep::follow_object(oop obj) { + obj->follow_contents(); +} + template inline void MarkSweep::follow_root(T* p) { assert(!Universe::heap()->is_in_reserved(p), "roots shouldn't be things within the heap"); @@ -66,7 +70,7 @@ template inline void MarkSweep::follow_root(T* p) { oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); if (!obj->mark()->is_marked()) { mark_object(obj); - obj->follow_contents(); + follow_object(obj); } } follow_stack(); @@ -90,6 +94,10 @@ void MarkSweep::push_objarray(oop obj, size_t index) { _objarray_stack.push(task); } +inline int MarkSweep::adjust_pointers(oop obj) { + return obj->adjust_pointers(); +} + template inline void MarkSweep::adjust_pointer(T* p) { T heap_oop = oopDesc::load_heap_oop(p); if (!oopDesc::is_null(heap_oop)) { diff --git a/hotspot/src/share/vm/memory/space.inline.hpp b/hotspot/src/share/vm/memory/space.inline.hpp index 6adfc5702a6..ccb81527586 100644 --- a/hotspot/src/share/vm/memory/space.inline.hpp +++ b/hotspot/src/share/vm/memory/space.inline.hpp @@ -214,7 +214,7 @@ inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) { assert(space->block_is_obj(q), "should be at block boundaries, and should be looking at objs"); // point all the oops to the new location - size_t size = oop(q)->adjust_pointers(); + size_t size = MarkSweep::adjust_pointers(oop(q)); size = space->adjust_obj_size(size); q += size; @@ -238,7 +238,7 @@ inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) { if (oop(q)->is_gc_marked()) { // q is alive // point all the oops to the new location - size_t size = oop(q)->adjust_pointers(); + size_t size = MarkSweep::adjust_pointers(oop(q)); size = space->adjust_obj_size(size); debug_only(prev_q = q); q += size; diff --git a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp index f49e376cbfc..cf2eec97ee9 100644 --- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,6 @@ #if INCLUDE_ALL_GCS #include "gc_implementation/parNew/parOopClosures.inline.hpp" #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #endif // INCLUDE_ALL_GCS // Macro to define InstanceClassLoaderKlass::oop_oop_iterate for virtual/nonvirtual for diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 8d62afef112..f7ac70e3f45 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -74,7 +74,6 @@ #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp" #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #endif // INCLUDE_ALL_GCS #ifdef COMPILER1 #include "c1/c1_Compiler.hpp" diff --git a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp index 73d6e439d6d..191f1b85383 100644 --- a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,6 @@ #include "gc_implementation/parNew/parOopClosures.inline.hpp" #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #endif // INCLUDE_ALL_GCS int InstanceMirrorKlass::_offset_of_static_fields = 0; diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.cpp b/hotspot/src/share/vm/oops/instanceRefKlass.cpp index 12804db3508..bf3cfa3dc8a 100644 --- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,6 @@ #include "gc_implementation/parNew/parOopClosures.inline.hpp" #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #endif // INCLUDE_ALL_GCS PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp index 8c2670c5214..ceaabf9d9b5 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp @@ -55,7 +55,6 @@ #include "gc_implementation/parallelScavenge/psCompactionManager.hpp" #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp" #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" -#include "oops/oop.pcgc.inline.hpp" #endif // INCLUDE_ALL_GCS ObjArrayKlass* ObjArrayKlass::allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS) { From 2c63bc9175ee033412babc014df472827aa91a66 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Mon, 16 Mar 2015 13:28:27 +0100 Subject: [PATCH 017/101] 8075635: Remove GenerationSpec array Replaced the array with explicit variables for young and old Reviewed-by: kbarrett, mgerdin --- .../jvm/hotspot/memory/GenCollectedHeap.java | 29 ++++++++----- .../cmsCollectorPolicy.cpp | 9 ++-- .../src/share/vm/memory/collectorPolicy.cpp | 10 ++--- .../src/share/vm/memory/collectorPolicy.hpp | 19 ++++++--- .../src/share/vm/memory/defNewGeneration.cpp | 2 +- .../src/share/vm/memory/genCollectedHeap.cpp | 42 +++++++------------ .../src/share/vm/memory/genCollectedHeap.hpp | 6 +-- hotspot/src/share/vm/memory/generation.cpp | 4 +- .../src/share/vm/memory/generationSpec.hpp | 18 +++----- hotspot/src/share/vm/runtime/vmStructs.cpp | 7 +++- .../src/share/vm/services/memoryService.cpp | 3 +- 11 files changed, 72 insertions(+), 77 deletions(-) diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java index 26b107355b0..b39c4602043 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java @@ -37,7 +37,9 @@ public class GenCollectedHeap extends SharedHeap { private static CIntegerField nGensField; private static AddressField youngGenField; private static AddressField oldGenField; - private static AddressField genSpecsField; + + private static AddressField youngGenSpecField; + private static AddressField oldGenSpecField; private static GenerationFactory genFactory; @@ -55,9 +57,12 @@ public class GenCollectedHeap extends SharedHeap { nGensField = type.getCIntegerField("_n_gens"); youngGenField = type.getAddressField("_young_gen"); oldGenField = type.getAddressField("_old_gen"); - genSpecsField = type.getAddressField("_gen_specs"); genFactory = new GenerationFactory(); + + Type collectorPolicyType = db.lookupType("GenCollectorPolicy"); + youngGenSpecField = collectorPolicyType.getAddressField("_young_gen_spec"); + oldGenSpecField = collectorPolicyType.getAddressField("_old_gen_spec"); } public GenCollectedHeap(Address addr) { @@ -115,21 +120,23 @@ public class GenCollectedHeap extends SharedHeap { /** Package-private access to GenerationSpecs */ GenerationSpec spec(int level) { if (Assert.ASSERTS_ENABLED) { - Assert.that((level >= 0) && (level < nGens()), "Index " + level + - " out of range (should be between 0 and " + nGens() + ")"); + Assert.that((level == 0) || (level == 1), "Index " + level + + " out of range (should be 0 or 1)"); } - if ((level < 0) || (level >= nGens())) { + if ((level != 0) && (level != 1)) { return null; } - Address ptrList = genSpecsField.getValue(addr); - if (ptrList == null) { - return null; + if (level == 0) { + return (GenerationSpec) + VMObjectFactory.newObject(GenerationSpec.class, + youngGenSpecField.getAddress()); + } else { + return (GenerationSpec) + VMObjectFactory.newObject(GenerationSpec.class, + oldGenSpecField.getAddress()); } - return (GenerationSpec) - VMObjectFactory.newObject(GenerationSpec.class, - ptrList.getAddressAt(level * VM.getVM().getAddressSize())); } public CollectedHeapName kind() { diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp index 0bc3a84dba4..a4960ad4f72 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,9 +52,10 @@ void ConcurrentMarkSweepPolicy::initialize_alignments() { } void ConcurrentMarkSweepPolicy::initialize_generations() { - _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC); - _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size); - _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep, _initial_old_size, _max_old_size); + _young_gen_spec = new GenerationSpec(Generation::ParNew, _initial_young_size, + _max_young_size, _gen_alignment); + _old_gen_spec = new GenerationSpec(Generation::ConcurrentMarkSweep, + _initial_old_size, _max_old_size, _gen_alignment); } void ConcurrentMarkSweepPolicy::initialize_size_policy(size_t init_eden_size, diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp index d20c2536e32..094e3c3e28e 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp @@ -190,11 +190,12 @@ GenCollectorPolicy::GenCollectorPolicy() : _min_young_size(0), _initial_young_size(0), _max_young_size(0), - _gen_alignment(0), _min_old_size(0), _initial_old_size(0), _max_old_size(0), - _generations(NULL) + _gen_alignment(0), + _young_gen_spec(NULL), + _old_gen_spec(NULL) {} size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) { @@ -912,9 +913,8 @@ void MarkSweepPolicy::initialize_alignments() { } void MarkSweepPolicy::initialize_generations() { - _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC); - _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size); - _generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size); + _young_gen_spec = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size, _gen_alignment); + _old_gen_spec = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size, _gen_alignment); } void MarkSweepPolicy::initialize_gc_policy_counters() { diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp index 6f20be7f6dc..365a0ebe734 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.hpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -208,7 +208,8 @@ class ClearedAllSoftRefs : public StackObj { }; class GenCollectorPolicy : public CollectorPolicy { -friend class TestGenCollectorPolicy; + friend class TestGenCollectorPolicy; + friend class VMStructs; protected: size_t _min_young_size; size_t _initial_young_size; @@ -221,7 +222,8 @@ friend class TestGenCollectorPolicy; // time. When using large pages they can differ. size_t _gen_alignment; - GenerationSpec **_generations; + GenerationSpec* _young_gen_spec; + GenerationSpec* _old_gen_spec; // Return true if an allocation should be attempted in the older generation // if it fails in the younger generation. Return false, otherwise. @@ -261,9 +263,14 @@ friend class TestGenCollectorPolicy; int number_of_generations() { return 2; } - virtual GenerationSpec **generations() { - assert(_generations != NULL, "Sanity check"); - return _generations; + GenerationSpec* young_gen_spec() const { + assert(_young_gen_spec != NULL, "_young_gen_spec should have been initialized"); + return _young_gen_spec; + } + + GenerationSpec* old_gen_spec() const { + assert(_old_gen_spec != NULL, "_old_gen_spec should have been initialized"); + return _old_gen_spec; } virtual GenCollectorPolicy* as_generation_policy() { return this; } diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 0f5b2236555..c0eeb620010 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -380,7 +380,7 @@ void DefNewGeneration::compute_new_size() { int next_level = level() + 1; GenCollectedHeap* gch = GenCollectedHeap::heap(); - assert(next_level < gch->_n_gens, + assert(next_level < gch->n_gens(), "DefNewGeneration cannot be an oldest gen"); Generation* old_gen = gch->old_gen(); diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 704291f0d94..64c37b3655c 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -90,7 +90,6 @@ GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) : jint GenCollectedHeap::initialize() { CollectedHeap::pre_initialize(); - int i; _n_gens = gen_policy()->number_of_generations(); assert(_n_gens == 2, "There is no support for more than two generations"); @@ -101,16 +100,6 @@ jint GenCollectedHeap::initialize() { // HeapWordSize). guarantee(HeapWordSize == wordSize, "HeapWordSize must equal wordSize"); - // The heap must be at least as aligned as generations. - size_t gen_alignment = Generation::GenGrain; - - _gen_specs = gen_policy()->generations(); - - // Make sure the sizes are all aligned. - for (i = 0; i < _n_gens; i++) { - _gen_specs[i]->align(gen_alignment); - } - // Allocate space for the heap. char* heap_address; @@ -133,12 +122,12 @@ jint GenCollectedHeap::initialize() { _gch = this; - ReservedSpace young_rs = heap_rs.first_part(_gen_specs[0]->max_size(), false, false); - _young_gen = _gen_specs[0]->init(young_rs, 0, rem_set()); - heap_rs = heap_rs.last_part(_gen_specs[0]->max_size()); + ReservedSpace young_rs = heap_rs.first_part(gen_policy()->young_gen_spec()->max_size(), false, false); + _young_gen = gen_policy()->young_gen_spec()->init(young_rs, 0, rem_set()); + heap_rs = heap_rs.last_part(gen_policy()->young_gen_spec()->max_size()); - ReservedSpace old_rs = heap_rs.first_part(_gen_specs[1]->max_size(), false, false); - _old_gen = _gen_specs[1]->init(old_rs, 1, rem_set()); + ReservedSpace old_rs = heap_rs.first_part(gen_policy()->old_gen_spec()->max_size(), false, false); + _old_gen = gen_policy()->old_gen_spec()->init(old_rs, 1, rem_set()); clear_incremental_collection_failed(); #if INCLUDE_ALL_GCS @@ -155,21 +144,18 @@ jint GenCollectedHeap::initialize() { char* GenCollectedHeap::allocate(size_t alignment, ReservedSpace* heap_rs){ - const char overflow_msg[] = "The size of the object heap + VM data exceeds " - "the maximum representable size"; - // Now figure out the total size. - size_t total_reserved = 0; - const size_t pageSize = UseLargePages ? - os::large_page_size() : os::vm_page_size(); - + const size_t pageSize = UseLargePages ? os::large_page_size() : os::vm_page_size(); assert(alignment % pageSize == 0, "Must be"); - for (int i = 0; i < _n_gens; i++) { - total_reserved += _gen_specs[i]->max_size(); - if (total_reserved < _gen_specs[i]->max_size()) { - vm_exit_during_initialization(overflow_msg); - } + GenerationSpec* young_spec = gen_policy()->young_gen_spec(); + GenerationSpec* old_spec = gen_policy()->old_gen_spec(); + + // Check for overflow. + size_t total_reserved = young_spec->max_size() + old_spec->max_size(); + if (total_reserved < young_spec->max_size()) { + vm_exit_during_initialization("The size of the object heap + VM data exceeds " + "the maximum representable size"); } assert(total_reserved % alignment == 0, err_msg("Gen size; total_reserved=" SIZE_FORMAT ", alignment=" diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index d6193770905..bcc20bcd2aa 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -67,8 +67,6 @@ public: Generation* _young_gen; Generation* _old_gen; - GenerationSpec** _gen_specs; - // The singleton Gen Remembered Set. GenRemSet* _rem_set; @@ -145,8 +143,8 @@ public: return CollectedHeap::GenCollectedHeap; } - Generation* young_gen() { return _young_gen; } - Generation* old_gen() { return _old_gen; } + Generation* young_gen() const { return _young_gen; } + Generation* old_gen() const { return _old_gen; } // The generational collector policy. GenCollectorPolicy* gen_policy() const { return _gen_policy; } diff --git a/hotspot/src/share/vm/memory/generation.cpp b/hotspot/src/share/vm/memory/generation.cpp index 6bed336c174..205cbce34a4 100644 --- a/hotspot/src/share/vm/memory/generation.cpp +++ b/hotspot/src/share/vm/memory/generation.cpp @@ -63,8 +63,8 @@ Generation::Generation(ReservedSpace rs, size_t initial_size, int level) : GenerationSpec* Generation::spec() { GenCollectedHeap* gch = GenCollectedHeap::heap(); - assert(0 <= level() && level() < gch->_n_gens, "Bad gen level"); - return gch->_gen_specs[level()]; + assert(level() == 0 || level() == 1, "Bad gen level"); + return level() == 0 ? gch->gen_policy()->young_gen_spec() : gch->gen_policy()->old_gen_spec(); } size_t Generation::max_capacity() const { diff --git a/hotspot/src/share/vm/memory/generationSpec.hpp b/hotspot/src/share/vm/memory/generationSpec.hpp index 58448a496af..5c0e57ed14b 100644 --- a/hotspot/src/share/vm/memory/generationSpec.hpp +++ b/hotspot/src/share/vm/memory/generationSpec.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,11 +39,11 @@ private: size_t _max_size; public: - GenerationSpec(Generation::Name name, size_t init_size, size_t max_size) { - _name = name; - _init_size = init_size; - _max_size = max_size; - } + GenerationSpec(Generation::Name name, size_t init_size, size_t max_size, size_t alignment) : + _name(name), + _init_size(align_size_up(init_size, alignment)), + _max_size(align_size_up(max_size, alignment)) + { } Generation* init(ReservedSpace rs, int level, GenRemSet* remset); @@ -53,12 +53,6 @@ public: void set_init_size(size_t size) { _init_size = size; } size_t max_size() const { return _max_size; } void set_max_size(size_t size) { _max_size = size; } - - // Alignment - void align(size_t alignment) { - set_init_size(align_size_up(init_size(), alignment)); - set_max_size(align_size_up(max_size(), alignment)); - } }; typedef GenerationSpec* GenerationSpecPtr; diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 727d3ace8d2..8524679cbc3 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -527,11 +527,11 @@ typedef CompactHashtable SymbolCompactHashTable; nonstatic_field(CollectedHeap, _defer_initial_card_mark, bool) \ nonstatic_field(CollectedHeap, _is_gc_active, bool) \ nonstatic_field(CollectedHeap, _total_collections, unsigned int) \ + \ nonstatic_field(CompactibleSpace, _compaction_top, HeapWord*) \ nonstatic_field(CompactibleSpace, _first_dead, HeapWord*) \ nonstatic_field(CompactibleSpace, _end_of_live, HeapWord*) \ \ - \ nonstatic_field(ContiguousSpace, _top, HeapWord*) \ nonstatic_field(ContiguousSpace, _concurrent_iteration_safe_limit, HeapWord*) \ nonstatic_field(ContiguousSpace, _saved_mark_word, HeapWord*) \ @@ -559,7 +559,9 @@ typedef CompactHashtable SymbolCompactHashTable; nonstatic_field(GenCollectedHeap, _young_gen, Generation*) \ nonstatic_field(GenCollectedHeap, _old_gen, Generation*) \ nonstatic_field(GenCollectedHeap, _n_gens, int) \ - nonstatic_field(GenCollectedHeap, _gen_specs, GenerationSpec**) \ + \ + nonstatic_field(GenCollectorPolicy, _young_gen_spec, GenerationSpec*) \ + nonstatic_field(GenCollectorPolicy, _old_gen_spec, GenerationSpec*) \ \ nonstatic_field(HeapWord, i, char*) \ \ @@ -1505,6 +1507,7 @@ typedef CompactHashtable SymbolCompactHashTable; declare_type(DefNewGeneration, Generation) \ declare_type(CardGeneration, Generation) \ declare_type(TenuredGeneration, CardGeneration) \ + declare_toplevel_type(GenCollectorPolicy) \ declare_toplevel_type(Space) \ declare_toplevel_type(BitMap) \ declare_type(CompactibleSpace, Space) \ diff --git a/hotspot/src/share/vm/services/memoryService.cpp b/hotspot/src/share/vm/services/memoryService.cpp index 794f4621ca5..89e57affaa3 100644 --- a/hotspot/src/share/vm/services/memoryService.cpp +++ b/hotspot/src/share/vm/services/memoryService.cpp @@ -130,8 +130,7 @@ void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) { GenCollectorPolicy* gen_policy = policy->as_generation_policy(); if (gen_policy != NULL) { - GenerationSpec** specs = gen_policy->generations(); - Generation::Name kind = specs[0]->name(); + Generation::Name kind = gen_policy->young_gen_spec()->name(); switch (kind) { case Generation::DefNew: _minor_gc_manager = MemoryManager::get_copy_memory_manager(); From 02c878c4314ba8e10c580ec8ca08bc8366a5ad94 Mon Sep 17 00:00:00 2001 From: Andrey Zakharov Date: Mon, 16 Mar 2015 17:49:35 +0300 Subject: [PATCH 018/101] 8061715: gc/g1/TestShrinkAuxiliaryData15.java fails with java.lang.RuntimeException: heap decommit failed - after > before Test for auxiliary data in G1 fails as they cannot precisely measure this aux data size. I've added whitebox method to get this size. Reviewed-by: tschatzl, jwilhelm, mgerdin --- test/lib/sun/hotspot/WhiteBox.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/lib/sun/hotspot/WhiteBox.java b/test/lib/sun/hotspot/WhiteBox.java index b19845392ff..419262203ca 100644 --- a/test/lib/sun/hotspot/WhiteBox.java +++ b/test/lib/sun/hotspot/WhiteBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ package sun.hotspot; +import java.lang.management.MemoryUsage; import java.lang.reflect.Executable; import java.util.Arrays; import java.util.List; @@ -94,8 +95,10 @@ public class WhiteBox { // G1 public native boolean g1InConcurrentMark(); public native boolean g1IsHumongous(Object o); + public native long g1NumMaxRegions(); public native long g1NumFreeRegions(); public native int g1RegionSize(); + public native MemoryUsage g1AuxiliaryMemoryUsage(); public native Object[] parseCommandLine(String commandline, char delim, DiagnosticCommand[] args); // NMT From f5e8a4d943949c9a720ae162e4ca35555cc98381 Mon Sep 17 00:00:00 2001 From: Tim Bell Date: Mon, 16 Mar 2015 17:59:09 +0100 Subject: [PATCH 019/101] 8061346: Source changes needed to build JDK 9 with Mac OS9 'Maverics' and clang/Xcode 5.1.1 Reviewed-by: dholmes, erikj --- make/jprt.properties | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/make/jprt.properties b/make/jprt.properties index 15eccf8be1c..44c306f6ade 100644 --- a/make/jprt.properties +++ b/make/jprt.properties @@ -133,7 +133,7 @@ my.build.targets.default= \ solaris_x64_5.11-{product|fastdebug}, \ linux_i586_2.6-{product|fastdebug}, \ linux_x64_2.6-{product|fastdebug}, \ - macosx_x64_10.7-{product|fastdebug}, \ + macosx_x64_10.9-{product|fastdebug}, \ windows_i586_6.1-{product|fastdebug}, \ windows_x64_6.1-{product|fastdebug} @@ -143,7 +143,7 @@ my.test.target.set= \ solaris_x64_5.11-product-c2-TESTNAME, \ linux_i586_2.6-product-{c1|c2}-TESTNAME, \ linux_x64_2.6-product-c2-TESTNAME, \ - macosx_x64_10.7-product-c2-TESTNAME, \ + macosx_x64_10.9-product-c2-TESTNAME, \ windows_i586_6.1-product-c1-TESTNAME, \ windows_x64_6.1-product-c2-TESTNAME @@ -255,7 +255,7 @@ my.build.targets.hotspot= \ solaris_x64_5.11-{product|fastdebug}, \ linux_i586_2.6-{product|fastdebug}, \ linux_x64_2.6-{product|fastdebug}, \ - macosx_x64_10.7-{product|fastdebug}, \ + macosx_x64_10.9-{product|fastdebug}, \ windows_i586_6.1-{product|fastdebug}, \ windows_x64_6.1-{product|fastdebug}, \ solaris_x64_5.11-{debugOpen}, \ @@ -332,18 +332,18 @@ my.test.targets.hotspot.linux.x64= \ linux_x64_2.6-{product|fastdebug}-c2-jbb_ParOldGC my.test.targets.hotspot.macosx.x64= \ - macosx_x64_10.7-{product|fastdebug}-c2-jvm98, \ - macosx_x64_10.7-{product|fastdebug}-c2-jvm98_nontiered, \ - macosx_x64_10.7-{product|fastdebug}-c2-scimark, \ - macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_SerialGC, \ - macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_ParallelGC, \ - macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_CMS, \ - macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_G1, \ - macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_ParOldGC, \ - macosx_x64_10.7-{product|fastdebug}-c2-jbb_default_nontiered, \ - macosx_x64_10.7-{product|fastdebug}-c2-jbb_ParallelGC, \ - macosx_x64_10.7-{product|fastdebug}-c2-jbb_G1, \ - macosx_x64_10.7-{product|fastdebug}-c2-jbb_ParOldGC + macosx_x64_10.9-{product|fastdebug}-c2-jvm98, \ + macosx_x64_10.9-{product|fastdebug}-c2-jvm98_nontiered, \ + macosx_x64_10.9-{product|fastdebug}-c2-scimark, \ + macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_SerialGC, \ + macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_ParallelGC, \ + macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_CMS, \ + macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_G1, \ + macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_ParOldGC, \ + macosx_x64_10.9-{product|fastdebug}-c2-jbb_default_nontiered, \ + macosx_x64_10.9-{product|fastdebug}-c2-jbb_ParallelGC, \ + macosx_x64_10.9-{product|fastdebug}-c2-jbb_G1, \ + macosx_x64_10.9-{product|fastdebug}-c2-jbb_ParOldGC my.test.targets.hotspot.windows.i586= \ windows_i586_6.1-{product|fastdebug}-{c1|c2}-jvm98, \ @@ -418,7 +418,7 @@ my.make.rule.test.targets.hotspot.servertests= \ solaris_x64_5.11-*-c2-hotspot_servertest, \ linux_i586_2.6-*-c2-hotspot_servertest, \ linux_x64_2.6-*-c2-hotspot_servertest, \ - macosx_x64_10.7-*-c2-hotspot_servertest, \ + macosx_x64_10.9-*-c2-hotspot_servertest, \ windows_i586_6.1-*-c2-hotspot_servertest, \ windows_x64_6.1-*-c2-hotspot_servertest @@ -427,7 +427,7 @@ my.make.rule.test.targets.hotspot.internalvmtests= \ solaris_x64_5.11-fastdebug-c2-hotspot_internalvmtests, \ linux_i586_2.6-fastdebug-c2-hotspot_internalvmtests, \ linux_x64_2.6-fastdebug-c2-hotspot_internalvmtests, \ - macosx_x64_10.7-fastdebug-c2-hotspot_internalvmtests, \ + macosx_x64_10.9-fastdebug-c2-hotspot_internalvmtests, \ windows_i586_6.1-fastdebug-c2-hotspot_internalvmtests, \ windows_x64_6.1-fastdebug-c2-hotspot_internalvmtests @@ -436,7 +436,7 @@ my.make.rule.test.targets.hotspot.reg.group= \ solaris_x64_5.11-fastdebug-c2-GROUP, \ linux_i586_2.6-fastdebug-c2-GROUP, \ linux_x64_2.6-fastdebug-c2-GROUP, \ - macosx_x64_10.7-fastdebug-c2-GROUP, \ + macosx_x64_10.9-fastdebug-c2-GROUP, \ windows_i586_6.1-fastdebug-c2-GROUP, \ windows_x64_6.1-fastdebug-c2-GROUP, \ linux_i586_2.6-fastdebug-c1-GROUP, \ From fd46a24a3e4f2dc763bed06b524dbde5e3a97ce3 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Fri, 27 Mar 2015 09:28:47 +0100 Subject: [PATCH 020/101] 8076076: Move SharedHeap::print_size_transition() into G1 code Reviewed-by: tschatzl, mgerdin --- .../vm/gc_implementation/g1/concurrentMark.cpp | 5 +---- .../gc_implementation/g1/g1CollectorPolicy.cpp | 18 ++++++++++++++---- .../gc_implementation/g1/g1CollectorPolicy.hpp | 2 ++ hotspot/src/share/vm/memory/sharedHeap.cpp | 14 -------------- hotspot/src/share/vm/memory/sharedHeap.hpp | 10 ---------- 5 files changed, 17 insertions(+), 32 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index c91b5bcf09c..49116d28b37 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -2088,10 +2088,7 @@ void ConcurrentMark::cleanup() { _cleanup_times.add((end - start) * 1000.0); if (G1Log::fine()) { - g1h->print_size_transition(gclog_or_tty, - start_used_bytes, - g1h->used(), - g1h->capacity()); + g1h->g1_policy()->print_heap_transition(start_used_bytes); } // Clean up will have freed any regions completely full of garbage. diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index bbb23748bf7..0be44bd25c5 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1201,11 +1201,21 @@ void G1CollectorPolicy::record_heap_size_info_at_start(bool full) { } } +void G1CollectorPolicy::print_heap_transition(size_t bytes_before) { + size_t bytes_after = _g1->used(); + size_t capacity = _g1->capacity(); + + gclog_or_tty->print(" " SIZE_FORMAT "%s->" SIZE_FORMAT "%s(" SIZE_FORMAT "%s)", + byte_size_in_proper_unit(bytes_before), + proper_unit_for_byte_size(bytes_before), + byte_size_in_proper_unit(bytes_after), + proper_unit_for_byte_size(bytes_after), + byte_size_in_proper_unit(capacity), + proper_unit_for_byte_size(capacity)); +} + void G1CollectorPolicy::print_heap_transition() { - _g1->print_size_transition(gclog_or_tty, - _heap_used_bytes_before_gc, - _g1->used(), - _g1->capacity()); + print_heap_transition(_heap_used_bytes_before_gc); } void G1CollectorPolicy::print_detailed_heap_transition(bool full) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index a4236a0a369..3cee9369634 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -700,6 +700,8 @@ public: void record_heap_size_info_at_start(bool full); // Print heap sizing transition (with less and more detail). + + void print_heap_transition(size_t bytes_before); void print_heap_transition(); void print_detailed_heap_transition(bool full = false); diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index 27672c8168d..1dde1e13c5e 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -102,17 +102,3 @@ void SharedHeap::post_initialize() { } void SharedHeap::ref_processing_init() {} - -// Some utilities. -void SharedHeap::print_size_transition(outputStream* out, - size_t bytes_before, - size_t bytes_after, - size_t capacity) { - out->print(" " SIZE_FORMAT "%s->" SIZE_FORMAT "%s(" SIZE_FORMAT "%s)", - byte_size_in_proper_unit(bytes_before), - proper_unit_for_byte_size(bytes_before), - byte_size_in_proper_unit(bytes_after), - proper_unit_for_byte_size(bytes_after), - byte_size_in_proper_unit(capacity), - proper_unit_for_byte_size(capacity)); -} diff --git a/hotspot/src/share/vm/memory/sharedHeap.hpp b/hotspot/src/share/vm/memory/sharedHeap.hpp index 80717520249..dec846acef4 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.hpp +++ b/hotspot/src/share/vm/memory/sharedHeap.hpp @@ -214,16 +214,6 @@ public: // Sets the number of parallel threads that will be doing tasks // (such as process roots) subsequently. virtual void set_par_threads(uint t); - - // - // New methods from CollectedHeap - // - - // Some utilities. - void print_size_transition(outputStream* out, - size_t bytes_before, - size_t bytes_after, - size_t capacity); }; #endif // SHARE_VM_MEMORY_SHAREDHEAP_HPP From dcd40878af612c98c1955656a2198d3e6d8689a7 Mon Sep 17 00:00:00 2001 From: David Lindholm Date: Fri, 27 Mar 2015 15:03:44 +0100 Subject: [PATCH 021/101] 8076054: g1: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files Reviewed-by: brutisso, stefank --- .../vm/gc_implementation/g1/g1CardCounts.cpp | 2 - .../g1/g1CodeCacheRemSet.cpp | 2 - .../vm/gc_implementation/g1/g1HRPrinter.cpp | 12 ++--- .../vm/gc_implementation/g1/g1RemSet.cpp | 8 ++- .../vm/gc_implementation/g1/heapRegion.cpp | 52 +++++++++---------- .../gc_implementation/g1/heapRegionRemSet.cpp | 32 ++++++------ .../vm/gc_implementation/g1/heapRegionSet.cpp | 13 +++-- .../vm/gc_implementation/g1/satbQueue.cpp | 4 +- .../vm/gc_implementation/g1/survRateGroup.cpp | 2 - 9 files changed, 55 insertions(+), 72 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp index 76bf8509aea..94f258afd6f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp @@ -31,8 +31,6 @@ #include "services/memTracker.hpp" #include "utilities/copy.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - void G1CardCountsMappingChangedListener::on_commit(uint start_idx, size_t num_regions, bool zero_filled) { if (zero_filled) { return; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp index f70375800e7..b09d8a8a31e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp @@ -33,8 +33,6 @@ #include "utilities/hashtable.inline.hpp" #include "utilities/stack.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - class CodeRootSetTable : public Hashtable { friend class G1CodeRootSetTest; typedef HashtableEntry Entry; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp index 8139048ef23..68a2a96d73d 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp @@ -27,8 +27,6 @@ #include "gc_implementation/g1/heapRegion.hpp" #include "utilities/ostream.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - const char* G1HRPrinter::action_name(ActionType action) { switch(action) { case Alloc: return "ALLOC"; @@ -85,18 +83,18 @@ void G1HRPrinter::print(ActionType action, RegionType type, if (type_str != NULL) { if (top != NULL) { gclog_or_tty->print_cr(G1HR_PREFIX" %s(%s) "PTR_FORMAT" "PTR_FORMAT, - action_str, type_str, bottom, top); + action_str, type_str, p2i(bottom), p2i(top)); } else { gclog_or_tty->print_cr(G1HR_PREFIX" %s(%s) "PTR_FORMAT, - action_str, type_str, bottom); + action_str, type_str, p2i(bottom)); } } else { if (top != NULL) { gclog_or_tty->print_cr(G1HR_PREFIX" %s "PTR_FORMAT" "PTR_FORMAT, - action_str, bottom, top); + action_str, p2i(bottom), p2i(top)); } else { gclog_or_tty->print_cr(G1HR_PREFIX" %s "PTR_FORMAT, - action_str, bottom); + action_str, p2i(bottom)); } } } @@ -105,7 +103,7 @@ void G1HRPrinter::print(ActionType action, HeapWord* bottom, HeapWord* end) { const char* action_str = action_name(action); gclog_or_tty->print_cr(G1HR_PREFIX" %s ["PTR_FORMAT","PTR_FORMAT"]", - action_str, bottom, end); + action_str, p2i(bottom), p2i(end)); } void G1HRPrinter::print(PhaseType phase, size_t phase_num) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp index eff64c4cd08..b452f9adca2 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp @@ -39,8 +39,6 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/intHisto.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - #define CARD_REPEAT_HISTO 0 #if CARD_REPEAT_HISTO @@ -156,9 +154,9 @@ public: "RS names card " SIZE_FORMAT_HEX ": " "[" PTR_FORMAT ", " PTR_FORMAT ")", _worker_i, - card_region->bottom(), card_region->end(), + p2i(card_region->bottom()), p2i(card_region->end()), card_index, - card_start, card_start + G1BlockOffsetSharedArray::N_words); + p2i(card_start), p2i(card_start + G1BlockOffsetSharedArray::N_words)); } void scan_strong_code_roots(HeapRegion* r) { @@ -428,7 +426,7 @@ bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i, err_msg("Card at "PTR_FORMAT" index "SIZE_FORMAT" representing heap at "PTR_FORMAT" (%u) must be in committed heap", p2i(card_ptr), _ct_bs->index_for(_ct_bs->addr_for(card_ptr)), - _ct_bs->addr_for(card_ptr), + p2i(_ct_bs->addr_for(card_ptr)), _g1->addr_to_region(_ct_bs->addr_for(card_ptr)))); // If the card is no longer dirty, nothing to do. diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 0d6c16e0e12..77f6c413287 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -39,8 +39,6 @@ #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - int HeapRegion::LogOfHRGrainBytes = 0; int HeapRegion::LogOfHRGrainWords = 0; size_t HeapRegion::GrainBytes = 0; @@ -505,7 +503,7 @@ class VerifyStrongCodeRootOopClosure: public OopClosure { gclog_or_tty->print_cr("Object "PTR_FORMAT" in region " "["PTR_FORMAT", "PTR_FORMAT") is above " "top "PTR_FORMAT, - (void *)obj, _hr->bottom(), _hr->end(), _hr->top()); + p2i(obj), p2i(_hr->bottom()), p2i(_hr->end()), p2i(_hr->top())); _failures = true; return; } @@ -540,7 +538,7 @@ public: if (!nm->is_alive()) { gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has dead nmethod " PTR_FORMAT" in its strong code roots", - _hr->bottom(), _hr->end(), nm); + p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm)); _failures = true; } else { VerifyStrongCodeRootOopClosure oop_cl(_hr, nm); @@ -549,12 +547,12 @@ public: gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has nmethod " PTR_FORMAT" in its strong code roots " "with no pointers into region", - _hr->bottom(), _hr->end(), nm); + p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm)); _failures = true; } else if (oop_cl.failures()) { gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] has other " "failures for nmethod "PTR_FORMAT, - _hr->bottom(), _hr->end(), nm); + p2i(_hr->bottom()), p2i(_hr->end()), p2i(nm)); _failures = true; } } @@ -589,7 +587,7 @@ void HeapRegion::verify_strong_code_roots(VerifyOption vo, bool* failures) const if (strong_code_roots_length > 0) { gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is empty " "but has "SIZE_FORMAT" code root entries", - bottom(), end(), strong_code_roots_length); + p2i(bottom()), p2i(end()), strong_code_roots_length); *failures = true; } return; @@ -624,7 +622,7 @@ void HeapRegion::print_on(outputStream* st) const { st->print(" "); st->print(" TS %5d", _gc_time_stamp); st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT, - prev_top_at_mark_start(), next_top_at_mark_start()); + p2i(prev_top_at_mark_start()), p2i(next_top_at_mark_start())); G1OffsetTableContigSpace::print_on(st); } @@ -687,23 +685,23 @@ public: gclog_or_tty->print_cr("Field "PTR_FORMAT " of live obj "PTR_FORMAT" in region " "["PTR_FORMAT", "PTR_FORMAT")", - p, (void*) _containing_obj, - from->bottom(), from->end()); + p2i(p), p2i(_containing_obj), + p2i(from->bottom()), p2i(from->end())); print_object(gclog_or_tty, _containing_obj); gclog_or_tty->print_cr("points to obj "PTR_FORMAT" not in the heap", - (void*) obj); + p2i(obj)); } else { HeapRegion* from = _g1h->heap_region_containing((HeapWord*)p); HeapRegion* to = _g1h->heap_region_containing((HeapWord*)obj); gclog_or_tty->print_cr("Field "PTR_FORMAT " of live obj "PTR_FORMAT" in region " "["PTR_FORMAT", "PTR_FORMAT")", - p, (void*) _containing_obj, - from->bottom(), from->end()); + p2i(p), p2i(_containing_obj), + p2i(from->bottom()), p2i(from->end())); print_object(gclog_or_tty, _containing_obj); gclog_or_tty->print_cr("points to dead obj "PTR_FORMAT" in region " "["PTR_FORMAT", "PTR_FORMAT")", - (void*) obj, to->bottom(), to->end()); + p2i(obj), p2i(to->bottom()), p2i(to->end())); print_object(gclog_or_tty, obj); } gclog_or_tty->print_cr("----------"); @@ -741,12 +739,12 @@ public: gclog_or_tty->print_cr("Field "PTR_FORMAT" " "of obj "PTR_FORMAT", " "in region "HR_FORMAT, - p, (void*) _containing_obj, + p2i(p), p2i(_containing_obj), HR_FORMAT_PARAMS(from)); _containing_obj->print_on(gclog_or_tty); gclog_or_tty->print_cr("points to obj "PTR_FORMAT" " "in region "HR_FORMAT, - (void*) obj, + p2i(obj), HR_FORMAT_PARAMS(to)); obj->print_on(gclog_or_tty); gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", @@ -783,7 +781,7 @@ void HeapRegion::verify(VerifyOption vo, !g1->is_obj_dead(obj, this)) { // Dead objects may have bigger block_size since they span several objects. gclog_or_tty->print_cr("obj "PTR_FORMAT" is of %shumongous size (" SIZE_FORMAT" words) in a %shumongous region", - p, g1->is_humongous(obj_size) ? "" : "non-", + p2i(p), g1->is_humongous(obj_size) ? "" : "non-", obj_size, is_region_humongous ? "" : "non-"); *failures = true; return; @@ -797,12 +795,12 @@ void HeapRegion::verify(VerifyOption vo, ClassLoaderDataGraph::unload_list_contains(klass)); if (!is_metaspace_object) { gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " - "not metadata", klass, (void *)obj); + "not metadata", p2i(klass), p2i(obj)); *failures = true; return; } else if (!klass->is_klass()) { gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " - "not a klass", klass, (void *)obj); + "not a klass", p2i(klass), p2i(obj)); *failures = true; return; } else { @@ -817,7 +815,7 @@ void HeapRegion::verify(VerifyOption vo, } } } else { - gclog_or_tty->print_cr(PTR_FORMAT" no an oop", (void *)obj); + gclog_or_tty->print_cr(PTR_FORMAT" no an oop", p2i(obj)); *failures = true; return; } @@ -832,7 +830,7 @@ void HeapRegion::verify(VerifyOption vo, if (p != top()) { gclog_or_tty->print_cr("end of last object "PTR_FORMAT" " - "does not match top "PTR_FORMAT, p, top()); + "does not match top "PTR_FORMAT, p2i(p), p2i(top())); *failures = true; return; } @@ -849,7 +847,7 @@ void HeapRegion::verify(VerifyOption vo, if (b_start_1 != p) { gclog_or_tty->print_cr("BOT look up for top: "PTR_FORMAT" " " yielded "PTR_FORMAT", expecting "PTR_FORMAT, - addr_1, b_start_1, p); + p2i(addr_1), p2i(b_start_1), p2i(p)); *failures = true; return; } @@ -861,7 +859,7 @@ void HeapRegion::verify(VerifyOption vo, if (b_start_2 != p) { gclog_or_tty->print_cr("BOT look up for top + 1: "PTR_FORMAT" " " yielded "PTR_FORMAT", expecting "PTR_FORMAT, - addr_2, b_start_2, p); + p2i(addr_2), p2i(b_start_2), p2i(p)); *failures = true; return; } @@ -875,7 +873,7 @@ void HeapRegion::verify(VerifyOption vo, if (b_start_3 != p) { gclog_or_tty->print_cr("BOT look up for top + diff: "PTR_FORMAT" " " yielded "PTR_FORMAT", expecting "PTR_FORMAT, - addr_3, b_start_3, p); + p2i(addr_3), p2i(b_start_3), p2i(p)); *failures = true; return; } @@ -887,7 +885,7 @@ void HeapRegion::verify(VerifyOption vo, if (b_start_4 != p) { gclog_or_tty->print_cr("BOT look up for end - 1: "PTR_FORMAT" " " yielded "PTR_FORMAT", expecting "PTR_FORMAT, - addr_4, b_start_4, p); + p2i(addr_4), p2i(b_start_4), p2i(p)); *failures = true; return; } @@ -896,7 +894,7 @@ void HeapRegion::verify(VerifyOption vo, if (is_region_humongous && object_num > 1) { gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is humongous " "but has "SIZE_FORMAT", objects", - bottom(), end(), object_num); + p2i(bottom()), p2i(end()), object_num); *failures = true; return; } @@ -947,7 +945,7 @@ void G1OffsetTableContigSpace::print() const { print_short(); gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", - bottom(), top(), _offsets.threshold(), end()); + p2i(bottom()), p2i(top()), p2i(_offsets.threshold()), p2i(end())); } HeapWord* G1OffsetTableContigSpace::initialize_threshold() { diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp index 835b8e2edd8..a8416bc9984 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @@ -37,8 +37,6 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/growableArray.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - class PerRegionTable: public CHeapObj { friend class OtherRegionsTable; friend class HeapRegionRemSetIterator; @@ -93,10 +91,10 @@ protected: if (G1TraceHeapRegionRememberedSet) { gclog_or_tty->print_cr(" PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").", - from, + p2i(from), UseCompressedOops - ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from) - : (void *)oopDesc::load_decode_heap_oop((oop*)from)); + ? p2i(oopDesc::load_decode_heap_oop((narrowOop*)from)) + : p2i(oopDesc::load_decode_heap_oop((oop*)from))); } HeapRegion* loc_hr = hr(); @@ -412,17 +410,17 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) { if (G1TraceHeapRegionRememberedSet) { gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").", - from, + p2i(from), UseCompressedOops - ? (void *)oopDesc::load_decode_heap_oop((narrowOop*)from) - : (void *)oopDesc::load_decode_heap_oop((oop*)from)); + ? p2i(oopDesc::load_decode_heap_oop((narrowOop*)from)) + : p2i(oopDesc::load_decode_heap_oop((oop*)from))); } int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift); if (G1TraceHeapRegionRememberedSet) { gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = %d)", - _hr->bottom(), from_card, + p2i(_hr->bottom()), from_card, FromCardCache::at(tid, cur_hrm_ind)); } @@ -471,7 +469,7 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) { "[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n", align_size_down(uintptr_t(from), CardTableModRefBS::card_size), - _hr->bottom(), from); + p2i(_hr->bottom()), p2i(from)); } } if (G1TraceHeapRegionRememberedSet) { @@ -533,7 +531,7 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) { "[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n", align_size_down(uintptr_t(from), CardTableModRefBS::card_size), - _hr->bottom(), from); + p2i(_hr->bottom()), p2i(from)); } } assert(contains_reference(from), "We just added it!"); @@ -602,8 +600,8 @@ PerRegionTable* OtherRegionsTable::delete_region_table() { if (G1TraceHeapRegionRememberedSet) { gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] " "for region [" PTR_FORMAT "...] (" SIZE_FORMAT " coarse entries).\n", - _hr->bottom(), - max->hr()->bottom(), + p2i(_hr->bottom()), + p2i(max->hr()->bottom()), _n_coarse_entries); } } @@ -857,7 +855,7 @@ void HeapRegionRemSet::print() { while (iter.has_next(card_index)) { HeapWord* card_start = G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index); - gclog_or_tty->print_cr(" Card " PTR_FORMAT, card_start); + gclog_or_tty->print_cr(" Card " PTR_FORMAT, p2i(card_start)); } if (iter.n_yielded() != occupied()) { gclog_or_tty->print_cr("Yielded disagrees with occupied:"); @@ -1152,8 +1150,8 @@ void HeapRegionRemSet::print_recorded() { } gclog_or_tty->print("Added card " PTR_FORMAT " to region [" PTR_FORMAT "...]" " for ref " PTR_FORMAT ".\n", - _recorded_cards[i], _recorded_regions[i]->bottom(), - _recorded_oops[i]); + p2i(_recorded_cards[i]), p2i(_recorded_regions[i]->bottom()), + p2i(_recorded_oops[i])); } } @@ -1240,7 +1238,7 @@ void HeapRegionRemSet::test() { while (iter.has_next(card_index)) { HeapWord* card_start = G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index); - gclog_or_tty->print_cr(" Card " PTR_FORMAT ".", card_start); + gclog_or_tty->print_cr(" Card " PTR_FORMAT ".", p2i(card_start)); sum++; } guarantee(sum == 11 - 3 + 2048, "Failure"); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp index 37a85aa0def..9657356c3bb 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp @@ -27,8 +27,6 @@ #include "gc_implementation/g1/heapRegionRemSet.hpp" #include "gc_implementation/g1/heapRegionSet.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - uint FreeRegionList::_unrealistically_long_length = 0; void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) { @@ -84,7 +82,7 @@ void HeapRegionSetBase::verify_end() { void HeapRegionSetBase::print_on(outputStream* out, bool print_contents) { out->cr(); - out->print_cr("Set: %s ("PTR_FORMAT")", name(), this); + out->print_cr("Set: %s ("PTR_FORMAT")", name(), p2i(this)); out->print_cr(" Region Assumptions"); out->print_cr(" humongous : %s", BOOL_TO_STR(regions_humongous())); out->print_cr(" free : %s", BOOL_TO_STR(regions_free())); @@ -106,7 +104,7 @@ void FreeRegionList::set_unrealistically_long_length(uint len) { } void FreeRegionList::fill_in_ext_msg_extra(hrs_ext_msg* msg) { - msg->append(" hd: "PTR_FORMAT" tl: "PTR_FORMAT, _head, _tail); + msg->append(" hd: "PTR_FORMAT" tl: "PTR_FORMAT, p2i(_head), p2i(_tail)); } void FreeRegionList::remove_all() { @@ -277,8 +275,8 @@ void FreeRegionList::clear() { void FreeRegionList::print_on(outputStream* out, bool print_contents) { HeapRegionSetBase::print_on(out, print_contents); out->print_cr(" Linking"); - out->print_cr(" head : "PTR_FORMAT, _head); - out->print_cr(" tail : "PTR_FORMAT, _tail); + out->print_cr(" head : "PTR_FORMAT, p2i(_head)); + out->print_cr(" tail : "PTR_FORMAT, p2i(_tail)); if (print_contents) { out->print_cr(" Contents"); @@ -306,7 +304,8 @@ void FreeRegionList::verify_list() { count++; guarantee(count < _unrealistically_long_length, - hrs_err_msg("[%s] the calculated length: %u seems very long, is there maybe a cycle? curr: "PTR_FORMAT" prev0: "PTR_FORMAT" " "prev1: "PTR_FORMAT" length: %u", name(), count, curr, prev0, prev1, length())); + hrs_err_msg("[%s] the calculated length: %u seems very long, is there maybe a cycle? curr: "PTR_FORMAT" prev0: "PTR_FORMAT" " "prev1: "PTR_FORMAT" length: %u", + name(), count, p2i(curr), p2i(prev0), p2i(prev1), length())); if (curr->next() != NULL) { guarantee(curr->next()->prev() == curr, "Next or prev pointers messed up"); diff --git a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp index 2ab59657776..4da322feb7a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp @@ -32,8 +32,6 @@ #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - void ObjPtrQueue::flush() { // The buffer might contain refs into the CSet. We have to filter it // first before we flush it, otherwise we might end up with an @@ -182,7 +180,7 @@ void ObjPtrQueue::print(const char* name, void** buf, size_t index, size_t sz) { gclog_or_tty->print_cr(" SATB BUFFER [%s] buf: "PTR_FORMAT" " "index: "SIZE_FORMAT" sz: "SIZE_FORMAT, - name, buf, index, sz); + name, p2i(buf), index, sz); } #endif // PRODUCT diff --git a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp index 4a2ea6e5aea..13c812499d3 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp @@ -29,8 +29,6 @@ #include "gc_implementation/g1/survRateGroup.hpp" #include "memory/allocation.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p, const char* name, size_t summary_surv_rates_len) : From 04fdb5ca76c14ce17d2c818f31dbd27e00f33929 Mon Sep 17 00:00:00 2001 From: David Lindholm Date: Fri, 27 Mar 2015 15:10:11 +0100 Subject: [PATCH 022/101] 8076055: cms: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files Reviewed-by: brutisso, tschatzl --- .../concurrentMarkSweepGeneration.cpp | 82 +++++++++---------- .../concurrentMarkSweep/freeChunk.cpp | 4 +- .../concurrentMarkSweep/promotionInfo.cpp | 6 +- .../concurrentMarkSweep/vmCMSOperations.cpp | 2 - 4 files changed, 43 insertions(+), 51 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index e273c205a37..037abd9ffa6 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -65,8 +65,6 @@ #include "services/memoryService.hpp" #include "services/runtimeService.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // statics CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; bool CMSCollector::_full_gc_requested = false; @@ -1593,7 +1591,7 @@ void CMSCollector::acquire_control_and_collect(bool full, bitMapLock()->lock_without_safepoint_check(); if (TraceCMSState) { gclog_or_tty->print_cr("CMS foreground collector has asked for control " - INTPTR_FORMAT " with first state %d", Thread::current(), first_state); + INTPTR_FORMAT " with first state %d", p2i(Thread::current()), first_state); gclog_or_tty->print_cr(" gets control with state %d", _collectorState); } @@ -1763,27 +1761,27 @@ void CMSCollector::print_eden_and_survivor_chunk_arrays() { // Eden if (_eden_chunk_array != NULL) { gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")", - eden_space->bottom(), eden_space->top(), - eden_space->end(), eden_space->capacity()); + p2i(eden_space->bottom()), p2i(eden_space->top()), + p2i(eden_space->end()), eden_space->capacity()); gclog_or_tty->print_cr("_eden_chunk_index=" SIZE_FORMAT ", " "_eden_chunk_capacity=" SIZE_FORMAT, _eden_chunk_index, _eden_chunk_capacity); for (size_t i = 0; i < _eden_chunk_index; i++) { gclog_or_tty->print_cr("_eden_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT, - i, _eden_chunk_array[i]); + i, p2i(_eden_chunk_array[i])); } } // Survivor if (_survivor_chunk_array != NULL) { gclog_or_tty->print_cr("survivor " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")", - from_space->bottom(), from_space->top(), - from_space->end(), from_space->capacity()); + p2i(from_space->bottom()), p2i(from_space->top()), + p2i(from_space->end()), from_space->capacity()); gclog_or_tty->print_cr("_survivor_chunk_index=" SIZE_FORMAT ", " "_survivor_chunk_capacity=" SIZE_FORMAT, _survivor_chunk_index, _survivor_chunk_capacity); for (size_t i = 0; i < _survivor_chunk_index; i++) { gclog_or_tty->print_cr("_survivor_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT, - i, _survivor_chunk_array[i]); + i, p2i(_survivor_chunk_array[i])); } } } @@ -1890,7 +1888,7 @@ void CMSCollector::collect_in_background(GCCause::Cause cause) { while (_collectorState != Idling) { if (TraceCMSState) { gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d", - Thread::current(), _collectorState); + p2i(Thread::current()), _collectorState); } // The foreground collector // holds the Heap_lock throughout its collection. @@ -1924,7 +1922,7 @@ void CMSCollector::collect_in_background(GCCause::Cause cause) { if (TraceCMSState) { gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT " exiting collection CMS state %d", - Thread::current(), _collectorState); + p2i(Thread::current()), _collectorState); } return; } else { @@ -2031,7 +2029,7 @@ void CMSCollector::collect_in_background(GCCause::Cause cause) { } if (TraceCMSState) { gclog_or_tty->print_cr(" Thread " INTPTR_FORMAT " done - next CMS state %d", - Thread::current(), _collectorState); + p2i(Thread::current()), _collectorState); } assert(_foregroundGCShouldWait, "block post-condition"); } @@ -2054,7 +2052,7 @@ void CMSCollector::collect_in_background(GCCause::Cause cause) { if (TraceCMSState) { gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT " exiting collection CMS state %d", - Thread::current(), _collectorState); + p2i(Thread::current()), _collectorState); } if (PrintGC && Verbose) { _cmsGen->print_heap_change(prev_used); @@ -2112,7 +2110,7 @@ bool CMSCollector::waitForForegroundGC() { CGC_lock->notify(); if (TraceCMSState) { gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT " waiting at CMS state %d", - Thread::current(), _collectorState); + p2i(Thread::current()), _collectorState); } while (_foregroundGCIsActive) { CGC_lock->wait(Mutex::_no_safepoint_check_flag); @@ -2124,7 +2122,7 @@ bool CMSCollector::waitForForegroundGC() { } if (TraceCMSState) { gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT " continuing at CMS state %d", - Thread::current(), _collectorState); + p2i(Thread::current()), _collectorState); } return res; } @@ -2356,13 +2354,13 @@ bool CMSCollector::is_cms_reachable(HeapWord* addr) { // Clear the marking bit map array before starting, but, just // for kicks, first report if the given address is already marked - gclog_or_tty->print_cr("Start: Address " PTR_FORMAT " is%s marked", addr, + gclog_or_tty->print_cr("Start: Address " PTR_FORMAT " is%s marked", p2i(addr), _markBitMap.isMarked(addr) ? "" : " not"); if (verify_after_remark()) { MutexLockerEx x(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag); bool result = verification_mark_bm()->isMarked(addr); - gclog_or_tty->print_cr("TransitiveMark: Address " PTR_FORMAT " %s marked", addr, + gclog_or_tty->print_cr("TransitiveMark: Address " PTR_FORMAT " %s marked", p2i(addr), result ? "IS" : "is NOT"); return result; } else { @@ -2377,13 +2375,13 @@ CMSCollector::print_on_error(outputStream* st) { CMSCollector* collector = ConcurrentMarkSweepGeneration::_collector; if (collector != NULL) { CMSBitMap* bitmap = &collector->_markBitMap; - st->print_cr("Marking Bits: (CMSBitMap*) " PTR_FORMAT, bitmap); + st->print_cr("Marking Bits: (CMSBitMap*) " PTR_FORMAT, p2i(bitmap)); bitmap->print_on_error(st, " Bits: "); st->cr(); CMSBitMap* mut_bitmap = &collector->_modUnionTable; - st->print_cr("Mod Union Table: (CMSBitMap*) " PTR_FORMAT, mut_bitmap); + st->print_cr("Mod Union Table: (CMSBitMap*) " PTR_FORMAT, p2i(mut_bitmap)); mut_bitmap->print_on_error(st, " Bits: "); } } @@ -2406,7 +2404,7 @@ class VerifyMarkedClosure: public BitMapClosure { HeapWord* addr = _marks->offsetToHeapWord(offset); if (!_marks->isMarked(addr)) { oop(addr)->print_on(gclog_or_tty); - gclog_or_tty->print_cr(" ("INTPTR_FORMAT" should have been marked)", addr); + gclog_or_tty->print_cr(" ("INTPTR_FORMAT" should have been marked)", p2i(addr)); _failed = true; } return true; @@ -2474,7 +2472,7 @@ bool CMSCollector::verify_after_remark(bool silent) { // presumably, a mutation to A failed to be picked up by preclean/remark? verify_after_remark_work_2(); } else { - warning("Unrecognized value %d for CMSRemarkVerifyVariant", + warning("Unrecognized value " UINTX_FORMAT " for CMSRemarkVerifyVariant", CMSRemarkVerifyVariant); } if (!silent) gclog_or_tty->print(" done] "); @@ -5056,7 +5054,7 @@ void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv, for (size_t i = 0; i < total - 1; i++) { if (PrintCMSStatistics > 0) { gclog_or_tty->print(" (chunk" SIZE_FORMAT ":" INTPTR_FORMAT ") ", - i, _survivor_chunk_array[i]); + i, p2i(_survivor_chunk_array[i])); } assert(_survivor_chunk_array[i] < _survivor_chunk_array[i+1], "Not sorted"); @@ -5700,8 +5698,8 @@ void ConcurrentMarkSweepGeneration::setNearLargestChunk() { gclog_or_tty->print_cr( "CMS: Large Block: " PTR_FORMAT ";" " Proximity: " PTR_FORMAT " -> " PTR_FORMAT, - largestAddr, - _cmsSpace->nearLargestChunk(), minAddr + nearLargestOffset); + p2i(largestAddr), + p2i(_cmsSpace->nearLargestChunk()), p2i(minAddr + nearLargestOffset)); } _cmsSpace->set_nearLargestChunk(minAddr + nearLargestOffset); } @@ -6184,7 +6182,7 @@ void MarkRefsIntoVerifyClosure::do_oop(oop obj) { _verification_bm->mark(addr); if (!_cms_bm->isMarked(addr)) { oop(addr)->print(); - gclog_or_tty->print_cr(" (" INTPTR_FORMAT " should have been marked)", addr); + gclog_or_tty->print_cr(" (" INTPTR_FORMAT " should have been marked)", p2i(addr)); fatal("... aborting"); } } @@ -6979,7 +6977,7 @@ void PushAndMarkVerifyClosure::do_oop(oop obj) { if (!_cms_bm->isMarked(addr)) { oop(addr)->print(); gclog_or_tty->print_cr(" (" INTPTR_FORMAT " should have been marked)", - addr); + p2i(addr)); fatal("... aborting"); } @@ -7375,16 +7373,16 @@ SweepClosure::SweepClosure(CMSCollector* collector, "sweep _limit out of bounds"); if (CMSTraceSweeper) { gclog_or_tty->print_cr("\n====================\nStarting new sweep with limit " PTR_FORMAT, - _limit); + p2i(_limit)); } } void SweepClosure::print_on(outputStream* st) const { tty->print_cr("_sp = [" PTR_FORMAT "," PTR_FORMAT ")", - _sp->bottom(), _sp->end()); - tty->print_cr("_limit = " PTR_FORMAT, _limit); - tty->print_cr("_freeFinger = " PTR_FORMAT, _freeFinger); - NOT_PRODUCT(tty->print_cr("_last_fc = " PTR_FORMAT, _last_fc);) + p2i(_sp->bottom()), p2i(_sp->end())); + tty->print_cr("_limit = " PTR_FORMAT, p2i(_limit)); + tty->print_cr("_freeFinger = " PTR_FORMAT, p2i(_freeFinger)); + NOT_PRODUCT(tty->print_cr("_last_fc = " PTR_FORMAT, p2i(_last_fc));) tty->print_cr("_inFreeRange = %d, _freeRangeInFreeLists = %d, _lastFreeRangeCoalesced = %d", _inFreeRange, _freeRangeInFreeLists, _lastFreeRangeCoalesced); } @@ -7428,7 +7426,7 @@ SweepClosure::~SweepClosure() { } if (CMSTraceSweeper) { gclog_or_tty->print_cr("end of sweep with _limit = " PTR_FORMAT "\n================", - _limit); + p2i(_limit)); } } #endif // PRODUCT @@ -7437,7 +7435,7 @@ void SweepClosure::initialize_free_range(HeapWord* freeFinger, bool freeRangeInFreeLists) { if (CMSTraceSweeper) { gclog_or_tty->print("---- Start free range at " PTR_FORMAT " with free block (%d)\n", - freeFinger, freeRangeInFreeLists); + p2i(freeFinger), freeRangeInFreeLists); } assert(!inFreeRange(), "Trampling existing free range"); set_inFreeRange(true); @@ -7501,14 +7499,14 @@ size_t SweepClosure::do_blk_careful(HeapWord* addr) { // coalesced chunk to the appropriate free list. if (inFreeRange()) { assert(freeFinger() >= _sp->bottom() && freeFinger() < _limit, - err_msg("freeFinger() " PTR_FORMAT" is out-of-bounds", freeFinger())); + err_msg("freeFinger() " PTR_FORMAT" is out-of-bounds", p2i(freeFinger()))); flush_cur_free_chunk(freeFinger(), pointer_delta(addr, freeFinger())); if (CMSTraceSweeper) { gclog_or_tty->print("Sweep: last chunk: "); gclog_or_tty->print("put_free_blk " PTR_FORMAT " ("SIZE_FORMAT") " "[coalesced:%d]\n", - freeFinger(), pointer_delta(addr, freeFinger()), + p2i(freeFinger()), pointer_delta(addr, freeFinger()), lastFreeRangeCoalesced() ? 1 : 0); } } @@ -7652,7 +7650,7 @@ void SweepClosure::do_already_free_chunk(FreeChunk* fc) { // the midst of a free range, we are coalescing print_free_block_coalesced(fc); if (CMSTraceSweeper) { - gclog_or_tty->print(" -- pick up free block " PTR_FORMAT " (" SIZE_FORMAT ")\n", fc, size); + gclog_or_tty->print(" -- pick up free block " PTR_FORMAT " (" SIZE_FORMAT ")\n", p2i(fc), size); } // remove it from the free lists _sp->removeFreeChunkFromFreeLists(fc); @@ -7714,7 +7712,7 @@ size_t SweepClosure::do_garbage_chunk(FreeChunk* fc) { // this will be swept up when we hit the end of the // free range if (CMSTraceSweeper) { - gclog_or_tty->print(" -- pick up garbage " PTR_FORMAT " (" SIZE_FORMAT ")\n", fc, size); + gclog_or_tty->print(" -- pick up garbage " PTR_FORMAT " (" SIZE_FORMAT ")\n", p2i(fc), size); } // If the chunk is being coalesced and the current free range is // in the free lists, remove the current free range so that it @@ -7807,7 +7805,7 @@ void SweepClosure::do_post_free_or_garbage_chunk(FreeChunk* fc, } if (CMSTraceSweeper) { - gclog_or_tty->print_cr(" -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", fc, chunkSize); + gclog_or_tty->print_cr(" -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", p2i(fc), chunkSize); } HeapWord* const fc_addr = (HeapWord*) fc; @@ -7906,14 +7904,14 @@ void SweepClosure::lookahead_and_flush(FreeChunk* fc, size_t chunk_size) { err_msg("eob = " PTR_FORMAT " eob-1 = " PTR_FORMAT " _limit = " PTR_FORMAT " out of bounds wrt _sp = [" PTR_FORMAT "," PTR_FORMAT ")" " when examining fc = " PTR_FORMAT "(" SIZE_FORMAT ")", - eob, eob-1, _limit, _sp->bottom(), _sp->end(), fc, chunk_size)); + p2i(eob), p2i(eob-1), p2i(_limit), p2i(_sp->bottom()), p2i(_sp->end()), p2i(fc), chunk_size)); if (eob >= _limit) { assert(eob == _limit || fc->is_free(), "Only a free chunk should allow us to cross over the limit"); if (CMSTraceSweeper) { gclog_or_tty->print_cr("_limit " PTR_FORMAT " reached or crossed by block " "[" PTR_FORMAT "," PTR_FORMAT ") in space " "[" PTR_FORMAT "," PTR_FORMAT ")", - _limit, fc, eob, _sp->bottom(), _sp->end()); + p2i(_limit), p2i(fc), p2i(eob), p2i(_sp->bottom()), p2i(_sp->end())); } // Return the storage we are tracking back into the free lists. if (CMSTraceSweeper) { @@ -7937,7 +7935,7 @@ void SweepClosure::flush_cur_free_chunk(HeapWord* chunk, size_t size) { } if (CMSTraceSweeper) { gclog_or_tty->print_cr(" -- add free block " PTR_FORMAT " (" SIZE_FORMAT ") to free lists", - chunk, size); + p2i(chunk), size); } // A new free range is going to be starting. The current // free range has not been added to the free lists yet or @@ -8010,7 +8008,7 @@ bool debug_verify_chunk_in_free_list(FreeChunk* fc) { void SweepClosure::print_free_block_coalesced(FreeChunk* fc) const { if (CMSTraceSweeper) { gclog_or_tty->print_cr("Sweep:coal_free_blk " PTR_FORMAT " (" SIZE_FORMAT ")", - fc, fc->size()); + p2i(fc), fc->size()); } } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp index 133ed3c5969..e58391acfae 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp @@ -27,8 +27,6 @@ #include "memory/freeBlockDictionary.hpp" #include "utilities/copy.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - #ifndef PRODUCT #define baadbabeHeapWord badHeapWordVal @@ -74,5 +72,5 @@ void FreeChunk::verifyList() const { void FreeChunk::print_on(outputStream* st) { st->print_cr("Next: " PTR_FORMAT " Prev: " PTR_FORMAT " %s", - next(), prev(), cantCoalesce() ? "[can't coalesce]" : ""); + p2i(next()), p2i(prev()), cantCoalesce() ? "[can't coalesce]" : ""); } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp index 44f5a287c6e..dfddda7cf2f 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp @@ -28,8 +28,6 @@ #include "oops/markOop.inline.hpp" #include "oops/oop.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - ///////////////////////////////////////////////////////////////////////// //// PromotionInfo ///////////////////////////////////////////////////////////////////////// @@ -360,6 +358,6 @@ void PromotionInfo::print_on(outputStream* st) const { void SpoolBlock::print_on(outputStream* st) const { st->print("[" PTR_FORMAT "," PTR_FORMAT "), " SIZE_FORMAT " HeapWords -> " PTR_FORMAT, - this, (HeapWord*)displacedHdr + bufferSize, - bufferSize, nextSpoolBlock); + p2i(this), p2i((HeapWord*)displacedHdr + bufferSize), + bufferSize, p2i(nextSpoolBlock)); } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp index 9587736f297..39d86cd475a 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp @@ -34,8 +34,6 @@ #include "runtime/os.hpp" #include "utilities/dtrace.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - ////////////////////////////////////////////////////////// // Methods in abstract class VM_CMS_Operation ////////////////////////////////////////////////////////// From bbadc1626fcc86f132519de92368698f1e0fc59d Mon Sep 17 00:00:00 2001 From: David Lindholm Date: Fri, 27 Mar 2015 15:24:49 +0100 Subject: [PATCH 023/101] 8076071: parallelScavenge: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files Reviewed-by: brutisso, mgerdin, stefank --- .../parallelScavenge/gcTaskManager.cpp | 56 +++++++++---------- .../parallelScavenge/gcTaskThread.cpp | 4 +- .../parallelScavenge/pcTasks.cpp | 10 ++-- .../parallelScavenge/psAdaptiveSizePolicy.cpp | 2 - .../parallelScavenge/psMarkSweep.cpp | 4 +- .../parallelScavenge/psOldGen.cpp | 8 +-- .../parallelScavenge/psParallelCompact.cpp | 48 ++++++++-------- .../parallelScavenge/psPromotionManager.cpp | 4 +- .../parallelScavenge/psScavenge.cpp | 8 +-- .../parallelScavenge/psVirtualspace.cpp | 12 ++-- .../parallelScavenge/psYoungGen.cpp | 52 ++++++++--------- 11 files changed, 94 insertions(+), 114 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp index a35c0913138..d9f38a0e2c8 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp @@ -32,8 +32,6 @@ #include "runtime/mutexLocker.hpp" #include "runtime/orderAccess.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // // GCTask // @@ -101,7 +99,7 @@ void GCTask::destruct() { NOT_PRODUCT( void GCTask::print(const char* message) const { tty->print(INTPTR_FORMAT " <- " INTPTR_FORMAT "(%u) -> " INTPTR_FORMAT, - newer(), this, affinity(), older()); + p2i(newer()), p2i(this), affinity(), p2i(older())); } ) @@ -113,7 +111,7 @@ GCTaskQueue* GCTaskQueue::create() { GCTaskQueue* result = new GCTaskQueue(false); if (TraceGCTaskQueue) { tty->print_cr("GCTaskQueue::create()" - " returns " INTPTR_FORMAT, result); + " returns " INTPTR_FORMAT, p2i(result)); } return result; } @@ -123,7 +121,7 @@ GCTaskQueue* GCTaskQueue::create_on_c_heap() { if (TraceGCTaskQueue) { tty->print_cr("GCTaskQueue::create_on_c_heap()" " returns " INTPTR_FORMAT, - result); + p2i(result)); } return result; } @@ -134,7 +132,7 @@ GCTaskQueue::GCTaskQueue(bool on_c_heap) : if (TraceGCTaskQueue) { tty->print_cr("[" INTPTR_FORMAT "]" " GCTaskQueue::GCTaskQueue() constructor", - this); + p2i(this)); } } @@ -147,7 +145,7 @@ void GCTaskQueue::destroy(GCTaskQueue* that) { tty->print_cr("[" INTPTR_FORMAT "]" " GCTaskQueue::destroy()" " is_c_heap_obj: %s", - that, + p2i(that), that->is_c_heap_obj() ? "true" : "false"); } // That instance may have been allocated as a CHeapObj, @@ -173,7 +171,7 @@ void GCTaskQueue::enqueue(GCTask* task) { tty->print_cr("[" INTPTR_FORMAT "]" " GCTaskQueue::enqueue(task: " INTPTR_FORMAT ")", - this, task); + p2i(this), p2i(task)); print("before:"); } assert(task != NULL, "shouldn't have null task"); @@ -200,7 +198,7 @@ void GCTaskQueue::enqueue(GCTaskQueue* list) { tty->print_cr("[" INTPTR_FORMAT "]" " GCTaskQueue::enqueue(list: " INTPTR_FORMAT ")", - this, list); + p2i(this), p2i(list)); print("before:"); list->print("list:"); } @@ -234,14 +232,14 @@ void GCTaskQueue::enqueue(GCTaskQueue* list) { GCTask* GCTaskQueue::dequeue() { if (TraceGCTaskQueue) { tty->print_cr("[" INTPTR_FORMAT "]" - " GCTaskQueue::dequeue()", this); + " GCTaskQueue::dequeue()", p2i(this)); print("before:"); } assert(!is_empty(), "shouldn't dequeue from empty list"); GCTask* result = remove(); assert(result != NULL, "shouldn't have NULL task"); if (TraceGCTaskQueue) { - tty->print_cr(" return: " INTPTR_FORMAT, result); + tty->print_cr(" return: " INTPTR_FORMAT, p2i(result)); print("after:"); } return result; @@ -251,7 +249,7 @@ GCTask* GCTaskQueue::dequeue() { GCTask* GCTaskQueue::dequeue(uint affinity) { if (TraceGCTaskQueue) { tty->print_cr("[" INTPTR_FORMAT "]" - " GCTaskQueue::dequeue(%u)", this, affinity); + " GCTaskQueue::dequeue(%u)", p2i(this), affinity); print("before:"); } assert(!is_empty(), "shouldn't dequeue from empty list"); @@ -275,7 +273,7 @@ GCTask* GCTaskQueue::dequeue(uint affinity) { result = remove(); } if (TraceGCTaskQueue) { - tty->print_cr(" return: " INTPTR_FORMAT, result); + tty->print_cr(" return: " INTPTR_FORMAT, p2i(result)); print("after:"); } return result; @@ -345,7 +343,7 @@ void GCTaskQueue::print(const char* message) const { " remove_end: " INTPTR_FORMAT " length: %d" " %s", - this, insert_end(), remove_end(), length(), message); + p2i(this), p2i(insert_end()), p2i(remove_end()), length(), message); uint count = 0; for (GCTask* element = insert_end(); element != NULL; @@ -486,7 +484,7 @@ void GCTaskManager::set_active_gang() { assert(!all_workers_active() || active_workers() == ParallelGCThreads, err_msg("all_workers_active() is incorrect: " - "active %d ParallelGCThreads %d", active_workers(), + "active %d ParallelGCThreads " UINTX_FORMAT, active_workers(), ParallelGCThreads)); if (TraceDynamicGCThreads) { gclog_or_tty->print_cr("GCTaskManager::set_active_gang(): " @@ -598,7 +596,7 @@ void GCTaskManager::add_task(GCTask* task) { MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag); if (TraceGCTaskManager) { tty->print_cr("GCTaskManager::add_task(" INTPTR_FORMAT " [%s])", - task, GCTask::Kind::to_string(task->kind())); + p2i(task), GCTask::Kind::to_string(task->kind())); } queue()->enqueue(task); // Notify with the lock held to avoid missed notifies. @@ -678,7 +676,7 @@ GCTask* GCTaskManager::get_task(uint which) { assert(result != NULL, "shouldn't have null task"); if (TraceGCTaskManager) { tty->print_cr("GCTaskManager::get_task(%u) => " INTPTR_FORMAT " [%s]", - which, result, GCTask::Kind::to_string(result->kind())); + which, p2i(result), GCTask::Kind::to_string(result->kind())); tty->print_cr(" %s", result->name()); } if (!result->is_idle_task()) { @@ -864,7 +862,7 @@ void IdleGCTask::do_it(GCTaskManager* manager, uint which) { tty->print_cr("[" INTPTR_FORMAT "]" " IdleGCTask:::do_it()" " should_wait: %s", - this, wait_for_task->should_wait() ? "true" : "false"); + p2i(this), wait_for_task->should_wait() ? "true" : "false"); } MutexLockerEx ml(manager->monitor(), Mutex::_no_safepoint_check_flag); if (TraceDynamicGCThreads) { @@ -878,7 +876,7 @@ void IdleGCTask::do_it(GCTaskManager* manager, uint which) { tty->print_cr("[" INTPTR_FORMAT "]" " IdleGCTask::do_it()" " [" INTPTR_FORMAT "] (%s)->wait()", - this, manager->monitor(), manager->monitor()->name()); + p2i(this), p2i(manager->monitor()), manager->monitor()->name()); } manager->monitor()->wait(Mutex::_no_safepoint_check_flag, 0); } @@ -890,7 +888,7 @@ void IdleGCTask::do_it(GCTaskManager* manager, uint which) { tty->print_cr("[" INTPTR_FORMAT "]" " IdleGCTask::do_it() returns" " should_wait: %s", - this, wait_for_task->should_wait() ? "true" : "false"); + p2i(this), wait_for_task->should_wait() ? "true" : "false"); } // Release monitor(). } @@ -1000,7 +998,7 @@ WaitForBarrierGCTask::WaitForBarrierGCTask(bool on_c_heap) : tty->print_cr("[" INTPTR_FORMAT "]" " WaitForBarrierGCTask::WaitForBarrierGCTask()" " monitor: " INTPTR_FORMAT, - this, monitor()); + p2i(this), p2i(monitor())); } } @@ -1011,9 +1009,9 @@ void WaitForBarrierGCTask::destroy(WaitForBarrierGCTask* that) { " WaitForBarrierGCTask::destroy()" " is_c_heap_obj: %s" " monitor: " INTPTR_FORMAT, - that, + p2i(that), that->is_c_heap_obj() ? "true" : "false", - that->monitor()); + p2i(that->monitor())); } that->destruct(); if (that->is_c_heap_obj()) { @@ -1028,7 +1026,7 @@ void WaitForBarrierGCTask::destruct() { tty->print_cr("[" INTPTR_FORMAT "]" " WaitForBarrierGCTask::destruct()" " monitor: " INTPTR_FORMAT, - this, monitor()); + p2i(this), p2i(monitor())); } this->BarrierGCTask::destruct(); // Clean up that should be in the destructor, @@ -1044,7 +1042,7 @@ void WaitForBarrierGCTask::do_it(GCTaskManager* manager, uint which) { tty->print_cr("[" INTPTR_FORMAT "]" " WaitForBarrierGCTask::do_it() waiting for idle" " monitor: " INTPTR_FORMAT, - this, monitor()); + p2i(this), p2i(monitor())); } { // First, wait for the barrier to arrive. @@ -1062,7 +1060,7 @@ void WaitForBarrierGCTask::do_it(GCTaskManager* manager, uint which) { tty->print_cr("[" INTPTR_FORMAT "]" " WaitForBarrierGCTask::do_it()" " [" INTPTR_FORMAT "] (%s)->notify_all()", - this, monitor(), monitor()->name()); + p2i(this), p2i(monitor()), monitor()->name()); } monitor()->notify_all(); // Release monitor(). @@ -1074,7 +1072,7 @@ void WaitForBarrierGCTask::wait_for(bool reset) { tty->print_cr("[" INTPTR_FORMAT "]" " WaitForBarrierGCTask::wait_for()" " should_wait: %s", - this, should_wait() ? "true" : "false"); + p2i(this), should_wait() ? "true" : "false"); } { // Grab the lock and check again. @@ -1084,7 +1082,7 @@ void WaitForBarrierGCTask::wait_for(bool reset) { tty->print_cr("[" INTPTR_FORMAT "]" " WaitForBarrierGCTask::wait_for()" " [" INTPTR_FORMAT "] (%s)->wait()", - this, monitor(), monitor()->name()); + p2i(this), p2i(monitor()), monitor()->name()); } monitor()->wait(Mutex::_no_safepoint_check_flag, 0); } @@ -1096,7 +1094,7 @@ void WaitForBarrierGCTask::wait_for(bool reset) { tty->print_cr("[" INTPTR_FORMAT "]" " WaitForBarrierGCTask::wait_for() returns" " should_wait: %s", - this, should_wait() ? "true" : "false"); + p2i(this), should_wait() ? "true" : "false"); } // Release monitor(). } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp index 91f23612a56..13060a4a12c 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp @@ -34,8 +34,6 @@ #include "runtime/os.hpp" #include "runtime/thread.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - GCTaskThread::GCTaskThread(GCTaskManager* manager, uint which, uint processor_id) : @@ -79,7 +77,7 @@ void GCTaskThread::print_task_time_stamps() { tty->print_cr("GC-Thread %u entries: %d", id(), _time_stamp_index); for(uint i=0; i<_time_stamp_index; i++) { GCTaskTimeStamp* time_stamp = time_stamp_at(i); - tty->print_cr("\t[ %s " INT64_FORMAT " " INT64_FORMAT " ]", + tty->print_cr("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]", time_stamp->name(), time_stamp->entry_time(), time_stamp->exit_time()); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp index 13ccf71c28c..fc2cd8c6bea 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp @@ -42,8 +42,6 @@ #include "runtime/vmThread.hpp" #include "services/management.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // // ThreadRootsMarkingTask // @@ -256,7 +254,7 @@ void StealRegionCompactionTask::do_it(GCTaskManager* manager, uint which) { which_stack_index = which; assert(manager->active_workers() == ParallelGCThreads, err_msg("all_workers_active has been incorrectly set: " - " active %d ParallelGCThreads %d", manager->active_workers(), + " active %d ParallelGCThreads " UINTX_FORMAT, manager->active_workers(), ParallelGCThreads)); } else { which_stack_index = ParCompactionManager::pop_recycled_stack_index(); @@ -268,7 +266,7 @@ void StealRegionCompactionTask::do_it(GCTaskManager* manager, uint which) { gclog_or_tty->print_cr("StealRegionCompactionTask::do_it " "region_stack_index %d region_stack = " PTR_FORMAT " " " empty (%d) use all workers %d", - which_stack_index, ParCompactionManager::region_list(which_stack_index), + which_stack_index, p2i(ParCompactionManager::region_list(which_stack_index)), cm->region_stack()->is_empty(), use_all_workers); } @@ -335,7 +333,7 @@ void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) { which_stack_index = which; assert(manager->active_workers() == ParallelGCThreads, err_msg("all_workers_active has been incorrectly set: " - " active %d ParallelGCThreads %d", manager->active_workers(), + " active %d ParallelGCThreads " UINTX_FORMAT, manager->active_workers(), ParallelGCThreads)); } else { which_stack_index = stack_index(); @@ -369,7 +367,7 @@ void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) { void* old_region_stack = (void*) cm->region_stack(); int old_region_stack_index = cm->region_stack_index(); gclog_or_tty->print_cr("Pushing region stack " PTR_FORMAT "/%d", - old_region_stack, old_region_stack_index); + p2i(old_region_stack), old_region_stack_index); } cm->set_region_stack(NULL); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp index 229b9dd3cfa..bf979b9e420 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp @@ -35,8 +35,6 @@ #include -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size, size_t init_promo_size, size_t init_survivor_size, diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index 7288b963c9b..171f4643920 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -54,8 +54,6 @@ #include "utilities/events.hpp" #include "utilities/stack.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - elapsedTimer PSMarkSweep::_accumulated_time; jlong PSMarkSweep::_time_of_last_gc = 0; CollectorCounters* PSMarkSweep::_counters = NULL; @@ -670,7 +668,7 @@ jlong PSMarkSweep::millis_since_last_gc() { jlong ret_val = now - _time_of_last_gc; // XXX See note in genCollectedHeap::millis_since_last_gc(). if (ret_val < 0) { - NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);) + NOT_PRODUCT(warning("time warp: " JLONG_FORMAT, ret_val);) return 0; } return ret_val; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp index c7ac0eb5a9b..61c6caf5364 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp @@ -33,8 +33,6 @@ #include "oops/oop.inline.hpp" #include "runtime/java.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - inline const char* PSOldGen::select_name() { return UseParallelOldGC ? "ParOldGen" : "PSOldGen"; } @@ -440,9 +438,9 @@ void PSOldGen::print_on(outputStream* st) const { capacity_in_bytes()/K, used_in_bytes()/K); } st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", - virtual_space()->low_boundary(), - virtual_space()->high(), - virtual_space()->high_boundary()); + p2i(virtual_space()->low_boundary()), + p2i(virtual_space()->high()), + p2i(virtual_space()->high_boundary())); st->print(" object"); object_space()->print_on(st); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index c262b0b5c95..b8f60ffdadc 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -62,8 +62,6 @@ #include -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // All sizes are in HeapWords. const size_t ParallelCompactData::Log2RegionSize = 16; // 64K words const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize; @@ -222,7 +220,7 @@ print_generic_summary_region(size_t i, const ParallelCompactData::RegionData* c) REGION_IDX_FORMAT " " PTR_FORMAT " " REGION_DATA_FORMAT " " REGION_DATA_FORMAT " " REGION_DATA_FORMAT " " REGION_IDX_FORMAT " %d", - i, c->data_location(), dci, c->destination(), + i, p2i(c->data_location()), dci, p2i(c->destination()), c->partial_obj_size(), c->live_obj_size(), c->data_size(), c->source_region(), c->destination_count()); @@ -272,7 +270,7 @@ print_initial_summary_region(size_t i, tty->print(SIZE_FORMAT_W(5) " " PTR_FORMAT " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " %d", - i, c->destination(), + i, p2i(c->destination()), c->partial_obj_size(), c->live_obj_size(), c->data_size(), c->source_region(), c->destination_count()); if (newline) tty->cr(); @@ -633,13 +631,13 @@ ParallelCompactData::summarize_split_space(size_t src_region, const char * split_type = partial_obj_size == 0 ? "easy" : "hard"; gclog_or_tty->print_cr("%s split: src=" PTR_FORMAT " src_c=" SIZE_FORMAT " pos=" SIZE_FORMAT, - split_type, source_next, split_region, + split_type, p2i(source_next), split_region, partial_obj_size); gclog_or_tty->print_cr("%s split: dst=" PTR_FORMAT " dst_c=" SIZE_FORMAT " tn=" PTR_FORMAT, - split_type, split_destination, + split_type, p2i(split_destination), addr_to_region_idx(split_destination), - *target_next); + p2i(*target_next)); if (partial_obj_size != 0) { HeapWord* const po_beg = split_info.destination(); @@ -648,8 +646,8 @@ ParallelCompactData::summarize_split_space(size_t src_region, "po_beg=" PTR_FORMAT " " SIZE_FORMAT " " "po_end=" PTR_FORMAT " " SIZE_FORMAT, split_type, - po_beg, addr_to_region_idx(po_beg), - po_end, addr_to_region_idx(po_end)); + p2i(po_beg), addr_to_region_idx(po_beg), + p2i(po_end), addr_to_region_idx(po_end)); } } @@ -666,8 +664,8 @@ bool ParallelCompactData::summarize(SplitInfo& split_info, HeapWord* const source_next_val = source_next == NULL ? NULL : *source_next; tty->print_cr("sb=" PTR_FORMAT " se=" PTR_FORMAT " sn=" PTR_FORMAT "tb=" PTR_FORMAT " te=" PTR_FORMAT " tn=" PTR_FORMAT, - source_beg, source_end, source_next_val, - target_beg, target_end, *target_next); + p2i(source_beg), p2i(source_end), p2i(source_next_val), + p2i(target_beg), p2i(target_end), p2i(*target_next)); } size_t cur_region = addr_to_region_idx(source_beg); @@ -1132,9 +1130,9 @@ PSParallelCompact::compute_dense_prefix_via_density(const SpaceId id, const size_t cur_deadwood = pointer_delta(dense_prefix, region_destination); if (TraceParallelOldGCDensePrefix && Verbose) { tty->print_cr("c#=" SIZE_FORMAT_W(4) " dst=" PTR_FORMAT " " - "dp=" SIZE_FORMAT_W(8) " " "cdw=" SIZE_FORMAT_W(8), - sd.region(cp), region_destination, - dense_prefix, cur_deadwood); + "dp=" PTR_FORMAT " " "cdw=" SIZE_FORMAT_W(8), + sd.region(cp), p2i(region_destination), + p2i(dense_prefix), cur_deadwood); } if (cur_deadwood >= deadwood_goal) { @@ -1200,7 +1198,7 @@ void PSParallelCompact::print_dense_prefix_stats(const char* const algorithm, "d2l=" SIZE_FORMAT " d2l%%=%6.4f " "d2r=" SIZE_FORMAT " l2r=" SIZE_FORMAT " ratio=%10.8f", - algorithm, addr, region_idx, + algorithm, p2i(addr), region_idx, space_live, dead_to_left, dead_to_left_pct, dead_to_right, live_to_right, @@ -1468,7 +1466,7 @@ PSParallelCompact::fill_with_live_objects(SpaceId id, HeapWord* const start, { if (TraceParallelOldGCSummaryPhase) { tty->print_cr("fill_with_live_objects [" PTR_FORMAT " " PTR_FORMAT ") " - SIZE_FORMAT, start, start + words, words); + SIZE_FORMAT, p2i(start), p2i(start + words), words); } ObjectStartArray* const start_array = _space_info[id].start_array(); @@ -1810,9 +1808,9 @@ PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction) tty->print_cr("id=%d cap=" SIZE_FORMAT " dp=" PTR_FORMAT " " "dp_region=" SIZE_FORMAT " " "dp_count=" SIZE_FORMAT " " "cr_count=" SIZE_FORMAT " " "nt=" PTR_FORMAT, - id, space->capacity_in_words(), dense_prefix_end, + id, space->capacity_in_words(), p2i(dense_prefix_end), dp_region, dp_words / region_size, - cr_words / region_size, new_top); + cr_words / region_size, p2i(new_top)); } } @@ -1830,10 +1828,10 @@ void PSParallelCompact::summary_phase_msg(SpaceId dst_space_id, SIZE_FORMAT "-" SIZE_FORMAT, src_space_id, space_names[src_space_id], dst_space_id, space_names[dst_space_id], - src_beg, src_end, + p2i(src_beg), p2i(src_end), _summary_data.addr_to_region_idx(src_beg), _summary_data.addr_to_region_idx(src_end), - dst_beg, dst_end, + p2i(dst_beg), p2i(dst_end), _summary_data.addr_to_region_idx(dst_beg), _summary_data.addr_to_region_idx(dst_end)); } @@ -2233,8 +2231,8 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { heap->trace_heap_after_gc(&_gc_tracer); if (PrintGCTaskTimeStamps) { - gclog_or_tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " " - INT64_FORMAT, + gclog_or_tty->print_cr("VM-Thread " JLONG_FORMAT " " JLONG_FORMAT " " + JLONG_FORMAT, marking_start.ticks(), compaction_start.ticks(), collection_exit.ticks()); gc_task_manager()->print_task_time_stamps(); @@ -2753,7 +2751,7 @@ void PSParallelCompact::verify_complete(SpaceId space_id) { const RegionData* const c = sd.region(cur_region); if (!c->completed()) { warning("region " SIZE_FORMAT " not filled: " - "destination_count=" SIZE_FORMAT, + "destination_count=%u", cur_region, c->destination_count()); issued_a_warning = true; } @@ -2763,7 +2761,7 @@ void PSParallelCompact::verify_complete(SpaceId space_id) { const RegionData* const c = sd.region(cur_region); if (!c->available()) { warning("region " SIZE_FORMAT " not empty: " - "destination_count=" SIZE_FORMAT, + "destination_count=%u", cur_region, c->destination_count()); issued_a_warning = true; } @@ -3298,7 +3296,7 @@ jlong PSParallelCompact::millis_since_last_gc() { jlong ret_val = now - _time_of_last_gc; // XXX See note in genCollectedHeap::millis_since_last_gc(). if (ret_val < 0) { - NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);) + NOT_PRODUCT(warning("time warp: " JLONG_FORMAT, ret_val);) return 0; } return ret_val; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp index cf79af15c4e..be4a9ed11d7 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @@ -35,8 +35,6 @@ #include "oops/oop.inline.hpp" #include "utilities/stack.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - PaddedEnd* PSPromotionManager::_manager_array = NULL; OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL; PSOldGen* PSPromotionManager::_old_gen = NULL; @@ -341,7 +339,7 @@ oop PSPromotionManager::oop_promotion_failed(oop obj, markOop obj_mark) { gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " (%d)}", "promotion-failure", obj->klass()->internal_name(), - (void *)obj, obj->size()); + p2i(obj), obj->size()); } #endif diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index 205170b8c65..04ff184ea0c 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -55,8 +55,6 @@ #include "services/memoryService.hpp" #include "utilities/stack.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - HeapWord* PSScavenge::_to_space_top_before_gc = NULL; int PSScavenge::_consecutive_skipped_scavenges = 0; ReferenceProcessor* PSScavenge::_ref_processor = NULL; @@ -550,8 +548,8 @@ bool PSScavenge::invoke_no_policy() { if (PrintTenuringDistribution) { gclog_or_tty->cr(); - gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold " - UINTX_FORMAT " (max threshold " UINTX_FORMAT ")", + gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u" + " (max threshold " UINTX_FORMAT ")", size_policy->calculated_survivor_size_in_bytes(), _tenuring_threshold, MaxTenuringThreshold); } @@ -693,7 +691,7 @@ bool PSScavenge::invoke_no_policy() { scavenge_exit.update(); if (PrintGCTaskTimeStamps) { - tty->print_cr("VM-Thread " INT64_FORMAT " " INT64_FORMAT " " INT64_FORMAT, + tty->print_cr("VM-Thread " JLONG_FORMAT " " JLONG_FORMAT " " JLONG_FORMAT, scavenge_entry.ticks(), scavenge_midpoint.ticks(), scavenge_exit.ticks()); gc_task_manager()->print_task_time_stamps(); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp index 7d11d38b885..867422eaf21 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp @@ -27,8 +27,6 @@ #include "runtime/os.hpp" #include "runtime/virtualspace.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // PSVirtualSpace PSVirtualSpace::PSVirtualSpace(ReservedSpace rs, size_t alignment) : @@ -218,22 +216,22 @@ void PSVirtualSpace::verify() const { void PSVirtualSpace::print() const { gclog_or_tty->print_cr("virtual space [" PTR_FORMAT "]: alignment=" SIZE_FORMAT "K grows %s%s", - this, alignment() / K, grows_up() ? "up" : "down", + p2i(this), alignment() / K, grows_up() ? "up" : "down", special() ? " (pinned in memory)" : ""); gclog_or_tty->print_cr(" reserved=" SIZE_FORMAT "K" " [" PTR_FORMAT "," PTR_FORMAT "]" " committed=" SIZE_FORMAT "K" " [" PTR_FORMAT "," PTR_FORMAT "]", reserved_size() / K, - reserved_low_addr(), reserved_high_addr(), + p2i(reserved_low_addr()), p2i(reserved_high_addr()), committed_size() / K, - committed_low_addr(), committed_high_addr()); + p2i(committed_low_addr()), p2i(committed_high_addr())); } #endif // #ifndef PRODUCT void PSVirtualSpace::print_space_boundaries_on(outputStream* st) const { st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", - low_boundary(), high(), high_boundary()); + p2i(low_boundary()), p2i(high()), p2i(high_boundary())); } PSVirtualSpaceHighToLow::PSVirtualSpaceHighToLow(ReservedSpace rs, @@ -350,5 +348,5 @@ size_t PSVirtualSpaceHighToLow::expand_into(PSVirtualSpace* other_space, void PSVirtualSpaceHighToLow::print_space_boundaries_on(outputStream* st) const { st->print_cr(" (" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT "]", - high_boundary(), low(), low_boundary()); + p2i(high_boundary()), p2i(low()), p2i(low_boundary())); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp index 77c0937eb01..286fbaa88fa 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp @@ -33,8 +33,6 @@ #include "oops/oop.inline.hpp" #include "runtime/java.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - PSYoungGen::PSYoungGen(size_t initial_size, size_t min_size, size_t max_size) : @@ -419,20 +417,22 @@ void PSYoungGen::mangle_survivors(MutableSpace* s1, // s1 gclog_or_tty->print_cr("Current region: [" PTR_FORMAT ", " PTR_FORMAT ") " "New region: [" PTR_FORMAT ", " PTR_FORMAT ")", - s1->bottom(), s1->end(), s1MR.start(), s1MR.end()); + p2i(s1->bottom()), p2i(s1->end()), + p2i(s1MR.start()), p2i(s1MR.end())); gclog_or_tty->print_cr(" Mangle before: [" PTR_FORMAT ", " PTR_FORMAT ") Mangle after: [" PTR_FORMAT ", " PTR_FORMAT ")", - delta1_left.start(), delta1_left.end(), delta1_right.start(), - delta1_right.end()); + p2i(delta1_left.start()), p2i(delta1_left.end()), + p2i(delta1_right.start()), p2i(delta1_right.end())); // s2 gclog_or_tty->print_cr("Current region: [" PTR_FORMAT ", " PTR_FORMAT ") " "New region: [" PTR_FORMAT ", " PTR_FORMAT ")", - s2->bottom(), s2->end(), s2MR.start(), s2MR.end()); + p2i(s2->bottom()), p2i(s2->end()), + p2i(s2MR.start()), p2i(s2MR.end())); gclog_or_tty->print_cr(" Mangle before: [" PTR_FORMAT ", " PTR_FORMAT ") Mangle after: [" PTR_FORMAT ", " PTR_FORMAT ")", - delta2_left.start(), delta2_left.end(), delta2_right.start(), - delta2_right.end()); + p2i(delta2_left.start()), p2i(delta2_left.end()), + p2i(delta2_right.start()), p2i(delta2_right.end())); } } @@ -456,22 +456,22 @@ void PSYoungGen::resize_spaces(size_t requested_eden_size, requested_eden_size, requested_survivor_size); gclog_or_tty->print_cr(" eden: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - eden_space()->bottom(), - eden_space()->end(), + p2i(eden_space()->bottom()), + p2i(eden_space()->end()), pointer_delta(eden_space()->end(), eden_space()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" from: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - from_space()->bottom(), - from_space()->end(), + p2i(from_space()->bottom()), + p2i(from_space()->end()), pointer_delta(from_space()->end(), from_space()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" to: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, - to_space()->bottom(), - to_space()->end(), + p2i(to_space()->bottom()), + p2i(to_space()->end()), pointer_delta( to_space()->end(), to_space()->bottom(), sizeof(char))); @@ -572,18 +572,18 @@ void PSYoungGen::resize_spaces(size_t requested_eden_size, if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); } } else { @@ -629,18 +629,18 @@ void PSYoungGen::resize_spaces(size_t requested_eden_size, if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" [eden_start .. eden_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - eden_start, - eden_end, + p2i(eden_start), + p2i(eden_end), pointer_delta(eden_end, eden_start, sizeof(char))); gclog_or_tty->print_cr(" [ to_start .. to_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - to_start, - to_end, + p2i(to_start), + p2i(to_end), pointer_delta( to_end, to_start, sizeof(char))); gclog_or_tty->print_cr(" [from_start .. from_end): " "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT, - from_start, - from_end, + p2i(from_start), + p2i(from_end), pointer_delta(from_end, from_start, sizeof(char))); } } From 28d7b8200d0a6d3b390bd2d315999c0e838867a9 Mon Sep 17 00:00:00 2001 From: David Lindholm Date: Fri, 27 Mar 2015 15:27:14 +0100 Subject: [PATCH 024/101] 8076072: parNew: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files Reviewed-by: stefank, brutisso --- .../vm/gc_implementation/parNew/parCardTableModRefBS.cpp | 9 ++++----- .../vm/gc_implementation/parNew/parNewGeneration.cpp | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp index efe7e399209..6f77be956c4 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp @@ -36,8 +36,6 @@ #include "runtime/virtualspace.hpp" #include "runtime/vmThread.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr, OopsInGenClosure* cl, CardTableRS* ct, @@ -376,13 +374,14 @@ process_chunk_boundaries(Space* sp, " does not exceed used.end() = " PTR_FORMAT "," " yet last_chunk_index_to_check " INTPTR_FORMAT " exceeds last_chunk_index " INTPTR_FORMAT, - last_block, last_block + last_block_size, - used.end(), + p2i(last_block), p2i(last_block + last_block_size), + p2i(used.end()), last_chunk_index_to_check, last_chunk_index)); assert(sp->used_region().end() > used.end(), err_msg("Expansion did not happen: " "[" PTR_FORMAT "," PTR_FORMAT ") -> [" PTR_FORMAT "," PTR_FORMAT ")", - sp->used_region().start(), sp->used_region().end(), used.start(), used.end())); + p2i(sp->used_region().start()), p2i(sp->used_region().end()), + p2i(used.start()), p2i(used.end()))); NOISY(tty->print_cr(" process_chunk_boundary: heap expanded; explicitly bounding last_chunk");) last_chunk_index_to_check = last_chunk_index; } diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index f1be6547dd6..775a6a513c6 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -55,8 +55,6 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/workgroup.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - #ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable:4355 ) // 'this' : used in base member initializer list @@ -1212,7 +1210,7 @@ oop ParNewGeneration::copy_to_survivor_space( if (TraceScavenge) { gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}", is_in_reserved(new_obj) ? "copying" : "tenuring", - new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size()); + new_obj->klass()->internal_name(), p2i(old), p2i(new_obj), new_obj->size()); } #endif From 4e7e0848a761d8891207b5d2c82b654520ee9a72 Mon Sep 17 00:00:00 2001 From: David Lindholm Date: Fri, 27 Mar 2015 15:29:19 +0100 Subject: [PATCH 025/101] 8076073: shared: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files Reviewed-by: stefank, brutisso --- .../vm/gc_implementation/shared/markSweep.cpp | 2 - .../shared/mutableNUMASpace.cpp | 4 +- .../gc_implementation/shared/mutableSpace.cpp | 4 +- .../shared/spaceDecorator.cpp | 4 +- .../src/share/vm/memory/defNewGeneration.cpp | 4 +- .../src/share/vm/memory/genCollectedHeap.cpp | 2 +- hotspot/src/share/vm/memory/generation.cpp | 8 +-- hotspot/src/share/vm/memory/generation.hpp | 2 +- .../src/share/vm/memory/heapInspection.cpp | 16 ++--- hotspot/src/share/vm/memory/metachunk.cpp | 4 +- hotspot/src/share/vm/memory/metaspace.cpp | 68 +++++++++---------- .../share/vm/memory/referenceProcessor.cpp | 64 +++++++++-------- hotspot/src/share/vm/memory/sharedHeap.cpp | 2 - hotspot/src/share/vm/memory/space.cpp | 18 +++-- .../vm/memory/threadLocalAllocBuffer.cpp | 6 +- hotspot/src/share/vm/memory/universe.cpp | 6 +- 16 files changed, 93 insertions(+), 121 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp index dadffdf01b5..bcf4fef7184 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp @@ -32,8 +32,6 @@ #include "oops/objArrayKlass.inline.hpp" #include "oops/oop.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - uint MarkSweep::_total_invocations = 0; Stack MarkSweep::_marking_stack; diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp index bdb746fe09e..1d4564160a0 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp @@ -31,8 +31,6 @@ #include "runtime/atomic.inline.hpp" #include "runtime/thread.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) { _lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray(0, true); _page_size = os::vm_page_size(); @@ -973,7 +971,7 @@ void MutableNUMASpace::LGRPSpace::scan_pages(size_t page_size, size_t page_count break; } if (e != scan_end) { - assert(e < scan_end, err_msg("e: " PTR_FORMAT " scan_end: " PTR_FORMAT, e, scan_end)); + assert(e < scan_end, err_msg("e: " PTR_FORMAT " scan_end: " PTR_FORMAT, p2i(e), p2i(scan_end))); if ((page_expected.size != page_size || page_expected.lgrp_id != lgrp_id()) && page_expected.size != 0) { diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp index e2e4a6b8e04..a0884bf36a2 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp @@ -33,8 +33,6 @@ #include "runtime/thread.hpp" #endif // INCLUDE_ALL_GCS -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) { assert(MutableSpace::alignment() % os::vm_page_size() == 0, "Space should be aligned"); @@ -253,7 +251,7 @@ void MutableSpace::print() const { print_on(tty); } void MutableSpace::print_on(outputStream* st) const { MutableSpace::print_short_on(st); st->print_cr(" [" INTPTR_FORMAT "," INTPTR_FORMAT "," INTPTR_FORMAT ")", - bottom(), top(), end()); + p2i(bottom()), p2i(top()), p2i(end())); } void MutableSpace::verify() { diff --git a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp index 15e38aa1ba1..1ff1e51c72d 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp @@ -27,8 +27,6 @@ #include "memory/space.inline.hpp" #include "utilities/copy.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // Catch-all file for utility classes #ifndef PRODUCT @@ -86,7 +84,7 @@ void SpaceMangler::mangle_region(MemRegion mr) { assert(ZapUnusedHeapArea, "Mangling should not be in use"); #ifdef ASSERT if(TraceZapUnusedHeapArea) { - gclog_or_tty->print("Mangling [" PTR_FORMAT " to " PTR_FORMAT ")", mr.start(), mr.end()); + gclog_or_tty->print("Mangling [" PTR_FORMAT " to " PTR_FORMAT ")", p2i(mr.start()), p2i(mr.end())); } Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord); if(TraceZapUnusedHeapArea) { diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index c0eeb620010..e306632374c 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -49,8 +49,6 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/stack.inline.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // // DefNewGeneration functions. @@ -137,7 +135,7 @@ void KlassScanClosure::do_klass(Klass* klass) { if (TraceScavenge) { ResourceMark rm; gclog_or_tty->print_cr("KlassScanClosure::do_klass " PTR_FORMAT ", %s, dirty: %s", - klass, + p2i(klass), klass->external_name(), klass->has_modified_oops() ? "true" : "false"); } diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 64c37b3655c..67d4fa56eb9 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -1337,7 +1337,7 @@ jlong GenCollectedHeap::millis_since_last_gc() { // back a time later than 'now'. jlong retVal = now - tolgc_cl.time(); if (retVal < 0) { - NOT_PRODUCT(warning("time warp: "INT64_FORMAT, (int64_t) retVal);) + NOT_PRODUCT(warning("time warp: " JLONG_FORMAT, retVal);) return 0; } return retVal; diff --git a/hotspot/src/share/vm/memory/generation.cpp b/hotspot/src/share/vm/memory/generation.cpp index 205cbce34a4..e27cb603291 100644 --- a/hotspot/src/share/vm/memory/generation.cpp +++ b/hotspot/src/share/vm/memory/generation.cpp @@ -42,8 +42,6 @@ #include "utilities/copy.hpp" #include "utilities/events.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - Generation::Generation(ReservedSpace rs, size_t initial_size, int level) : _level(level), _ref_processor(NULL) { @@ -103,9 +101,9 @@ void Generation::print_on(outputStream* st) const { st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", capacity()/K, used()/K); st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", - _virtual_space.low_boundary(), - _virtual_space.high(), - _virtual_space.high_boundary()); + p2i(_virtual_space.low_boundary()), + p2i(_virtual_space.high()), + p2i(_virtual_space.high_boundary())); } void Generation::print_summary_info() { print_summary_info_on(tty); } diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp index a2e15a08895..650f54b72f8 100644 --- a/hotspot/src/share/vm/memory/generation.hpp +++ b/hotspot/src/share/vm/memory/generation.hpp @@ -399,7 +399,7 @@ class Generation: public CHeapObj { // have to guard against non-monotonicity. NOT_PRODUCT( if (now < _time_of_last_gc) { - warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, (int64_t)_time_of_last_gc, (int64_t)now); + warning("time warp: " JLONG_FORMAT " to " JLONG_FORMAT, _time_of_last_gc, now); } ) return _time_of_last_gc; diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp index c4b5ba787d0..31ba78e8db1 100644 --- a/hotspot/src/share/vm/memory/heapInspection.cpp +++ b/hotspot/src/share/vm/memory/heapInspection.cpp @@ -38,8 +38,6 @@ #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #endif // INCLUDE_ALL_GCS -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // HeapInspection inline KlassInfoEntry::~KlassInfoEntry() { @@ -100,8 +98,8 @@ void KlassInfoEntry::print_on(outputStream* st) const { // simplify the formatting (ILP32 vs LP64) - always cast the numbers to 64-bit st->print_cr(INT64_FORMAT_W(13) " " UINT64_FORMAT_W(13) " %s", - (jlong) _instance_count, - (julong) _instance_words * HeapWordSize, + (int64_t)_instance_count, + (uint64_t)_instance_words * HeapWordSize, name()); } @@ -240,8 +238,8 @@ void KlassInfoHisto::sort() { void KlassInfoHisto::print_elements(outputStream* st) const { // simplify the formatting (ILP32 vs LP64) - store the sum in 64-bit - jlong total = 0; - julong totalw = 0; + int64_t total = 0; + uint64_t totalw = 0; for(int i=0; i < elements()->length(); i++) { st->print("%4d: ", i+1); elements()->at(i)->print_on(st); @@ -451,7 +449,7 @@ static void print_classname(outputStream* st, Klass* klass) { if (loader_oop == NULL) { st->print("null"); } else { - st->print(INTPTR_FORMAT, klass->class_loader_data()); + st->print(INTPTR_FORMAT, p2i(klass->class_loader_data())); } } @@ -557,13 +555,13 @@ void KlassInfoHisto::print_class_stats(outputStream* st, } if (csv_format) { - st->print("%d,%d", e->index(), super_index); + st->print("%ld,%d", e->index(), super_index); for (int c=0; cprint("," JULONG_FORMAT, col_table[c]);} } st->print(",%s",e->name()); } else { - st->print("%5d %5d", e->index(), super_index); + st->print("%5ld %5d", e->index(), super_index); for (int c=0; cprint_cr("Metachunk:" " bottom " PTR_FORMAT " top " PTR_FORMAT " end " PTR_FORMAT " size " SIZE_FORMAT, - bottom(), _top, end(), word_size()); + p2i(bottom()), p2i(_top), p2i(end()), word_size()); if (Verbose) { st->print_cr(" used " SIZE_FORMAT " free " SIZE_FORMAT, used_word_size(), free_word_size()); diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index 8f7476d8469..d60679d43fb 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -49,8 +49,6 @@ #include "utilities/debug.hpp" #include "utilities/macros.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - typedef BinaryTreeDictionary > BlockTreeDictionary; typedef BinaryTreeDictionary > ChunkTreeDictionary; @@ -388,7 +386,7 @@ class VirtualSpaceNode : public CHeapObj { #define assert_is_ptr_aligned(ptr, alignment) \ assert(is_ptr_aligned(ptr, alignment), \ err_msg(PTR_FORMAT " is not aligned to " \ - SIZE_FORMAT, ptr, alignment)) + SIZE_FORMAT, p2i(ptr), alignment)) #define assert_is_size_aligned(size, alignment) \ assert(is_size_aligned(size, alignment), \ @@ -800,7 +798,7 @@ void VirtualSpaceNode::inc_container_count() { _container_count++; assert(_container_count == container_count_slow(), err_msg("Inconsistency in container_count _container_count " SIZE_FORMAT - " container_count_slow() " SIZE_FORMAT, + " container_count_slow() %u", _container_count, container_count_slow())); } @@ -813,7 +811,7 @@ void VirtualSpaceNode::dec_container_count() { void VirtualSpaceNode::verify_container_count() { assert(_container_count == container_count_slow(), err_msg("Inconsistency in container_count _container_count " SIZE_FORMAT - " container_count_slow() " SIZE_FORMAT, _container_count, container_count_slow())); + " container_count_slow() %u", _container_count, container_count_slow())); } #endif @@ -916,7 +914,7 @@ Metachunk* VirtualSpaceNode::take_from_committed(size_t chunk_word_size) { if (!is_available(chunk_word_size)) { if (TraceMetadataChunkAllocation) { - gclog_or_tty->print("VirtualSpaceNode::take_from_committed() not available %d words ", chunk_word_size); + gclog_or_tty->print("VirtualSpaceNode::take_from_committed() not available " SIZE_FORMAT " words ", chunk_word_size); // Dump some information about the virtual space that is nearly full print_on(gclog_or_tty); } @@ -989,7 +987,7 @@ bool VirtualSpaceNode::initialize() { assert(reserved()->start() == (HeapWord*) _rs.base(), err_msg("Reserved start was not set properly " PTR_FORMAT - " != " PTR_FORMAT, reserved()->start(), _rs.base())); + " != " PTR_FORMAT, p2i(reserved()->start()), p2i(_rs.base()))); assert(reserved()->word_size() == _rs.size() / BytesPerWord, err_msg("Reserved size was not set properly " SIZE_FORMAT " != " SIZE_FORMAT, reserved()->word_size(), @@ -1003,13 +1001,13 @@ void VirtualSpaceNode::print_on(outputStream* st) const { size_t used = used_words_in_vs(); size_t capacity = capacity_words_in_vs(); VirtualSpace* vs = virtual_space(); - st->print_cr(" space @ " PTR_FORMAT " " SIZE_FORMAT "K, %3d%% used " + st->print_cr(" space @ " PTR_FORMAT " " SIZE_FORMAT "K, " SIZE_FORMAT_W(3) "%% used " "[" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", - vs, capacity / K, + p2i(vs), capacity / K, capacity == 0 ? 0 : used * 100 / capacity, - bottom(), top(), end(), - vs->high_boundary()); + p2i(bottom()), p2i(top()), p2i(end()), + p2i(vs->high_boundary())); } #ifdef ASSERT @@ -1812,7 +1810,7 @@ Metachunk* ChunkManager::free_chunks_get(size_t word_size) { if (TraceMetadataChunkAllocation && Verbose) { gclog_or_tty->print_cr("ChunkManager::free_chunks_get: free_list " PTR_FORMAT " head " PTR_FORMAT " size " SIZE_FORMAT, - free_list, chunk, chunk->word_size()); + p2i(free_list), p2i(chunk), chunk->word_size()); } } else { chunk = humongous_dictionary()->get_chunk( @@ -1872,7 +1870,7 @@ Metachunk* ChunkManager::chunk_freelist_allocate(size_t word_size) { } gclog_or_tty->print("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk " PTR_FORMAT " size " SIZE_FORMAT " count " SIZE_FORMAT " ", - this, chunk, chunk->word_size(), list_count); + p2i(this), p2i(chunk), chunk->word_size(), list_count); locked_print_free_chunks(gclog_or_tty); } @@ -2019,7 +2017,7 @@ void SpaceManager::locked_print_chunks_in_use_on(outputStream* st) const { for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) { Metachunk* chunk = chunks_in_use(i); st->print("SpaceManager: %s " PTR_FORMAT, - chunk_size_name(i), chunk); + chunk_size_name(i), p2i(chunk)); if (chunk != NULL) { st->print_cr(" free " SIZE_FORMAT, chunk->free_word_size()); @@ -2130,8 +2128,8 @@ void SpaceManager::print_on(outputStream* st) const { for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists ; i = next_chunk_index(i) ) { - st->print_cr(" chunks_in_use " PTR_FORMAT " chunk size " PTR_FORMAT, - chunks_in_use(i), + st->print_cr(" chunks_in_use " PTR_FORMAT " chunk size " SIZE_FORMAT, + p2i(chunks_in_use(i)), chunks_in_use(i) == NULL ? 0 : chunks_in_use(i)->word_size()); } st->print_cr(" waste: Small " SIZE_FORMAT " Medium " SIZE_FORMAT @@ -2194,7 +2192,7 @@ void SpaceManager::initialize() { } _current_chunk = NULL; if (TraceMetadataChunkAllocation && Verbose) { - gclog_or_tty->print_cr("SpaceManager(): " PTR_FORMAT, this); + gclog_or_tty->print_cr("SpaceManager(): " PTR_FORMAT, p2i(this)); } } @@ -2238,7 +2236,7 @@ SpaceManager::~SpaceManager() { dec_total_from_size_metrics(); if (TraceMetadataChunkAllocation && Verbose) { - gclog_or_tty->print_cr("~SpaceManager(): " PTR_FORMAT, this); + gclog_or_tty->print_cr("~SpaceManager(): " PTR_FORMAT, p2i(this)); locked_print_chunks_in_use_on(gclog_or_tty); } @@ -2258,7 +2256,7 @@ SpaceManager::~SpaceManager() { for (ChunkIndex i = ZeroIndex; i < HumongousIndex; i = next_chunk_index(i)) { if (TraceMetadataChunkAllocation && Verbose) { - gclog_or_tty->print_cr("returned %d %s chunks to freelist", + gclog_or_tty->print_cr("returned " SIZE_FORMAT " %s chunks to freelist", sum_count_in_chunks_in_use(i), chunk_size_name(i)); } @@ -2266,7 +2264,7 @@ SpaceManager::~SpaceManager() { chunk_manager()->return_chunks(i, chunks); set_chunks_in_use(i, NULL); if (TraceMetadataChunkAllocation && Verbose) { - gclog_or_tty->print_cr("updated freelist count %d %s", + gclog_or_tty->print_cr("updated freelist count " SSIZE_FORMAT " %s", chunk_manager()->free_chunks(i)->count(), chunk_size_name(i)); } @@ -2279,7 +2277,7 @@ SpaceManager::~SpaceManager() { // Humongous chunks if (TraceMetadataChunkAllocation && Verbose) { - gclog_or_tty->print_cr("returned %d %s humongous chunks to dictionary", + gclog_or_tty->print_cr("returned " SIZE_FORMAT " %s humongous chunks to dictionary", sum_count_in_chunks_in_use(HumongousIndex), chunk_size_name(HumongousIndex)); gclog_or_tty->print("Humongous chunk dictionary: "); @@ -2293,14 +2291,14 @@ SpaceManager::~SpaceManager() { #endif if (TraceMetadataChunkAllocation && Verbose) { gclog_or_tty->print(PTR_FORMAT " (" SIZE_FORMAT ") ", - humongous_chunks, + p2i(humongous_chunks), humongous_chunks->word_size()); } assert(humongous_chunks->word_size() == (size_t) align_size_up(humongous_chunks->word_size(), smallest_chunk_size()), err_msg("Humongous chunk size is wrong: word size " SIZE_FORMAT - " granularity %d", + " granularity " SIZE_FORMAT, humongous_chunks->word_size(), smallest_chunk_size())); Metachunk* next_humongous_chunks = humongous_chunks->next(); humongous_chunks->container()->dec_container_count(); @@ -2309,7 +2307,7 @@ SpaceManager::~SpaceManager() { } if (TraceMetadataChunkAllocation && Verbose) { gclog_or_tty->cr(); - gclog_or_tty->print_cr("updated dictionary count %d %s", + gclog_or_tty->print_cr("updated dictionary count " SIZE_FORMAT " %s", chunk_manager()->humongous_dictionary()->total_count(), chunk_size_name(HumongousIndex)); } @@ -2399,7 +2397,7 @@ void SpaceManager::add_chunk(Metachunk* new_chunk, bool make_current) { assert(new_chunk->is_empty(), "Not ready for reuse"); if (TraceMetadataChunkAllocation && Verbose) { - gclog_or_tty->print("SpaceManager::add_chunk: %d) ", + gclog_or_tty->print("SpaceManager::add_chunk: " SIZE_FORMAT ") ", sum_count_in_chunks_in_use()); new_chunk->print_on(gclog_or_tty); chunk_manager()->locked_print_free_chunks(gclog_or_tty); @@ -3097,7 +3095,7 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a metaspace_rs = ReservedSpace(compressed_class_space_size(), _reserve_alignment, large_pages); if (!metaspace_rs.is_reserved()) { - vm_exit_during_initialization(err_msg("Could not allocate metaspace: %d bytes", + vm_exit_during_initialization(err_msg("Could not allocate metaspace: " SIZE_FORMAT " bytes", compressed_class_space_size())); } } @@ -3119,10 +3117,10 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a initialize_class_space(metaspace_rs); if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) { - gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: " SIZE_FORMAT, - Universe::narrow_klass_base(), Universe::narrow_klass_shift()); + gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d", + p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift()); gclog_or_tty->print_cr("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT, - compressed_class_space_size(), metaspace_rs.base(), requested_addr); + compressed_class_space_size(), p2i(metaspace_rs.base()), p2i(requested_addr)); } } @@ -3251,7 +3249,7 @@ void Metaspace::global_initialize() { vm_exit_during_initialization("Unable to dump shared archive.", err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space (" SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed " - "klass limit: " SIZE_FORMAT, cds_total, compressed_class_space_size(), + "klass limit: " UINT64_FORMAT, cds_total, compressed_class_space_size(), cds_total + compressed_class_space_size(), UnscaledClassSpaceMax)); } @@ -3262,7 +3260,7 @@ void Metaspace::global_initialize() { Universe::set_narrow_klass_base((address)_space_list->current_virtual_space()->bottom()); if (TraceMetavirtualspaceAllocation && Verbose) { gclog_or_tty->print_cr("Setting_narrow_klass_base to Address: " PTR_FORMAT, - _space_list->current_virtual_space()->bottom()); + p2i(_space_list->current_virtual_space()->bottom())); } Universe::set_narrow_klass_shift(0); @@ -3768,10 +3766,10 @@ void Metaspace::verify() { } void Metaspace::dump(outputStream* const out) const { - out->print_cr("\nVirtual space manager: " INTPTR_FORMAT, vsm()); + out->print_cr("\nVirtual space manager: " INTPTR_FORMAT, p2i(vsm())); vsm()->dump(out); if (using_class_space()) { - out->print_cr("\nClass space manager: " INTPTR_FORMAT, class_vsm()); + out->print_cr("\nClass space manager: " INTPTR_FORMAT, p2i(class_vsm())); class_vsm()->dump(out); } } @@ -3932,13 +3930,13 @@ class TestVirtualSpaceNodeTest { assert(vsn.is_available(word_size), \ err_msg(#word_size ": " PTR_FORMAT " bytes were not available in " \ "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \ - (uintptr_t)(word_size * BytesPerWord), vsn.bottom(), vsn.end())); + (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end()))); #define assert_is_available_negative(word_size) \ assert(!vsn.is_available(word_size), \ err_msg(#word_size ": " PTR_FORMAT " bytes should not be available in " \ "VirtualSpaceNode [" PTR_FORMAT ", " PTR_FORMAT ")", \ - (uintptr_t)(word_size * BytesPerWord), vsn.bottom(), vsn.end())); + (uintptr_t)(word_size * BytesPerWord), p2i(vsn.bottom()), p2i(vsn.end()))); static void test_is_available_positive() { // Reserve some memory. diff --git a/hotspot/src/share/vm/memory/referenceProcessor.cpp b/hotspot/src/share/vm/memory/referenceProcessor.cpp index 1a011ce1e91..ad668d667ec 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.cpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp @@ -35,8 +35,6 @@ #include "runtime/java.hpp" #include "runtime/jniHandles.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL; ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL; bool ReferenceProcessor::_pending_list_uses_discovered_field = false; @@ -161,7 +159,7 @@ void ReferenceProcessor::update_soft_ref_master_clock() { NOT_PRODUCT( if (now < _soft_ref_timestamp_clock) { - warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, + warning("time warp: " JLONG_FORMAT " to " JLONG_FORMAT, _soft_ref_timestamp_clock, now); } ) @@ -361,7 +359,7 @@ void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list, // field. if (TraceReferenceGC && PrintGCDetails) { gclog_or_tty->print_cr("ReferenceProcessor::enqueue_discovered_reflist list " - INTPTR_FORMAT, (address)refs_list.head()); + INTPTR_FORMAT, p2i(refs_list.head())); } oop obj = NULL; @@ -375,7 +373,7 @@ void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list, next_d = java_lang_ref_Reference::discovered(obj); if (TraceReferenceGC && PrintGCDetails) { gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT, - (void *)obj, (void *)next_d); + p2i(obj), p2i(next_d)); } assert(java_lang_ref_Reference::next(obj) == NULL, "Reference not active; should not be discovered"); @@ -402,7 +400,7 @@ void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list, next_d = java_lang_ref_Reference::discovered(obj); if (TraceReferenceGC && PrintGCDetails) { gclog_or_tty->print_cr(" obj " INTPTR_FORMAT "/next_d " INTPTR_FORMAT, - (void *)obj, (void *)next_d); + p2i(obj), p2i(next_d)); } assert(java_lang_ref_Reference::next(obj) == NULL, "The reference should not be enqueued"); @@ -565,7 +563,7 @@ ReferenceProcessor::process_phase1(DiscoveredList& refs_list, !policy->should_clear_reference(iter.obj(), _soft_ref_timestamp_clock)) { if (TraceReferenceGC) { gclog_or_tty->print_cr("Dropping reference (" INTPTR_FORMAT ": %s" ") by policy", - (void *)iter.obj(), iter.obj()->klass()->internal_name()); + p2i(iter.obj()), iter.obj()->klass()->internal_name()); } // Remove Reference object from list iter.remove(); @@ -582,9 +580,9 @@ ReferenceProcessor::process_phase1(DiscoveredList& refs_list, complete_gc->do_void(); NOT_PRODUCT( if (PrintGCDetails && TraceReferenceGC) { - gclog_or_tty->print_cr(" Dropped %d dead Refs out of %d " - "discovered Refs by policy, from list " INTPTR_FORMAT, - iter.removed(), iter.processed(), (address)refs_list.head()); + gclog_or_tty->print_cr(" Dropped " SIZE_FORMAT " dead Refs out of " SIZE_FORMAT + " discovered Refs by policy, from list " INTPTR_FORMAT, + iter.removed(), iter.processed(), p2i(refs_list.head())); } ) } @@ -604,7 +602,7 @@ ReferenceProcessor::pp2_work(DiscoveredList& refs_list, if (iter.is_referent_alive()) { if (TraceReferenceGC) { gclog_or_tty->print_cr("Dropping strongly reachable reference (" INTPTR_FORMAT ": %s)", - (void *)iter.obj(), iter.obj()->klass()->internal_name()); + p2i(iter.obj()), iter.obj()->klass()->internal_name()); } // The referent is reachable after all. // Remove Reference object from list. @@ -620,9 +618,9 @@ ReferenceProcessor::pp2_work(DiscoveredList& refs_list, } NOT_PRODUCT( if (PrintGCDetails && TraceReferenceGC && (iter.processed() > 0)) { - gclog_or_tty->print_cr(" Dropped %d active Refs out of %d " - "Refs in discovered list " INTPTR_FORMAT, - iter.removed(), iter.processed(), (address)refs_list.head()); + gclog_or_tty->print_cr(" Dropped " SIZE_FORMAT " active Refs out of " SIZE_FORMAT + " Refs in discovered list " INTPTR_FORMAT, + iter.removed(), iter.processed(), p2i(refs_list.head())); } ) } @@ -659,9 +657,9 @@ ReferenceProcessor::pp2_work_concurrent_discovery(DiscoveredList& refs_list, complete_gc->do_void(); NOT_PRODUCT( if (PrintGCDetails && TraceReferenceGC && (iter.processed() > 0)) { - gclog_or_tty->print_cr(" Dropped %d active Refs out of %d " - "Refs in discovered list " INTPTR_FORMAT, - iter.removed(), iter.processed(), (address)refs_list.head()); + gclog_or_tty->print_cr(" Dropped " SIZE_FORMAT " active Refs out of " SIZE_FORMAT + " Refs in discovered list " INTPTR_FORMAT, + iter.removed(), iter.processed(), p2i(refs_list.head())); } ) } @@ -690,7 +688,7 @@ ReferenceProcessor::process_phase3(DiscoveredList& refs_list, if (TraceReferenceGC) { gclog_or_tty->print_cr("Adding %sreference (" INTPTR_FORMAT ": %s) as pending", clear_referent ? "cleared " : "", - (void *)iter.obj(), iter.obj()->klass()->internal_name()); + p2i(iter.obj()), iter.obj()->klass()->internal_name()); } assert(iter.obj()->is_oop(UseConcMarkSweepGC), "Adding a bad reference"); iter.next(); @@ -807,11 +805,11 @@ void ReferenceProcessor::balance_queues(DiscoveredList ref_lists[]) for (uint i = 0; i < _max_num_q; ++i) { total_refs += ref_lists[i].length(); if (TraceReferenceGC && PrintGCDetails) { - gclog_or_tty->print("%d ", ref_lists[i].length()); + gclog_or_tty->print(SIZE_FORMAT " ", ref_lists[i].length()); } } if (TraceReferenceGC && PrintGCDetails) { - gclog_or_tty->print_cr(" = %d", total_refs); + gclog_or_tty->print_cr(" = " SIZE_FORMAT, total_refs); } size_t avg_refs = total_refs / _num_q + 1; uint to_idx = 0; @@ -877,11 +875,11 @@ void ReferenceProcessor::balance_queues(DiscoveredList ref_lists[]) for (uint i = 0; i < _max_num_q; ++i) { balanced_total_refs += ref_lists[i].length(); if (TraceReferenceGC && PrintGCDetails) { - gclog_or_tty->print("%d ", ref_lists[i].length()); + gclog_or_tty->print(SIZE_FORMAT " ", ref_lists[i].length()); } } if (TraceReferenceGC && PrintGCDetails) { - gclog_or_tty->print_cr(" = %d", balanced_total_refs); + gclog_or_tty->print_cr(" = " SIZE_FORMAT, balanced_total_refs); gclog_or_tty->flush(); } assert(total_refs == balanced_total_refs, "Balancing was incomplete"); @@ -923,7 +921,7 @@ ReferenceProcessor::process_discovered_reflist( size_t total_list_count = total_count(refs_lists); if (PrintReferenceGC && PrintGCDetails) { - gclog_or_tty->print(", %u refs", total_list_count); + gclog_or_tty->print(", " SIZE_FORMAT " refs", total_list_count); } // Phase 1 (soft refs only): @@ -1016,7 +1014,7 @@ inline DiscoveredList* ReferenceProcessor::get_discovered_list(ReferenceType rt) ShouldNotReachHere(); } if (TraceReferenceGC && PrintGCDetails) { - gclog_or_tty->print_cr("Thread %d gets list " INTPTR_FORMAT, id, list); + gclog_or_tty->print_cr("Thread %d gets list " INTPTR_FORMAT, id, p2i(list)); } return list; } @@ -1043,14 +1041,14 @@ ReferenceProcessor::add_to_discovered_list_mt(DiscoveredList& refs_list, if (TraceReferenceGC) { gclog_or_tty->print_cr("Discovered reference (mt) (" INTPTR_FORMAT ": %s)", - (void *)obj, obj->klass()->internal_name()); + p2i(obj), obj->klass()->internal_name()); } } else { // If retest was non NULL, another thread beat us to it: // The reference has already been discovered... if (TraceReferenceGC) { gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)", - (void *)obj, obj->klass()->internal_name()); + p2i(obj), obj->klass()->internal_name()); } } } @@ -1065,7 +1063,7 @@ void ReferenceProcessor::verify_referent(oop obj) { assert(da ? referent->is_oop() : referent->is_oop_or_null(), err_msg("Bad referent " INTPTR_FORMAT " found in Reference " INTPTR_FORMAT " during %satomic discovery ", - (void *)referent, (void *)obj, da ? "" : "non-")); + p2i(referent), p2i(obj), da ? "" : "non-")); } #endif @@ -1145,7 +1143,7 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) { // The reference has already been discovered... if (TraceReferenceGC) { gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)", - (void *)obj, obj->klass()->internal_name()); + p2i(obj), obj->klass()->internal_name()); } if (RefDiscoveryPolicy == ReferentBasedDiscovery) { // assumes that an object is not processed twice; @@ -1203,7 +1201,7 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) { if (TraceReferenceGC) { gclog_or_tty->print_cr("Discovered reference (" INTPTR_FORMAT ": %s)", - (void *)obj, obj->klass()->internal_name()); + p2i(obj), obj->klass()->internal_name()); } } assert(obj->is_oop(), "Discovered a bad reference"); @@ -1314,7 +1312,7 @@ ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list, // active; we need to trace and mark its cohort. if (TraceReferenceGC) { gclog_or_tty->print_cr("Precleaning Reference (" INTPTR_FORMAT ": %s)", - (void *)iter.obj(), iter.obj()->klass()->internal_name()); + p2i(iter.obj()), iter.obj()->klass()->internal_name()); } // Remove Reference object from list iter.remove(); @@ -1337,9 +1335,9 @@ ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list, NOT_PRODUCT( if (PrintGCDetails && PrintReferenceGC && (iter.processed() > 0)) { - gclog_or_tty->print_cr(" Dropped %d Refs out of %d " - "Refs in discovered list " INTPTR_FORMAT, - iter.removed(), iter.processed(), (address)refs_list.head()); + gclog_or_tty->print_cr(" Dropped " SIZE_FORMAT " Refs out of " SIZE_FORMAT + " Refs in discovered list " INTPTR_FORMAT, + iter.removed(), iter.processed(), p2i(refs_list.head())); } ) } diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index 1dde1e13c5e..5f07a7695ee 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -35,8 +35,6 @@ #include "utilities/copy.hpp" #include "utilities/workgroup.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - SharedHeap* SharedHeap::_sh; SharedHeap::SharedHeap(CollectorPolicy* policy_) : diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 6e9984f9860..d0fdd3c615e 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -44,8 +44,6 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top, HeapWord* top_obj) { if (top_obj != NULL) { @@ -456,20 +454,20 @@ void Space::print() const { print_on(tty); } void Space::print_on(outputStream* st) const { print_short_on(st); st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ")", - bottom(), end()); + p2i(bottom()), p2i(end())); } void ContiguousSpace::print_on(outputStream* st) const { print_short_on(st); st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", - bottom(), top(), end()); + p2i(bottom()), p2i(top()), p2i(end())); } void OffsetTableContigSpace::print_on(outputStream* st) const { print_short_on(st); st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", - bottom(), top(), _offsets.threshold(), end()); + p2i(bottom()), p2i(top()), p2i(_offsets.threshold()), p2i(end())); } void ContiguousSpace::verify() const { @@ -592,7 +590,7 @@ ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN) HeapWord* ContiguousSpace::block_start_const(const void* p) const { assert(MemRegion(bottom(), end()).contains(p), err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", - p, bottom(), end())); + p2i(p), p2i(bottom()), p2i(end()))); if (p >= top()) { return top(); } else { @@ -603,7 +601,7 @@ HeapWord* ContiguousSpace::block_start_const(const void* p) const { cur += oop(cur)->size(); } assert(oop(last)->is_oop(), - err_msg(PTR_FORMAT " should be an object start", last)); + err_msg(PTR_FORMAT " should be an object start", p2i(last))); return last; } } @@ -611,15 +609,15 @@ HeapWord* ContiguousSpace::block_start_const(const void* p) const { size_t ContiguousSpace::block_size(const HeapWord* p) const { assert(MemRegion(bottom(), end()).contains(p), err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", - p, bottom(), end())); + p2i(p), p2i(bottom()), p2i(end()))); HeapWord* current_top = top(); assert(p <= current_top, err_msg("p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT, - p, current_top)); + p2i(p), p2i(current_top))); assert(p == current_top || oop(p)->is_oop(), err_msg("p (" PTR_FORMAT ") is not a block start - " "current_top: " PTR_FORMAT ", is_oop: %s", - p, current_top, BOOL_TO_STR(oop(p)->is_oop()))); + p2i(p), p2i(current_top), BOOL_TO_STR(oop(p)->is_oop()))); if (p < current_top) { return oop(p)->size(); } else { diff --git a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp index 06033439c5a..177d638922b 100644 --- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp +++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp @@ -31,8 +31,6 @@ #include "runtime/thread.inline.hpp" #include "utilities/copy.hpp" -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // Thread-Local Edens support // static member initialization @@ -154,7 +152,7 @@ void ThreadLocalAllocBuffer::resize() { if (PrintTLAB && Verbose) { gclog_or_tty->print("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]" " refills %d alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT "\n", - myThread(), myThread()->osthread()->thread_id(), + p2i(myThread()), myThread()->osthread()->thread_id(), _target_refills, _allocation_fraction.average(), desired_size(), aligned_new_size); } set_desired_size(aligned_new_size); @@ -263,7 +261,7 @@ void ThreadLocalAllocBuffer::print_stats(const char* tag) { " slow allocs: %d refill waste: " SIZE_FORMAT "B" " alloc:%8.5f %8.0fKB refills: %d waste %4.1f%% gc: %dB" " slow: %dB fast: %dB\n", - tag, thrd, thrd->osthread()->thread_id(), + tag, p2i(thrd), thrd->osthread()->thread_id(), _desired_size / (K / HeapWordSize), _slow_allocations, _refill_waste_limit * HeapWordSize, _allocation_fraction.average(), diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index 6c55aed8969..75f4f96e23a 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -84,8 +84,6 @@ #include "classfile/sharedClassUtil.hpp" #endif -PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC - // Known objects Klass* Universe::_boolArrayKlassObj = NULL; Klass* Universe::_byteArrayKlassObj = NULL; @@ -792,12 +790,12 @@ jint Universe::initialize_heap() { void Universe::print_compressed_oops_mode() { tty->cr(); tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB", - Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M); + p2i(Universe::heap()->base()), Universe::heap()->reserved_region().byte_size()/M); tty->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode())); if (Universe::narrow_oop_base() != 0) { - tty->print(": " PTR_FORMAT, Universe::narrow_oop_base()); + tty->print(": " PTR_FORMAT, p2i(Universe::narrow_oop_base())); } if (Universe::narrow_oop_shift() != 0) { From 062cf882e0d69e5b6f0e4319a2bfb739e11ced13 Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Tue, 31 Mar 2015 07:54:56 +0200 Subject: [PATCH 026/101] 8076225: Move the thread claim parity from SharedHeap to Thread Reviewed-by: brutisso, jwilhelm, kbarrett --- .../gc_implementation/g1/concurrentMark.cpp | 2 +- .../src/share/vm/memory/genCollectedHeap.cpp | 2 +- hotspot/src/share/vm/memory/sharedHeap.cpp | 17 ++++--------- hotspot/src/share/vm/memory/sharedHeap.hpp | 13 ++++------ hotspot/src/share/vm/runtime/thread.cpp | 24 +++++++++++++++++-- hotspot/src/share/vm/runtime/thread.hpp | 7 ++++-- 6 files changed, 39 insertions(+), 26 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index 49116d28b37..60ae0b4cd91 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -2581,7 +2581,7 @@ class G1RemarkThreadsClosure : public ThreadClosure { public: G1RemarkThreadsClosure(G1CollectedHeap* g1h, CMTask* task) : _cm_obj(task), _cm_cl(g1h, g1h->concurrent_mark(), task), _code_cl(&_cm_cl, !CodeBlobToOopClosure::FixRelocations), - _thread_parity(SharedHeap::heap()->strong_roots_parity()) {} + _thread_parity(Threads::thread_claim_parity()) {} void do_thread(Thread* thread) { if (thread->is_Java_thread()) { diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 67d4fa56eb9..3ca321cf026 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -589,7 +589,7 @@ void GenCollectedHeap::process_roots(bool activate_scope, StrongRootsScope srs(this, activate_scope); // General roots. - assert(_strong_roots_parity != 0, "must have called prologue code"); + assert(Threads::thread_claim_parity() != 0, "must have called prologue code"); assert(code_roots != NULL, "code root closure should always be set"); // _n_termination for _process_strong_tasks should be set up stream // in a method not running in a GC worker. Otherwise the GC worker diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index 5f07a7695ee..3e93264d019 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -40,7 +40,6 @@ SharedHeap* SharedHeap::_sh; SharedHeap::SharedHeap(CollectorPolicy* policy_) : CollectedHeap(), _collector_policy(policy_), - _strong_roots_parity(0), _workers(NULL) { _sh = this; // ch is static, should be set only once. @@ -68,26 +67,20 @@ void SharedHeap::set_par_threads(uint t) { _n_par_threads = t; } -void SharedHeap::change_strong_roots_parity() { - // Also set the new collection parity. - assert(_strong_roots_parity >= 0 && _strong_roots_parity <= 2, - "Not in range."); - _strong_roots_parity++; - if (_strong_roots_parity == 3) _strong_roots_parity = 1; - assert(_strong_roots_parity >= 1 && _strong_roots_parity <= 2, - "Not in range."); -} - SharedHeap::StrongRootsScope::StrongRootsScope(SharedHeap* heap, bool activate) : MarkScope(activate), _sh(heap) { if (_active) { - _sh->change_strong_roots_parity(); + Threads::change_thread_claim_parity(); // Zero the claimed high water mark in the StringTable StringTable::clear_parallel_claimed_index(); } } +SharedHeap::StrongRootsScope::~StrongRootsScope() { + Threads::assert_all_threads_claimed(); +} + void SharedHeap::set_barrier_set(BarrierSet* bs) { _barrier_set = bs; // Cached barrier set for fast access in oops diff --git a/hotspot/src/share/vm/memory/sharedHeap.hpp b/hotspot/src/share/vm/memory/sharedHeap.hpp index dec846acef4..edb9e468ceb 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.hpp +++ b/hotspot/src/share/vm/memory/sharedHeap.hpp @@ -113,10 +113,6 @@ protected: // A gc policy, controls global gc resource issues CollectorPolicy *_collector_policy; - // See the discussion below, in the specification of the reader function - // for this variable. - int _strong_roots_parity; - // If we're doing parallel GC, use this gang of threads. FlexibleWorkGang* _workers; @@ -156,7 +152,10 @@ public: bool no_gc_in_progress() { return !is_gc_active(); } - // Some collectors will perform "process_strong_roots" in parallel. + // Note, the below comment needs to be updated to reflect the changes + // introduced by JDK-8076225. This should be done as part of JDK-8076289. + // + //Some collectors will perform "process_strong_roots" in parallel. // Such a call will involve claiming some fine-grained tasks, such as // scanning of threads. To make this process simpler, we provide the // "strong_roots_parity()" method. Collectors that start parallel tasks @@ -182,7 +181,6 @@ public: // task-claiming variables may be initialized, to indicate "never // claimed". public: - int strong_roots_parity() { return _strong_roots_parity; } // Call these in sequential code around process_roots. // strong_roots_prologue calls change_strong_roots_parity, if @@ -192,11 +190,10 @@ public: public: StrongRootsScope(SharedHeap* heap, bool activate = true); + ~StrongRootsScope(); }; - friend class StrongRootsScope; private: - void change_strong_roots_parity(); public: FlexibleWorkGang* workers() const { return _workers; } diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 7d6596d30ff..544903d918e 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -3183,6 +3183,7 @@ JavaThread* Threads::_thread_list = NULL; int Threads::_number_of_threads = 0; int Threads::_number_of_non_daemon_threads = 0; int Threads::_return_code = 0; +int Threads::_thread_claim_parity = 0; size_t JavaThread::_stack_size_at_create = 0; #ifdef ASSERT bool Threads::_vm_complete = false; @@ -3217,7 +3218,6 @@ void Threads::threads_do(ThreadClosure* tc) { // If CompilerThreads ever become non-JavaThreads, add them here } - void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) { TraceTime timer("Initialize java.lang classes", TraceStartupTime); @@ -4046,6 +4046,26 @@ void Threads::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { VMThread::vm_thread()->oops_do(f, cld_f, cf); } +void Threads::change_thread_claim_parity() { + // Set the new claim parity. + assert(_thread_claim_parity >= 0 && _thread_claim_parity <= 2, + "Not in range."); + _thread_claim_parity++; + if (_thread_claim_parity == 3) _thread_claim_parity = 1; + assert(_thread_claim_parity >= 1 && _thread_claim_parity <= 2, + "Not in range."); +} + +#ifndef PRODUCT +void Threads::assert_all_threads_claimed() { + ALL_JAVA_THREADS(p) { + const int thread_parity = p->oops_do_parity(); + assert((thread_parity == _thread_claim_parity), + err_msg("Thread " PTR_FORMAT " has incorrect parity %d != %d", p2i(p), thread_parity, _thread_claim_parity)); + } +} +#endif // PRODUCT + void Threads::possibly_parallel_oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { // Introduce a mechanism allowing parallel threads to claim threads as // root groups. Overhead should be small enough to use all the time, @@ -4060,7 +4080,7 @@ void Threads::possibly_parallel_oops_do(OopClosure* f, CLDClosure* cld_f, CodeBl assert(!is_par || (SharedHeap::heap()->n_par_threads() == SharedHeap::heap()->workers()->active_workers()), "Mismatch"); - int cp = SharedHeap::heap()->strong_roots_parity(); + int cp = Threads::thread_claim_parity(); ALL_JAVA_THREADS(p) { if (p->claim_oops_do(is_par, cp)) { p->oops_do(f, cld_f, cf); diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index 9c6a7c79796..2744281f00e 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -551,6 +551,7 @@ protected: Monitor* owned_locks() const { return _owned_locks; } bool owns_locks() const { return owned_locks() != NULL; } bool owns_locks_but_compiled_lock() const; + int oops_do_parity() const { return _oops_do_parity; } // Deadlock detection bool allow_allocation() { return _allow_allocation_count == 0; } @@ -1855,6 +1856,7 @@ class Threads: AllStatic { static int _number_of_threads; static int _number_of_non_daemon_threads; static int _return_code; + static int _thread_claim_parity; #ifdef ASSERT static bool _vm_complete; #endif @@ -1884,9 +1886,10 @@ class Threads: AllStatic { // Does not include JNI_VERSION_1_1 static jboolean is_supported_jni_version(jint version); - // Garbage collection - static void follow_other_roots(void f(oop*)); + static int thread_claim_parity() { return _thread_claim_parity; } + static void change_thread_claim_parity(); + static void assert_all_threads_claimed() PRODUCT_RETURN; // Apply "f->do_oop" to all root oops in all threads. // This version may only be called by sequential code. static void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); From ff23a172834cca4061a4bd9a5dc1dc742cabff02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Tue, 31 Mar 2015 08:27:30 +0200 Subject: [PATCH 027/101] 8076231: Remove unused is_in_partial_collection() Reviewed-by: brutisso, drwhite --- .../gc_implementation/g1/g1CollectedHeap.cpp | 19 ------------------- .../gc_implementation/g1/g1CollectedHeap.hpp | 4 ---- .../parallelScavenge/parallelScavengeHeap.cpp | 11 ----------- .../parallelScavenge/parallelScavengeHeap.hpp | 6 +----- .../share/vm/gc_interface/collectedHeap.hpp | 6 ------ .../src/share/vm/memory/genCollectedHeap.cpp | 2 +- .../src/share/vm/memory/genCollectedHeap.hpp | 2 +- 7 files changed, 3 insertions(+), 47 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index deb2e2af927..45fe0dd7cb9 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -402,25 +402,6 @@ HeapRegion* G1CollectedHeap::pop_dirty_cards_region() return hr; } -#ifdef ASSERT -// A region is added to the collection set as it is retired -// so an address p can point to a region which will be in the -// collection set but has not yet been retired. This method -// therefore is only accurate during a GC pause after all -// regions have been retired. It is used for debugging -// to check if an nmethod has references to objects that can -// be move during a partial collection. Though it can be -// inaccurate, it is sufficient for G1 because the conservative -// implementation of is_scavengable() for G1 will indicate that -// all nmethods must be scanned during a partial collection. -bool G1CollectedHeap::is_in_partial_collection(const void* p) { - if (p == NULL) { - return false; - } - return heap_region_containing(p)->in_collection_set(); -} -#endif - // Returns true if the reference points to an object that // can move in an incremental collection. bool G1CollectedHeap::is_scavengable(const void* p) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 11955f403af..d607455e216 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -1379,10 +1379,6 @@ public: inline bool is_in_young(const oop obj); -#ifdef ASSERT - virtual bool is_in_partial_collection(const void* p); -#endif - virtual bool is_scavengable(const void* addr); // We don't need barriers for initializing stores to objects diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp index 39ee16a48f6..a50328680bc 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp @@ -203,17 +203,6 @@ bool ParallelScavengeHeap::is_scavengable(const void* addr) { return is_in_young((oop)addr); } -#ifdef ASSERT -// Don't implement this by using is_in_young(). This method is used -// in some cases to check that is_in_young() is correct. -bool ParallelScavengeHeap::is_in_partial_collection(const void *p) { - assert(is_in_reserved(p) || p == NULL, - "Does not work if address is non-null and outside of the heap"); - // The order of the generations is old (low addr), young (high addr) - return p >= old_gen()->reserved().end(); -} -#endif - // There are two levels of allocation policy here. // // When an allocation request fails, the requesting thread must invoke a VM diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp index 722ed9eeafd..82b950af8e3 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -141,10 +141,6 @@ class ParallelScavengeHeap : public CollectedHeap { bool is_in_reserved(const void* p) const; -#ifdef ASSERT - virtual bool is_in_partial_collection(const void *p); -#endif - bool is_in_young(oop p); // reserved part bool is_in_old(oop p); // reserved part diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp index dba48ae4f92..5c6da39095c 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp @@ -291,12 +291,6 @@ class CollectedHeap : public CHeapObj { return p == NULL || is_in_closed_subset(p); } -#ifdef ASSERT - // Returns true if "p" is in the part of the - // heap being collected. - virtual bool is_in_partial_collection(const void *p) = 0; -#endif - // An object is scavengable if its location may move during a scavenge. // (A scavenge is a GC which is not a full GC.) virtual bool is_scavengable(const void *p) = 0; diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 3ca321cf026..f879b801203 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -572,7 +572,7 @@ void GenCollectedHeap::set_n_termination(uint t) { class AssertNonScavengableClosure: public OopClosure { public: virtual void do_oop(oop* p) { - assert(!Universe::heap()->is_in_partial_collection(*p), + assert(!GenCollectedHeap::heap()->is_in_partial_collection(*p), "Referent should not be scavengable."); } virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } }; diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index bcc20bcd2aa..77336a4c9bb 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -215,7 +215,7 @@ public: bool is_in_young(oop p); #ifdef ASSERT - virtual bool is_in_partial_collection(const void* p); + bool is_in_partial_collection(const void* p); #endif virtual bool is_scavengable(const void* addr) { From a5e42354fed69f1fd96a7f96ad11c16fb45bb8a7 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Tue, 31 Mar 2015 11:27:20 +0200 Subject: [PATCH 028/101] 8076237: Remove unused _collector_policy field in SharedHeap Reviewed-by: jwilhelm, drwhite, stefank --- .../src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 2 +- hotspot/src/share/vm/memory/genCollectedHeap.cpp | 2 +- hotspot/src/share/vm/memory/sharedHeap.cpp | 3 +-- hotspot/src/share/vm/memory/sharedHeap.hpp | 7 ++----- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 45fe0dd7cb9..6c17645fecc 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1728,7 +1728,7 @@ void G1CollectedHeap::shrink(size_t shrink_bytes) { G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) : - SharedHeap(policy_), + SharedHeap(), _g1_policy(policy_), _dirty_card_queue_set(false), _into_cset_dirty_card_queue_set(false), diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index f879b801203..8b8114cb498 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -78,7 +78,7 @@ enum GCH_strong_roots_tasks { }; GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) : - SharedHeap(policy), + SharedHeap(), _rem_set(NULL), _gen_policy(policy), _process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)), diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index 3e93264d019..34424a66c33 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -37,9 +37,8 @@ SharedHeap* SharedHeap::_sh; -SharedHeap::SharedHeap(CollectorPolicy* policy_) : +SharedHeap::SharedHeap() : CollectedHeap(), - _collector_policy(policy_), _workers(NULL) { _sh = this; // ch is static, should be set only once. diff --git a/hotspot/src/share/vm/memory/sharedHeap.hpp b/hotspot/src/share/vm/memory/sharedHeap.hpp index edb9e468ceb..e65ca85fcbf 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.hpp +++ b/hotspot/src/share/vm/memory/sharedHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -110,15 +110,12 @@ protected: // set the static pointer "_sh" to that instance. static SharedHeap* _sh; - // A gc policy, controls global gc resource issues - CollectorPolicy *_collector_policy; - // If we're doing parallel GC, use this gang of threads. FlexibleWorkGang* _workers; // Full initialization is done in a concrete subtype's "initialize" // function. - SharedHeap(CollectorPolicy* policy_); + SharedHeap(); // Returns true if the calling thread holds the heap lock, // or the calling thread is a par gc thread and the heap_lock is held From 68ad80c022cbb1bff4ebc6ad220f559cd31ff310 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Tue, 31 Mar 2015 11:29:21 +0200 Subject: [PATCH 029/101] 8076241: Remove unused methods mod_card_iterate() and non_clean_card_iterate_serial() Reviewed-by: kbarrett, pliden, stefank --- .../parNew/parCardTableModRefBS.cpp | 3 +- .../src/share/vm/memory/cardTableModRefBS.cpp | 48 +------------------ .../src/share/vm/memory/cardTableModRefBS.hpp | 31 +----------- 3 files changed, 5 insertions(+), 77 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp index 6f77be956c4..9ab76383957 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp @@ -151,8 +151,7 @@ process_stride(Space* sp, // result of the dirty card iteration below. OrderAccess::storestore(); - // We do not call the non_clean_card_iterate_serial() version because - // we want to clear the cards: clear_cl here does the work of finding + // We want to clear the cards: clear_cl here does the work of finding // contiguous dirty ranges of cards to process and clear. clear_cl.do_MemRegion(chunk_mr); diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp index d0024231c6d..ac8c7484f98 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp @@ -470,13 +470,9 @@ void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp, fatal("Parallel gc not supported here."); #endif // INCLUDE_ALL_GCS } else { - // We do not call the non_clean_card_iterate_serial() version below because - // we want to clear the cards (which non_clean_card_iterate_serial() does not - // do for us): clear_cl here does the work of finding contiguous dirty ranges - // of cards to process and clear. + // clear_cl finds contiguous dirty ranges of cards to process and clear. - DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), - cl->gen_boundary()); + DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), cl->gen_boundary()); ClearNoncleanCardWrapper clear_cl(dcto_cl, ct); clear_cl.do_MemRegion(mr); @@ -484,46 +480,6 @@ void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp, } } -// The iterator itself is not MT-aware, but -// MT-aware callers and closures can use this to -// accomplish dirty card iteration in parallel. The -// iterator itself does not clear the dirty cards, or -// change their values in any manner. -void CardTableModRefBS::non_clean_card_iterate_serial(MemRegion mr, - MemRegionClosure* cl) { - bool is_par = (SharedHeap::heap()->n_par_threads() > 0); - assert(!is_par || - (SharedHeap::heap()->n_par_threads() == - SharedHeap::heap()->workers()->active_workers()), "Mismatch"); - for (int i = 0; i < _cur_covered_regions; i++) { - MemRegion mri = mr.intersection(_covered[i]); - if (mri.word_size() > 0) { - jbyte* cur_entry = byte_for(mri.last()); - jbyte* limit = byte_for(mri.start()); - while (cur_entry >= limit) { - jbyte* next_entry = cur_entry - 1; - if (*cur_entry != clean_card) { - size_t non_clean_cards = 1; - // Should the next card be included in this range of dirty cards. - while (next_entry >= limit && *next_entry != clean_card) { - non_clean_cards++; - cur_entry = next_entry; - next_entry--; - } - // The memory region may not be on a card boundary. So that - // objects beyond the end of the region are not processed, make - // cur_cards precise with regard to the end of the memory region. - MemRegion cur_cards(addr_for(cur_entry), - non_clean_cards * card_size_in_words); - MemRegion dirty_region = cur_cards.intersection(mri); - cl->do_MemRegion(dirty_region); - } - cur_entry = next_entry; - } - } - } -} - void CardTableModRefBS::dirty_MemRegion(MemRegion mr) { assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start(), "Unaligned start"); assert((HeapWord*)align_size_up ((uintptr_t)mr.end(), HeapWordSize) == mr.end(), "Unaligned end" ); diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp index f7cf9e68499..97ce901ab80 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp @@ -37,7 +37,7 @@ // the head of "o" is dirtied, not necessarily the card containing the // modified field itself. For object arrays, however, the barrier *is* // precise; only the card containing the modified element is dirtied. -// Any MemRegionClosures used to scan dirty cards should take these +// Closures used to scan dirty cards should take these // considerations into account. class Generation; @@ -176,16 +176,7 @@ class CardTableModRefBS: public ModRefBarrierSet { // Iterate over the portion of the card-table which covers the given // region mr in the given space and apply cl to any dirty sub-regions - // of mr. Dirty cards are _not_ cleared by the iterator method itself, - // but closures may arrange to do so on their own should they so wish. - void non_clean_card_iterate_serial(MemRegion mr, MemRegionClosure* cl); - - // A variant of the above that will operate in a parallel mode if - // worker threads are available, and clear the dirty cards as it - // processes them. - // XXX ??? MemRegionClosure above vs OopsInGenClosure below XXX - // XXX some new_dcto_cl's take OopClosure's, plus as above there are - // some MemRegionClosures. Clean this up everywhere. XXX + // of mr. Clears the dirty cards as they are processed. void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr, OopsInGenClosure* cl, CardTableRS* ct); @@ -379,24 +370,6 @@ public: // *** Card-table-RemSet-specific things. - // Invoke "cl.do_MemRegion" on a set of MemRegions that collectively - // includes all the modified cards (expressing each card as a - // MemRegion). Thus, several modified cards may be lumped into one - // region. The regions are non-overlapping, and are visited in - // *decreasing* address order. (This order aids with imprecise card - // marking, where a dirty card may cause scanning, and summarization - // marking, of objects that extend onto subsequent cards.) - void mod_card_iterate(MemRegionClosure* cl) { - non_clean_card_iterate_serial(_whole_heap, cl); - } - - // Like the "mod_cards_iterate" above, except only invokes the closure - // for cards within the MemRegion "mr" (which is required to be - // card-aligned and sized.) - void mod_card_iterate(MemRegion mr, MemRegionClosure* cl) { - non_clean_card_iterate_serial(mr, cl); - } - static uintx ct_max_alignment_constraint(); // Apply closure "cl" to the dirty cards containing some part of From 5449ba9220caf96336c09764f394c9394a4851b4 Mon Sep 17 00:00:00 2001 From: David Lindholm Date: Tue, 31 Mar 2015 11:34:35 +0200 Subject: [PATCH 030/101] 8076173: VirtualSpaceNode container_count() and container_count_slow() have different return types Reviewed-by: pliden, stefank --- hotspot/src/share/vm/memory/metaspace.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp index d60679d43fb..280667d16f4 100644 --- a/hotspot/src/share/vm/memory/metaspace.cpp +++ b/hotspot/src/share/vm/memory/metaspace.cpp @@ -344,7 +344,7 @@ class VirtualSpaceNode : public CHeapObj { void inc_container_count(); void dec_container_count(); #ifdef ASSERT - uint container_count_slow(); + uintx container_count_slow(); void verify_container_count(); #endif @@ -461,8 +461,8 @@ void VirtualSpaceNode::purge(ChunkManager* chunk_manager) { } #ifdef ASSERT -uint VirtualSpaceNode::container_count_slow() { - uint count = 0; +uintx VirtualSpaceNode::container_count_slow() { + uintx count = 0; Metachunk* chunk = first_chunk(); Metachunk* invalid_chunk = (Metachunk*) top(); while (chunk < invalid_chunk ) { @@ -796,10 +796,7 @@ Mutex* const SpaceManager::_expand_lock = void VirtualSpaceNode::inc_container_count() { assert_lock_strong(SpaceManager::expand_lock()); _container_count++; - assert(_container_count == container_count_slow(), - err_msg("Inconsistency in container_count _container_count " SIZE_FORMAT - " container_count_slow() %u", - _container_count, container_count_slow())); + DEBUG_ONLY(verify_container_count();) } void VirtualSpaceNode::dec_container_count() { @@ -810,8 +807,8 @@ void VirtualSpaceNode::dec_container_count() { #ifdef ASSERT void VirtualSpaceNode::verify_container_count() { assert(_container_count == container_count_slow(), - err_msg("Inconsistency in container_count _container_count " SIZE_FORMAT - " container_count_slow() %u", _container_count, container_count_slow())); + err_msg("Inconsistency in container_count _container_count " UINTX_FORMAT + " container_count_slow() " UINTX_FORMAT, _container_count, container_count_slow())); } #endif From be607cf8cfdd826321b1518933a6f4db100db536 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Mon, 30 Mar 2015 10:24:00 -0400 Subject: [PATCH 031/101] 8075401: Remove DiscoveredListIterator::update_discovered() Remove unnecessary function Reviewed-by: brutisso, jwilhelm, ecaspole --- .../src/share/vm/memory/referenceProcessor.cpp | 3 --- .../src/share/vm/memory/referenceProcessor.hpp | 16 +--------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/hotspot/src/share/vm/memory/referenceProcessor.cpp b/hotspot/src/share/vm/memory/referenceProcessor.cpp index ad668d667ec..8943a5e675f 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.cpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp @@ -676,7 +676,6 @@ ReferenceProcessor::process_phase3(DiscoveredList& refs_list, ResourceMark rm; DiscoveredListIterator iter(refs_list, keep_alive, is_alive); while (iter.has_next()) { - iter.update_discovered(); iter.load_ptrs(DEBUG_ONLY(false /* allow_null_referent */)); if (clear_referent) { // NULL out referent pointer @@ -693,8 +692,6 @@ ReferenceProcessor::process_phase3(DiscoveredList& refs_list, assert(iter.obj()->is_oop(UseConcMarkSweepGC), "Adding a bad reference"); iter.next(); } - // Remember to update the next pointer of the last ref. - iter.update_discovered(); // Close the reachable set complete_gc->do_void(); } diff --git a/hotspot/src/share/vm/memory/referenceProcessor.hpp b/hotspot/src/share/vm/memory/referenceProcessor.hpp index 0600b270aa1..6dd50e5a936 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.hpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -173,20 +173,6 @@ public: } } - // Update the discovered field. - inline void update_discovered() { - // First _prev_next ref actually points into DiscoveredList (gross). - if (UseCompressedOops) { - if (!oopDesc::is_null(*(narrowOop*)_prev_next)) { - _keep_alive->do_oop((narrowOop*)_prev_next); - } - } else { - if (!oopDesc::is_null(*(oop*)_prev_next)) { - _keep_alive->do_oop((oop*)_prev_next); - } - } - } - // NULL out referent pointer. void clear_referent(); From cee2c148bcaf25847c6cafe286223ffb7a81a871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Wed, 1 Apr 2015 10:49:08 +0200 Subject: [PATCH 032/101] 8076294: Cleanup of CollectedHeap::kind() Reviewed-by: stefank, ecaspole --- hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp | 2 +- .../parallelScavenge/parallelScavengeHeap.hpp | 2 +- hotspot/src/share/vm/gc_interface/collectedHeap.hpp | 4 +--- hotspot/src/share/vm/memory/genCollectedHeap.hpp | 2 +- hotspot/src/share/vm/runtime/vmStructs.cpp | 4 ++-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index d607455e216..1a3be8c2a9a 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -1008,7 +1008,7 @@ public: // Set _n_par_threads according to a policy TBD. void set_par_threads(); - virtual CollectedHeap::Name kind() const { + virtual Name kind() const { return CollectedHeap::G1CollectedHeap; } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp index 82b950af8e3..867bdbf55ee 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp @@ -83,7 +83,7 @@ class ParallelScavengeHeap : public CollectedHeap { MarkSweep }; - ParallelScavengeHeap::Name kind() const { + virtual Name kind() const { return CollectedHeap::ParallelScavengeHeap; } diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp index 5c6da39095c..5dec0eca8ab 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp @@ -185,8 +185,6 @@ class CollectedHeap : public CHeapObj { public: enum Name { - Abstract, - SharedHeap, GenCollectedHeap, ParallelScavengeHeap, G1CollectedHeap @@ -196,7 +194,7 @@ class CollectedHeap : public CHeapObj { return _filler_array_max_size; } - virtual CollectedHeap::Name kind() const { return CollectedHeap::Abstract; } + virtual Name kind() const = 0; /** * Returns JNI error code JNI_ENOMEM if memory could not be allocated, diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index 77336a4c9bb..a91432748a0 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -139,7 +139,7 @@ public: // Initialize ("weak") refs processing support virtual void ref_processing_init(); - virtual CollectedHeap::Name kind() const { + virtual Name kind() const { return CollectedHeap::GenCollectedHeap; } diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 8524679cbc3..f7561b6f72f 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -2253,9 +2253,9 @@ typedef CompactHashtable SymbolCompactHashTable; \ declare_constant(CardTableRS::youngergen_card) \ \ - declare_constant(CollectedHeap::Abstract) \ - declare_constant(CollectedHeap::SharedHeap) \ declare_constant(CollectedHeap::GenCollectedHeap) \ + declare_constant(CollectedHeap::ParallelScavengeHeap) \ + declare_constant(CollectedHeap::G1CollectedHeap) \ \ declare_constant(GenCollectedHeap::max_gens) \ \ From 473bf6175fe478118dcb150f848e000690cb6d7f Mon Sep 17 00:00:00 2001 From: Jon Masamitsu Date: Tue, 17 Mar 2015 11:19:05 -0700 Subject: [PATCH 033/101] 8017462: G1: guarantee fails with UseDynamicNumberOfGCThreads Reviewed-by: tschatzl, brutisso --- .../gc_implementation/g1/g1CollectedHeap.cpp | 16 +++-- .../gc_implementation/g1/g1GCPhaseTimes.cpp | 56 ++++++++------- .../TestDynamicNumberOfGCThreads.java | 69 +++++++++++++++++++ 3 files changed, 108 insertions(+), 33 deletions(-) create mode 100644 hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 6c17645fecc..8733e4714a9 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3712,7 +3712,14 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); - uint active_workers = workers()->active_workers(); + uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(), + workers()->active_workers(), + Threads::number_of_non_daemon_threads()); + assert(UseDynamicNumberOfGCThreads || + active_workers == workers()->total_workers(), + "If not dynamic should be using all the workers"); + workers()->set_active_workers(active_workers); + double pause_start_sec = os::elapsedTime(); g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress()); log_gc_header(); @@ -5410,15 +5417,10 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) { hot_card_cache->reset_hot_cache_claimed_index(); hot_card_cache->set_use_cache(false); - uint n_workers; - n_workers = - AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(), - workers()->active_workers(), - Threads::number_of_non_daemon_threads()); + const uint n_workers = workers()->active_workers(); assert(UseDynamicNumberOfGCThreads || n_workers == workers()->total_workers(), "If not dynamic should be using all the workers"); - workers()->set_active_workers(n_workers); set_par_threads(n_workers); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp index 24379ffd5b8..3b7a12b320b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp @@ -154,28 +154,28 @@ class WorkerDataArray : public CHeapObj { _has_new_data = true; } - double average(){ - calculate_totals(); + double average(uint active_threads){ + calculate_totals(active_threads); return _average; } - T sum() { - calculate_totals(); + T sum(uint active_threads) { + calculate_totals(active_threads); return _sum; } - T minimum() { - calculate_totals(); + T minimum(uint active_threads) { + calculate_totals(active_threads); return _min; } - T maximum() { - calculate_totals(); + T maximum(uint active_threads) { + calculate_totals(active_threads); return _max; } void reset() PRODUCT_RETURN; - void verify() PRODUCT_RETURN; + void verify(uint active_threads) PRODUCT_RETURN; void set_enabled(bool enabled) { _enabled = enabled; } @@ -183,7 +183,7 @@ class WorkerDataArray : public CHeapObj { private: - void calculate_totals(){ + void calculate_totals(uint active_threads){ if (!_has_new_data) { return; } @@ -191,13 +191,14 @@ class WorkerDataArray : public CHeapObj { _sum = (T)0; _min = _data[0]; _max = _min; - for (uint i = 0; i < _length; ++i) { + assert(active_threads <= _length, "Wrong number of active threads"); + for (uint i = 0; i < active_threads; ++i) { T val = _data[i]; _sum += val; _min = MIN2(_min, val); _max = MAX2(_max, val); } - _average = (double)_sum / (double)_length; + _average = (double)_sum / (double)active_threads; _has_new_data = false; } }; @@ -226,17 +227,18 @@ void WorkerDataArray::reset() { } template -void WorkerDataArray::verify() { +void WorkerDataArray::verify(uint active_threads) { if (!_enabled) { return; } - for (uint i = 0; i < _length; i++) { + assert(active_threads <= _length, "Wrong number of active threads"); + for (uint i = 0; i < active_threads; i++) { assert(_data[i] != WorkerDataArray::uninitialized(), err_msg("Invalid data for worker %u in '%s'", i, _title)); } if (_thread_work_items != NULL) { - _thread_work_items->verify(); + _thread_work_items->verify(active_threads); } } @@ -321,7 +323,7 @@ void G1GCPhaseTimes::note_gc_end() { } for (int i = 0; i < GCParPhasesSentinel; i++) { - _gc_par_phases[i]->verify(); + _gc_par_phases[i]->verify(_active_gc_threads); } } @@ -378,7 +380,7 @@ void G1GCPhaseTimes::record_thread_work_item(GCParPhases phase, uint worker_i, s // return the average time for a phase in milliseconds double G1GCPhaseTimes::average_time_ms(GCParPhases phase) { - return _gc_par_phases[phase]->average() * 1000.0; + return _gc_par_phases[phase]->average(_active_gc_threads) * 1000.0; } double G1GCPhaseTimes::get_time_ms(GCParPhases phase, uint worker_i) { @@ -386,15 +388,15 @@ double G1GCPhaseTimes::get_time_ms(GCParPhases phase, uint worker_i) { } double G1GCPhaseTimes::sum_time_ms(GCParPhases phase) { - return _gc_par_phases[phase]->sum() * 1000.0; + return _gc_par_phases[phase]->sum(_active_gc_threads) * 1000.0; } double G1GCPhaseTimes::min_time_ms(GCParPhases phase) { - return _gc_par_phases[phase]->minimum() * 1000.0; + return _gc_par_phases[phase]->minimum(_active_gc_threads) * 1000.0; } double G1GCPhaseTimes::max_time_ms(GCParPhases phase) { - return _gc_par_phases[phase]->maximum() * 1000.0; + return _gc_par_phases[phase]->maximum(_active_gc_threads) * 1000.0; } size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_i) { @@ -404,22 +406,22 @@ size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_i) { size_t G1GCPhaseTimes::sum_thread_work_items(GCParPhases phase) { assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); - return _gc_par_phases[phase]->thread_work_items()->sum(); + return _gc_par_phases[phase]->thread_work_items()->sum(_active_gc_threads); } double G1GCPhaseTimes::average_thread_work_items(GCParPhases phase) { assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); - return _gc_par_phases[phase]->thread_work_items()->average(); + return _gc_par_phases[phase]->thread_work_items()->average(_active_gc_threads); } size_t G1GCPhaseTimes::min_thread_work_items(GCParPhases phase) { assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); - return _gc_par_phases[phase]->thread_work_items()->minimum(); + return _gc_par_phases[phase]->thread_work_items()->minimum(_active_gc_threads); } size_t G1GCPhaseTimes::max_thread_work_items(GCParPhases phase) { assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); - return _gc_par_phases[phase]->thread_work_items()->maximum(); + return _gc_par_phases[phase]->thread_work_items()->maximum(_active_gc_threads); } class G1GCParPhasePrinter : public StackObj { @@ -455,14 +457,16 @@ class G1GCParPhasePrinter : public StackObj { } void print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray* phase) { - for (uint i = 0; i < phase->_length; ++i) { + uint active_length = _phase_times->_active_gc_threads; + for (uint i = 0; i < active_length; ++i) { buf.append(" %.1lf", _phase_times->get_time_ms(phase_id, i)); } buf.print_cr(); } void print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray* thread_work_items) { - for (uint i = 0; i < thread_work_items->_length; ++i) { + uint active_length = _phase_times->_active_gc_threads; + for (uint i = 0; i < active_length; ++i) { buf.append(" " SIZE_FORMAT, _phase_times->get_thread_work_item(phase_id, i)); } buf.print_cr(); diff --git a/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java b/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java new file mode 100644 index 00000000000..f6455761ada --- /dev/null +++ b/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test TestDynamicNumberOfGCThreads + * @bug 8017462 + * @summary Ensure that UseDynamicNumberOfGCThreads runs + * @requires vm.gc=="null" + * @key gc + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.ProcessTools; +import com.oracle.java.testlibrary.OutputAnalyzer; + +public class TestDynamicNumberOfGCThreads { + public static void main(String[] args) throws Exception { + + testDynamicNumberOfGCThreads("UseConcMarkSweepGC"); + + testDynamicNumberOfGCThreads("UseG1GC"); + + testDynamicNumberOfGCThreads("UseParallelGC"); + } + + private static void verifyDynamicNumberOfGCThreads(OutputAnalyzer output) { + output.shouldContain("new_active_workers"); + output.shouldHaveExitValue(0); + } + + private static void testDynamicNumberOfGCThreads(String gcFlag) throws Exception { + // UseDynamicNumberOfGCThreads and TraceDynamicGCThreads enabled + ProcessBuilder pb_enabled = + ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-Xmx10M", "-XX:+PrintGCDetails", "-XX:+UseDynamicNumberOfGCThreads", "-XX:+TraceDynamicGCThreads", GCTest.class.getName()); + verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start())); + } + + static class GCTest { + private static byte[] garbage; + public static void main(String [] args) { + System.out.println("Creating garbage"); + // create 128MB of garbage. This should result in at least one GC + for (int i = 0; i < 1024; i++) { + garbage = new byte[128 * 1024]; + } + System.out.println("Done"); + } + } +} From d57d843873a598faaf7bce60882957b8f7ea9a10 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 17 Mar 2015 12:14:58 -0700 Subject: [PATCH 034/101] 8075277: JDK is still building X11 related Java files on OSX Reviewed-by: ihse, erikj, serb --- make/CompileJavaModules.gmk | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk index 8c7141b294b..a1fa1305e0e 100644 --- a/make/CompileJavaModules.gmk +++ b/make/CompileJavaModules.gmk @@ -144,9 +144,19 @@ java.desktop_EXCLUDE_FILES += \ ifeq ($(OPENJDK_TARGET_OS), macosx) # exclude all X11 on Mac. - java.desktop_EXCLUDES += sun/awt/X11 + java.desktop_EXCLUDES += \ + sun/awt/X11 \ + sun/java2d/x11 \ + sun/java2d/jules \ + sun/java2d/xr \ + com/sun/java/swing/plaf/gtk \ + # java.desktop_EXCLUDE_FILES += \ - $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/BackBufferCapsProvider.java \ + $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/*.java) \ + $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/opengl/*.java) \ + $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/awt/*.java) \ + $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/awt/motif/*.java) \ + $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/font/*.java) \ # else # TBD: figure out how to eliminate this long list From 31a45d5c8602946e6f5b643c10115dc4ea022aca Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Thu, 26 Mar 2015 11:34:50 +0100 Subject: [PATCH 035/101] 8054220: Debugger doesn't show variables *outside* lambda 8058227: Debugger has no access to outer variables inside Lambda Put local variables captured by lambda into the lambda method's LocalVariableTable. Reviewed-by: mcimadamore, rfield --- .../sun/tools/javac/comp/LambdaToMethod.java | 35 +++++-------------- .../classes/com/sun/tools/javac/jvm/Code.java | 6 +++- .../javac/MethodParameters/LambdaTest.out | 2 +- .../javac/lambda/LocalVariableTable.java | 8 ++--- 4 files changed, 18 insertions(+), 33 deletions(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java index 933950c02b8..1b0b7d18ca7 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java @@ -1885,7 +1885,7 @@ public class LambdaToMethod extends TreeTranslator { * Translate a symbol of a given kind into something suitable for the * synthetic lambda body */ - Symbol translate(Name name, final Symbol sym, LambdaSymbolKind skind) { + Symbol translate(final Symbol sym, LambdaSymbolKind skind) { Symbol ret; switch (skind) { case CAPTURED_THIS: @@ -1893,7 +1893,7 @@ public class LambdaToMethod extends TreeTranslator { break; case TYPE_VAR: // Just erase the type var - ret = new VarSymbol(sym.flags(), name, + ret = new VarSymbol(sym.flags(), sym.name, types.erasure(sym.type), sym.owner); /* this information should also be kept for LVT generation at Gen @@ -1902,7 +1902,7 @@ public class LambdaToMethod extends TreeTranslator { ((VarSymbol)ret).pos = ((VarSymbol)sym).pos; break; case CAPTURED_VAR: - ret = new VarSymbol(SYNTHETIC | FINAL | PARAMETER, name, types.erasure(sym.type), translatedSym) { + ret = new VarSymbol(SYNTHETIC | FINAL | PARAMETER, sym.name, types.erasure(sym.type), translatedSym) { @Override public Symbol baseSymbol() { //keep mapping with original captured symbol @@ -1911,16 +1911,16 @@ public class LambdaToMethod extends TreeTranslator { }; break; case LOCAL_VAR: - ret = new VarSymbol(sym.flags() & FINAL, name, sym.type, translatedSym); + ret = new VarSymbol(sym.flags() & FINAL, sym.name, sym.type, translatedSym); ((VarSymbol) ret).pos = ((VarSymbol) sym).pos; break; case PARAM: - ret = new VarSymbol((sym.flags() & FINAL) | PARAMETER, name, types.erasure(sym.type), translatedSym); + ret = new VarSymbol((sym.flags() & FINAL) | PARAMETER, sym.name, types.erasure(sym.type), translatedSym); ((VarSymbol) ret).pos = ((VarSymbol) sym).pos; break; default: - ret = makeSyntheticVar(FINAL, name, types.erasure(sym.type), translatedSym); - ((VarSymbol) ret).pos = ((VarSymbol) sym).pos; + Assert.error(skind.name()); + throw new AssertionError(); } if (ret != sym) { ret.setDeclarationAttributes(sym.getRawAttributes()); @@ -1931,27 +1931,8 @@ public class LambdaToMethod extends TreeTranslator { void addSymbol(Symbol sym, LambdaSymbolKind skind) { Map transMap = getSymbolMap(skind); - Name preferredName; - switch (skind) { - case CAPTURED_THIS: - preferredName = names.fromString("encl$" + transMap.size()); - break; - case CAPTURED_VAR: - preferredName = names.fromString("cap$" + transMap.size()); - break; - case LOCAL_VAR: - preferredName = sym.name; - break; - case PARAM: - preferredName = sym.name; - break; - case TYPE_VAR: - preferredName = sym.name; - break; - default: throw new AssertionError(); - } if (!transMap.containsKey(sym)) { - transMap.put(sym, translate(preferredName, sym, skind)); + transMap.put(sym, translate(sym, skind)); } } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java index 329deb81353..09459431696 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java @@ -2166,7 +2166,11 @@ public class Code { boolean keepLocalVariables = varDebugInfo || (var.sym.isExceptionParameter() && var.sym.hasTypeAnnotations()); if (!keepLocalVariables) return; - if ((var.sym.flags() & Flags.SYNTHETIC) != 0) return; + //don't keep synthetic vars, unless they are lambda method parameters + boolean ignoredSyntheticVar = (var.sym.flags() & Flags.SYNTHETIC) != 0 && + ((var.sym.owner.flags() & Flags.LAMBDA_METHOD) == 0 || + (var.sym.flags() & Flags.PARAMETER) == 0); + if (ignoredSyntheticVar) return; if (varBuffer == null) varBuffer = new LocalVar[20]; else diff --git a/langtools/test/tools/javac/MethodParameters/LambdaTest.out b/langtools/test/tools/javac/MethodParameters/LambdaTest.out index 2349dd0e0c5..d8367934afd 100644 --- a/langtools/test/tools/javac/MethodParameters/LambdaTest.out +++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.out @@ -2,6 +2,6 @@ class LambdaTest -- LambdaTest.() LambdaTest.foo(i) LambdaTest.lambda$static$1(x1/*synthetic*/)/*synthetic*/ -LambdaTest.lambda$null$0(final cap$0/*synthetic*/, x2/*synthetic*/)/*synthetic*/ +LambdaTest.lambda$null$0(final x1/*synthetic*/, x2/*synthetic*/)/*synthetic*/ static interface LambdaTest$I -- inner LambdaTest$I.m(x) diff --git a/langtools/test/tools/javac/lambda/LocalVariableTable.java b/langtools/test/tools/javac/lambda/LocalVariableTable.java index 8a4d04a061b..b70bc73556a 100644 --- a/langtools/test/tools/javac/lambda/LocalVariableTable.java +++ b/langtools/test/tools/javac/lambda/LocalVariableTable.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8025998 8026749 + * @bug 8025998 8026749 8054220 8058227 * @summary Missing LV table in lambda bodies * @compile -g LocalVariableTable.java * @run main LocalVariableTable @@ -183,7 +183,7 @@ public class LocalVariableTable { Run1 r = (a) -> { int x = a; }; } - @Expect({ "a", "x" }) + @Expect({ "a", "x", "v" }) static class Lambda_Args1_Local1_Captured1 { void m() { int v = 0; @@ -191,7 +191,7 @@ public class LocalVariableTable { } } - @Expect({ "a1", "a2", "x1", "x2", "this" }) + @Expect({ "a1", "a2", "x1", "x2", "this", "v1", "v2" }) static class Lambda_Args2_Local2_Captured2_this { int v; void m() { @@ -204,7 +204,7 @@ public class LocalVariableTable { } } - @Expect({ "e" }) + @Expect({ "e", "c" }) static class Lambda_Try_Catch { private static Runnable asUncheckedRunnable(Closeable c) { return () -> { From ffae4d69552329e6b617bad34545e11963420174 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 26 Mar 2015 16:17:36 +0100 Subject: [PATCH 036/101] 8076060: Improve make bootstrap process Reviewed-by: erikj --- langtools/make/Makefile | 49 ----------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 langtools/make/Makefile diff --git a/langtools/make/Makefile b/langtools/make/Makefile deleted file mode 100644 index ce3a3333405..00000000000 --- a/langtools/make/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# Locate this Makefile -ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), ) - makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST)) -else - makefile_path := $(lastword $(MAKEFILE_LIST)) -endif -repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path)) - -# What is the name of this subsystem (langtools, corba, etc)? -subsystem_name := $(notdir $(repo_dir)) - -# Try to locate top-level makefile -top_level_makefile := $(repo_dir)/../Makefile -ifneq ($(wildcard $(top_level_makefile)), ) - $(info Will run $(subsystem_name) target on top-level Makefile) - $(info WARNING: This is a non-recommended way of building!) - $(info ===================================================) -else - $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?) - $(error Build from top-level Makefile instead) -endif - -all: - @$(MAKE) -f $(top_level_makefile) $(subsystem_name) From 38527cecd5014425e823f86a80350211992d6fb7 Mon Sep 17 00:00:00 2001 From: Vicente Romero Date: Fri, 27 Mar 2015 10:11:21 -0700 Subject: [PATCH 037/101] 8075184: javac is mistakenly considering an missing enclosing instance error as an overload error Reviewed-by: mcimadamore --- .../com/sun/tools/javac/code/Kinds.java | 30 +++++++++------- .../com/sun/tools/javac/comp/Attr.java | 7 ++-- .../sun/tools/javac/comp/DeferredAttr.java | 4 +-- .../com/sun/tools/javac/comp/Resolve.java | 36 +++++++++---------- .../examples/CantAccessInnerClsConstr.java | 5 ++- .../tools/javac/lambda/MethodReference23.java | 2 +- .../tools/javac/lambda/MethodReference23.out | 8 ++--- 7 files changed, 49 insertions(+), 43 deletions(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java index c29549a221b..263d0c50bd9 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,22 +66,22 @@ public class Kinds { MTH(Category.BASIC, KindName.METHOD, KindSelector.MTH), POLY(Category.BASIC, KindSelector.POLY), ERR(Category.ERROR, KindSelector.ERR), - AMBIGUOUS(Category.OVERLOAD), - HIDDEN(Category.OVERLOAD), - STATICERR(Category.OVERLOAD), - MISSING_ENCL(Category.OVERLOAD), - ABSENT_VAR(Category.OVERLOAD, KindName.VAR), - WRONG_MTHS(Category.OVERLOAD, KindName.METHOD), - WRONG_MTH(Category.OVERLOAD, KindName.METHOD), - ABSENT_MTH(Category.OVERLOAD, KindName.METHOD), - ABSENT_TYP(Category.OVERLOAD, KindName.CLASS); + AMBIGUOUS(Category.RESOLUTION_TARGET), // overloaded target + HIDDEN(Category.RESOLUTION_TARGET), // not overloaded non-target + STATICERR(Category.RESOLUTION_TARGET), // overloaded? target + MISSING_ENCL(Category.RESOLUTION), // not overloaded non-target + ABSENT_VAR(Category.RESOLUTION_TARGET, KindName.VAR), // not overloaded non-target + WRONG_MTHS(Category.RESOLUTION_TARGET, KindName.METHOD), // overloaded target + WRONG_MTH(Category.RESOLUTION_TARGET, KindName.METHOD), // not overloaded target + ABSENT_MTH(Category.RESOLUTION_TARGET, KindName.METHOD), // not overloaded non-target + ABSENT_TYP(Category.RESOLUTION_TARGET, KindName.CLASS); // not overloaded non-target // There are essentially two "levels" to the Kind datatype. // The first is a totally-ordered set of categories of // solutions. Within each category, we have more // possibilities. private enum Category { - BASIC, ERROR, OVERLOAD; + BASIC, ERROR, RESOLUTION, RESOLUTION_TARGET; } private final KindName kindName; @@ -127,8 +127,12 @@ public class Kinds { return selector.contains(kindSelectors); } - public boolean isOverloadError() { - return category == Category.OVERLOAD; + public boolean isResolutionError() { + return category == Category.RESOLUTION || category == Category.RESOLUTION_TARGET; + } + + public boolean isResolutionTargetError() { + return category == Category.RESOLUTION_TARGET; } public boolean isValid() { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index c3b467de0e5..4c9b083ef06 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -2109,7 +2109,7 @@ public class Attr extends JCTree.Visitor { clazztype = cdef.sym.type; Symbol sym = tree.constructor = rs.resolveConstructor( tree.pos(), localEnv, clazztype, argtypes, typeargtypes); - Assert.check(!sym.kind.isOverloadError()); + Assert.check(!sym.kind.isResolutionError()); tree.constructor = sym; tree.constructorType = checkId(noCheckTree, clazztype, @@ -2647,17 +2647,20 @@ public class Attr extends JCTree.Visitor { Symbol refSym = refResult.fst; Resolve.ReferenceLookupHelper lookupHelper = refResult.snd; + /** this switch will need to go away and be replaced by the new RESOLUTION_TARGET testing + * JDK-8075541 + */ if (refSym.kind != MTH) { boolean targetError; switch (refSym.kind) { case ABSENT_MTH: + case MISSING_ENCL: targetError = false; break; case WRONG_MTH: case WRONG_MTHS: case AMBIGUOUS: case HIDDEN: - case MISSING_ENCL: case STATICERR: targetError = true; break; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java index 8a7156155fd..5432166b48f 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java @@ -1209,8 +1209,8 @@ public class DeferredAttr extends JCTree.Visitor { rs.getMemberReference(tree, localEnv, mref2, exprTree.type, tree.name); tree.sym = res; - if (res.kind.isOverloadError() || - res.type.hasTag(FORALL) || + if (res.kind.isResolutionTargetError() || + res.type != null && res.type.hasTag(FORALL) || (res.flags() & Flags.VARARGS) != 0 || (TreeInfo.isStaticSelector(exprTree, tree.name.table.names) && exprTree.type.isRaw())) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java index 5e1fb9e8040..258999e8afb 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -194,7 +194,7 @@ public class Resolve { void reportVerboseResolutionDiagnostic(DiagnosticPosition dpos, Name name, Type site, List argtypes, List typeargtypes, Symbol bestSoFar) { - boolean success = !bestSoFar.kind.isOverloadError(); + boolean success = !bestSoFar.kind.isResolutionError(); if (success && !verboseResolutionMode.contains(VerboseResolutionMode.SUCCESS)) { return; @@ -1389,7 +1389,7 @@ public class Resolve { if (currentSymbol.kind != VAR) continue; // invariant: sym.kind == Symbol.Kind.VAR - if (!bestSoFar.kind.isOverloadError() && + if (!bestSoFar.kind.isResolutionError() && currentSymbol.owner != bestSoFar.owner) return new AmbiguityError(bestSoFar, currentSymbol); else if (!bestSoFar.kind.betterThan(VAR)) { @@ -1432,11 +1432,11 @@ public class Resolve { !sym.isInheritedIn(site.tsym, types)) { return bestSoFar; } else if (useVarargs && (sym.flags() & VARARGS) == 0) { - return bestSoFar.kind.isOverloadError() ? + return bestSoFar.kind.isResolutionError() ? new BadVarargsMethod((ResolveError)bestSoFar.baseSymbol()) : bestSoFar; } - Assert.check(!sym.kind.isOverloadError()); + Assert.check(!sym.kind.isResolutionError()); try { Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes, allowBoxing, useVarargs, types.noWarnings); @@ -1457,7 +1457,7 @@ public class Resolve { ? new AccessError(env, site, sym) : bestSoFar; } - return (bestSoFar.kind.isOverloadError() && bestSoFar.kind != AMBIGUOUS) + return (bestSoFar.kind.isResolutionError() && bestSoFar.kind != AMBIGUOUS) ? sym : mostSpecific(argtypes, sym, bestSoFar, env, site, useVarargs); } @@ -1939,8 +1939,8 @@ public class Resolve { bestSoFar.kind != AMBIGUOUS && l.nonEmpty(); l = l.tail) { sym = findMemberType(env, site, name, l.head.tsym); - if (!bestSoFar.kind.isOverloadError() && - !sym.kind.isOverloadError() && + if (!bestSoFar.kind.isResolutionError() && + !sym.kind.isResolutionError() && sym.owner != bestSoFar.owner) bestSoFar = new AmbiguityError(bestSoFar, sym); else @@ -2176,7 +2176,7 @@ public class Resolve { List argtypes, List typeargtypes, LogResolveHelper logResolveHelper) { - if (sym.kind.isOverloadError()) { + if (sym.kind.isResolutionError()) { ResolveError errSym = (ResolveError)sym.baseSymbol(); sym = errSym.access(name, qualified ? site.tsym : syms.noSymbol); argtypes = logResolveHelper.getArgumentTypes(errSym, sym, name, argtypes); @@ -2366,7 +2366,7 @@ public class Resolve { } @Override Symbol access(Env env, DiagnosticPosition pos, Symbol location, Symbol sym) { - if (sym.kind.isOverloadError()) { + if (sym.kind.isResolutionError()) { sym = super.access(env, pos, location, sym); } else if (allowMethodHandles) { MethodSymbol msym = (MethodSymbol)sym; @@ -2523,7 +2523,7 @@ public class Resolve { } @Override Symbol access(Env env, DiagnosticPosition pos, Symbol location, Symbol sym) { - if (sym.kind.isOverloadError()) { + if (sym.kind.isResolutionError()) { if (sym.kind != WRONG_MTH && sym.kind != WRONG_MTHS) { sym = super.access(env, pos, location, sym); @@ -2933,7 +2933,7 @@ public class Resolve { */ final boolean shouldStop(Symbol sym, MethodResolutionPhase phase) { return phase.ordinal() > maxPhase.ordinal() || - !sym.kind.isOverloadError() || sym.kind == AMBIGUOUS; + !sym.kind.isResolutionError() || sym.kind == AMBIGUOUS; } /** @@ -2979,7 +2979,7 @@ public class Resolve { @Override Symbol access(Env env, DiagnosticPosition pos, Symbol location, Symbol sym) { - if (sym.kind.isOverloadError()) { + if (sym.kind.isResolutionError()) { //if nothing is found return the 'first' error sym = accessMethod(sym, pos, location, site, name, true, argtypes, typeargtypes); } @@ -3321,7 +3321,7 @@ public class Resolve { boolean hasEnclosingInstance(Env env, Type type) { Symbol encl = resolveSelfContainingInternal(env, type.tsym, false); - return encl != null && !encl.kind.isOverloadError(); + return encl != null && !encl.kind.isResolutionError(); } private Symbol resolveSelfContainingInternal(Env env, @@ -3503,7 +3503,7 @@ public class Resolve { @Override public Symbol access(Name name, TypeSymbol location) { - if (!sym.kind.isOverloadError() && sym.kind.matches(KindSelector.TYP)) + if (!sym.kind.isResolutionError() && sym.kind.matches(KindSelector.TYP)) return types.createErrorType(name, location, sym.type).tsym; else return sym; @@ -4053,7 +4053,7 @@ public class Resolve { } else { key = "bad.instance.method.in.unbound.lookup"; } - return sym.kind.isOverloadError() ? + return sym.kind.isResolutionError() ? ((ResolveError)sym).getDiagnostic(dkind, pos, location, site, name, argtypes, typeargtypes) : diags.create(dkind, log.currentSource(), pos, key, Kinds.kindName(sym), sym); } @@ -4232,8 +4232,8 @@ public class Resolve { @Override public Symbol mergeResults(Symbol bestSoFar, Symbol sym) { //Check invariants (see {@code LookupHelper.shouldStop}) - Assert.check(bestSoFar.kind.isOverloadError() && bestSoFar.kind != AMBIGUOUS); - if (!sym.kind.isOverloadError()) { + Assert.check(bestSoFar.kind.isResolutionError() && bestSoFar.kind != AMBIGUOUS); + if (!sym.kind.isResolutionError()) { //varargs resolution successful return sym; } else { diff --git a/langtools/test/tools/javac/diags/examples/CantAccessInnerClsConstr.java b/langtools/test/tools/javac/diags/examples/CantAccessInnerClsConstr.java index ce4f3238abd..112862cd2ef 100644 --- a/langtools/test/tools/javac/diags/examples/CantAccessInnerClsConstr.java +++ b/langtools/test/tools/javac/diags/examples/CantAccessInnerClsConstr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,9 +21,8 @@ * questions. */ -// key: compiler.err.prob.found.req // key: compiler.misc.cant.access.inner.cls.constr -// key: compiler.misc.invalid.mref +// key: compiler.err.invalid.mref class CantAccessInnerClsConstructor { diff --git a/langtools/test/tools/javac/lambda/MethodReference23.java b/langtools/test/tools/javac/lambda/MethodReference23.java index b7610389a02..2ac0e04b3ee 100644 --- a/langtools/test/tools/javac/lambda/MethodReference23.java +++ b/langtools/test/tools/javac/lambda/MethodReference23.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 8003280 + * @bug 8003280 8075184 * @summary Add lambda tests * check that pair of bound/non-bound constructor references is flagged as ambiguous * @author Maurizio Cimadamore diff --git a/langtools/test/tools/javac/lambda/MethodReference23.out b/langtools/test/tools/javac/lambda/MethodReference23.out index 462a75105ff..456a002bd99 100644 --- a/langtools/test/tools/javac/lambda/MethodReference23.out +++ b/langtools/test/tools/javac/lambda/MethodReference23.out @@ -1,6 +1,6 @@ -MethodReference23.java:52:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, MethodReference23, MethodReference23)) -MethodReference23.java:53:15: compiler.err.cant.apply.symbol: kindname.method, call11, MethodReference23.SAM11, @1140, kindname.class, MethodReference23, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, MethodReference23, MethodReference23))) -MethodReference23.java:57:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23)) -MethodReference23.java:58:15: compiler.err.cant.apply.symbol: kindname.method, call12, MethodReference23.SAM12, @1282, kindname.class, MethodReference23, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23))) +MethodReference23.java:52:19: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, MethodReference23, MethodReference23) +MethodReference23.java:53:16: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, MethodReference23, MethodReference23) +MethodReference23.java:57:19: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23) +MethodReference23.java:58:16: compiler.err.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23) MethodReference23.java:72:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference23.SAM21), MethodReference23, kindname.method, call3(MethodReference23.SAM22), MethodReference23 5 errors From 8b611ba470ae21d66344edd454f2dbe61762ff23 Mon Sep 17 00:00:00 2001 From: Bhavesh Patel Date: Sat, 28 Mar 2015 10:18:27 -0700 Subject: [PATCH 038/101] 8076026: DocTree should parse hyphenated attributes correctly Reviewed-by: jjg, ksrini --- .../tools/javac/parser/DocCommentParser.java | 12 ++++++-- .../test/tools/javac/doctree/AttrTest.java | 28 +++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java index 17409cca180..1dee684f910 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -797,7 +797,7 @@ public class DocCommentParser { loop: while (isIdentifierStart(ch)) { int namePos = bp; - Name name = readIdentifier(); + Name name = readAttributeName(); skipWhitespace(); List value = null; ValueKind vkind = ValueKind.EMPTY; @@ -905,6 +905,14 @@ public class DocCommentParser { return names.fromChars(buf, start, bp - start); } + protected Name readAttributeName() { + int start = bp; + nextChar(); + while (bp < buflen && (Character.isUnicodeIdentifierPart(ch) || ch == '-')) + nextChar(); + return names.fromChars(buf, start, bp - start); + } + protected Name readTagName() { int start = bp; nextChar(); diff --git a/langtools/test/tools/javac/doctree/AttrTest.java b/langtools/test/tools/javac/doctree/AttrTest.java index 2e13a16059a..9eace1357b7 100644 --- a/langtools/test/tools/javac/doctree/AttrTest.java +++ b/langtools/test/tools/javac/doctree/AttrTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 7021614 + * @bug 7021614 8076026 * @summary extend com.sun.source API to support parsing javadoc comments * @build DocCommentTester * @run main DocCommentTester AttrTest.java @@ -52,6 +52,30 @@ DocComment[DOC_COMMENT, pos:1 body: empty block tags: empty ] +*/ + + /** + * foo + */ + void hyphened_attr() { } +/* +DocComment[DOC_COMMENT, pos:1 + firstSentence: 3 + StartElement[START_ELEMENT, pos:1 + name:a + attributes: 1 + Attribute[ATTRIBUTE, pos:4 + name: name-test + vkind: UNQUOTED + value: 1 + Text[TEXT, pos:14, hyphened] + ] + ] + Text[TEXT, pos:23, foo] + EndElement[END_ELEMENT, pos:26, a] + body: empty + block tags: empty +] */ /** From 8afd89977c59c2bfb98f4e47e588fc096a0b3435 Mon Sep 17 00:00:00 2001 From: Srikanth Adayapalam Date: Mon, 30 Mar 2015 17:09:14 +0530 Subject: [PATCH 039/101] 8062373: Project Coin: diamond and anonymous classes Allow diamond inference in combination with anonymous class instance creation Co-authored-by: Maurizio Cimadamore Reviewed-by: mcimadamore, vromero --- .../com/sun/tools/javac/code/Source.java | 3 + .../com/sun/tools/javac/comp/Analyzer.java | 6 +- .../com/sun/tools/javac/comp/Attr.java | 241 ++++++++++++------ .../com/sun/tools/javac/comp/AttrContext.java | 8 +- .../com/sun/tools/javac/comp/Check.java | 77 +++++- .../sun/tools/javac/comp/DeferredAttr.java | 34 ++- .../com/sun/tools/javac/comp/Enter.java | 3 +- .../com/sun/tools/javac/comp/Resolve.java | 3 +- .../tools/javac/resources/compiler.properties | 19 +- .../com/sun/tools/javac/tree/TreeInfo.java | 14 +- .../InnerClassesInAnonymousClassTest.java | 6 +- .../diags/examples/DiamondAndAnonClass.java | 6 +- .../examples/DiamondAndNonDenotableTypes.java | 42 +++ .../javac/failover/CheckAttributedTree.java | 8 +- .../generics/diamond/6939780/T6939780.java | 7 +- .../generics/diamond/6939780/T6939780_7.out | 8 +- .../generics/diamond/6939780/T6939780_8.out | 10 +- .../generics/diamond/6939780/T6939780_9.out | 13 + .../generics/diamond/6996914/T6996914a.java | 36 ++- .../generics/diamond/6996914/T6996914b.java | 5 +- .../generics/diamond/8065986/T8065986b.java | 9 +- .../generics/diamond/8065986/T8065986b.out | 12 +- .../diamond/MultipleInferenceHooksTest.java | 38 +++ .../javac/generics/diamond/neg/Neg01.java | 13 +- .../javac/generics/diamond/neg/Neg01.out | 16 +- .../javac/generics/diamond/neg/Neg02.java | 22 +- .../javac/generics/diamond/neg/Neg02.out | 58 +++-- .../javac/generics/diamond/neg/Neg03.java | 32 ++- .../javac/generics/diamond/neg/Neg03.out | 100 +++++--- .../javac/generics/diamond/neg/Neg04.java | 12 +- .../javac/generics/diamond/neg/Neg04.out | 16 +- .../javac/generics/diamond/neg/Neg05.java | 22 +- .../javac/generics/diamond/neg/Neg05.out | 66 +++-- .../javac/generics/diamond/neg/Neg06.java | 6 +- .../javac/generics/diamond/neg/Neg06.out | 8 +- .../javac/generics/diamond/neg/Neg07.java | 3 +- .../javac/generics/diamond/neg/Neg07.out | 3 +- .../javac/generics/diamond/neg/Neg09.java | 6 +- .../javac/generics/diamond/neg/Neg09.out | 10 +- .../javac/generics/diamond/neg/Neg12.java | 33 +++ .../javac/generics/diamond/neg/Neg12.out | 4 + .../javac/generics/diamond/neg/Neg13.java | 49 ++++ .../javac/generics/diamond/neg/Neg13.out | 5 + .../javac/generics/diamond/neg/Neg14.java | 49 ++++ .../javac/generics/diamond/neg/Neg14.out | 5 + .../javac/generics/diamond/neg/Neg15.java | 66 +++++ .../javac/generics/diamond/neg/Neg15.out | 4 + .../javac/generics/diamond/neg/Neg16.java | 36 +++ .../javac/generics/diamond/neg/Neg16.out | 2 + .../javac/generics/diamond/neg/Neg17.java | 21 ++ .../javac/generics/diamond/neg/Neg17.out | 2 + .../javac/generics/diamond/neg/Neg18.java | 16 ++ .../javac/generics/diamond/neg/Neg18.out | 3 + .../javac/generics/diamond/neg/Neg19.java | 21 ++ .../javac/generics/diamond/neg/Neg19.out | 2 + .../generics/diamond/neg/pkg/Neg18_01.java | 29 +++ .../javac/generics/diamond/pos/Pos01.java | 16 +- .../javac/generics/diamond/pos/Pos02.java | 24 +- .../javac/generics/diamond/pos/Pos03.java | 34 ++- .../javac/generics/diamond/pos/Pos04.java | 14 +- .../javac/generics/diamond/pos/Pos05.java | 11 +- .../generics/inference/8055963/T8055963.java | 11 +- .../tools/javac/lambda/8066974/T8066974.java | 4 +- .../tools/javac/lambda/8066974/T8066974.out | 7 +- .../test/tools/javac/lambda/TargetType46.java | 3 +- .../test/tools/javac/lambda/TargetType46.out | 3 +- .../test/tools/javac/lambda/TargetType68.java | 8 +- .../test/tools/javac/lambda/TargetType68.out | 3 + .../test/tools/javac/lambda/TargetType69.java | 5 +- .../org/openjdk/tests/javac/FDTest.java | 5 +- .../tools/javac/scope/DupUnsharedTest.java | 6 +- 71 files changed, 1257 insertions(+), 245 deletions(-) create mode 100644 langtools/test/tools/javac/diags/examples/DiamondAndNonDenotableTypes.java create mode 100644 langtools/test/tools/javac/generics/diamond/6939780/T6939780_9.out create mode 100644 langtools/test/tools/javac/generics/diamond/MultipleInferenceHooksTest.java create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg12.java create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg12.out create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg13.java create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg13.out create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg14.java create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg14.out create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg15.java create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg15.out create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg16.java create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg16.out create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg17.java create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg17.out create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg18.java create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg18.out create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg19.java create mode 100644 langtools/test/tools/javac/generics/diamond/neg/Neg19.out create mode 100644 langtools/test/tools/javac/generics/diamond/neg/pkg/Neg18_01.java create mode 100644 langtools/test/tools/javac/lambda/TargetType68.out diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java index 5f2dd39c32a..687012387de 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java @@ -209,6 +209,9 @@ public enum Source { public boolean allowPrivateSafeVarargs() { return compareTo(JDK1_9) >= 0; } + public boolean allowDiamondWithAnonymousClassCreation() { + return compareTo(JDK1_9) >= 0; + } public boolean allowUnderscoreIdentifier() { return compareTo(JDK1_8) <= 0; } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java index 1eb1ab48808..f5975776fa2 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -90,6 +90,7 @@ public class Analyzer { final DeferredAttr deferredAttr; final TreeMaker make; final Names names; + private final boolean allowDiamondWithAnonymousClassCreation; final EnumSet analyzerModes; @@ -112,6 +113,7 @@ public class Analyzer { String findOpt = options.get("find"); //parse modes Source source = Source.instance(context); + allowDiamondWithAnonymousClassCreation = source.allowDiamondWithAnonymousClassCreation(); analyzerModes = AnalyzerMode.getAnalyzerModes(findOpt, source); } @@ -210,7 +212,7 @@ public class Analyzer { boolean match(JCNewClass tree) { return tree.clazz.hasTag(TYPEAPPLY) && !TreeInfo.isDiamond(tree) && - tree.def == null; + (tree.def == null || allowDiamondWithAnonymousClassCreation); } @Override diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index 4c9b083ef06..36a9c6bc9ce 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -46,6 +46,10 @@ import com.sun.tools.javac.comp.DeferredAttr.AttrMode; import com.sun.tools.javac.comp.Infer.InferenceContext; import com.sun.tools.javac.comp.Infer.FreeTypeListener; import com.sun.tools.javac.jvm.*; +import static com.sun.tools.javac.resources.CompilerProperties.Fragments.Diamond; +import static com.sun.tools.javac.resources.CompilerProperties.Fragments.DiamondInvalidArg; +import static com.sun.tools.javac.resources.CompilerProperties.Fragments.DiamondInvalidArgs; +import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.Fragments; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.tree.JCTree.*; @@ -54,6 +58,7 @@ import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.DefinedBy.Api; import com.sun.tools.javac.util.Dependencies.AttributionKind; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; +import com.sun.tools.javac.util.JCDiagnostic.Fragment; import com.sun.tools.javac.util.List; import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Flags.ANNOTATION; @@ -219,6 +224,26 @@ public class Attr extends JCTree.Visitor { final Type found, final KindSelector ownkind, final ResultInfo resultInfo) { + return check(tree, found, ownkind, resultInfo, true); + } + /** Check kind and type of given tree against protokind and prototype. + * If check succeeds, store type in tree and return it. + * If check fails, store errType in tree and return it. + * No checks are performed if the prototype is a method type. + * It is not necessary in this case since we know that kind and type + * are correct. + * + * @param tree The tree whose kind and type is checked + * @param found The computed type of the tree + * @param ownkind The computed kind of the tree + * @param resultInfo The expected result of the tree + * @param recheckPostInference If true and inference is underway, arrange to recheck the tree after inference finishes. + */ + Type check(final JCTree tree, + final Type found, + final KindSelector ownkind, + final ResultInfo resultInfo, + boolean recheckPostInference) { InferenceContext inferenceContext = resultInfo.checkContext.inferenceContext(); Type owntype; boolean shouldCheck = !found.hasTag(ERROR) && @@ -233,12 +258,14 @@ public class Attr extends JCTree.Visitor { //delay the check if there are inference variables in the found type //this means we are dealing with a partially inferred poly expression owntype = shouldCheck ? resultInfo.pt : found; - inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), - instantiatedContext -> { - ResultInfo pendingResult = - resultInfo.dup(inferenceContext.asInstType(resultInfo.pt)); - check(tree, inferenceContext.asInstType(found), ownkind, pendingResult); - }); + if (recheckPostInference) { + inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), + instantiatedContext -> { + ResultInfo pendingResult = + resultInfo.dup(inferenceContext.asInstType(resultInfo.pt)); + check(tree, inferenceContext.asInstType(found), ownkind, pendingResult, false); + }); + } } else { owntype = shouldCheck ? resultInfo.check(tree, found) : @@ -862,7 +889,7 @@ public class Attr extends JCTree.Visitor { } else { chk.checkOverrideClashes(tree.pos(), env.enclClass.type, m); } - chk.checkOverride(tree, m); + chk.checkOverride(env, tree, m); if (isDefaultMethod && types.overridesObjectMethod(m.enclClass(), m)) { log.error(tree, "default.overrides.object.member", m.name, Kinds.kindName(m.location()), m.location()); @@ -1969,11 +1996,16 @@ public class Attr extends JCTree.Visitor { (((JCVariableDecl) env.tree).mods.flags & Flags.ENUM) == 0 || ((JCVariableDecl) env.tree).init != tree)) log.error(tree.pos(), "enum.cant.be.instantiated"); + + boolean isSpeculativeDiamondInferenceRound = TreeInfo.isDiamond(tree) && + resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.SPECULATIVE; + boolean skipNonDiamondPath = false; // Check that class is not abstract - if (cdef == null && + if (cdef == null && !isSpeculativeDiamondInferenceRound && // class body may be nulled out in speculative tree copy (clazztype.tsym.flags() & (ABSTRACT | INTERFACE)) != 0) { log.error(tree.pos(), "abstract.cant.be.instantiated", clazztype.tsym); + skipNonDiamondPath = true; } else if (cdef != null && clazztype.tsym.isInterface()) { // Check that no constructor arguments are given to // anonymous classes implementing an interface @@ -1986,7 +2018,9 @@ public class Attr extends JCTree.Visitor { // Error recovery: pretend no arguments were supplied. argtypes = List.nil(); typeargtypes = List.nil(); - } else if (TreeInfo.isDiamond(tree)) { + skipNonDiamondPath = true; + } + if (TreeInfo.isDiamond(tree)) { ClassType site = new ClassType(clazztype.getEnclosingType(), clazztype.tsym.type.getTypeArguments(), clazztype.tsym, @@ -2022,7 +2056,7 @@ public class Attr extends JCTree.Visitor { tree.clazz.type = types.createErrorType(clazztype); if (!constructorType.isErroneous()) { - tree.clazz.type = clazztype = constructorType.getReturnType(); + tree.clazz.type = clazz.type = constructorType.getReturnType(); tree.constructorType = types.createMethodTypeWithReturn(constructorType, syms.voidType); } clazztype = chk.checkClassType(tree.clazz, tree.clazz.type, true); @@ -2031,7 +2065,7 @@ public class Attr extends JCTree.Visitor { // Resolve the called constructor under the assumption // that we are referring to a superclass instance of the // current instance (JLS ???). - else { + else if (!skipNonDiamondPath) { //the following code alters some of the fields in the current //AttrContext - hence, the current context must be dup'ed in //order to avoid downstream failures @@ -2052,70 +2086,8 @@ public class Attr extends JCTree.Visitor { } if (cdef != null) { - // We are seeing an anonymous class instance creation. - // In this case, the class instance creation - // expression - // - // E.new C(args) { ... } - // - // is represented internally as - // - // E . new C(args) ( class { ... } ) . - // - // This expression is then *transformed* as follows: - // - // (1) add an extends or implements clause - // (2) add a constructor. - // - // For instance, if C is a class, and ET is the type of E, - // the expression - // - // E.new C(args) { ... } - // - // is translated to (where X is a fresh name and typarams is the - // parameter list of the super constructor): - // - // new X(<*nullchk*>E, args) where - // X extends C { - // X(ET e, args) { - // e.super(args) - // } - // ... - // } - - if (clazztype.tsym.isInterface()) { - cdef.implementing = List.of(clazz); - } else { - cdef.extending = clazz; - } - - if (resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK && - isSerializable(clazztype)) { - localEnv.info.isSerializable = true; - } - - attribStat(cdef, localEnv); - - // If an outer instance is given, - // prefix it to the constructor arguments - // and delete it from the new expression - if (tree.encl != null && !clazztype.tsym.isInterface()) { - tree.args = tree.args.prepend(makeNullCheck(tree.encl)); - argtypes = argtypes.prepend(tree.encl.type); - tree.encl = null; - } - - // Reassign clazztype and recompute constructor. - clazztype = cdef.sym.type; - Symbol sym = tree.constructor = rs.resolveConstructor( - tree.pos(), localEnv, clazztype, argtypes, typeargtypes); - Assert.check(!sym.kind.isResolutionError()); - tree.constructor = sym; - tree.constructorType = checkId(noCheckTree, - clazztype, - tree.constructor, - localEnv, - new ResultInfo(pkind, newMethodTemplate(syms.voidType, argtypes, typeargtypes))); + visitAnonymousClassDefinition(tree, clazz, clazztype, cdef, localEnv, argtypes, typeargtypes, pkind); + return; } if (tree.constructor != null && tree.constructor.kind == MTH) @@ -2133,6 +2105,125 @@ public class Attr extends JCTree.Visitor { chk.validate(tree.typeargs, localEnv); } + // where + private void visitAnonymousClassDefinition(JCNewClass tree, JCExpression clazz, Type clazztype, + JCClassDecl cdef, Env localEnv, + List argtypes, List typeargtypes, + KindSelector pkind) { + // We are seeing an anonymous class instance creation. + // In this case, the class instance creation + // expression + // + // E.new C(args) { ... } + // + // is represented internally as + // + // E . new C(args) ( class { ... } ) . + // + // This expression is then *transformed* as follows: + // + // (1) add an extends or implements clause + // (2) add a constructor. + // + // For instance, if C is a class, and ET is the type of E, + // the expression + // + // E.new C(args) { ... } + // + // is translated to (where X is a fresh name and typarams is the + // parameter list of the super constructor): + // + // new X(<*nullchk*>E, args) where + // X extends C { + // X(ET e, args) { + // e.super(args) + // } + // ... + // } + InferenceContext inferenceContext = resultInfo.checkContext.inferenceContext(); + final boolean isDiamond = TreeInfo.isDiamond(tree); + if (isDiamond + && ((tree.constructorType != null && inferenceContext.free(tree.constructorType)) + || (tree.clazz.type != null && inferenceContext.free(tree.clazz.type)))) { + inferenceContext.addFreeTypeListener(List.of(tree.constructorType, tree.clazz.type), + instantiatedContext -> { + tree.constructorType = instantiatedContext.asInstType(tree.constructorType); + clazz.type = instantiatedContext.asInstType(clazz.type); + visitAnonymousClassDefinition(tree, clazz, clazz.type, cdef, localEnv, argtypes, typeargtypes, pkind); + }); + } else { + if (isDiamond && clazztype.hasTag(CLASS)) { + List invalidDiamondArgs = chk.checkDiamondDenotable((ClassType)clazztype); + if (!clazztype.isErroneous() && invalidDiamondArgs.nonEmpty()) { + // One or more types inferred in the previous steps is non-denotable. + Fragment fragment = Diamond(clazztype.tsym); + log.error(tree.clazz.pos(), + Errors.CantApplyDiamond1( + fragment, + invalidDiamondArgs.size() > 1 ? + DiamondInvalidArgs(invalidDiamondArgs, fragment) : + DiamondInvalidArg(invalidDiamondArgs, fragment))); + } + // For <>(){}, inferred types must also be accessible. + for (Type t : clazztype.getTypeArguments()) { + rs.checkAccessibleType(env, t); + } + } + + // If we already errored, be careful to avoid a further avalanche. ErrorType answers + // false for isInterface call even when the original type is an interface. + boolean implementing = clazztype.tsym.isInterface() || + clazztype.isErroneous() && clazztype.getOriginalType().tsym.isInterface(); + + if (implementing) { + cdef.implementing = List.of(clazz); + } else { + cdef.extending = clazz; + } + + if (resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK && + isSerializable(clazztype)) { + localEnv.info.isSerializable = true; + } + + attribStat(cdef, localEnv); + + List finalargtypes; + // If an outer instance is given, + // prefix it to the constructor arguments + // and delete it from the new expression + if (tree.encl != null && !clazztype.tsym.isInterface()) { + tree.args = tree.args.prepend(makeNullCheck(tree.encl)); + finalargtypes = argtypes.prepend(tree.encl.type); + tree.encl = null; + } else { + finalargtypes = argtypes; + } + + // Reassign clazztype and recompute constructor. As this necessarily involves + // another attribution pass for deferred types in the case of <>, replicate + // them. Original arguments have right decorations already. + if (isDiamond && pkind.contains(KindSelector.POLY)) { + finalargtypes = finalargtypes.map(deferredAttr.deferredCopier); + } + + clazztype = cdef.sym.type; + Symbol sym = tree.constructor = rs.resolveConstructor( + tree.pos(), localEnv, clazztype, finalargtypes, typeargtypes); + Assert.check(!sym.kind.isResolutionError()); + tree.constructor = sym; + tree.constructorType = checkId(noCheckTree, + clazztype, + tree.constructor, + localEnv, + new ResultInfo(pkind, newMethodTemplate(syms.voidType, finalargtypes, typeargtypes))); + } + Type owntype = (tree.constructor != null && tree.constructor.kind == MTH) ? + clazztype : types.createErrorType(tree.type); + result = check(tree, owntype, KindSelector.VAL, resultInfo, false); + chk.validate(tree.typeargs, localEnv); + } + /** Make an attributed null check tree. */ public JCExpression makeNullCheck(JCExpression arg) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java index db812ff0687..84d4a5318a6 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,6 +63,11 @@ public class AttrContext { */ boolean isSpeculative = false; + /** + * Is this an attribution environment for an anonymous class instantiated using <> ? + */ + boolean isAnonymousDiamond = false; + /** Are arguments to current function applications boxed into an array for varargs? */ Resolve.MethodResolutionPhase pendingResolutionPhase = null; @@ -100,6 +105,7 @@ public class AttrContext { info.defaultSuperCallSite = defaultSuperCallSite; info.isSerializable = isSerializable; info.isSpeculative = isSpeculative; + info.isAnonymousDiamond = isAnonymousDiamond; return info; } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index b2af981a8ea..2f74ea42998 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -32,6 +32,8 @@ import javax.tools.JavaFileManager; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Attribute.Compound; import com.sun.tools.javac.jvm.*; +import com.sun.tools.javac.resources.CompilerProperties.Errors; +import com.sun.tools.javac.resources.CompilerProperties.Fragments; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; @@ -84,6 +86,7 @@ public class Check { private boolean suppressAbortOnBadClassFile; private boolean enableSunApiLintControl; private final JavaFileManager fileManager; + private final Source source; private final Profile profile; private final boolean warnOnAccessToSensitiveMembers; @@ -122,11 +125,12 @@ public class Check { lint = Lint.instance(context); fileManager = context.get(JavaFileManager.class); - Source source = Source.instance(context); + source = Source.instance(context); allowSimplifiedVarargs = source.allowSimplifiedVarargs(); allowDefaultMethods = source.allowDefaultMethods(); allowStrictMethodClashCheck = source.allowStrictMethodClashCheck(); allowPrivateSafeVarargs = source.allowPrivateSafeVarargs(); + allowDiamondWithAnonymousClassCreation = source.allowDiamondWithAnonymousClassCreation(); complexInference = options.isSet("complexinference"); warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts"); suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile"); @@ -169,6 +173,10 @@ public class Check { */ boolean allowPrivateSafeVarargs; + /** Switch: can diamond inference be used in anonymous instance creation ? + */ + boolean allowDiamondWithAnonymousClassCreation; + /** Switch: -complexinference option set? */ boolean complexInference; @@ -773,10 +781,9 @@ public class Check { if (!TreeInfo.isDiamond(tree) || t.isErroneous()) { return checkClassType(tree.clazz.pos(), t, true); - } else if (tree.def != null) { + } else if (tree.def != null && !allowDiamondWithAnonymousClassCreation) { log.error(tree.clazz.pos(), - "cant.apply.diamond.1", - t, diags.fragment("diamond.and.anon.class", t)); + Errors.CantApplyDiamond1(t, Fragments.DiamondAndAnonClassNotSupportedInSource(source.name))); return types.createErrorType(t); } else if (t.tsym.type.getTypeArguments().isEmpty()) { log.error(tree.clazz.pos(), @@ -794,6 +801,59 @@ public class Check { } } + /** Check that the type inferred using the diamond operator does not contain + * non-denotable types such as captured types or intersection types. + * @param t the type inferred using the diamond operator + * @return the (possibly empty) list of non-denotable types. + */ + List checkDiamondDenotable(ClassType t) { + ListBuffer buf = new ListBuffer<>(); + for (Type arg : t.getTypeArguments()) { + if (!diamondTypeChecker.visit(arg, null)) { + buf.append(arg); + } + } + return buf.toList(); + } + // where + + /** diamondTypeChecker: A type visitor that descends down the given type looking for non-denotable + * types. The visit methods return false as soon as a non-denotable type is encountered and true + * otherwise. + */ + private static final Types.SimpleVisitor diamondTypeChecker = new Types.SimpleVisitor() { + @Override + public Boolean visitType(Type t, Void s) { + return true; + } + @Override + public Boolean visitClassType(ClassType t, Void s) { + if (t.isCompound()) { + return false; + } + for (Type targ : t.getTypeArguments()) { + if (!visit(targ, s)) { + return false; + } + } + return true; + } + @Override + public Boolean visitCapturedType(CapturedType t, Void s) { + return false; + } + + @Override + public Boolean visitArrayType(ArrayType t, Void s) { + return visit(t.elemtype, s); + } + + @Override + public Boolean visitWildcardType(WildcardType t, Void s) { + return visit(t.type, s); + } + }; + void checkVarargsMethodDecl(Env env, JCMethodDecl tree) { MethodSymbol m = tree.sym; if (!allowSimplifiedVarargs) return; @@ -1917,7 +1977,7 @@ public class Check { * for errors. * @param m The overriding method. */ - void checkOverride(JCMethodDecl tree, MethodSymbol m) { + void checkOverride(Env env, JCMethodDecl tree, MethodSymbol m) { ClassSymbol origin = (ClassSymbol)m.owner; if ((origin.flags() & ENUM) != 0 && names.finalize.equals(m.name)) if (m.overrides(syms.enumFinalFinalize, origin, types, false)) { @@ -1934,7 +1994,12 @@ public class Check { } } - if (m.attribute(syms.overrideType.tsym) != null && !isOverrider(m)) { + // Check if this method must override a super method due to being annotated with @Override + // or by virtue of being a member of a diamond inferred anonymous class. Latter case is to + // be treated "as if as they were annotated" with @Override. + boolean mustOverride = m.attribute(syms.overrideType.tsym) != null || + (env.info.isAnonymousDiamond && !m.isConstructor() && !m.isPrivate()); + if (mustOverride && !isOverrider(m)) { DiagnosticPosition pos = tree.pos(); for (JCAnnotation a : tree.getModifiers().annotations) { if (a.annotationType.type.tsym == syms.overrideType.tsym) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java index 5432166b48f..9cb73b3a545 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java @@ -26,6 +26,7 @@ package com.sun.tools.javac.comp; import com.sun.source.tree.LambdaExpressionTree.BodyKind; +import com.sun.source.tree.NewClassTree; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Type.TypeMapping; import com.sun.tools.javac.comp.Resolve.ResolveError; @@ -81,6 +82,8 @@ public class DeferredAttr extends JCTree.Visitor { final Log log; final Symtab syms; final TreeMaker make; + final TreeCopier treeCopier; + final TypeMapping deferredCopier; final Types types; final Flow flow; final Names names; @@ -125,6 +128,35 @@ public class DeferredAttr extends JCTree.Visitor { return "Empty deferred context!"; } }; + + // For speculative attribution, skip the class definition in <>. + treeCopier = + new TreeCopier(make) { + @Override @DefinedBy(Api.COMPILER_TREE) + public JCTree visitNewClass(NewClassTree node, Void p) { + JCNewClass t = (JCNewClass) node; + if (TreeInfo.isDiamond(t)) { + JCExpression encl = copy(t.encl, p); + List typeargs = copy(t.typeargs, p); + JCExpression clazz = copy(t.clazz, p); + List args = copy(t.args, p); + JCClassDecl def = null; + return make.at(t.pos).NewClass(encl, typeargs, clazz, args, def); + } else { + return super.visitNewClass(node, p); + } + } + }; + deferredCopier = new TypeMapping () { + @Override + public Type visitType(Type t, Void v) { + if (t.hasTag(DEFERRED)) { + DeferredType dt = (DeferredType) t; + return new DeferredType(treeCopier.copy(dt.tree), dt.env); + } + return t; + } + }; } /** shared tree for stuck expressions */ @@ -364,7 +396,7 @@ public class DeferredAttr extends JCTree.Visitor { * disabled during speculative type-checking. */ JCTree attribSpeculative(JCTree tree, Env env, ResultInfo resultInfo) { - return attribSpeculative(tree, env, resultInfo, new TreeCopier<>(make), + return attribSpeculative(tree, env, resultInfo, treeCopier, (newTree)->new DeferredAttrDiagHandler(log, newTree)); } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java index d8abe3b6855..177dbf8df2f 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -192,6 +192,7 @@ public class Enter extends JCTree.Visitor { localEnv.info.isSelfCall = false; localEnv.info.lint = null; // leave this to be filled in by Attr, // when annotations have been processed + localEnv.info.isAnonymousDiamond = TreeInfo.isDiamond(env.tree); return localEnv; } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java index 258999e8afb..ba0e01df0a2 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -2555,7 +2555,8 @@ public class Resolve { boolean allowBoxing, boolean useVarargs) { Symbol bestSoFar = methodNotFound; - for (final Symbol sym : site.tsym.members().getSymbolsByName(names.init)) { + TypeSymbol tsym = site.tsym.isInterface() ? syms.objectType.tsym : site.tsym; + for (final Symbol sym : tsym.members().getSymbolsByName(names.init)) { //- System.out.println(" e " + e.sym); if (sym.kind == MTH && (sym.flags_field & SYNTHETIC) == 0) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index c3a8900c57c..6dc46740995 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -2010,6 +2010,16 @@ compiler.misc.diamond=\ compiler.misc.diamond.non.generic=\ cannot use ''<>'' with non-generic class {0} +# 0: list of type, 1: message segment +compiler.misc.diamond.invalid.arg=\ + type argument {0} inferred for {1} is not allowed in this context\n\ + inferred argument is not expressible in the Signature attribute + +# 0: list of type, 1: message segment +compiler.misc.diamond.invalid.args=\ + type arguments {0} inferred for {1} are not allowed in this context\n\ + inferred arguments are not expressible in the Signature attribute + # 0: unused compiler.misc.diamond.and.explicit.params=\ cannot use ''<>'' with explicit type parameters for constructor @@ -2271,10 +2281,6 @@ compiler.misc.varargs.implement=\ compiler.misc.varargs.clash.with=\ {0} in {1} overrides {2} in {3} -# 0: unused -compiler.misc.diamond.and.anon.class=\ - cannot use ''<>'' with anonymous inner classes - # 0: symbol kind, 1: symbol, 2: symbol, 3: message segment compiler.misc.inapplicable.method=\ {0} {1}.{2} is not applicable\n\ @@ -2283,6 +2289,11 @@ compiler.misc.inapplicable.method=\ ######################################## # Diagnostics for language feature changes ######################################## +# 0: string +compiler.misc.diamond.and.anon.class.not.supported.in.source=\ + cannot use ''<>'' with anonymous inner classes in -source {0}\n\ + (use -source 9 or higher to enable ''<>'' with anonymous inner classes) + # 0: string compiler.err.unsupported.binary.lit=\ binary literals are not supported in -source {0}\n\ diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java index b97af9782ef..af23690482f 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -190,6 +190,18 @@ public class TreeInfo { } } + /** Return true if the given tree represents a type elided anonymous class instance creation. */ + public static boolean isAnonymousDiamond(JCTree tree) { + switch(tree.getTag()) { + case NEWCLASS: { + JCNewClass nc = (JCNewClass)tree; + return nc.def != null && isDiamond(nc.clazz); + } + case ANNOTATED_TYPE: return isAnonymousDiamond(((JCAnnotatedType)tree).underlyingType); + default: return false; + } + } + public static boolean isEnumInit(JCTree tree) { switch (tree.getTag()) { case VARDEF: diff --git a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java index 78a5287f6c7..04a563ce99f 100644 --- a/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java +++ b/langtools/test/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8042251 + * @bug 8042251 8062373 * @summary Testing InnerClasses_attribute of inner classes in anonymous class. * @library /tools/lib /tools/javac/lib ../lib * @build InnerClassesTestBase TestResult TestBase InMemoryFileManager ToolBox @@ -73,6 +73,6 @@ public class InnerClassesInAnonymousClassTest extends InnerClassesTestBase { public void getAdditionalFlags(Map> class2Flags, ClassType type, Modifier... flags) { super.getAdditionalFlags(class2Flags, type, flags); class2Flags.put("Anonymous", getFlags(currentClassType, Arrays.asList(flags))); - class2Flags.put("1", new HashSet<>()); + class2Flags.put("1", new HashSet<>() {}); } } diff --git a/langtools/test/tools/javac/diags/examples/DiamondAndAnonClass.java b/langtools/test/tools/javac/diags/examples/DiamondAndAnonClass.java index 26ef5e7cfb5..8e94de00630 100644 --- a/langtools/test/tools/javac/diags/examples/DiamondAndAnonClass.java +++ b/langtools/test/tools/javac/diags/examples/DiamondAndAnonClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,10 @@ * questions. */ -// key: compiler.misc.diamond.and.anon.class +// key: compiler.misc.diamond.and.anon.class.not.supported.in.source // key: compiler.err.cant.apply.diamond.1 +// key: compiler.warn.source.no.bootclasspath +// options: -source 8 import java.util.*; diff --git a/langtools/test/tools/javac/diags/examples/DiamondAndNonDenotableTypes.java b/langtools/test/tools/javac/diags/examples/DiamondAndNonDenotableTypes.java new file mode 100644 index 00000000000..0f2650d3e47 --- /dev/null +++ b/langtools/test/tools/javac/diags/examples/DiamondAndNonDenotableTypes.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.misc.diamond +// key: compiler.err.cant.apply.diamond.1 +// key: compiler.misc.diamond.invalid.arg +// key: compiler.misc.diamond.invalid.args + +import java.util.*; + +class DiamondAndNonDenotableType { + DiamondAndNonDenotableType(T t) {} +} + +class DiamondAndNonDenotableTypes { + DiamondAndNonDenotableTypes(T t, S s) {} + void m() { + List wl = null; + new DiamondAndNonDenotableTypes<>(wl, wl) {}; + new DiamondAndNonDenotableType<>(wl) {}; + }; +} diff --git a/langtools/test/tools/javac/failover/CheckAttributedTree.java b/langtools/test/tools/javac/failover/CheckAttributedTree.java index 34222c8736d..66f91ee5e91 100644 --- a/langtools/test/tools/javac/failover/CheckAttributedTree.java +++ b/langtools/test/tools/javac/failover/CheckAttributedTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6970584 8006694 + * @bug 6970584 8006694 8062373 * @summary assorted position errors in compiler syntax trees * temporarily workaround combo tests are causing time out in several platforms * @library ../lib @@ -290,7 +290,7 @@ public class CheckAttributedTree extends JavacTestingAbstractThreadedTest { } public void finished(TaskEvent e) { } }); - + int i = 0; try { Iterable trees = task.parse(); // JavaCompiler c = JavaCompiler.instance(((JavacTaskImpl) task).getContext()); @@ -308,7 +308,7 @@ public class CheckAttributedTree extends JavacTestingAbstractThreadedTest { if (def.hasTag(CLASSDEF) && analyzedElems.contains(((JCTree.JCClassDecl)def).sym)) { //System.err.println("Adding pair..." + cu.sourcefile + " " + ((JCTree.JCClassDecl) def).name); - res.add(new Pair<>(cu, def)); + res.add((i++ % 2) == 0 ? new Pair<>(cu, def) {} : new Pair<>(cu, def)); } } } diff --git a/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java b/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java index 6d7ef0da676..603d48bae4b 100644 --- a/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java +++ b/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java @@ -1,11 +1,12 @@ /* * @test /nodynamiccopyright/ - * @bug 6939780 7020044 8009459 8021338 8064365 + * @bug 6939780 7020044 8009459 8021338 8064365 8062373 * - * @summary add a warning to detect diamond sites + * @summary add a warning to detect diamond sites (including anonymous class instance creation at source >= 9) * @author mcimadamore * @compile/ref=T6939780_7.out -Xlint:-options -source 7 T6939780.java -XDrawDiagnostics -XDfind=diamond - * @compile/ref=T6939780_8.out T6939780.java -XDrawDiagnostics -XDfind=diamond + * @compile/ref=T6939780_8.out -Xlint:-options -source 8 T6939780.java -XDrawDiagnostics -XDfind=diamond + * @compile/ref=T6939780_9.out -Xlint:-options -source 9 T6939780.java -XDrawDiagnostics -XDfind=diamond * */ diff --git a/langtools/test/tools/javac/generics/diamond/6939780/T6939780_7.out b/langtools/test/tools/javac/generics/diamond/6939780/T6939780_7.out index 52d621d78df..fbf2fe6a0c8 100644 --- a/langtools/test/tools/javac/generics/diamond/6939780/T6939780_7.out +++ b/langtools/test/tools/javac/generics/diamond/6939780/T6939780_7.out @@ -1,5 +1,5 @@ -T6939780.java:21:28: compiler.warn.diamond.redundant.args -T6939780.java:22:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo -T6939780.java:30:19: compiler.warn.diamond.redundant.args -T6939780.java:31:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo +T6939780.java:22:28: compiler.warn.diamond.redundant.args +T6939780.java:23:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo +T6939780.java:31:19: compiler.warn.diamond.redundant.args +T6939780.java:32:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo 4 warnings diff --git a/langtools/test/tools/javac/generics/diamond/6939780/T6939780_8.out b/langtools/test/tools/javac/generics/diamond/6939780/T6939780_8.out index 3d979d15147..76e2ea00260 100644 --- a/langtools/test/tools/javac/generics/diamond/6939780/T6939780_8.out +++ b/langtools/test/tools/javac/generics/diamond/6939780/T6939780_8.out @@ -1,7 +1,7 @@ -T6939780.java:20:33: compiler.warn.diamond.redundant.args -T6939780.java:21:28: compiler.warn.diamond.redundant.args -T6939780.java:22:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo -T6939780.java:29:19: compiler.warn.diamond.redundant.args +T6939780.java:21:33: compiler.warn.diamond.redundant.args +T6939780.java:22:28: compiler.warn.diamond.redundant.args +T6939780.java:23:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo T6939780.java:30:19: compiler.warn.diamond.redundant.args -T6939780.java:31:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo +T6939780.java:31:19: compiler.warn.diamond.redundant.args +T6939780.java:32:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo 6 warnings diff --git a/langtools/test/tools/javac/generics/diamond/6939780/T6939780_9.out b/langtools/test/tools/javac/generics/diamond/6939780/T6939780_9.out new file mode 100644 index 00000000000..308851596b5 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/6939780/T6939780_9.out @@ -0,0 +1,13 @@ +T6939780.java:21:33: compiler.warn.diamond.redundant.args +T6939780.java:22:28: compiler.warn.diamond.redundant.args +T6939780.java:23:28: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo +T6939780.java:24:33: compiler.warn.diamond.redundant.args +T6939780.java:25:28: compiler.warn.diamond.redundant.args +T6939780.java:26:28: compiler.warn.diamond.redundant.args +T6939780.java:30:19: compiler.warn.diamond.redundant.args +T6939780.java:31:19: compiler.warn.diamond.redundant.args +T6939780.java:32:19: compiler.warn.diamond.redundant.args.1: T6939780.Foo, T6939780.Foo +T6939780.java:33:19: compiler.warn.diamond.redundant.args +T6939780.java:34:19: compiler.warn.diamond.redundant.args +T6939780.java:35:19: compiler.warn.diamond.redundant.args +12 warnings diff --git a/langtools/test/tools/javac/generics/diamond/6996914/T6996914a.java b/langtools/test/tools/javac/generics/diamond/6996914/T6996914a.java index 47e7f98a40c..b0f42327d86 100644 --- a/langtools/test/tools/javac/generics/diamond/6996914/T6996914a.java +++ b/langtools/test/tools/javac/generics/diamond/6996914/T6996914a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6996914 7020044 + * @bug 6996914 7020044 8062373 * @summary Diamond inference: problem when accessing protected constructor * @run main T6996914a */ @@ -53,6 +53,17 @@ public class T6996914a { } } + enum DiamondKind { + STANDARD("new Foo<>();"), + ANON("new Foo<>() {};"); + + String expr; + + DiamondKind(String expr) { + this.expr = expr; + } + } + enum ConstructorKind { PACKAGE(""), PROTECTED("protected"), @@ -93,14 +104,14 @@ public class T6996914a { final static String sourceStub = "#I\n" + "class Test {\n" + - " Foo fs = new Foo<>();\n" + + " Foo fs = #D\n" + "}\n"; String source; - public ClientClass(PackageKind pk) { + public ClientClass(PackageKind pk, DiamondKind dk) { super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); - source = sourceStub.replace("#I", pk.importDecl); + source = sourceStub.replace("#I", pk.importDecl).replace("#D", dk.expr); } @Override @@ -112,20 +123,22 @@ public class T6996914a { public static void main(String... args) throws Exception { for (PackageKind pk : PackageKind.values()) { for (ConstructorKind ck : ConstructorKind.values()) { - compileAndCheck(pk, ck); + for (DiamondKind dk : DiamondKind.values()) { + compileAndCheck(pk, ck, dk); + } } } } - static void compileAndCheck(PackageKind pk, ConstructorKind ck) throws Exception { + static void compileAndCheck(PackageKind pk, ConstructorKind ck, DiamondKind dk) throws Exception { FooClass foo = new FooClass(pk, ck); - ClientClass client = new ClientClass(pk); + ClientClass client = new ClientClass(pk, dk); final JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); ErrorListener el = new ErrorListener(); JavacTask ct = (JavacTask)tool.getTask(null, null, el, null, null, Arrays.asList(foo, client)); ct.analyze(); - if (el.errors > 0 == check(pk, ck)) { + if (el.errors > 0 == check(pk, ck, dk)) { String msg = el.errors > 0 ? "Error compiling files" : "No error when compiling files"; @@ -133,9 +146,10 @@ public class T6996914a { } } - static boolean check(PackageKind pk, ConstructorKind ck) { + static boolean check(PackageKind pk, ConstructorKind ck, DiamondKind dk) { switch (pk) { - case A: return ck == ConstructorKind.PUBLIC; + case A: return ck == ConstructorKind.PUBLIC || + (ck == ConstructorKind.PROTECTED && dk == DiamondKind.ANON); case DEFAULT: return ck != ConstructorKind.PRIVATE; default: throw new AssertionError("Unknown package kind"); } diff --git a/langtools/test/tools/javac/generics/diamond/6996914/T6996914b.java b/langtools/test/tools/javac/generics/diamond/6996914/T6996914b.java index 42339dbb0aa..651ce36a36a 100644 --- a/langtools/test/tools/javac/generics/diamond/6996914/T6996914b.java +++ b/langtools/test/tools/javac/generics/diamond/6996914/T6996914b.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6996914 7020044 + * @bug 6996914 7020044 8062373 * @summary Diamond inference: problem when accessing protected constructor * @compile T6996914b.java */ @@ -35,4 +35,5 @@ class Super { class Test { Super ssi1 = new Super<>(1, "", 2); + Super ssi2 = new Super<>(1, "", 2) {}; } diff --git a/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.java b/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.java index 40a6a8b573e..9793363d9c9 100644 --- a/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.java +++ b/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 8065986 + * @bug 8065986 8062373 * * @summary Compiler fails to NullPointerException when calling super with Object<>() * @compile/fail/ref=T8065986b.out T8065986b.java -XDrawDiagnostics @@ -29,5 +29,12 @@ class T8065986b { this(cond ? o1 : o2); } + T8065986b(int x) { + this(new Object<>() {}); + } + + T8065986b(int x, int y) { + this(new ArrayList<>() {}); + } static void m() { } } diff --git a/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.out b/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.out index 30bcfb6eb65..ec65f48b075 100644 --- a/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.out +++ b/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.out @@ -1,6 +1,8 @@ T8065986b.java:13:24: compiler.err.cant.apply.diamond.1: java.lang.Object, (compiler.misc.diamond.non.generic: java.lang.Object) -T8065986b.java:17:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, java.util.ArrayList,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch))} -T8065986b.java:21:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @435,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch))} -T8065986b.java:25:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @516,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch))} -T8065986b.java:29:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @603,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: java.lang.Object, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch))} -5 errors +T8065986b.java:17:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, java.util.ArrayList,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList, int)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))} +T8065986b.java:21:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @443,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: int))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))} +T8065986b.java:25:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @524,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: int))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))} +T8065986b.java:29:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @611,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: java.lang.Object, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: java.lang.Object, int)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))} +T8065986b.java:33:24: compiler.err.cant.apply.diamond.1: java.lang.Object, (compiler.misc.diamond.non.generic: java.lang.Object) +T8065986b.java:37:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, java.util.ArrayList,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList, int)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(int,int), (compiler.misc.arg.length.mismatch))} +7 errors diff --git a/langtools/test/tools/javac/generics/diamond/MultipleInferenceHooksTest.java b/langtools/test/tools/javac/generics/diamond/MultipleInferenceHooksTest.java new file mode 100644 index 00000000000..af3f943bedc --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/MultipleInferenceHooksTest.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8062373 + * @summary Test that <>(){} works fine without verify error when there are multiple post inference hooks. + */ + +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.Set; + +public class MultipleInferenceHooksTest { + public static void main(String[] args) { + Set result = Collections.newSetFromMap(new IdentityHashMap<>() {}); + } +} diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg01.java b/langtools/test/tools/javac/generics/diamond/neg/Neg01.java index acbb06cd6c2..f0e98394110 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg01.java +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg01.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary Check that diamond fails when inference violates declared bounds * (basic test with nested class, generic/non-generic constructors) @@ -25,5 +25,16 @@ class Neg01 { Neg01 n6 = new Neg01<>("", ""); Neg01 n7 = new Neg01<>("", ""); Foo n8 = new Neg01<>("", ""); + + Neg01 n9 = new Neg01<>("", ""){}; + Neg01 n10 = new Neg01<>("", ""){}; + Neg01 n11 = new Neg01<>("", ""){}; + Neg01 n12 = new Neg01<>("", ""){}; + + Neg01 n13 = new Neg01<>(""){}; + Neg01 n14 = new Neg01<>(""){}; + Neg01 n15 = new Neg01<>(""){}; + Neg01 n16 = new Neg01<>(""){}; + } } diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg01.out b/langtools/test/tools/javac/generics/diamond/neg/Neg01.out index c2bbf4c35b9..4f54718d44e 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg01.out +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg01.out @@ -12,4 +12,18 @@ Neg01.java:25:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01 Neg01.java:26:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null Neg01.java:27:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , (compiler.misc.location: kindname.class, Neg01, null) Neg01.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null -14 errors +Neg01.java:29:15: compiler.err.not.within.bounds: java.lang.String, X +Neg01.java:29:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null +Neg01.java:30:15: compiler.err.not.within.bounds: ? extends java.lang.String, X +Neg01.java:30:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null +Neg01.java:31:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null +Neg01.java:32:15: compiler.err.not.within.bounds: ? super java.lang.String, X +Neg01.java:32:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null +Neg01.java:34:15: compiler.err.not.within.bounds: java.lang.String, X +Neg01.java:34:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null +Neg01.java:35:15: compiler.err.not.within.bounds: ? extends java.lang.String, X +Neg01.java:35:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null +Neg01.java:36:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null +Neg01.java:37:15: compiler.err.not.within.bounds: ? super java.lang.String, X +Neg01.java:37:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null +28 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg02.java b/langtools/test/tools/javac/generics/diamond/neg/Neg02.java index ac4cc2cb998..26ff47d9949 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg02.java +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg02.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary Check that diamond fails when inference violates declared bounds * (test with nested class, qualified/simple type expressions) @@ -26,6 +26,16 @@ class Neg02 { Foo f6 = new Foo<>("", ""); Foo f7 = new Foo<>("", ""); Foo f8 = new Foo<>("", ""); + + Foo f9 = new Foo<>(""){}; + Foo f10 = new Foo<>(""){}; + Foo f11 = new Foo<>(""){}; + Foo f12 = new Foo<>(""){}; + + Foo f13 = new Foo<>("", ""){}; + Foo f14 = new Foo<>("", ""){}; + Foo f15 = new Foo<>("", ""){}; + Foo f16 = new Foo<>("", ""){}; } void testQualified() { @@ -38,5 +48,15 @@ class Neg02 { Foo f6 = new Neg02.Foo<>("", ""); Foo f7 = new Neg02.Foo<>("", ""); Foo f8 = new Neg02.Foo<>("", ""); + + Foo f9 = new Neg02.Foo<>(""){}; + Foo f10 = new Neg02.Foo<>(""){}; + Foo f11 = new Neg02.Foo<>(""){}; + Foo f12 = new Neg02.Foo<>(""){}; + + Foo f13 = new Neg02.Foo<>("", ""){}; + Foo f14 = new Neg02.Foo<>("", ""){}; + Foo f15 = new Neg02.Foo<>("", ""){}; + Foo f16 = new Neg02.Foo<>("", ""){}; } } diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg02.out b/langtools/test/tools/javac/generics/diamond/neg/Neg02.out index 4e3d7d201ce..73126ec1f8d 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg02.out +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg02.out @@ -12,18 +12,46 @@ Neg02.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02 Neg02.java:27:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null Neg02.java:28:13: compiler.err.not.within.bounds: ? super java.lang.String, X Neg02.java:28:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null -Neg02.java:32:13: compiler.err.not.within.bounds: java.lang.String, X -Neg02.java:32:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null -Neg02.java:33:13: compiler.err.not.within.bounds: ? extends java.lang.String, X -Neg02.java:33:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null -Neg02.java:34:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null -Neg02.java:35:13: compiler.err.not.within.bounds: ? super java.lang.String, X -Neg02.java:35:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null -Neg02.java:37:13: compiler.err.not.within.bounds: java.lang.String, X -Neg02.java:37:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null -Neg02.java:38:13: compiler.err.not.within.bounds: ? extends java.lang.String, X -Neg02.java:38:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null -Neg02.java:39:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null -Neg02.java:40:13: compiler.err.not.within.bounds: ? super java.lang.String, X -Neg02.java:40:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null -28 errors +Neg02.java:30:13: compiler.err.not.within.bounds: java.lang.String, X +Neg02.java:30:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:31:13: compiler.err.not.within.bounds: ? extends java.lang.String, X +Neg02.java:31:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:32:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:33:13: compiler.err.not.within.bounds: ? super java.lang.String, X +Neg02.java:33:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:35:13: compiler.err.not.within.bounds: java.lang.String, X +Neg02.java:35:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:36:13: compiler.err.not.within.bounds: ? extends java.lang.String, X +Neg02.java:36:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:37:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:38:13: compiler.err.not.within.bounds: ? super java.lang.String, X +Neg02.java:38:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:42:13: compiler.err.not.within.bounds: java.lang.String, X +Neg02.java:42:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:43:13: compiler.err.not.within.bounds: ? extends java.lang.String, X +Neg02.java:43:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:44:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:45:13: compiler.err.not.within.bounds: ? super java.lang.String, X +Neg02.java:45:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:47:13: compiler.err.not.within.bounds: java.lang.String, X +Neg02.java:47:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:48:13: compiler.err.not.within.bounds: ? extends java.lang.String, X +Neg02.java:48:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:49:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:50:13: compiler.err.not.within.bounds: ? super java.lang.String, X +Neg02.java:50:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:52:13: compiler.err.not.within.bounds: java.lang.String, X +Neg02.java:52:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:53:13: compiler.err.not.within.bounds: ? extends java.lang.String, X +Neg02.java:53:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:54:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:55:13: compiler.err.not.within.bounds: ? super java.lang.String, X +Neg02.java:55:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:57:13: compiler.err.not.within.bounds: java.lang.String, X +Neg02.java:57:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:58:13: compiler.err.not.within.bounds: ? extends java.lang.String, X +Neg02.java:58:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:59:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +Neg02.java:60:13: compiler.err.not.within.bounds: ? super java.lang.String, X +Neg02.java:60:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null +56 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg03.java b/langtools/test/tools/javac/generics/diamond/neg/Neg03.java index 83994b3b42e..54e68129398 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg03.java +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg03.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary Check that diamond fails when inference violates declared bounds * (test with inner class, qualified/simple type expressions) @@ -26,6 +26,16 @@ class Neg03 { Foo f6 = new Foo<>("", ""); Foo f7 = new Foo<>("", ""); Foo f8 = new Foo<>("", ""); + + Foo f9 = new Foo<>(""){}; + Foo f10 = new Foo<>(""){}; + Foo f11 = new Foo<>(""){}; + Foo f12 = new Foo<>(""){}; + + Foo f13 = new Foo<>("", ""){}; + Foo f14 = new Foo<>("", ""){}; + Foo f15 = new Foo<>("", ""){}; + Foo f16 = new Foo<>("", ""){}; } void testQualified_1() { @@ -38,6 +48,16 @@ class Neg03 { Foo f6 = new Neg03.Foo<>("", ""); Foo f7 = new Neg03.Foo<>("", ""); Foo f8 = new Neg03.Foo<>("", ""); + + Foo f9 = new Neg03.Foo<>(""){}; + Foo f10 = new Neg03.Foo<>(""){}; + Foo f11 = new Neg03.Foo<>(""){}; + Foo f12 = new Neg03.Foo<>(""){}; + + Foo f13 = new Neg03.Foo<>("", ""){}; + Foo f14 = new Neg03.Foo<>("", ""){}; + Foo f15 = new Neg03.Foo<>("", ""){}; + Foo f16 = new Neg03.Foo<>("", ""){}; } void testQualified_2(Neg03 n) { @@ -50,5 +70,15 @@ class Neg03 { Foo f6 = n.new Foo<>("", ""); Foo f7 = n.new Foo<>("", ""); Foo f8 = n.new Foo<>("", ""); + + Foo f9 = n.new Foo<>(""){}; + Foo f10 = n.new Foo<>(""){}; + Foo f11 = n.new Foo<>(""){}; + Foo f12 = n.new Foo<>(""){}; + + Foo f13 = n.new Foo<>("", ""){}; + Foo f14 = n.new Foo<>("", ""){}; + Foo f15 = n.new Foo<>("", ""){}; + Foo f16 = n.new Foo<>("", ""){}; } } diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg03.out b/langtools/test/tools/javac/generics/diamond/neg/Neg03.out index b255fca3c99..20ecb6ca326 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg03.out +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg03.out @@ -12,32 +12,74 @@ Neg03.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03 Neg03.java:27:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null Neg03.java:28:13: compiler.err.not.within.bounds: ? super java.lang.String, V Neg03.java:28:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:32:13: compiler.err.not.within.bounds: java.lang.String, V -Neg03.java:32:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:33:13: compiler.err.not.within.bounds: ? extends java.lang.String, V -Neg03.java:33:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:34:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:35:13: compiler.err.not.within.bounds: ? super java.lang.String, V -Neg03.java:35:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:37:13: compiler.err.not.within.bounds: java.lang.String, V -Neg03.java:37:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:38:13: compiler.err.not.within.bounds: ? extends java.lang.String, V -Neg03.java:38:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:39:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:40:13: compiler.err.not.within.bounds: ? super java.lang.String, V -Neg03.java:40:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:44:13: compiler.err.not.within.bounds: java.lang.String, V -Neg03.java:44:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:45:13: compiler.err.not.within.bounds: ? extends java.lang.String, V -Neg03.java:45:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:46:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:47:13: compiler.err.not.within.bounds: ? super java.lang.String, V -Neg03.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:49:13: compiler.err.not.within.bounds: java.lang.String, V -Neg03.java:49:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:50:13: compiler.err.not.within.bounds: ? extends java.lang.String, V -Neg03.java:50:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:51:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -Neg03.java:52:13: compiler.err.not.within.bounds: ? super java.lang.String, V -Neg03.java:52:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null -42 errors +Neg03.java:30:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:30:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:31:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:31:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:32:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:33:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:33:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:35:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:35:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:36:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:36:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:37:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:38:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:38:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:42:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:42:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:43:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:43:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:44:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:45:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:45:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:47:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:47:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:48:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:48:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:49:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:50:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:50:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:52:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:52:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:53:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:53:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:54:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:55:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:55:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:57:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:57:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:58:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:58:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:59:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:60:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:60:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:64:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:64:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:65:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:65:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:66:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:67:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:67:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:69:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:69:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:70:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:70:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:71:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:72:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:72:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:74:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:74:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:75:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:75:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:76:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:77:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:77:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:79:13: compiler.err.not.within.bounds: java.lang.String, V +Neg03.java:79:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:80:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg03.java:80:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:81:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +Neg03.java:82:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg03.java:82:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null +84 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg04.java b/langtools/test/tools/javac/generics/diamond/neg/Neg04.java index 94aa8d638b3..28b01b4de67 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg04.java +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg04.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary Check that diamond fails when inference violates declared bounds * (test with local class, qualified/simple type expressions) @@ -25,5 +25,15 @@ class Neg04 { Foo n6 = new Foo<>("", ""); Foo n7 = new Foo<>("", ""); Foo n8 = new Foo<>("", ""); + + Foo n9 = new Foo<>(""){}; + Foo n10 = new Foo<>(""){}; + Foo n11 = new Foo<>(""){}; + Foo n12 = new Foo<>(""){}; + + Foo n13 = new Foo<>("", ""){}; + Foo n14 = new Foo<>("", ""){}; + Foo n15 = new Foo<>("", ""){}; + Foo n16 = new Foo<>("", ""){}; } } diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg04.out b/langtools/test/tools/javac/generics/diamond/neg/Neg04.out index 656d268015f..d8d7512aee1 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg04.out +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg04.out @@ -12,4 +12,18 @@ Neg04.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), Neg04.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null Neg04.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, V Neg04.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null -14 errors +Neg04.java:29:13: compiler.err.not.within.bounds: java.lang.String, V +Neg04.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null +Neg04.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg04.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null +Neg04.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null +Neg04.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg04.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null +Neg04.java:34:13: compiler.err.not.within.bounds: java.lang.String, V +Neg04.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null +Neg04.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String, V +Neg04.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null +Neg04.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null +Neg04.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String, V +Neg04.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null +28 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg05.java b/langtools/test/tools/javac/generics/diamond/neg/Neg05.java index 53ee397b50f..960f5729cde 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg05.java +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg05.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary Check that usage of rare types doesn't cause spurious diamond diagnostics * @author mcimadamore @@ -25,6 +25,16 @@ class Neg05 { Neg05.Foo f6 = new Neg05.Foo<>("", ""); Neg05.Foo f7 = new Neg05.Foo<>("", ""); Neg05.Foo f8 = new Neg05.Foo<>("", ""); + + Neg05.Foo f9 = new Neg05.Foo<>(""){}; + Neg05.Foo f10 = new Neg05.Foo<>(""){}; + Neg05.Foo f11 = new Neg05.Foo<>(""){}; + Neg05.Foo f12 = new Neg05.Foo<>(""){}; + + Neg05.Foo f13 = new Neg05.Foo<>("", ""){}; + Neg05.Foo f14 = new Neg05.Foo<>("", ""){}; + Neg05.Foo f15 = new Neg05.Foo<>("", ""){}; + Neg05.Foo f16 = new Neg05.Foo<>("", ""){}; } void testRare_2(Neg05 n) { @@ -37,5 +47,15 @@ class Neg05 { Neg05.Foo f6 = n.new Foo<>("", ""); Neg05.Foo f7 = n.new Foo<>("", ""); Neg05.Foo f8 = n.new Foo<>("", ""); + + Neg05.Foo f9 = n.new Foo<>(""){}; + Neg05.Foo f10 = n.new Foo<>(""){}; + Neg05.Foo f11 = n.new Foo<>(""){}; + Neg05.Foo f12 = n.new Foo<>(""){}; + + Neg05.Foo f13 = n.new Foo<>("", ""){}; + Neg05.Foo f14 = n.new Foo<>("", ""){}; + Neg05.Foo f15 = n.new Foo<>("", ""){}; + Neg05.Foo f16 = n.new Foo<>("", ""){}; } } diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg05.out b/langtools/test/tools/javac/generics/diamond/neg/Neg05.out index 7ab2ece7e0e..8f31285f0ef 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg05.out +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg05.out @@ -6,20 +6,52 @@ Neg05.java:24:48: compiler.err.improperly.formed.type.inner.raw.param Neg05.java:25:58: compiler.err.improperly.formed.type.inner.raw.param Neg05.java:26:43: compiler.err.improperly.formed.type.inner.raw.param Neg05.java:27:56: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:31:37: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:31:44: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) -Neg05.java:32:47: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:32:54: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) -Neg05.java:33:32: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:33:39: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) -Neg05.java:34:45: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:34:52: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) -Neg05.java:36:37: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:36:44: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) -Neg05.java:37:47: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:37:54: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) -Neg05.java:38:32: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:38:39: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) -Neg05.java:39:45: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:39:52: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) -24 errors +Neg05.java:29:48: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:29:35: compiler.err.cant.apply.symbol: kindname.constructor, , V, java.lang.String, kindname.class, compiler.misc.anonymous.class: , (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, V)) +Neg05.java:30:59: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:30:46: compiler.err.cant.apply.symbol: kindname.constructor, , V, java.lang.String, kindname.class, compiler.misc.anonymous.class: , (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, V)) +Neg05.java:31:44: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:31:31: compiler.err.cant.apply.symbol: kindname.constructor, , V, java.lang.String, kindname.class, compiler.misc.anonymous.class: , (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, V)) +Neg05.java:32:57: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:32:44: compiler.err.cant.apply.symbol: kindname.constructor, , V, java.lang.String, kindname.class, compiler.misc.anonymous.class: , (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, V)) +Neg05.java:34:49: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:34:36: compiler.err.cant.apply.symbol: kindname.constructor, , V,Z, java.lang.String,java.lang.String, kindname.class, compiler.misc.anonymous.class: , (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.inconvertible.types: java.lang.String, V)) +Neg05.java:35:59: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:35:46: compiler.err.cant.apply.symbol: kindname.constructor, , V,Z, java.lang.String,java.lang.String, kindname.class, compiler.misc.anonymous.class: , (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.inconvertible.types: java.lang.String, V)) +Neg05.java:36:44: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:36:31: compiler.err.cant.apply.symbol: kindname.constructor, , V,Z, java.lang.String,java.lang.String, kindname.class, compiler.misc.anonymous.class: , (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.inconvertible.types: java.lang.String, V)) +Neg05.java:37:57: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:37:44: compiler.err.cant.apply.symbol: kindname.constructor, , V,Z, java.lang.String,java.lang.String, kindname.class, compiler.misc.anonymous.class: , (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.inconvertible.types: java.lang.String, V)) +Neg05.java:41:37: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:41:44: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) +Neg05.java:42:47: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:42:54: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) +Neg05.java:43:32: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:43:39: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) +Neg05.java:44:45: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:44:52: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) +Neg05.java:46:37: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:46:44: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) +Neg05.java:47:47: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:47:54: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) +Neg05.java:48:32: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:48:39: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) +Neg05.java:49:45: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:49:52: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) +Neg05.java:51:37: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:51:44: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) +Neg05.java:52:48: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:52:55: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) +Neg05.java:53:33: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:53:40: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) +Neg05.java:54:46: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:54:53: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V, Neg05.Foo, Neg05.Foo)) +Neg05.java:56:38: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:56:45: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) +Neg05.java:57:48: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:57:55: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) +Neg05.java:58:33: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:58:40: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) +Neg05.java:59:46: compiler.err.improperly.formed.type.inner.raw.param +Neg05.java:59:53: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg05.Foo), (compiler.misc.infer.no.conforming.instance.exists: V,Z, Neg05.Foo, Neg05.Foo)) +56 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg06.java b/langtools/test/tools/javac/generics/diamond/neg/Neg06.java index 73aae17b00e..e4f98dccd6b 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg06.java +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg06.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary Check that diamond works where LHS is supertype of RHS (nilary constructor) * @author mcimadamore @@ -9,9 +9,13 @@ */ class Neg06 { + interface ISuperFoo {} + interface IFoo extends ISuperFoo {} static class CSuperFoo {} static class CFoo extends CSuperFoo {} + ISuperFoo isf = new IFoo<>() {}; CSuperFoo csf1 = new CFoo<>(); + CSuperFoo csf2 = new CFoo<>() {}; } diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg06.out b/langtools/test/tools/javac/generics/diamond/neg/Neg06.out index bf439f78f89..c085b5ebdd6 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg06.out +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg06.out @@ -1,2 +1,6 @@ -Neg06.java:16:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)) -1 error +Neg06.java:18:36: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.IFoo), (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)) +Neg06.java:18:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.anonymous.class: java.lang.Object, Neg06.ISuperFoo) +Neg06.java:19:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)) +Neg06.java:20:37: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number)) +Neg06.java:20:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: compiler.misc.anonymous.class: , Neg06.CSuperFoo) +5 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg07.java b/langtools/test/tools/javac/generics/diamond/neg/Neg07.java index f65bee8e1d8..199a2e861f4 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg07.java +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg07.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary Check that diamond works where LHS is supertype of RHS (1-ary constructor) * @author mcimadamore @@ -15,4 +15,5 @@ class Neg07 { } SuperFoo sf1 = new Foo<>(""); + SuperFoo sf2 = new Foo<>("") {}; } diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg07.out b/langtools/test/tools/javac/generics/diamond/neg/Neg07.out index 59c37899ed0..8bec602bdba 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg07.out +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg07.out @@ -1,2 +1,3 @@ Neg07.java:17:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number) -1 error +Neg07.java:18:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number) +2 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg09.java b/langtools/test/tools/javac/generics/diamond/neg/Neg09.java index 4a85619e45b..729a3f1d10b 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg09.java +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg09.java @@ -1,10 +1,10 @@ /* * @test /nodynamiccopyright/ - * @bug 7020044 + * @bug 7020044 8062373 * - * @summary Check that diamond is not allowed with anonymous inner class expressions + * @summary Check that diamond is not allowed with anonymous inner class expressions at source < 9 * @author Maurizio Cimadamore - * @compile/fail/ref=Neg09.out Neg09.java -XDrawDiagnostics + * @compile/fail/ref=Neg09.out Neg09.java -source 8 -XDrawDiagnostics * */ diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg09.out b/langtools/test/tools/javac/generics/diamond/neg/Neg09.out index 5893555fba8..af5238b72ca 100644 --- a/langtools/test/tools/javac/generics/diamond/neg/Neg09.out +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg09.out @@ -1,5 +1,7 @@ -Neg09.java:17:34: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class: Neg09.Member) -Neg09.java:18:34: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class: Neg09.Nested) -Neg09.java:22:39: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class: Neg09.Member) -Neg09.java:23:40: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class: Neg09.Nested) +- compiler.warn.source.no.bootclasspath: 1.8 +Neg09.java:17:34: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class.not.supported.in.source: 1.8) +Neg09.java:18:34: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class.not.supported.in.source: 1.8) +Neg09.java:22:39: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class.not.supported.in.source: 1.8) +Neg09.java:23:40: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class.not.supported.in.source: 1.8) 4 errors +1 warning diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg12.java b/langtools/test/tools/javac/generics/diamond/neg/Neg12.java new file mode 100644 index 00000000000..526f84626f5 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg12.java @@ -0,0 +1,33 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8062373 + * + * @summary Test diamond + anonymous classes with non-denotable types + * @author mcimadamore + * @compile/fail/ref=Neg12.out Neg12.java -XDrawDiagnostics + * + */ + + class Neg12 { + static class Foo { + Foo(X x) { } + } + + static class DoubleFoo { + DoubleFoo(X x,Y y) { } + } + + static class TripleFoo { + TripleFoo(X x,Y y,Z z) { } + } + + Foo fi = new Foo<>(1); + Foo fw = new Foo<>(fi) {}; // Error. + Foo fw1 = new Foo<>(fi); // OK. + Foo fd = new Foo<>(3.0); + DoubleFoo dw = new DoubleFoo<>(fi,fd) {}; // Error. + DoubleFoo dw1 = new DoubleFoo<>(fi,fd); // OK. + Foo fs = new Foo<>("one"); + TripleFoo tw = new TripleFoo<>(fi,fd,fs) {}; // Error. + TripleFoo tw1 = new TripleFoo<>(fi,fd,fs); // OK. + } diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg12.out b/langtools/test/tools/javac/generics/diamond/neg/Neg12.out new file mode 100644 index 00000000000..aaa54b38073 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg12.out @@ -0,0 +1,4 @@ +Neg12.java:25:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg12.Foo), (compiler.misc.diamond.invalid.arg: Neg12.Foo, (compiler.misc.diamond: Neg12.Foo)) +Neg12.java:28:38: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg12.DoubleFoo), (compiler.misc.diamond.invalid.args: Neg12.Foo,Neg12.Foo, (compiler.misc.diamond: Neg12.DoubleFoo)) +Neg12.java:31:40: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg12.TripleFoo), (compiler.misc.diamond.invalid.args: Neg12.Foo,Neg12.Foo, (compiler.misc.diamond: Neg12.TripleFoo)) +3 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg13.java b/langtools/test/tools/javac/generics/diamond/neg/Neg13.java new file mode 100644 index 00000000000..45c6ecaae98 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg13.java @@ -0,0 +1,49 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8062373 + * + * @summary Test diamond + anonymous classes with abstract super type + * @author sadayapalam + * @compile/fail/ref=Neg13.out Neg13.java -XDrawDiagnostics + * + */ +class Neg13 { + + static abstract class A { + abstract void foo(); + } + + static void foo(A as) {} + + public static void main(String[] args) { + + // Method invocation context - good <>(){} + foo(new A<>() { + public void foo() {} + }); + + // Assignment context - good <>(){} + A aq = new A<>() { + public void foo() {} + }; + + // When the anonymous type subtypes an abstract class but is missing definitions for + // abstract methods, expect no overload resolution error, but an attribution error + // while attributing anonymous class body. + + + // Method invocation context - bad <>(){} + foo(new A<>() { + }); + + // Assignment invocation context - bad <>(){} + aq = new A<>() { + }; + + // Method invocation context - bad <>() + foo(new A<>()); + + // Assignment invocation context - bad <>() + aq = new A<>(); + } +} diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg13.out b/langtools/test/tools/javac/generics/diamond/neg/Neg13.out new file mode 100644 index 00000000000..a179a772a54 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg13.out @@ -0,0 +1,5 @@ +Neg13.java:36:23: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: Neg13$3, foo(), Neg13.A +Neg13.java:40:24: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: Neg13$4, foo(), Neg13.A +Neg13.java:44:13: compiler.err.abstract.cant.be.instantiated: Neg13.A +Neg13.java:47:14: compiler.err.abstract.cant.be.instantiated: Neg13.A +4 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg14.java b/langtools/test/tools/javac/generics/diamond/neg/Neg14.java new file mode 100644 index 00000000000..0ad9114c784 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg14.java @@ -0,0 +1,49 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8062373 + * + * @summary Test diamond + anonymous classes with super type being an interface. + * @author sadayapalam + * @compile/fail/ref=Neg14.out Neg14.java -XDrawDiagnostics + * + */ +class Neg14 { + + static interface A { + void foo(); + } + + static void foo(A as) {} + + public static void main(String[] args) { + + // Method invocation context - good <>(){} + foo(new A<>() { + public void foo() {} + }); + + // Assignment context - good <>(){} + A aq = new A<>() { + public void foo() {} + }; + + // When the anonymous type subtypes an interface but is missing definitions for + // abstract methods, expect no overload resolution error, but an attribution error + // while attributing anonymous class body. + + + // Method invocation context - bad <>(){} + foo(new A<>() { + }); + + // Assignment invocation context - bad <>(){} + aq = new A<>() { + }; + + // Method invocation context - bad <>() + foo(new A<>()); + + // Assignment invocation context - bad <>() + aq = new A<>(); + } +} diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg14.out b/langtools/test/tools/javac/generics/diamond/neg/Neg14.out new file mode 100644 index 00000000000..8b0514018a7 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg14.out @@ -0,0 +1,5 @@ +Neg14.java:36:23: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: Neg14$3, foo(), Neg14.A +Neg14.java:40:24: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: Neg14$4, foo(), Neg14.A +Neg14.java:44:13: compiler.err.abstract.cant.be.instantiated: Neg14.A +Neg14.java:47:14: compiler.err.abstract.cant.be.instantiated: Neg14.A +4 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg15.java b/langtools/test/tools/javac/generics/diamond/neg/Neg15.java new file mode 100644 index 00000000000..2c0d28607fa --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg15.java @@ -0,0 +1,66 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8062373 + * + * @summary Test that javac complains when a <> inferred class contains a public method that does override a supertype method. + * @author sadayapalam + * @compile/fail/ref=Neg15.out Neg15.java -XDrawDiagnostics + * + */ + +class Neg15 { + + interface Predicate { + default boolean test(T t) { + System.out.println("Default method"); + return false; + } + } + + + static void someMethod(Predicate p) { + if (!p.test(null)) + throw new Error("Blew it"); + } + + public static void main(String[] args) { + + someMethod(new Predicate() { + public boolean test(Integer n) { + System.out.println("Override"); + return true; + } + boolean test(Integer n, int i) { + System.out.println("Override"); + return true; + } + protected boolean test(Integer n, int i, int j) { + System.out.println("Override"); + return true; + } + private boolean test(Integer n, int i, long j) { + System.out.println("Override"); + return true; + } + }); + + someMethod(new Predicate<>() { + public boolean test(Integer n) { // bad. + System.out.println("Override"); + return true; + } + boolean test(Integer n, int i) { // bad, package access. + System.out.println("Override"); + return true; + } + protected boolean test(Integer n, int i, int j) { // bad, protected access. + System.out.println("Override"); + return true; + } + private boolean test(Integer n, int i, long j) { // OK, private method. + System.out.println("Override"); + return true; + } + }); + } +} diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg15.out b/langtools/test/tools/javac/generics/diamond/neg/Neg15.out new file mode 100644 index 00000000000..1e6f1efa8ac --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg15.out @@ -0,0 +1,4 @@ +Neg15.java:48:28: compiler.err.method.does.not.override.superclass +Neg15.java:52:21: compiler.err.method.does.not.override.superclass +Neg15.java:56:31: compiler.err.method.does.not.override.superclass +3 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg16.java b/langtools/test/tools/javac/generics/diamond/neg/Neg16.java new file mode 100644 index 00000000000..775c17231d5 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg16.java @@ -0,0 +1,36 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8062373 + * @summary Test that javac does not recommend a diamond site that would result in error. + * @compile/ref=Neg16.out -Xlint:-options Neg16.java -XDrawDiagnostics -XDfind=diamond + */ + +class Neg16 { + + interface Predicate { + default boolean test(T t) { + System.out.println("Default method"); + return false; + } + } + + static void someMethod(Predicate p) { + if (!p.test(null)) + throw new Error("Blew it"); + } + + public static void main(String[] args) { + someMethod(new Predicate() { // cannot convert to diamond + public boolean test(Integer n) { + System.out.println("Override"); + return true; + } + }); + someMethod(new Predicate() { // can convert to diamond. + public boolean test(Number n) { + System.out.println("Override"); + return true; + } + }); + } +} diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg16.out b/langtools/test/tools/javac/generics/diamond/neg/Neg16.out new file mode 100644 index 00000000000..712aa4fba63 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg16.out @@ -0,0 +1,2 @@ +Neg16.java:29:33: compiler.warn.diamond.redundant.args +1 warning diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg17.java b/langtools/test/tools/javac/generics/diamond/neg/Neg17.java new file mode 100644 index 00000000000..960fbd77a63 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg17.java @@ -0,0 +1,21 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8062373 + * @summary Test that the anonymous class constructor appears to returns a Foo, when it actually returns a Anon$1. (status as of now - may change in future) + * @compile/fail/ref=Neg17.out Neg17.java -XDrawDiagnostics + */ + +import java.util.Collections; + +abstract class Neg17 { + + abstract void m(); + + public static void main(String[] args) { + Collections.singletonList(new Neg17<>() { void m() {} }).get(0).m(); // good. + Collections.singletonList(new Neg17<>() { + void m() {} + private void n() {} + }).get(0).n(); // bad unknown method n() + } +} diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg17.out b/langtools/test/tools/javac/generics/diamond/neg/Neg17.out new file mode 100644 index 00000000000..aeb7601d59b --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg17.out @@ -0,0 +1,2 @@ +Neg17.java:19:21: compiler.err.cant.resolve.location.args: kindname.method, n, , , (compiler.misc.location: kindname.class, Neg17, null) +1 error diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg18.java b/langtools/test/tools/javac/generics/diamond/neg/Neg18.java new file mode 100644 index 00000000000..4acb7ef2f09 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg18.java @@ -0,0 +1,16 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8062373 + * @summary Test that inaccessible vararg element type triggers an error during diamond inferred anonymous class instance creation. + * @compile/fail/ref=Neg18.out Neg18.java -XDrawDiagnostics + */ + +import java.util.Collections; +import pkg.Neg18_01; + +class Neg18 { + + public static void main(String[] args) { + new Neg18_01<>() {}; + } +} diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg18.out b/langtools/test/tools/javac/generics/diamond/neg/Neg18.out new file mode 100644 index 00000000000..edbff10f635 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg18.out @@ -0,0 +1,3 @@ +Neg18.java:14:21: compiler.err.prob.found.req: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: pkg.Neg18_01), (compiler.misc.inaccessible.varargs.type: pkg.Neg18_01.PkgPrivate, kindname.class, Neg18)) +Neg18.java:14:26: compiler.err.not.def.public.cant.access: pkg.Neg18_01.PkgPrivate, pkg.Neg18_01 +2 errors diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg19.java b/langtools/test/tools/javac/generics/diamond/neg/Neg19.java new file mode 100644 index 00000000000..173a72a8db9 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg19.java @@ -0,0 +1,21 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8062373 + * @summary Test that when inaccessible types constitute the inferred types of <> the compiler complains. + * @compile/fail/ref=Neg19.out Neg19.java -XDrawDiagnostics + */ + + + +class Neg19 { + public static void main(String[] args) { + new Neg19_01().foo(new Neg19_01<>()); // OK. + new Neg19_01().foo(new Neg19_01<>() {}); // ERROR. + } +} + +class Neg19_01 { + private class Private {} + Neg19_01() {} + void foo(Neg19_01 p) {} +} diff --git a/langtools/test/tools/javac/generics/diamond/neg/Neg19.out b/langtools/test/tools/javac/generics/diamond/neg/Neg19.out new file mode 100644 index 00000000000..aaba880ed1c --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/Neg19.out @@ -0,0 +1,2 @@ +Neg19.java:13:34: compiler.err.report.access: Neg19_01.Private, private, Neg19_01 +1 error diff --git a/langtools/test/tools/javac/generics/diamond/neg/pkg/Neg18_01.java b/langtools/test/tools/javac/generics/diamond/neg/pkg/Neg18_01.java new file mode 100644 index 00000000000..569096025a4 --- /dev/null +++ b/langtools/test/tools/javac/generics/diamond/neg/pkg/Neg18_01.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package pkg; + +public class Neg18_01 { + static class PkgPrivate {} + public Neg18_01 (PkgPrivate ... pp) {} +} diff --git a/langtools/test/tools/javac/generics/diamond/pos/Pos01.java b/langtools/test/tools/javac/generics/diamond/pos/Pos01.java index 1ae7f9bf76b..9a60314f4a8 100644 --- a/langtools/test/tools/javac/generics/diamond/pos/Pos01.java +++ b/langtools/test/tools/javac/generics/diamond/pos/Pos01.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary basic test for diamond (generic/non-generic constructors) * @author mcimadamore @@ -48,7 +48,17 @@ public class Pos01 { Pos01 p6 = new Pos01<>(1, ""); Pos01 p7 = new Pos01<>(1, ""); Pos01 p8 = new Pos01<>(1, ""); - } + + Pos01 p9 = new Pos01<>(1){}; + Pos01 p10 = new Pos01<>(1){}; + Pos01 p11 = new Pos01<>(1){}; + Pos01 p12 = new Pos01<>(1){}; + + Pos01 p13 = new Pos01<>(1, ""){}; + Pos01 p14= new Pos01<>(1, ""){}; + Pos01 p15 = new Pos01<>(1, ""){}; + Pos01 p16 = new Pos01<>(1, ""){}; + } public static void main(String[] args) { Pos01 p1 = new Pos01<>(""); diff --git a/langtools/test/tools/javac/generics/diamond/pos/Pos02.java b/langtools/test/tools/javac/generics/diamond/pos/Pos02.java index 835020c40a1..72800e1814f 100644 --- a/langtools/test/tools/javac/generics/diamond/pos/Pos02.java +++ b/langtools/test/tools/javac/generics/diamond/pos/Pos02.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary basic test for diamond (simple/qualified type-expressions) * @author mcimadamore @@ -48,6 +48,16 @@ public class Pos02 { Foo f6 = new Foo<>(1, ""); Foo f7 = new Foo<>(1, ""); Foo f8 = new Foo<>(1, ""); + + Foo f9 = new Foo<>(1){}; + Foo f10 = new Foo<>(1){}; + Foo f11 = new Foo<>(1){}; + Foo f12 = new Foo<>(1){}; + + Foo f13 = new Foo<>(1, ""){}; + Foo f14 = new Foo<>(1, ""){}; + Foo f15 = new Foo<>(1, ""){}; + Foo f16 = new Foo<>(1, ""){}; } void testQualified() { @@ -60,6 +70,16 @@ public class Pos02 { Foo f6 = new Pos02.Foo<>(1, ""); Foo f7 = new Pos02.Foo<>(1, ""); Foo f8 = new Pos02.Foo<>(1, ""); + + Foo f9 = new Pos02.Foo<>(1){}; + Foo f10 = new Pos02.Foo<>(1){}; + Foo f11 = new Pos02.Foo<>(1){}; + Foo f12 = new Pos02.Foo<>(1){}; + + Foo f13 = new Pos02.Foo<>(1, ""){}; + Foo f14 = new Pos02.Foo<>(1, ""){}; + Foo f15 = new Pos02.Foo<>(1, ""){}; + Foo f16 = new Pos02.Foo<>(1, ""){}; } public static void main(String[] args) { diff --git a/langtools/test/tools/javac/generics/diamond/pos/Pos03.java b/langtools/test/tools/javac/generics/diamond/pos/Pos03.java index 9f975cfc642..aa7fed2f464 100644 --- a/langtools/test/tools/javac/generics/diamond/pos/Pos03.java +++ b/langtools/test/tools/javac/generics/diamond/pos/Pos03.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary basic test for diamond (simple/qualified type-expressions, member inner) * @author mcimadamore @@ -49,6 +49,16 @@ public class Pos03 { Foo f6 = new Foo<>(1, ""); Foo f7 = new Foo<>(1, ""); Foo f8 = new Foo<>(1, ""); + + Foo f9 = new Foo<>(1){}; + Foo f10 = new Foo<>(1){}; + Foo f11 = new Foo<>(1){}; + Foo f12 = new Foo<>(1){}; + + Foo f13 = new Foo<>(1, ""){}; + Foo f14 = new Foo<>(1, ""){}; + Foo f15 = new Foo<>(1, ""){}; + Foo f16 = new Foo<>(1, ""){}; } void testQualified_1() { @@ -61,6 +71,16 @@ public class Pos03 { Foo f6 = new Pos03.Foo<>(1, ""); Foo f7 = new Pos03.Foo<>(1, ""); Foo f8 = new Pos03.Foo<>(1, ""); + + Foo f9 = new Pos03.Foo<>(1){}; + Foo f10 = new Pos03.Foo<>(1){}; + Foo f11 = new Pos03.Foo<>(1){}; + Foo f12 = new Pos03.Foo<>(1){}; + + Foo f13 = new Pos03.Foo<>(1, ""){}; + Foo f14 = new Pos03.Foo<>(1, ""){}; + Foo f15 = new Pos03.Foo<>(1, ""){}; + Foo f16 = new Pos03.Foo<>(1, ""){}; } void testQualified_2(Pos03 p) { @@ -73,6 +93,16 @@ public class Pos03 { Foo f6 = p.new Foo<>(1, ""); Foo f7 = p.new Foo<>(1, ""); Foo f8 = p.new Foo<>(1, ""); + + Foo f9 = p.new Foo<>(1){}; + Foo f10 = p.new Foo<>(1){}; + Foo f11 = p.new Foo<>(1){}; + Foo f12 = p.new Foo<>(1){}; + + Foo f13 = p.new Foo<>(1, ""){}; + Foo f14 = p.new Foo<>(1, ""){}; + Foo f15 = p.new Foo<>(1, ""){}; + Foo f16 = p.new Foo<>(1, ""){}; } public static void main(String[] args) { diff --git a/langtools/test/tools/javac/generics/diamond/pos/Pos04.java b/langtools/test/tools/javac/generics/diamond/pos/Pos04.java index c0a3516f91e..664cfa1ea75 100644 --- a/langtools/test/tools/javac/generics/diamond/pos/Pos04.java +++ b/langtools/test/tools/javac/generics/diamond/pos/Pos04.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary basic test for diamond (simple/qualified type-expressions, local class) * @author mcimadamore @@ -48,6 +48,16 @@ public class Pos04 { Foo p6 = new Foo<>(1, ""); Foo p7 = new Foo<>(1, ""); Foo p8 = new Foo<>(1, ""); + + Foo p9 = new Foo<>(1){}; + Foo p10 = new Foo<>(1){}; + Foo p11 = new Foo<>(1){}; + Foo p12 = new Foo<>(1){}; + + Foo p13 = new Foo<>(1, ""){}; + Foo p14 = new Foo<>(1, ""){}; + Foo p15 = new Foo<>(1, ""){}; + Foo p16 = new Foo<>(1, ""){}; } public static void main(String[] args) { diff --git a/langtools/test/tools/javac/generics/diamond/pos/Pos05.java b/langtools/test/tools/javac/generics/diamond/pos/Pos05.java index 9223ae8f2a7..74fc84cf388 100644 --- a/langtools/test/tools/javac/generics/diamond/pos/Pos05.java +++ b/langtools/test/tools/javac/generics/diamond/pos/Pos05.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,11 +23,10 @@ /* * @test - * @bug 6939620 7020044 + * @bug 6939620 7020044 8062373 * * @summary Check that 'complex' inference sometimes works in method context * @author mcimadamore - * @compile Pos05.java * */ @@ -41,5 +40,11 @@ public class Pos05 { void test() { m(new Foo<>(1)); + m(new Foo<>(1) {}); } + + public static void main(String [] args) { + new Pos05().test(); + } + } diff --git a/langtools/test/tools/javac/generics/inference/8055963/T8055963.java b/langtools/test/tools/javac/generics/inference/8055963/T8055963.java index 82f00275b8d..0d4e12076d5 100644 --- a/langtools/test/tools/javac/generics/inference/8055963/T8055963.java +++ b/langtools/test/tools/javac/generics/inference/8055963/T8055963.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,10 @@ /** * @test - * @bug 8055963 + * @bug 8055963 8062373 * @summary Inference failure with nested invocation - * @compile T8055963.java */ -class T8055963 { +public class T8055963 { static class C {} @@ -38,4 +37,8 @@ class T8055963 { void test() { C cs = choose(new C(), new C<>()); } + + public static void main(String [] args) { + new T8055963().test(); + } } diff --git a/langtools/test/tools/javac/lambda/8066974/T8066974.java b/langtools/test/tools/javac/lambda/8066974/T8066974.java index 8f47277f734..fd8119dd970 100644 --- a/langtools/test/tools/javac/lambda/8066974/T8066974.java +++ b/langtools/test/tools/javac/lambda/8066974/T8066974.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 8066974 + * @bug 8066974 8062373 * @summary Compiler doesn't infer method's generic type information in lambda body * @compile/fail/ref=T8066974.out -XDrawDiagnostics T8066974.java */ @@ -34,11 +34,13 @@ class T8066974 { map(p->p.m(rt)); map(mapper(rt)); map(new ThrowingMapper<>(rt)); + map(new ThrowingMapper<>(rt) {}); } void testChecked(CheckedThrowing ct) { map(p->p.m(ct)); map(mapper(ct)); map(new ThrowingMapper<>(ct)); + map(new ThrowingMapper<>(ct) {}); } } diff --git a/langtools/test/tools/javac/lambda/8066974/T8066974.out b/langtools/test/tools/javac/lambda/8066974/T8066974.out index 59772fc59a4..101a18ac191 100644 --- a/langtools/test/tools/javac/lambda/8066974/T8066974.out +++ b/langtools/test/tools/javac/lambda/8066974/T8066974.out @@ -1,4 +1,5 @@ -T8066974.java:40:19: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception T8066974.java:41:19: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception -T8066974.java:42:13: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception -3 errors +T8066974.java:42:19: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception +T8066974.java:43:13: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception +T8066974.java:44:13: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Exception +4 errors diff --git a/langtools/test/tools/javac/lambda/TargetType46.java b/langtools/test/tools/javac/lambda/TargetType46.java index da371231427..680ff3a7bed 100644 --- a/langtools/test/tools/javac/lambda/TargetType46.java +++ b/langtools/test/tools/javac/lambda/TargetType46.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 8003280 + * @bug 8003280 8062373 * @summary Add lambda tests * compiler doesn't report accessibility problem due to inaccessible target * @compile/fail/ref=TargetType46.out -XDrawDiagnostics TargetType46.java @@ -22,6 +22,7 @@ class TargetType46 { outer.m(()->{}); //access error outer.m(this::g); //access error outer.m(new ArrayList<>()); //ok + outer.m(new ArrayList<>() {}); // access error outer.m(Collections.emptyList()); //ok } diff --git a/langtools/test/tools/javac/lambda/TargetType46.out b/langtools/test/tools/javac/lambda/TargetType46.out index ac3a1254589..30cd7034217 100644 --- a/langtools/test/tools/javac/lambda/TargetType46.out +++ b/langtools/test/tools/javac/lambda/TargetType46.out @@ -1,3 +1,4 @@ TargetType46.java:22:17: compiler.err.report.access: TargetType46Outer.PI, private, TargetType46Outer TargetType46.java:23:17: compiler.err.report.access: TargetType46Outer.PI, private, TargetType46Outer -2 errors +TargetType46.java:25:16: compiler.err.report.access: TargetType46Outer.PI, private, TargetType46Outer +3 errors diff --git a/langtools/test/tools/javac/lambda/TargetType68.java b/langtools/test/tools/javac/lambda/TargetType68.java index 92ce99bd8ad..13cad4f16b0 100644 --- a/langtools/test/tools/javac/lambda/TargetType68.java +++ b/langtools/test/tools/javac/lambda/TargetType68.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,9 @@ /* * @test - * @bug 8010303 + * @bug 8010303 8062373 * @summary Graph inference: missing incorporation step causes spurious inference error - * @compile TargetType68.java + * @compile/fail/ref=TargetType68.out -XDrawDiagnostics TargetType68.java */ import java.util.*; @@ -58,6 +58,6 @@ class TargetType68 { List> data_2 = new ArrayList<>(); numberChart.getData().setAll( Arrays.asList(new XYChart.Series<>("Data", FXCollections.observableList(data_1)), - new XYChart.Series<>("Data", FXCollections.observableList(data_2)))); + new XYChart.Series<>("Data", FXCollections.observableList(data_2)) {})); } } diff --git a/langtools/test/tools/javac/lambda/TargetType68.out b/langtools/test/tools/javac/lambda/TargetType68.out new file mode 100644 index 00000000000..6dd8e49c233 --- /dev/null +++ b/langtools/test/tools/javac/lambda/TargetType68.out @@ -0,0 +1,3 @@ +TargetType68.java:61:32: compiler.err.cant.inherit.from.final: TargetType68.XYChart.Series +TargetType68.java:61:39: compiler.err.cant.inherit.from.final: TargetType68.XYChart.Series +2 errors diff --git a/langtools/test/tools/javac/lambda/TargetType69.java b/langtools/test/tools/javac/lambda/TargetType69.java index 065c1e95fb2..46b7a22ce9b 100644 --- a/langtools/test/tools/javac/lambda/TargetType69.java +++ b/langtools/test/tools/javac/lambda/TargetType69.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8010303 + * @bug 8010303 8062373 * @summary Graph inference: missing incorporation step causes spurious inference error * @compile TargetType69.java */ @@ -47,5 +47,6 @@ class TargetType69 { void test(Function classifier, Function>> coll) { exerciseMapTabulation(coll, new GroupedMapAssertion<>(classifier)); + exerciseMapTabulation(coll, new GroupedMapAssertion<>(classifier) {}); } } diff --git a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/javac/FDTest.java b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/javac/FDTest.java index d63f7734dbf..813c588349f 100644 --- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/javac/FDTest.java +++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/javac/FDTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -108,9 +108,10 @@ public class FDTest { public static List> generateCases() { ArrayList> list = new ArrayList<>(); HierarchyGenerator hg = new HierarchyGenerator(); + int i = 0; for (TestKind tk : TestKind.values()) { for (Hierarchy hs : tk.getHierarchy(hg)) { - list.add(new Pair<>(tk, hs)); + list.add((i++ % 2) == 0 ? new Pair<>(tk, hs) {} : new Pair<>(tk, hs)); } } return list; diff --git a/langtools/test/tools/javac/scope/DupUnsharedTest.java b/langtools/test/tools/javac/scope/DupUnsharedTest.java index 7506648aa85..b60a2d1c7cb 100644 --- a/langtools/test/tools/javac/scope/DupUnsharedTest.java +++ b/langtools/test/tools/javac/scope/DupUnsharedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,7 +68,7 @@ public class DupUnsharedTest { } void runScopeContentTest() throws Exception { - Set expected = Collections.newSetFromMap(new IdentityHashMap<>()); + Set expected = Collections.newSetFromMap(new IdentityHashMap<>() {}); Set notExpected = Collections.newSetFromMap(new IdentityHashMap<>()); WriteableScope s1 = WriteableScope.create(symtab.rootPackage); ClassSymbol acceptSym = symtab.arrayClass; @@ -105,7 +105,7 @@ public class DupUnsharedTest { } Set toSet(Iterable it) { - Set result = Collections.newSetFromMap(new IdentityHashMap<>()); + Set result = Collections.newSetFromMap(new IdentityHashMap<>() {}); for (Symbol sym : it) { result.add(sym); From 68593842f8cc6aa71e6ca59a452a1d90f1a96ad4 Mon Sep 17 00:00:00 2001 From: Srikanth Adayapalam Date: Mon, 23 Mar 2015 09:48:37 +0530 Subject: [PATCH 040/101] 7040592: Gen.java: fix code for handling 'null' literal when expected type is array Eliminate needless checkcast when null is assigned to a multi-dimensional array typedobject Reviewed-by: mcimadamore --- .../classes/com/sun/tools/javac/jvm/Code.java | 8 +- .../classes/com/sun/tools/javac/jvm/Gen.java | 14 ++-- .../CoerceNullToMoreSpecificTypeTest.java | 66 +++++++++++++++++ .../test/tools/javac/T7040592/T7040592.java | 74 +++++++++++++++++++ 4 files changed, 150 insertions(+), 12 deletions(-) create mode 100644 langtools/test/tools/javac/T7040592/CoerceNullToMoreSpecificTypeTest.java create mode 100644 langtools/test/tools/javac/T7040592/T7040592.java diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java index 09459431696..305847f6ac3 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java @@ -497,13 +497,9 @@ public class Code { case aaload: { state.pop(1);// index Type a = state.stack[state.stacksize-1]; + Assert.check(!a.hasTag(BOT)); // null type as is cannot be indexed. state.pop(1); - //sometimes 'null type' is treated as a one-dimensional array type - //see Gen.visitLiteral - we should handle this case accordingly - Type stackType = a.hasTag(BOT) ? - syms.objectType : - types.erasure(types.elemtype(a)); - state.push(stackType); } + state.push(types.erasure(types.elemtype(a))); } break; case goto_: markDead(); diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java index 67f47e6b8e6..402ae13470b 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java @@ -1860,6 +1860,13 @@ public class Gen extends JCTree.Visitor { public void visitAssign(JCAssign tree) { Item l = genExpr(tree.lhs, tree.lhs.type); genExpr(tree.rhs, tree.lhs.type).load(); + if (tree.rhs.type.hasTag(BOT)) { + /* This is just a case of widening reference conversion that per 5.1.5 simply calls + for "regarding a reference as having some other type in a manner that can be proved + correct at compile time." + */ + code.state.forceStackTop(tree.lhs.type); + } result = items.makeAssignItem(l); } @@ -2272,12 +2279,7 @@ public class Gen extends JCTree.Visitor { public void visitLiteral(JCLiteral tree) { if (tree.type.hasTag(BOT)) { code.emitop0(aconst_null); - if (types.dimensions(pt) > 1) { - code.emitop2(checkcast, makeRef(tree.pos(), pt)); - result = items.makeStackItem(pt); - } else { - result = items.makeStackItem(tree.type); - } + result = items.makeStackItem(tree.type); } else result = items.makeImmediateItem(tree.type, tree.value); diff --git a/langtools/test/tools/javac/T7040592/CoerceNullToMoreSpecificTypeTest.java b/langtools/test/tools/javac/T7040592/CoerceNullToMoreSpecificTypeTest.java new file mode 100644 index 00000000000..ba84ef5f795 --- /dev/null +++ b/langtools/test/tools/javac/T7040592/CoerceNullToMoreSpecificTypeTest.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7040592 + * @summary Test that the assertion in State.forceStackTop does not fail at compile time. + */ + +import java.lang.reflect.Field; +import java.util.ArrayList; +import org.w3c.dom.Element; + +public class CoerceNullToMoreSpecificTypeTest { + abstract class NodeImpl { + } + + NodeImpl ownerNode; + + public Element getElement() { + return (Element) (isOwned() ? ownerNode : null); + } + + boolean isOwned() { + return true; + } + + static void processArrays(boolean expectNulls, Object [] nulla, Object [][] nullaa) { + if (expectNulls) { + if (nulla != null || nullaa != null) { + throw new AssertionError("Null actual, but not null formal"); + } + } else { + if (nulla.length != 123 || nullaa.length != 321) + throw new AssertionError("Wrong arrays received"); + } + } + + public static void main(String[] args) { + ArrayList> typeList = new ArrayList<>(); + Field rf = null; + typeList.add((rf != null) ? rf.getType() : null); + processArrays(true, null, null); + processArrays(false, new Object[123], new Object[321][]); + } +} diff --git a/langtools/test/tools/javac/T7040592/T7040592.java b/langtools/test/tools/javac/T7040592/T7040592.java new file mode 100644 index 00000000000..04939cbcc2b --- /dev/null +++ b/langtools/test/tools/javac/T7040592/T7040592.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7040592 + * @summary Verify that null can be assigned freely to array types without a checkcast + */ + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.nio.file.Paths; + +public class T7040592 { + + private static final String assertionErrorMsg = + "null should be assignable to array type without a checkcast"; + + public static void main(String[] args) { + new T7040592().run(); + } + + void run() { + check("-c", Paths.get(System.getProperty("test.classes"), + "T7040592_01.class").toString()); + } + + void check(String... params) { + StringWriter s; + String out; + try (PrintWriter pw = new PrintWriter(s = new StringWriter())) { + com.sun.tools.javap.Main.run(params, pw); + out = s.toString(); + } + if (out.contains("checkcast")) { + throw new AssertionError(assertionErrorMsg); + } + } + +} + +class T7040592_01 { + static void handleArrays(Object [] a, Object [][] b, Object [][][] c) { + } + public static void main(String[] args) { + Object a[]; + Object o = (a = null)[0]; + Object b[][]; + o = (b = null)[0][0]; + Object c[][][]; + o = (c = null)[0][0][0]; + handleArrays(null, null, null); + } +} From 7f727ff4dfd7c2a6cfe47c698ce67a80a254d29d Mon Sep 17 00:00:00 2001 From: Stefan Johansson Date: Tue, 24 Mar 2015 10:24:31 +0100 Subject: [PATCH 041/101] 8075735: Missing include causes minimal build failure Added the missing include. Reviewed-by: jprovino, dholmes, stefank --- hotspot/src/share/vm/runtime/thread.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 622fb5c34bd..7d6596d30ff 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -87,8 +87,9 @@ #include "utilities/defaultStream.hpp" #include "utilities/dtrace.hpp" #include "utilities/events.hpp" -#include "utilities/preserveException.hpp" #include "utilities/macros.hpp" +#include "utilities/preserveException.hpp" +#include "utilities/workgroup.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp" #include "gc_implementation/g1/concurrentMarkThread.inline.hpp" From 8efb3ab7c1cf0164237c50d60c4cd564b3d6a897 Mon Sep 17 00:00:00 2001 From: Mikael Gerdin Date: Tue, 24 Mar 2015 13:49:56 +0100 Subject: [PATCH 042/101] 8075511: Enable -Woverloaded-virtual C++ warning for HotSpot build Reviewed-by: erikj, simonis, ehelin --- hotspot/make/linux/makefiles/gcc.make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make index c1d59e990a0..85aa5c33ded 100644 --- a/hotspot/make/linux/makefiles/gcc.make +++ b/hotspot/make/linux/makefiles/gcc.make @@ -207,7 +207,7 @@ ifeq ($(USE_CLANG), true) WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body endif -WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type +WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual ifeq ($(USE_CLANG),) # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit From 0c57e77d43943d792a62fc80c38817b15ae88b5a Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Tue, 24 Mar 2015 11:21:21 +0100 Subject: [PATCH 043/101] 8075803: Fix GC includes and forward declarations Reviewed-by: pliden, mgerdin --- .../compactibleFreeListSpace.hpp | 4 +++- .../concurrentMarkSweepGeneration.hpp | 5 ++++- .../vm/gc_implementation/g1/concurrentMark.hpp | 1 + .../vm/gc_implementation/g1/g1CollectedHeap.hpp | 1 + .../gc_implementation/parNew/parNewGeneration.hpp | 1 + .../parNew/parOopClosures.inline.hpp | 3 ++- .../gc_implementation/parallelScavenge/pcTasks.cpp | 3 ++- .../parallelScavenge/psMarkSweep.hpp | 4 ++-- .../parallelScavenge/psParallelCompact.hpp | 3 +-- .../vm/gc_implementation/shared/markSweep.cpp | 10 +++++++++- .../vm/gc_implementation/shared/markSweep.hpp | 14 +++++--------- hotspot/src/share/vm/memory/defNewGeneration.hpp | 3 +++ .../share/vm/memory/defNewGeneration.inline.hpp | 4 +++- hotspot/src/share/vm/memory/space.cpp | 1 - hotspot/src/share/vm/oops/cpCache.cpp | 3 --- 15 files changed, 37 insertions(+), 23 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp index 72eecc19fbc..4c6fb3c5b1b 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,9 @@ // space, in this case a CompactibleFreeListSpace. // Forward declarations +class CMSCollector; class CompactibleFreeListSpace; +class ConcurrentMarkSweepGeneration; class BlkClosure; class BlkClosureCareful; class FreeChunk; diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index 98f13cbc258..c316db870e3 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPGENERATION_HPP #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPGENERATION_HPP +#include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp" #include "gc_implementation/shared/gcHeapSummary.hpp" #include "gc_implementation/shared/gSpaceCounters.hpp" #include "gc_implementation/shared/gcStats.hpp" @@ -55,6 +56,7 @@ // means of a sliding mark-compact. class AdaptiveSizePolicy; +class CMSCollector; class CMSConcMarkingTask; class CMSGCAdaptivePolicyCounters; class CMSTracer; @@ -64,6 +66,7 @@ class ConcurrentMarkSweepPolicy; class ConcurrentMarkSweepThread; class CompactibleFreeListSpace; class FreeChunk; +class ParNewGeneration; class PromotionInfo; class ScanMarkedObjectsAgainCarefullyClosure; class TenuredGeneration; diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp index c8783171096..be9773b7991 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp @@ -34,6 +34,7 @@ class G1CollectedHeap; class CMBitMap; class CMTask; +class ConcurrentMark; typedef GenericTaskQueue CMTaskQueue; typedef GenericTaskQueueSet CMTaskQueueSet; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 91b47100797..11955f403af 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -56,6 +56,7 @@ class HRRSCleanupTask; class GenerationSpec; class OopsInHeapRegionClosure; class G1KlassScanClosure; +class G1ParScanThreadState; class ObjectClosure; class SpaceClosure; class CompactibleSpaceClosure; diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp index aa97271ac85..8e81515ed69 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP +#include "gc_implementation/parNew/parOopClosures.hpp" #include "gc_implementation/shared/gcTrace.hpp" #include "gc_implementation/shared/parGCAllocBuffer.hpp" #include "gc_implementation/shared/copyFailedInfo.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp index 9658d59e1e4..93000ce2f84 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ #include "gc_implementation/parNew/parOopClosures.hpp" #include "memory/cardTableRS.hpp" #include "memory/genCollectedHeap.hpp" +#include "memory/genOopClosures.inline.hpp" template inline void ParScanWeakRefClosure::do_oop_work(T* p) { assert (!oopDesc::is_null(*p), "null weak reference?"); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp index bd22eb5574f..c277038c904 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" +#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #include "gc_implementation/parallelScavenge/pcTasks.hpp" #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" #include "gc_implementation/shared/gcTimer.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp index 7b5678db161..2c97a150cb0 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSMARKSWEEP_HPP #include "gc_implementation/shared/collectorCounters.hpp" -#include "gc_implementation/shared/markSweep.inline.hpp" +#include "gc_implementation/shared/markSweep.hpp" #include "utilities/stack.hpp" class PSAdaptiveSizePolicy; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp index c098e455741..d402309851f 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp" #include "gc_implementation/parallelScavenge/psCompactionManager.hpp" #include "gc_implementation/shared/collectorCounters.hpp" -#include "gc_implementation/shared/markSweep.hpp" #include "gc_implementation/shared/mutableSpace.hpp" #include "memory/sharedHeap.hpp" #include "oops/oop.hpp" diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp index 309a955d8a3..01e7e88f5b8 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,6 +84,14 @@ MarkSweep::FollowStackClosure MarkSweep::follow_stack_closure; void MarkSweep::FollowStackClosure::do_void() { follow_stack(); } +void PreservedMark::adjust_pointer() { + MarkSweep::adjust_pointer(&_obj); +} + +void PreservedMark::restore() { + _obj->set_mark(_mark); +} + // We preserve the mark which should be replaced at the end and the location // that it will go. Note that the object that this markOop belongs to isn't // currently at that address but it will be after phase4 diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp index 462643e2f52..37928ea2ac6 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,8 @@ #define SHARE_VM_GC_IMPLEMENTATION_SHARED_MARKSWEEP_HPP #include "gc_interface/collectedHeap.hpp" -#include "memory/universe.hpp" +#include "memory/genOopClosures.hpp" +#include "memory/iterator.hpp" #include "oops/markOop.hpp" #include "oops/oop.hpp" #include "runtime/timer.hpp" @@ -182,13 +183,8 @@ public: _mark = mark; } - void adjust_pointer() { - MarkSweep::adjust_pointer(&_obj); - } - - void restore() { - _obj->set_mark(_mark); - } + void adjust_pointer(); + void restore(); }; #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_MARKSWEEP_HPP diff --git a/hotspot/src/share/vm/memory/defNewGeneration.hpp b/hotspot/src/share/vm/memory/defNewGeneration.hpp index 4e7899eb229..4d12a022359 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.hpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp @@ -29,11 +29,14 @@ #include "gc_implementation/shared/cSpaceCounters.hpp" #include "gc_implementation/shared/generationCounters.hpp" #include "gc_implementation/shared/copyFailedInfo.hpp" +#include "memory/generation.hpp" #include "utilities/stack.hpp" class ContiguousSpace; class ScanClosure; class STWGCTimer; +class CSpaceCounters; +class ScanWeakRefClosure; // DefNewGeneration is a young generation containing eden, from- and // to-space. diff --git a/hotspot/src/share/vm/memory/defNewGeneration.inline.hpp b/hotspot/src/share/vm/memory/defNewGeneration.inline.hpp index d30ad37885d..111db332bab 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.inline.hpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,10 @@ #ifndef SHARE_VM_MEMORY_DEFNEWGENERATION_INLINE_HPP #define SHARE_VM_MEMORY_DEFNEWGENERATION_INLINE_HPP +#include "gc_interface/collectedHeap.hpp" #include "memory/cardTableRS.hpp" #include "memory/defNewGeneration.hpp" +#include "memory/genOopClosures.inline.hpp" #include "memory/space.hpp" // Methods of protected closure types diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index a7ea1b648f0..6e9984f9860 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -26,7 +26,6 @@ #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "gc_implementation/shared/liveRange.hpp" -#include "gc_implementation/shared/markSweep.hpp" #include "gc_implementation/shared/spaceDecorator.hpp" #include "gc_interface/collectedHeap.inline.hpp" #include "memory/blockOffsetTable.inline.hpp" diff --git a/hotspot/src/share/vm/oops/cpCache.cpp b/hotspot/src/share/vm/oops/cpCache.cpp index f9f73d218da..90416b468fc 100644 --- a/hotspot/src/share/vm/oops/cpCache.cpp +++ b/hotspot/src/share/vm/oops/cpCache.cpp @@ -35,9 +35,6 @@ #include "runtime/handles.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "utilities/macros.hpp" -#if INCLUDE_ALL_GCS -# include "gc_implementation/parallelScavenge/psPromotionManager.hpp" -#endif // INCLUDE_ALL_GCS PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC From b980d9390988a1f63e74b1a40b0a3051f4ca428a Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 25 Mar 2015 10:08:09 +0100 Subject: [PATCH 044/101] 8075809: Add missing includes of stack.inline.hpp Reviewed-by: jmasa, pliden --- .../gc_implementation/parallelScavenge/psPromotionManager.cpp | 3 ++- .../share/vm/gc_implementation/parallelScavenge/psTasks.cpp | 1 + hotspot/src/share/vm/memory/genMarkSweep.cpp | 1 + hotspot/src/share/vm/memory/heapInspection.cpp | 1 + hotspot/src/share/vm/oops/klass.cpp | 2 +- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp index 4a6716aefab..33d300fcbb7 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ #include "memory/padded.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/oop.psgc.inline.hpp" +#include "utilities/stack.inline.hpp" PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp index df320d87ff0..e944dfea010 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp @@ -40,6 +40,7 @@ #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" #include "services/management.hpp" +#include "utilities/stack.inline.hpp" #include "utilities/taskqueue.hpp" // diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index eac303540f2..ef2707999f2 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -50,6 +50,7 @@ #include "runtime/vmThread.hpp" #include "utilities/copy.hpp" #include "utilities/events.hpp" +#include "utilities/stack.inline.hpp" void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool clear_all_softrefs) { guarantee(level == 1, "We always collect both old and young."); diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp index 4d8091210b5..c4b5ba787d0 100644 --- a/hotspot/src/share/vm/memory/heapInspection.cpp +++ b/hotspot/src/share/vm/memory/heapInspection.cpp @@ -33,6 +33,7 @@ #include "runtime/os.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" +#include "utilities/stack.inline.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" #endif // INCLUDE_ALL_GCS diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp index 295008dd309..09256c71971 100644 --- a/hotspot/src/share/vm/oops/klass.cpp +++ b/hotspot/src/share/vm/oops/klass.cpp @@ -39,8 +39,8 @@ #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "trace/traceMacros.hpp" -#include "utilities/stack.hpp" #include "utilities/macros.hpp" +#include "utilities/stack.inline.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" From 602b7d79e988f22e274b19ec3fd29782609907e8 Mon Sep 17 00:00:00 2001 From: Stefan Karlsson Date: Wed, 25 Mar 2015 10:13:56 +0100 Subject: [PATCH 045/101] 8075829: Move CSpaceCounters implementation to cSpaceCounters.cpp Reviewed-by: jwilhelm, brutisso --- .../shared/cSpaceCounters.cpp | 19 ++++++++++++++- .../shared/cSpaceCounters.hpp | 23 +++++-------------- hotspot/src/share/vm/memory/space.hpp | 4 ++-- .../src/share/vm/precompiled/precompiled.hpp | 1 - 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.cpp b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.cpp index 0e40ce7ec83..9b371987e1d 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,3 +63,20 @@ CSpaceCounters::CSpaceCounters(const char* name, int ordinal, size_t max_size, _space->capacity(), CHECK); } } + +void CSpaceCounters::update_capacity() { + _capacity->set_value(_space->capacity()); +} + +void CSpaceCounters::update_used() { + _used->set_value(_space->used()); +} + +void CSpaceCounters::update_all() { + update_used(); + update_capacity(); +} + +jlong ContiguousSpaceUsedHelper::take_sample(){ + return _space->used(); +} diff --git a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp index 12d759566ac..e30044bc5e3 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #define SHARE_VM_GC_IMPLEMENTATION_SHARED_CSPACECOUNTERS_HPP #include "gc_implementation/shared/generationCounters.hpp" -#include "memory/space.inline.hpp" +#include "memory/space.hpp" #include "runtime/perfData.hpp" // A CSpaceCounters is a holder class for performance counters @@ -56,18 +56,9 @@ class CSpaceCounters: public CHeapObj { if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space); } - virtual inline void update_capacity() { - _capacity->set_value(_space->capacity()); - } - - virtual inline void update_used() { - _used->set_value(_space->used()); - } - - virtual inline void update_all() { - update_used(); - update_capacity(); - } + virtual void update_capacity(); + virtual void update_used(); + virtual void update_all(); const char* name_space() const { return _name_space; } }; @@ -79,9 +70,7 @@ class ContiguousSpaceUsedHelper : public PerfLongSampleHelper { public: ContiguousSpaceUsedHelper(ContiguousSpace* space) : _space(space) { } - inline jlong take_sample() { - return _space->used(); - } + jlong take_sample(); }; #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_CSPACECOUNTERS_HPP diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index f5649764ffa..61761ba3815 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -195,7 +195,7 @@ class Space: public CHeapObj { // structure supporting these calls, possibly speeding up future calls. // The default implementation, however, is simply to call the const // version. - inline virtual HeapWord* block_start(const void* p); + virtual HeapWord* block_start(const void* p); // Requires "addr" to be the start of a chunk, and returns its size. // "addr + size" is required to be the start of a new chunk, or the end diff --git a/hotspot/src/share/vm/precompiled/precompiled.hpp b/hotspot/src/share/vm/precompiled/precompiled.hpp index a2ae0465c3d..e69fdf460ad 100644 --- a/hotspot/src/share/vm/precompiled/precompiled.hpp +++ b/hotspot/src/share/vm/precompiled/precompiled.hpp @@ -135,7 +135,6 @@ # include "memory/resourceArea.hpp" # include "memory/sharedHeap.hpp" # include "memory/space.hpp" -# include "memory/space.inline.hpp" # include "memory/threadLocalAllocBuffer.hpp" # include "memory/threadLocalAllocBuffer.inline.hpp" # include "memory/universe.hpp" From 9454c8c825ea06d0d093fe8c750372eab161c50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Wed, 25 Mar 2015 17:43:55 +0100 Subject: [PATCH 046/101] 8073868: Regex matching causes java.lang.ArrayIndexOutOfBoundsException: 64 Reviewed-by: attila, lagergren --- .../runtime/regexp/joni/ArrayCompiler.java | 3 - .../runtime/regexp/joni/ByteCodeMachine.java | 24 ---- .../runtime/regexp/joni/StackMachine.java | 114 +----------------- .../regexp/joni/constants/TargetInfo.java | 1 - nashorn/test/script/basic/JDK-8073868.js | 45 +++++++ 5 files changed, 47 insertions(+), 140 deletions(-) create mode 100644 nashorn/test/script/basic/JDK-8073868.js diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java index 0e789333bb7..b343d775297 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java @@ -145,9 +145,6 @@ final class ArrayCompiler extends Compiler { case TargetInfo.IS_EMPTY_MEM: addOpcode(OPCode.NULL_CHECK_END_MEMST); break; - case TargetInfo.IS_EMPTY_REC: - addOpcode(OPCode.NULL_CHECK_END_MEMST_PUSH); - break; default: break; } // switch diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java index 30cfe907af5..dbed5d18285 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java @@ -183,7 +183,6 @@ class ByteCodeMachine extends StackMachine { case OPCode.NULL_CHECK_START: opNullCheckStart(); continue; case OPCode.NULL_CHECK_END: opNullCheckEnd(); continue; case OPCode.NULL_CHECK_END_MEMST: opNullCheckEndMemST(); continue; - case OPCode.NULL_CHECK_END_MEMST_PUSH: opNullCheckEndMemSTPush(); continue; case OPCode.JUMP: opJump(); continue; case OPCode.PUSH: opPush(); continue; @@ -1025,29 +1024,6 @@ class ByteCodeMachine extends StackMachine { } } - // USE_SUBEXP_CALL - private void opNullCheckEndMemSTPush() { - final int mem = code[ip++]; /* mem: null check id */ - - int isNull; - if (Config.USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT) { - isNull = nullCheckMemStRec(mem, s); - } else { - isNull = nullCheckRec(mem, s); - } - - if (isNull != 0) { - if (Config.DEBUG_MATCH) { - Config.log.println("NULL_CHECK_END_MEMST_PUSH: skip id:" + mem + ", s:" + s); - } - - if (isNull == -1) {opFail(); return;} - nullCheckFound(); - } else { - pushNullCheckEnd(mem); - } - } - private void opJump() { ip += code[ip] + 1; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java index fc498c454e8..4cc33baf9bc 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java @@ -19,7 +19,6 @@ */ package jdk.nashorn.internal.runtime.regexp.joni; -import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsAt; import java.lang.ref.WeakReference; import jdk.nashorn.internal.runtime.regexp.joni.constants.StackPopLevel; import jdk.nashorn.internal.runtime.regexp.joni.constants.StackType; @@ -369,118 +368,9 @@ abstract class StackMachine extends Matcher implements StackType { } } - protected final int nullCheckRec(final int id, final int s) { - int level = 0; - int k = stk; - while (true) { - k--; - final StackEntry e = stack[k]; - - if (e.type == NULL_CHECK_START) { - if (e.getNullCheckNum() == id) { - if (level == 0) { - return e.getNullCheckPStr() == s ? 1 : 0; - } - level--; - } - } else if (e.type == NULL_CHECK_END) { - level++; - } - } - } - protected final int nullCheckMemSt(final int id, final int s) { - int k = stk; - int isNull; - while (true) { - k--; - StackEntry e = stack[k]; - - if (e.type == NULL_CHECK_START) { - if (e.getNullCheckNum() == id) { - if (e.getNullCheckPStr() != s) { - isNull = 0; - break; - } - int endp; - isNull = 1; - while (k < stk) { - if (e.type == MEM_START) { - if (e.getMemEnd() == INVALID_INDEX) { - isNull = 0; - break; - } - if (bsAt(regex.btMemEnd, e.getMemNum())) { - endp = stack[e.getMemEnd()].getMemPStr(); - } else { - endp = e.getMemEnd(); - } - if (stack[e.getMemStart()].getMemPStr() != endp) { - isNull = 0; - break; - } else if (endp != s) { - isNull = -1; /* empty, but position changed */ - } - } - k++; - e = stack[k]; // !! - } - break; - } - } - } - return isNull; - } - - protected final int nullCheckMemStRec(final int id, final int s) { - int level = 0; - int k = stk; - int isNull; - while (true) { - k--; - StackEntry e = stack[k]; - - if (e.type == NULL_CHECK_START) { - if (e.getNullCheckNum() == id) { - if (level == 0) { - if (e.getNullCheckPStr() != s) { - isNull = 0; - break; - } - int endp; - isNull = 1; - while (k < stk) { - if (e.type == MEM_START) { - if (e.getMemEnd() == INVALID_INDEX) { - isNull = 0; - break; - } - if (bsAt(regex.btMemEnd, e.getMemNum())) { - endp = stack[e.getMemEnd()].getMemPStr(); - } else { - endp = e.getMemEnd(); - } - if (stack[e.getMemStart()].getMemPStr() != endp) { - isNull = 0; - break; - } else if (endp != s) { - isNull = -1; /* empty, but position changed */ - } - } - k++; - e = stack[k]; - } - break; - } - level--; - } - } else if (e.type == NULL_CHECK_END) { - if (e.getNullCheckNum() == id) { - level++; - } - } - } - return isNull; + // Return -1 here to cause operation to fail + return -nullCheck(id, s); } protected final int getRepeat(final int id) { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java index 8dfb92bd611..5708a397fdc 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java @@ -24,5 +24,4 @@ public interface TargetInfo { final int ISNOT_EMPTY = 0; final int IS_EMPTY = 1; final int IS_EMPTY_MEM = 2; - final int IS_EMPTY_REC = 3; } diff --git a/nashorn/test/script/basic/JDK-8073868.js b/nashorn/test/script/basic/JDK-8073868.js new file mode 100644 index 00000000000..f35fb161eeb --- /dev/null +++ b/nashorn/test/script/basic/JDK-8073868.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8073868: Regex matching causes java.lang.ArrayIndexOutOfBoundsException: 64 + * + * @test + * @run + */ + +function test(input) { + var comma = input.indexOf(","); + Assert.assertEquals(/([^\s]+),(.*)+/.exec(input)[0], input.trimLeft()); + Assert.assertEquals(/([^\s]+),(.*)+/.exec(input)[1], input.substring(0, comma).trimLeft()); + Assert.assertEquals(/([^\s]+),(.*)+/.exec(input)[2], input.substring(comma + 1)); + Assert.assertEquals(/(.*)+/.exec(input)[0], input); + Assert.assertEquals(/(.*)+/.exec(input)[1], input); +} + +test(" xxxx, xxx xxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx "); +test(" xxxx, xxx xxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx "); +test("x, xxxxxxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx "); + +Assert.assertEquals(/(?:\1a|())*/.exec("a")[0], "a"); +Assert.assertEquals(/(?:\1a|())*/.exec("a")[1], undefined); From 87529b486445420ae0f5c320f2c9039b6a97e0ea Mon Sep 17 00:00:00 2001 From: Ed Nevill Date: Wed, 25 Mar 2015 10:24:51 -0700 Subject: [PATCH 047/101] 8075860: aarch64: jdk9/dev fails to build Fix undefined os::Linux::ucontext_set_pc in aarch64 build Reviewed-by: kvn --- .../os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp index 11bd2f7fe31..2d116ef212c 100644 --- a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +++ b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp @@ -116,6 +116,14 @@ address os::Linux::ucontext_get_pc(ucontext_t * uc) { #endif } +void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) { +#ifdef BUILTIN_SIM + uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; +#else + uc->uc_mcontext.pc = (intptr_t)pc; +#endif +} + intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) { #ifdef BUILTIN_SIM return (intptr_t*)uc->uc_mcontext.gregs[REG_SP]; @@ -311,7 +319,7 @@ JVM_handle_linux_signal(int sig, } #else if (StubRoutines::is_safefetch_fault(pc)) { - uc->uc_mcontext.pc = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc)); + os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); return 1; } #endif @@ -432,11 +440,7 @@ JVM_handle_linux_signal(int sig, // save all thread context in case we need to restore it if (thread != NULL) thread->set_saved_exception_pc(pc); -#ifdef BUILTIN_SIM - uc->uc_mcontext.gregs[REG_PC] = (greg_t)stub; -#else - uc->uc_mcontext.pc = (__u64)stub; -#endif + os::Linux::ucontext_set_pc(uc, stub); return true; } From edbd6cb695fe66633c2a0f2ccbef8e4380ca9e08 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Wed, 25 Mar 2015 19:50:00 +0100 Subject: [PATCH 048/101] 8076012: SA don't support flags of type size_t Added support for flags of type size_t in VM.Flags Reviewed-by: sla, kbarrett --- .../classes/sun/jvm/hotspot/runtime/VM.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java index caf06eadf76..ee0b541bdbf 100644 --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java @@ -123,6 +123,7 @@ public class VM { private static Type intxType; private static Type uintxType; + private static Type sizetType; private static CIntegerType boolType; private Boolean sharingEnabled; private Boolean compressedOopsEnabled; @@ -175,7 +176,7 @@ public class VM { public long getIntx() { if (Assert.ASSERTS_ENABLED) { - Assert.that(isIntx(), "not a intx flag!"); + Assert.that(isIntx(), "not an intx flag!"); } return addr.getCIntegerAt(0, intxType.getSize(), false); } @@ -191,6 +192,17 @@ public class VM { return addr.getCIntegerAt(0, uintxType.getSize(), true); } + public boolean isSizet() { + return type.equals("size_t"); + } + + public long getSizet() { + if (Assert.ASSERTS_ENABLED) { + Assert.that(isSizet(), "not a size_t flag!"); + } + return addr.getCIntegerAt(0, sizetType.getSize(), true); + } + public String getValue() { if (isBool()) { return new Boolean(getBool()).toString(); @@ -198,6 +210,8 @@ public class VM { return new Long(getIntx()).toString(); } else if (isUIntx()) { return new Long(getUIntx()).toString(); + } else if (isSizet()) { + return new Long(getSizet()).toString(); } else { return null; } @@ -323,6 +337,7 @@ public class VM { intxType = db.lookupType("intx"); uintxType = db.lookupType("uintx"); + sizetType = db.lookupType("size_t"); boolType = (CIntegerType) db.lookupType("bool"); minObjAlignmentInBytes = getObjectAlignmentInBytes(); From 1eb8d0b847be738c99e34571a6c9f0f6cd731243 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 26 Mar 2015 16:17:30 +0100 Subject: [PATCH 049/101] 8076060: Improve make bootstrap process Reviewed-by: erikj --- Makefile | 218 ++---------- common/autoconf/basics.m4 | 16 +- common/autoconf/configure.ac | 3 +- common/autoconf/generated-configure.sh | 17 +- common/autoconf/spec.gmk.in | 35 +- configure | 3 +- make/Help.gmk | 115 +++++++ make/HotspotWrapper.gmk | 2 +- make/Init.gmk | 229 +++++++++++++ make/InitSupport.gmk | 319 +++++++++++++++++ make/Jprt.gmk | 5 +- make/Main.gmk | 54 ++- make/MainSupport.gmk | 186 ++++++++++ make/MakeHelpers.gmk | 451 ------------------------- make/common/MakeBase.gmk | 73 +++- 15 files changed, 975 insertions(+), 751 deletions(-) create mode 100644 make/Help.gmk create mode 100644 make/Init.gmk create mode 100644 make/InitSupport.gmk create mode 100644 make/MainSupport.gmk delete mode 100644 make/MakeHelpers.gmk diff --git a/Makefile b/Makefile index 825bad1fcb7..2460cd414d8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,200 +23,42 @@ # questions. # -# This must be the first rule -default: +### +### This file is just a very small wrapper needed to run the real make/Init.gmk. +### It also performs some sanity checks on make. +### -# Inclusion of this pseudo-target will cause make to execute this file -# serially, regardless of -j. Recursively called makefiles will not be -# affected, however. This is required for correct dependency management. -.NOTPARALLEL: - -# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make. +# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU Make. # /usr/ccs/bin/make lacks basically every other flow control mechanism. -.TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1 +.TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU Make/gmake, this is a requirement. Check your path. 1>&2 && exit 1 -# Assume we have GNU make, but check version. +# The .FEATURES variable is likely to be unique for GNU Make. +ifeq ($(.FEATURES), ) + $(info Error: '$(MAKE)' does not seem to be GNU Make, which is a requirement.) + $(info Check your path, or upgrade to GNU Make 3.81 or newer.) + $(error Cannot continue) +endif + +# Assume we have GNU Make, but check version. ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), ) - $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.) + $(info Error: This version of GNU Make is too low ($(MAKE_VERSION)).) + $(info Check your path, or upgrade to GNU Make 3.81 or newer.) + $(error Cannot continue) +endif + +# In Cygwin, the MAKE variable gets prepended with the current directory if the +# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe). +ifneq ($(findstring :, $(MAKE)), ) + MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE))) endif # Locate this Makefile -ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) - makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST)) +ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),) + makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST))) else - makefile_path:=$(lastword $(MAKEFILE_LIST)) + makefile_path := $(lastword $(MAKEFILE_LIST)) endif -root_dir:=$(patsubst %/,%,$(dir $(makefile_path))) +topdir := $(strip $(patsubst %/, %, $(dir $(makefile_path)))) -ifeq ($(MAIN_TARGETS), ) - COMMAND_LINE_VARIABLES:=$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))) - MAKE_CONTROL_VARIABLES:=LOG CONF SPEC JOBS TEST IGNORE_OLD_CONFIG - UNKNOWN_COMMAND_LINE_VARIABLES:=$(strip $(filter-out $(MAKE_CONTROL_VARIABLES), $(COMMAND_LINE_VARIABLES))) - ifneq ($(UNKNOWN_COMMAND_LINE_VARIABLES), ) - $(info Note: Command line contains non-control variables: $(UNKNOWN_COMMAND_LINE_VARIABLES).) - $(info Make sure it is not mistyped, and that you intend to override this variable.) - $(info 'make help' will list known control variables) - endif -endif - -ifneq ($(findstring qp,$(MAKEFLAGS)),) - # When called with -qp, assume an external part (e.g. bash completion) is trying - # to understand our targets. - # Duplication of global targets, needed before ParseConfAndSpec in case we have - # no configurations. - help: - # If both CONF and SPEC are unset, look for all available configurations by - # setting CONF to the empty string. - ifeq ($(SPEC), ) - CONF?= - endif -endif - -# ... and then we can include our helper functions -include $(root_dir)/make/MakeHelpers.gmk - -$(eval $(call ParseLogLevel)) -$(eval $(call ParseConfAndSpec)) - -# Now determine if we have zero, one or several configurations to build. -ifeq ($(SPEC),) - # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. -else - # In Cygwin, the MAKE variable gets messed up if the make executable is called with - # a Windows mixed path (c:/cygwin/bin/make.exe). If that's the case, fix it by removing - # the prepended root_dir. - ifneq ($(findstring :, $(MAKE)), ) - MAKE := $(patsubst $(root_dir)%, %, $(MAKE)) - endif - - # We are potentially building multiple configurations. - # First, find out the valid targets - # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find - # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. - all_phony_targets := $(sort $(filter-out $(global_targets), $(strip $(shell \ - cd $(root_dir)/make && $(MAKE) -f Main.gmk -p -q FRC SPEC=$(firstword $(SPEC)) \ - -I $(root_dir)/make/common | grep "^.PHONY:" | head -n 1 | cut -d " " -f 2-)))) - - # Loop through the configurations and call the main-wrapper for each one. The wrapper - # target will execute with a single configuration loaded. - $(all_phony_targets): - @$(if $(TARGET_RUN),,\ - $(foreach spec,$(SPEC),\ - (cd $(root_dir) && $(MAKE) SPEC=$(spec) MAIN_TARGETS="$(call GetRealTarget)" \ - $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) main-wrapper) &&) true) - @echo > /dev/null - $(eval TARGET_RUN=true) - - .PHONY: $(all_phony_targets) - - ifneq ($(MAIN_TARGETS), ) - # The wrapper target was called so we now have a single configuration. Load the spec file - # and call the real Main.gmk. - include $(SPEC) - include $(SRC_ROOT)/make/common/MakeBase.gmk - - ### Clean up from previous run - # Remove any build.log from a previous run, if they exist - ifneq (,$(BUILD_LOG)) - ifneq (,$(BUILD_LOG_PREVIOUS)) - # Rotate old log - $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null) - $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null) - else - $(shell $(RM) $(BUILD_LOG) 2> /dev/null) - endif - $(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null) - endif - # Remove any javac server logs and port files. This - # prevents a new make run to reuse the previous servers. - ifneq (,$(SJAVAC_SERVER_DIR)) - $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*) - endif - - # Split out the targets requiring sequential execution. Run these targets separately - # from the rest so that the rest may still enjoy full parallel execution. - SEQUENTIAL_TARGETS := $(filter dist-clean clean% reconfigure, $(MAIN_TARGETS)) - PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS)) - - main-wrapper: - ifneq ($(SEQUENTIAL_TARGETS), ) - (cd $(SRC_ROOT)/make && $(MAKE) -f Main.gmk SPEC=$(SPEC) -j 1 \ - $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(SEQUENTIAL_TARGETS)) - endif - ifneq ($(PARALLEL_TARGETS), ) - @$(call AtMakeStart) - (cd $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -f Main.gmk SPEC=$(SPEC) -j $(JOBS) \ - $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(PARALLEL_TARGETS) \ - $(if $(filter true, $(OUTPUT_SYNC_SUPPORTED)), -O$(OUTPUT_SYNC))) - @$(call AtMakeEnd) - endif - - .PHONY: main-wrapper - - endif -endif - -# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. -# If you add more global targets, please update the variable global_targets in MakeHelpers. - -# Helper macro to allow $(info) to properly print strings beginning with spaces. -_:= - -help: - $(info ) - $(info OpenJDK Makefile help) - $(info =====================) - $(info ) - $(info Common make targets) - $(info $(_) make [default] # Compile all modules in langtools, hotspot, jdk, jaxws,) - $(info $(_) # jaxp and corba, and create a runnable "exploded" image) - $(info $(_) make all # Compile everything, all repos, docs and images) - $(info $(_) make images # Create complete j2sdk and j2re images) - $(info $(_) make # Build the specified phase and everything it depends on) - $(info $(_) # (gensrc, java, copy, libs, launchers, gendata, rmic)) - $(info $(_) make *-only # Applies to most targets and disables compling the) - $(info $(_) # dependencies for the target. This is faster but may) - $(info $(_) # result in incorrect build results!) - $(info $(_) make docs # Create all docs) - $(info $(_) make docs-javadoc # Create just javadocs, depends on less than full docs) - $(info $(_) make profiles # Create complete j2re compact profile images) - $(info $(_) make bootcycle-images # Build images twice, second time with newly built JDK) - $(info $(_) make install # Install the generated images locally) - $(info $(_) make reconfigure # Rerun configure with the same arguments as last time) - $(info $(_) make help # Give some help on using make) - $(info $(_) make test # Run tests, default is all tests (see TEST below)) - $(info ) - $(info Targets for cleaning) - $(info $(_) make clean # Remove all files generated by make, but not those) - $(info $(_) # generated by configure) - $(info $(_) make dist-clean # Remove all files, including configuration) - $(info $(_) make clean- # Remove the subdir in the output dir with the name) - $(info $(_) make clean- # Remove all build results related to a certain build) - $(info $(_) # phase (gensrc, java, libs, launchers)) - $(info $(_) make clean- # Remove all build results related to a certain module) - $(info $(_) make clean-- # Remove all build results related to a certain) - $(info $(_) # module and phase) - $(info ) - $(info Targets for specific modules) - $(info $(_) make # Build and everything it depends on.) - $(info $(_) make - # Compile the specified phase for the specified module) - $(info $(_) # and everything it depends on) - $(info $(_) # (gensrc, java, copy, libs, launchers, gendata, rmic)) - $(info ) - $(info Make control variables) - $(info $(_) CONF= # Build all configurations (note, assignment is empty)) - $(info $(_) CONF= # Build the configuration(s) with a name matching) - $(info $(_) # ) - $(info $(_) SPEC= # Build the configuration given by the spec file) - $(info $(_) LOG= # Change the log level from warn to ) - $(info $(_) # Available log levels are:) - $(info $(_) # 'warn' (default), 'info', 'debug' and 'trace') - $(info $(_) # To see executed command lines, use LOG=debug) - $(info $(_) JOBS= # Run parallel make jobs) - $(info $(_) # Note that -jN does not work as expected!) - $(info $(_) IGNORE_OLD_CONFIG=true # Skip tests if spec file is up to date) - $(info $(_) make test TEST= # Only run the given test or tests, e.g.) - $(info $(_) # make test TEST="jdk_lang jdk_net") - $(info ) - -.PHONY: help +# ... and then we can include the real makefile +include $(topdir)/make/Init.gmk diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index 422837aae88..2e483b28d77 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -78,7 +78,7 @@ AC_DEFUN([BASIC_PREPEND_TO_PATH], AC_DEFUN([BASIC_FIXUP_PATH], [ # Only process if variable expands to non-empty - + if test "x[$]$1" != x; then if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then BASIC_FIXUP_PATH_CYGWIN($1) @@ -118,7 +118,7 @@ AC_DEFUN([BASIC_FIXUP_PATH], AC_DEFUN([BASIC_FIXUP_EXECUTABLE], [ # Only process if variable expands to non-empty - + if test "x[$]$1" != x; then if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then BASIC_FIXUP_EXECUTABLE_CYGWIN($1) @@ -709,18 +709,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in]) ]) -AC_DEFUN_ONCE([BASIC_SETUP_LOGGING], -[ - # Setup default logging of stdout and stderr to build.log in the output root. - BUILD_LOG='$(OUTPUT_ROOT)/build.log' - BUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old' - BUILD_LOG_WRAPPER='$(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)' - AC_SUBST(BUILD_LOG) - AC_SUBST(BUILD_LOG_PREVIOUS) - AC_SUBST(BUILD_LOG_WRAPPER) -]) - - #%%% Simple tools %%% # Check if we have found a usable version of make diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac index 14497a039ad..29dd14662ca 100644 --- a/common/autoconf/configure.ac +++ b/common/autoconf/configure.ac @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -88,7 +88,6 @@ PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET # Continue setting up basic stuff. Most remaining code require fundamental tools. BASIC_SETUP_PATHS -BASIC_SETUP_LOGGING # Check if it's a pure open build or if custom sources are to be used. JDKOPT_SETUP_OPEN_OR_CUSTOM diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index d7648b21e96..79bab4baf45 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -907,9 +907,6 @@ JVM_VARIANTS JVM_INTERPRETER JDK_VARIANT SET_OPENJDK -BUILD_LOG_WRAPPER -BUILD_LOG_PREVIOUS -BUILD_LOG TOPDIR PATH_SEP ZERO_ARCHDEF @@ -3471,9 +3468,6 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - - #%%% Simple tools %%% # Check if we have found a usable version of make @@ -4369,7 +4363,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1426774983 +DATE_WHEN_GENERATED=1427382753 ############################################################################### # @@ -14401,15 +14395,6 @@ $as_echo "$as_me: The path of TOPDIR, which resolves as \"$path\", is invalid." AUTOCONF_DIR=$TOPDIR/common/autoconf - # Setup default logging of stdout and stderr to build.log in the output root. - BUILD_LOG='$(OUTPUT_ROOT)/build.log' - BUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old' - BUILD_LOG_WRAPPER='$(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)' - - - - - # Check if it's a pure open build or if custom sources are to be used. # Check whether --enable-openjdk-only was given. diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index d21ab83451a..89f070cadb0 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -55,25 +55,12 @@ CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@ # A self-referential reference to this file. SPEC:=@SPEC@ -# Specify where the spec file is. -MAKE_ARGS="SPEC=$(SPEC)" +# What make to use for main processing, after bootstrapping top-level Makefile. +MAKE := @MAKE@ -MAKE:=@MAKE@ - -# Pass along the verbosity and log level settings. -ifeq (,$(findstring VERBOSE=,$(MAKE))) - MAKE:=$(MAKE) $(VERBOSE) VERBOSE="$(VERBOSE)" LOG_LEVEL="$(LOG_LEVEL)" -endif - -# No implicit variables or rules! -ifeq (,$(findstring -R,$(MAKE))) - MAKE:=$(MAKE) -R -endif - -# Specify where the common include directory for makefiles is. -ifeq (,$(findstring -I @TOPDIR@/make/common,$(MAKE))) - MAKE:=$(MAKE) -I @TOPDIR@/make/common -endif +# The default make arguments +MAKE_ARGS = $(MAKE_LOG_FLAGS) -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \ + MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" LOG_LEVEL=$(LOG_LEVEL) OUTPUT_SYNC_SUPPORTED:=@OUTPUT_SYNC_SUPPORTED@ OUTPUT_SYNC:=@OUTPUT_SYNC@ @@ -573,18 +560,6 @@ JTREGEXE:=@JTREGEXE@ XCODEBUILD=@XCODEBUILD@ FIXPATH:=@FIXPATH@ -# Where the build output is stored for your convenience. -BUILD_LOG:=@BUILD_LOG@ -BUILD_LOG_PREVIOUS:=@BUILD_LOG_PREVIOUS@ -# Disable the build log wrapper on sjavac+windows until -# we have solved how to prevent the log wrapper to wait -# for the background sjavac server process. -ifeq (@ENABLE_SJAVAC@X@OPENJDK_BUILD_OS@,yesXwindows) - BUILD_LOG_WRAPPER:= -else - BUILD_LOG_WRAPPER:=@BUILD_LOG_WRAPPER@ -endif - # Build setup ENABLE_JFR=@ENABLE_JFR@ ENABLE_INTREE_EC=@ENABLE_INTREE_EC@ diff --git a/configure b/configure index 4ab8846d575..af0b5b57bd8 100644 --- a/configure +++ b/configure @@ -31,4 +31,5 @@ this_script_dir=`cd $this_script_dir > /dev/null && pwd` # Delegate to wrapper, forcing wrapper to believe $0 is this script by using -c. # This trick is needed to get autoconf to co-operate properly. -bash -c ". $this_script_dir/common/autoconf/configure" $this_script_dir/configure CHECKME $this_script_dir "$@" +# The ${-:+-$-} construction passes on bash options. +bash ${-:+-$-} -c ". $this_script_dir/common/autoconf/configure" $this_script_dir/configure CHECKME $this_script_dir "$@" diff --git a/make/Help.gmk b/make/Help.gmk new file mode 100644 index 00000000000..4f2dae1647b --- /dev/null +++ b/make/Help.gmk @@ -0,0 +1,115 @@ +# +# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +### +### Global targets for printing help etc. +### + +# Helper macro to allow $(info) to properly print strings beginning with spaces. +_:= + +help: + $(info ) + $(info OpenJDK Makefile help) + $(info =====================) + $(info ) + $(info Common make targets) + $(info $(_) make [default] # Compile all modules in langtools, hotspot, jdk, jaxws,) + $(info $(_) # jaxp and corba, and create a runnable "exploded" image) + $(info $(_) make all # Compile everything, all repos, docs and images) + $(info $(_) make images # Create complete jdk and jre images) + $(info $(_) make # Build the specified phase and everything it depends on) + $(info $(_) # (gensrc, java, copy, libs, launchers, gendata, rmic)) + $(info $(_) make *-only # Applies to most targets and disables compling the) + $(info $(_) # dependencies for the target. This is faster but may) + $(info $(_) # result in incorrect build results!) + $(info $(_) make docs # Create all docs) + $(info $(_) make docs-javadoc # Create just javadocs, depends on less than full docs) + $(info $(_) make profiles # Create complete jre compact profile images) + $(info $(_) make bootcycle-images # Build images twice, second time with newly built JDK) + $(info $(_) make install # Install the generated images locally) + $(info $(_) make reconfigure # Rerun configure with the same arguments as last time) + $(info $(_) make help # Give some help on using make) + $(info $(_) make test # Run tests, default is all tests (see TEST below)) + $(info ) + $(info Targets for cleaning) + $(info $(_) make clean # Remove all files generated by make, but not those) + $(info $(_) # generated by configure) + $(info $(_) make dist-clean # Remove all files, including configuration) + $(info $(_) make clean- # Remove the subdir in the output dir with the name) + $(info $(_) make clean- # Remove all build results related to a certain build) + $(info $(_) # phase (gensrc, java, libs, launchers)) + $(info $(_) make clean- # Remove all build results related to a certain module) + $(info $(_) make clean-- # Remove all build results related to a certain) + $(info $(_) # module and phase) + $(info ) + $(info Targets for specific modules) + $(info $(_) make # Build and everything it depends on) + $(info $(_) make - # Compile the specified phase for the specified module) + $(info $(_) # and everything it depends on) + $(info $(_) # (gensrc, java, copy, libs, launchers, gendata, rmic)) + $(info ) + $(info Make control variables) + $(info $(_) CONF= # Build all configurations (note, assignment is empty)) + $(info $(_) CONF= # Build the configuration(s) with a name matching) + $(info $(_) # ) + $(info $(_) SPEC= # Build the configuration given by the spec file) + $(info $(_) LOG= # Change the log level from warn to ) + $(info $(_) # Available log levels are:) + $(info $(_) # 'warn' (default), 'info', 'debug' and 'trace') + $(info $(_) # To see executed command lines, use LOG=debug) + $(info $(_) JOBS= # Run parallel make jobs) + $(info $(_) # Note that -jN does not work as expected!) + $(info $(_) CONF_CHECK= # What to do if spec file is out of date) + $(info $(_) # method is 'auto', 'ignore' or 'fail' (default)) + $(info $(_) make test TEST= # Only run the given test or tests, e.g.) + $(info $(_) # make test TEST="jdk_lang jdk_net") + $(info ) + $(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))),\ + $(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration)) + # We need a dummy rule otherwise make will complain + @true + +print-targets: + $(if $(any_spec_file), ,\ + @echo "Note: More targets will be available when at least one configuration exists." 1>&2\ + ) + @echo $(ALL_TARGETS) + +print-modules: + $(if $(any_spec_file), \ + @$(MAKE) -s -f $(topdir)/make/Main.gmk -I $(topdir)/make/common SPEC=$(any_spec_file) print-modules \ + , \ + @echo print-modules can currently only be run when at least one configuration exists \ + ) + +print-configurations: + $(foreach var, $(all_confs), $(info $(var))) + # We need a dummy rule otherwise make will complain + @true + +ALL_GLOBAL_TARGETS := help print-modules print-targets print-configurations + +.PHONY: $(ALL_GLOBAL_TARGETS) diff --git a/make/HotspotWrapper.gmk b/make/HotspotWrapper.gmk index 0677deb0080..e5ec544abcb 100644 --- a/make/HotspotWrapper.gmk +++ b/make/HotspotWrapper.gmk @@ -42,7 +42,7 @@ HOTSPOT_FILES := $(shell $(FIND) -L $(HOTSPOT_TOPDIR) -name ".hg" -prune -o -pri # not doing it breaks builds on msys. $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES) @$(MKDIR) -p $(HOTSPOT_OUTPUTDIR) - @($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC)) + @($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC)) $(TOUCH) $@ hotspot: $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp diff --git a/make/Init.gmk b/make/Init.gmk new file mode 100644 index 00000000000..7d7fada35ea --- /dev/null +++ b/make/Init.gmk @@ -0,0 +1,229 @@ +# +# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +################################################################################ +# This is the bootstrapping part of the build. This file is included from the +# top level Makefile, and is responsible for launching the Main.gmk file with +# the proper make and the proper make arguments. +################################################################################ + +# This must be the first rule +default: +.PHONY: default + +# Inclusion of this pseudo-target will cause make to execute this file +# serially, regardless of -j. +.NOTPARALLEL: + +# If included from the top-level Makefile then topdir is set, but not when +# recursively calling ourself with a spec. +ifeq ($(topdir),) + topdir := $(strip $(patsubst %/make/, %, $(dir $(lastword $(MAKEFILE_LIST))))) +endif + +# Our helper functions. Will include $(SPEC) if $(HAS_SPEC) is true. +include $(topdir)/make/InitSupport.gmk + +# Here are "global" targets, i.e. targets that can be executed without having a configuration. +# This will define ALL_GLOBAL_TARGETS. +include $(topdir)/make/Help.gmk + +# Extract main targets from Main.gmk. +ifneq ($(any_spec_file), ) + ifeq ($(wildcard $(dir $(any_spec_file))/make-support),) + # If make-support does not exist, we need to build the genmodules java tool first. + $(info Creating data for first make execution in new configuration...) + ignore_output := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \ + -I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true FRC) + $(info Done) + endif + ALL_MAIN_TARGETS := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \ + -I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true print-targets) +else + # Without at least a single valid configuration, we cannot extract any real + # targets. To provide a helpful error message about the missing configuration + # later on, accept whatever targets the user has provided for now. + ALL_MAIN_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default) +endif + +# Targets provided by this file. +ALL_INIT_TARGETS := reconfigure + +ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)) + +ifneq ($(findstring qp, $(MAKEFLAGS)),) + ############################################################################## + # When called with -qp, assume an external part (e.g. bash completion) is trying + # to understand our targets. Just list our targets and do no more checking. + ############################################################################## + + $(ALL_TARGETS): + + .PHONY: $(ALL_TARGETS) + +else ifeq ($(HAS_SPEC),) + + ############################################################################## + # This is the normal case, we have been called from the command line by the + # user and we need to call ourself back with a proper SPEC. + ############################################################################## + + $(eval $(call CheckControlVariables)) + $(eval $(call CheckDeprecatedEnvironment)) + $(eval $(call CheckInvalidMakeFlags)) + + $(eval $(call ParseConfCheckOption)) + + # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS. + $(eval $(call ParseLogLevel)) + + ifneq ($(findstring $(LOG_LEVEL),info debug trace),) + $(info Running make as '$(strip $(MAKE) $(MFLAGS) $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))') + endif + + # CALLED_TARGETS is the list of targets that the user provided, + # or "default" if unspecified. + CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default) + CALLED_SPEC_TARGETS := $(filter $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS), $(CALLED_TARGETS)) + ifneq ($(CALLED_SPEC_TARGETS),) + # We have at least one non-global target, which need a SPEC + $(eval $(call ParseConfAndSpec)) + # Now SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails) + + INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS)) + SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(CALLED_SPEC_TARGETS)) + PARALLEL_TARGETS := $(filter-out $(INIT_TARGETS) $(SEQUENTIAL_TARGETS), $(CALLED_SPEC_TARGETS)) + + # The spec files depend on the autoconf source code. This check makes sure + # the configuration is up to date after changes to configure. + $(SPECS): $(wildcard $(topdir)/common/autoconf/*) + ifeq ($(CONF_CHECK), fail) + @echo "Error: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'." + $(call PrintConfCheckFailed) + @exit 2 + else ifeq ($(CONF_CHECK), auto) + @echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'." + @( cd $(topdir) && \ + $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -f $(topdir)/make/Init.gmk SPEC=$@ HAS_SPEC=true \ + reconfigure ) + else ifeq ($(CONF_CHECK), ignore) + # Do nothing + endif + + # Unless reconfigure is explicitely called, let all targets depend on the spec files to be up to date. + ifeq ($(findstring reconfigure, $(CALLED_SPEC_TARGETS)), ) + $(CALLED_SPEC_TARGETS): $(SPECS) + endif + + # The recipe will be run once for every target specified, but we only want to execute the + # recipe a single time, hence the TARGET_DONE with a dummy command if true. + $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS): + @$(if $(TARGET_DONE), \ + true \ + , \ + $(foreach spec, $(SPECS), \ + ( cd $(topdir) && \ + $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -j 1 -f $(topdir)/make/Init.gmk \ + SPEC=$(spec) HAS_SPEC=true \ + USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \ + LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) \ + INIT_TARGETS="$(INIT_TARGETS)" SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \ + PARALLEL_TARGETS="$(PARALLEL_TARGETS)" \ + main ) && \ + ) true \ + $(eval TARGET_DONE=true) \ + ) + + .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS) + + endif # has $(CALLED_SPEC_TARGETS) + +else # HAS_SPEC=true + + ############################################################################## + # Now we have a spec. This part provides the "main" target that acts as a + # trampoline to call the Main.gmk with the value of $(MAKE) found in the spec + # file. + ############################################################################## + + ifeq ($(LOG_NOFILE), true) + # Disable log wrapper if LOG=[level,]nofile was given + override BUILD_LOG_WRAPPER := + endif + + ifeq ($(OUTPUT_SYNC_SUPPORTED), true) + OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC) + endif + + $(eval $(call CheckSpecSanity)) + + reconfigure: + ifneq ($(CONFIGURE_COMMAND_LINE), ) + $(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'" + else + $(ECHO) "Re-running configure using default settings" + endif + ( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \ + $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) ) + + main-init: + $(call RotateLogFiles) + $(BUILD_LOG_WRAPPER) $(PRINTF) "Building target(s) '$(strip \ + $(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \ + )' in configuration '$(CONF_NAME)'\n" + + + # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls. + # We need to clear it of the init-specific variables. The user-specified + # variables are explicitely propagated using $(USER_MAKE_VARS). + main: MAKEOVERRIDES := + + main: $(INIT_TARGETS) main-init + ifneq ($(SEQUENTIAL_TARGETS), ) + # Don't touch build output dir since we might be cleaning. That means + # no log wrapper. + ( cd $(TOPDIR) && \ + $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ + $(SEQUENTIAL_TARGETS) \ + ) + endif + ifneq ($(PARALLEL_TARGETS), ) + $(call StartGlobalTimer) + $(call PrepareSmartJavac) + ( cd $(TOPDIR) && \ + $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \ + -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \ + $(PARALLEL_TARGETS) \ + ) + $(call CleanupSmartJavac) + $(call StopGlobalTimer) + $(call ReportBuildTimes) + endif + $(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building target(s) '$(strip \ + $(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \ + )' in configuration '$(CONF_NAME)'\n" + + .PHONY: reconfigure main-init main +endif diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk new file mode 100644 index 00000000000..536502acba6 --- /dev/null +++ b/make/InitSupport.gmk @@ -0,0 +1,319 @@ +# +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +################################################################################ +# This file contains helper functions for Init.gmk. +# It is divided in two parts, depending on if a SPEC is present or not +# (HAS_SPEC is true or not). +################################################################################ + +ifndef _INITSUPPORT_GMK +_INITSUPPORT_GMK := 1 + +# Setup information about available configurations, if any. +build_dir=$(topdir)/build +all_spec_files=$(wildcard $(build_dir)/*/spec.gmk) +# Extract the configuration names from the path +all_confs=$(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files))) +any_spec_file=$(firstword $(all_spec_files)) + +ifeq ($(HAS_SPEC),) + ############################################################################## + # Helper functions for the initial part of Init.gmk, before the spec file is + # loaded. Most of these functions provide parsing and setting up make options + # from the command-line. + ############################################################################## + + # Make control variables, handled by Init.gmk + INIT_CONTROL_VARIABLES := LOG CONF SPEC JOBS CONF_CHECK + + # All known make control variables + MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER + + # Define a simple reverse function. + # Should maybe move to MakeBase.gmk, but we can't include that file now. + reverse = \ + $(if $(strip $(1)), $(call reverse, $(wordlist 2, $(words $(1)), $(1)))) \ + $(firstword $(1)) + + # The variable MAKEOVERRIDES contains variable assignments from the command + # line, but in reverse order to what the user entered. + COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES)))) + + # A list like FOO="val1" BAR="val2" containing all user-supplied make variables + # that we should propagate. + USER_MAKE_VARS := $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \ + $(MAKEOVERRIDES)) + + # Check for unknown command-line variables + define CheckControlVariables + command_line_variables := $$(strip $$(foreach var, \ + $$(subst \ ,_,$$(MAKEOVERRIDES)), \ + $$(firstword $$(subst =, , $$(var))))) + unknown_command_line_variables := $$(strip $$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables))) + ifneq ($$(unknown_command_line_variables), ) + $$(info Note: Command line contains non-control variables:) + $$(foreach var, $$(unknown_command_line_variables), $$(info * $$(var)=$$($$(var)))) + $$(info Make sure it is not mistyped, and that you intend to override this variable.) + $$(info 'make help' will list known control variables.) + $$(info ) + endif + endef + + # Check for deprecated ALT_ variables + define CheckDeprecatedEnvironment + defined_alt_variables := $$(filter ALT_%, $$(.VARIABLES)) + ifneq ($$(defined_alt_variables), ) + $$(info Warning: You have the following ALT_ variables set:) + $$(foreach var, $$(defined_alt_variables), $$(info * $$(var)=$$($$(var)))) + $$(info ALT_ variables are deprecated, and may result in a failed build.) + $$(info Please clean your environment.) + $$(info ) + endif + endef + + # Check for invalid make flags like -j + define CheckInvalidMakeFlags + # This is a trick to get this rule to execute before any other rules + # MAKEFLAGS only indicate -j if read in a recipe (!) + $$(topdir)/make/Init.gmk: .FORCE + $$(if $$(findstring --jobserver, $$(MAKEFLAGS)), \ + $$(info Error: 'make -jN' is not supported, use 'make JOBS=N') \ + $$(error Cannot continue) \ + ) + .FORCE: + .PHONY: .FORCE + endef + + # Check that the CONF_CHECK option is valid and set up handling + define ParseConfCheckOption + ifeq ($$(CONF_CHECK), ) + # Default behavior is fail + CONF_CHECK := fail + else ifneq ($$(filter-out auto fail ignore, $$(CONF_CHECK)),) + $$(info Error: CONF_CHECK must be one of: auto, fail or ignore.) + $$(error Cannot continue) + endif + endef + + define ParseLogLevel + # Catch old-style VERBOSE= command lines. + ifneq ($$(origin VERBOSE), undefined) + $$(info Error: VERBOSE is deprecated. Use LOG= instead.) + $$(error Cannot continue) + endif + + # Setup logging according to LOG + + # If the "nofile" argument is given, act on it and strip it away + ifneq ($$(findstring nofile, $$(LOG)),) + LOG_NOFILE := true + # COMMA is defined in spec.gmk, but that is not included yet + COMMA := , + # First try to remove ",nofile" if it exists, otherwise just remove "nofile" + LOG_STRIPPED := $$(subst nofile,, $$(subst $$(COMMA)nofile,, $$(LOG))) + # We might have ended up with a leading comma. Remove it + LOG_LEVEL := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED))) + else + LOG_LEVEL := $$(LOG) + endif + + ifeq ($$(LOG_LEVEL),) + # Set LOG to "warn" as default if not set + LOG_LEVEL := warn + endif + + ifeq ($$(LOG_LEVEL), warn) + MAKE_LOG_FLAGS := -s + else ifeq ($$(LOG_LEVEL), info) + MAKE_LOG_FLAGS := -s + else ifeq ($$(LOG_LEVEL), debug) + MAKE_LOG_FLAGS := + else ifeq ($$(LOG_LEVEL), trace) + MAKE_LOG_FLAGS := -d + else + $$(info Error: LOG must be one of: warn, info, debug or trace.) + $$(error Cannot continue) + endif + endef + + define ParseConfAndSpec + ifneq ($$(origin SPEC), undefined) + # We have been given a SPEC, check that it works out properly + ifneq ($$(origin CONF), undefined) + # We also have a CONF argument. We can't have both. + $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.) + $$(error Cannot continue) + endif + ifeq ($$(wildcard $$(SPEC)),) + $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).) + $$(error Cannot continue) + endif + ifeq ($$(filter /%, $$(SPEC)),) + # If given with relative path, make it absolute + SPECS := $$(CURDIR)/$$(strip $$(SPEC)) + else + SPECS := $$(SPEC) + endif + + # For now, unset this SPEC variable. + override SPEC := + else + # Use spec.gmk files in the build output directory + ifeq ($$(any_spec_file),) + $$(info Error: No configurations found for $$(topdir).) + $$(info Please run 'bash configure' to create a configuration.) + $$(info ) + $$(error Cannot continue) + endif + + ifneq ($$(origin CONF), undefined) + # User have given a CONF= argument. + ifeq ($$(CONF),) + # If given CONF=, match all configurations + matching_confs := $$(strip $$(all_confs)) + else + # Otherwise select those that contain the given CONF string + matching_confs := $$(strip $$(foreach var, $$(all_confs), $$(if $$(findstring $$(CONF), $$(var)), $$(var)))) + endif + ifeq ($$(matching_confs),) + $$(info Error: No configurations found matching CONF=$$(CONF).) + $$(info Available configurations in $$(build_dir):) + $$(foreach var, $$(all_confs), $$(info * $$(var))) + $$(error Cannot continue) + else + ifeq ($$(words $$(matching_confs)), 1) + $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF))) + else + $$(info Building these configurations (matching CONF=$$(CONF)):) + $$(foreach var, $$(matching_confs), $$(info * $$(var))) + endif + endif + + # Create a SPEC definition. This will contain the path to one or more spec.gmk files. + SPECS := $$(addsuffix /spec.gmk, $$(addprefix $$(build_dir)/, $$(matching_confs))) + else + # No CONF or SPEC given, check the available configurations + ifneq ($$(words $$(all_spec_files)), 1) + $$(info Error: No CONF given, but more than one configuration found.) + $$(info Available configurations in $$(build_dir):) + $$(foreach var, $$(all_confs), $$(info * $$(var))) + $$(info Please retry building with CONF= (or SPEC=).) + $$(info ) + $$(error Cannot continue) + endif + + # We found exactly one configuration, use it + SPECS := $$(strip $$(all_spec_files)) + endif + endif + endef + + define PrintConfCheckFailed + @echo ' ' + @echo "Please rerun configure! Easiest way to do this is by running" + @echo "'make reconfigure'." + @echo "This behavior may also be changed using CONF_CHECK=." + @echo ' ' + endef + +else # $(HAS_SPEC)=true + ############################################################################## + # Helper functions for the 'main' target. These functions assume a single, + # proper and existing SPEC is provided, and will load it. + ############################################################################## + + include $(SPEC) + include $(SRC_ROOT)/make/common/MakeBase.gmk + + # Define basic logging setup + BUILD_LOG := $(OUTPUT_ROOT)/build.log + BUILD_TRACE_LOG := $(OUTPUT_ROOT)/build-trace-time.log + + BUILD_LOG_WRAPPER := $(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG) + + # Disable the build log wrapper on sjavac+windows until + # we have solved how to prevent the log wrapper to wait + # for the background sjavac server process. + ifeq ($(ENABLE_SJAVAC)X$(OPENJDK_BUILD_OS),yesXwindows) + LOG_NOFILE := true + endif + + # Sanity check the spec file, so it matches this source code + define CheckSpecSanity + ifneq ($$(topdir), $$(TOPDIR)) + $$(info Error: SPEC mismatch. $$$$(TOPDIR) does not match current directory.) + $$(error Cannot continue) + endif + endef + + define RotateLogFiles + $(RM) $(BUILD_LOG).old 2> /dev/null + $(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true + $(if $(findstring trace, $(LOG_LEVEL)), \ + $(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \ + $(MV) $(BUILD_TRACE_LOG) $(BUILD_TRACE_LOG).old 2> /dev/null || true \ + ) + endef + + # Remove any javac server logs and port files. This + # prevents a new make run to reuse the previous servers. + define PrepareSmartJavac + $(if $(SJAVAC_SERVER_DIR), \ + $(RM) -r $(SJAVAC_SERVER_DIR) 2> /dev/null && \ + $(MKDIR) -p $(SJAVAC_SERVER_DIR) \ + ) + endef + + define CleanupSmartJavac + [ -f $(SJAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping sjavac server && \ + $(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true + endef + + define StartGlobalTimer + $(RM) -r $(BUILDTIMESDIR) 2> /dev/null + $(MKDIR) -p $(BUILDTIMESDIR) + $(call RecordStartTime,TOTAL) + endef + + define StopGlobalTimer + $(call RecordEndTime,TOTAL) + endef + + # Find all build_time_* files and print their contents in a list sorted + # on the name of the sub repository. + define ReportBuildTimes + $(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) -- \ + "----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \ + "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \ + "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \ + "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \ + $(XARGS) $(CAT) | $(SORT) -k 2`" \ + "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" + endef + +endif # HAS_SPEC + +endif # _INITSUPPORT_GMK diff --git a/make/Jprt.gmk b/make/Jprt.gmk index f3f8726c23f..57a7c67b1ca 100644 --- a/make/Jprt.gmk +++ b/make/Jprt.gmk @@ -130,7 +130,4 @@ final-images: all endif @$(call TargetExit) - -########################################################################### -# Phony targets -.PHONY: jprt_bundle bundles final-images +ALL_TARGETS += jprt_bundle bundles final-images diff --git a/make/Main.gmk b/make/Main.gmk index 5a4e0d5c23a..03c84034ba7 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -26,14 +26,19 @@ ################################################################################ # This is the main makefile containing most actual top level targets. It needs # to be called with a SPEC file defined. +################################################################################ # Declare default target default: +ifeq ($(wildcard $(SPEC)),) + $(error Main.gmk needs SPEC set to a proper spec.gmk) +endif + # Now load the spec include $(SPEC) -include $(SRC_ROOT)/make/MakeHelpers.gmk +include $(SRC_ROOT)/make/MainSupport.gmk # Load the vital tools for all the makefiles. include $(SRC_ROOT)/make/common/MakeBase.gmk @@ -588,43 +593,30 @@ dist-clean: clean ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_TEST_TARGETS) \ $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS) -################################################################################ - -# Setup a rule for SPEC file that fails if executed. This check makes sure the -# configuration is up to date after changes to configure. -ifeq ($(findstring reconfigure, $(MAKECMDGOALS)), ) - $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*) - @$(ECHO) "ERROR: $(SPEC) is not up to date." - @$(ECHO) "Please rerun configure! Easiest way to do this is by running" - @$(ECHO) "'make reconfigure'." - @$(ECHO) "It may also be ignored by setting IGNORE_OLD_CONFIG=true" - @if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi -endif - -# The reconfigure target is automatically run serially from everything else -# by the Makefile calling this file. - -reconfigure: - ifneq ($(CONFIGURE_COMMAND_LINE), ) - @$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'" - else - @$(ECHO) "Re-running configure using default settings" - endif - @( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \ - $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) ) - -ALL_TARGETS += reconfigure - ################################################################################ # Declare *-only targets for each normal target $(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t))) -ALL_TARGETS += $(addsuffix -only, $(filter-out clean%, $(ALL_TARGETS))) +ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS))) + +################################################################################ + +# Include JPRT targets +include $(SRC_ROOT)/make/Jprt.gmk + +################################################################################ + +print-targets: + @$(ECHO) $(sort $(ALL_TARGETS)) + +print-modules: + @$(ECHO) $(sort $(ALL_MODULES)) + +# print-* targets intentionally not added to ALL_TARGETS since they are internal only. +# The corresponding external targets are in Help.gmk ################################################################################ .PHONY: $(ALL_TARGETS) -include $(SRC_ROOT)/make/Jprt.gmk - FRC: # Force target diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk new file mode 100644 index 00000000000..aded13eef23 --- /dev/null +++ b/make/MainSupport.gmk @@ -0,0 +1,186 @@ +# +# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +################################################################################ +# This file contains helper functions for Main.gmk. +################################################################################ + +ifndef _MAINSUPPORT_GMK +_MAINSUPPORT_GMK := 1 + +# Run the tests specified by $1. +define RunTests + ($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \ + JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \ + TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \ + ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $1) || true +endef + +# Cleans the dir given as $1 +define CleanDir + @$(PRINTF) "Cleaning $(strip $1) build artifacts ..." + @($(CD) $(OUTPUT_ROOT) && $(RM) -r $1) + @$(PRINTF) " done\n" +endef + +define CleanTest + @$(PRINTF) "Cleaning test $(strip $1) ..." + @$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) + @$(PRINTF) " done\n" +endef + +define Clean-gensrc + @$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..." + @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) + @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1) + @$(PRINTF) " done\n" +endef + +define Clean-java + @$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." + @$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) + @$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1) + @$(PRINTF) " done\n" + @$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." + @$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) + @$(PRINTF) " done\n" +endef + +define Clean-native + @$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..." + @$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) + @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) + @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1) + @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) + @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1) + @$(PRINTF) " done\n" +endef + +define Clean-include + @$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..." + @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1) + @$(PRINTF) " done\n" +endef + +define CleanModule + $(call Clean-gensrc, $1) + $(call Clean-java, $1) + $(call Clean-native, $1) + $(call Clean-include, $1) +endef + + +################################################################################ + +MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR) +MAKE_MAKEDIR_LIST := make + +# Helper macro for DeclareRecipesForPhase +# Declare a recipe for calling the module and phase specific makefile. +# If there are multiple makefiles to call, create a rule for each topdir +# that contains a makefile with the target $module-$suffix-$repodir, +# (i.e: java.base-gensrc-jdk) +# Normally there is only one makefile, and the target will just be +# $module-$suffix +# Param 1: Name of list to add targets to +# Param 2: Module name +# Param 3: Topdir +define DeclareRecipeForModuleMakefile + ifeq ($$($1_MULTIPLE_MAKEFILES), true) + $2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3) + $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $3) + + $2-$$($1_TARGET_SUFFIX)-$$(notdir $3): + else + $2-$$($1_TARGET_SUFFIX): + endif + $(ECHO) $(LOG_INFO) "Building $$@" + ifeq ($$($1_USE_WRAPPER), true) + +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ + -f ModuleWrapper.gmk \ + $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \ + $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ + MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX)) + else + +($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \ + $3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \ + && $(MAKE) $(MAKE_ARGS) \ + -f $$($1_FILE_PREFIX)-$2.gmk \ + $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \ + $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ + MODULE=$2) + endif + +endef + +# Helper macro for DeclareRecipesForPhase +# Param 1: Name of list to add targets to +# Param 2: Module name +define DeclareRecipesForPhaseAndModule + $1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \ + $$(patsubst $$d/%, $$d, $$(filter $$d/%, \ + $$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \ + $$(foreach s, $(MAKE_MAKEDIR_LIST), \ + $$(addsuffix /$$s, $(MAKE_TOPDIR_LIST)))))))))) + + # Only declare recipes if there are makefiles to call + ifneq ($$($1_$2_TOPDIRS), ) + ifeq ($(NO_RECIPES),) + $$(foreach d, $$($1_$2_TOPDIRS), \ + $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d))) + endif + $1 += $2-$$($1_TARGET_SUFFIX) + $1_MODULES += $2 + endif +endef + +# Declare recipes for a specific module and build phase if there are makefiles +# present for the specific combination. +# Param 1: Name of list to add targets to +# Named params: +# TARGET_SUFFIX : Suffix of target to create for recipe +# MAKE_SUBDIR : Subdir for this build phase +# FILE_PREFIX : File prefix for this build phase +# USE_WRAPPER : Set to true to use ModuleWrapper.gmk +# CHECK_MODULES : List of modules to try +# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in +# phase in multiple repos +# Exported variables: +# $1_MODULES : All modules that had rules generated +# $1_TARGETS : All targets generated +define DeclareRecipesForPhase + $(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE)) + $(if $(8),$(error Internal makefile error: Too many arguments to \ + DeclareRecipesForPhase, please update MakeHelper.gmk)) + + $$(foreach m, $$($(strip $1)_CHECK_MODULES), \ + $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m))) + + $(strip $1)_TARGETS := $$($(strip $1)) +endef + +################################################################################ + +endif # _MAINSUPPORT_GMK diff --git a/make/MakeHelpers.gmk b/make/MakeHelpers.gmk deleted file mode 100644 index 2de3b9cb03c..00000000000 --- a/make/MakeHelpers.gmk +++ /dev/null @@ -1,451 +0,0 @@ -# -# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -################################################################ -# -# This file contains helper functions for the top-level Makefile that does -# not depend on the spec.gmk file having been read. (The purpose of this -# file is ju to avoid cluttering the top-level Makefile.) -# -################################################################ - -ifndef _MAKEHELPERS_GMK -_MAKEHELPERS_GMK := 1 - -############################## -# Stuff to run at include time -############################## - -# Find out which variables were passed explicitely on the make command line. These -# will be passed on to sub-makes, overriding spec.gmk settings. -MAKE_ARGS=$(foreach var,$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))),$(var)="$($(var))") - -list_alt_overrides_with_origins=$(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var))))) -list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins))) - -# Store the build times in this directory. -BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times - -# Global targets are possible to run either with or without a SPEC. The prototypical -# global target is "help". -global_targets=help - -############################## -# Functions -############################## - -define CheckEnvironment - # Find all environment or command line variables that begin with ALT. - $(if $(list_alt_overrides), - @$(PRINTF) "\nWARNING: You have the following ALT_ variables set:\n" - @$(PRINTF) "$(foreach var,$(list_alt_overrides),$(var)=$$$(var))\n" - @$(PRINTF) "ALT_ variables are deprecated and will be ignored. Please clean your environment.\n\n" - ) -endef - -### Functions for timers - -# Record starting time for build of a sub repository. -define RecordStartTime - $(MKDIR) -p $(BUILDTIMESDIR) - $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1 - $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable -endef - -# Record ending time and calculate the difference and store it in a -# easy to read format. Handles builds that cross midnight. Expects -# that a build will never take 24 hours or more. -define RecordEndTime - $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1 - $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable - $(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \ - $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \ - M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \ - > $(BUILDTIMESDIR)/build_time_diff_$1 -endef - -# Find all build_time_* files and print their contents in a list sorted -# on the name of the sub repository. -define ReportBuildTimes - $(BUILD_LOG_WRAPPER) $(PRINTF) -- "----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \ - "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \ - "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \ - "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \ - "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" -endef - -define ResetAllTimers - $$(shell $(MKDIR) -p $(BUILDTIMESDIR) && $(RM) $(BUILDTIMESDIR)/build_time_*) -endef - -define StartGlobalTimer - $(call RecordStartTime,TOTAL) -endef - -define StopGlobalTimer - $(call RecordEndTime,TOTAL) -endef - -### Functions for managing makefile structure (start/end of makefile and individual targets) - -# Do not indent this function, this will add whitespace at the start which the caller won't handle -define GetRealTarget -$(strip $(if $(findstring main-wrapper, $(MAKECMDGOALS)), $(MAIN_TARGETS), \ - $(if $(MAKECMDGOALS),$(MAKECMDGOALS),default))) -endef - -# Do not indent this function, this will add whitespace at the start which the caller won't handle -define LastGoal -$(strip $(lastword $(call GetRealTarget))) -endef - -# Check if the current target is the final target, as specified by -# the user on the command line. If so, call AtRootMakeEnd. -define CheckIfMakeAtEnd - # Check if the current target is the last goal - $(if $(filter $@,$(call LastGoal)),$(call AtMakeEnd)) - # If the target is 'foo-only', check if our goal was stated as 'foo' - $(if $(filter $@,$(call LastGoal)-only),$(call AtMakeEnd)) -endef - -# Hook to be called when starting to execute a top-level target -define TargetEnter - $(PRINTF) "## Starting $(patsubst %-only,%,$@)\n" - $(call RecordStartTime,$(patsubst %-only,%,$@)) -endef - -# Hook to be called when finish executing a top-level target -define TargetExit - $(call RecordEndTime,$(patsubst %-only,%,$@)) - $(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \ - "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d ' '`" -endef - -# Hook to be called as the very first thing when running a normal build -define AtMakeStart - $(if $(findstring --jobserver,$(MAKEFLAGS)),$(error make -j is not supported, use make JOBS=n)) - $(call CheckEnvironment) - $(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) "Running make as '$(MAKE) $(MFLAGS) $(MAKE_ARGS)'\n" - $(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(PRODUCT_NAME) for target '$(call GetRealTarget)' in configuration '$(CONF_NAME)'\n\n" - $(call StartGlobalTimer) -endef - -# Hook to be called as the very last thing for targets that are "top level" targets -define AtMakeEnd - [ -f $(SJAVAC_SERVER_DIR)/server.port ] && echo Stopping sjavac server && $(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true - $(call StopGlobalTimer) - $(call ReportBuildTimes) - @$(PRINTF) "\nFinished building $(PRODUCT_NAME) for target '$(call GetRealTarget)'\n" - $(call CheckEnvironment) -endef - -### Functions for parsing and setting up make options from command-line - -define FatalError - # If the user specificed a "global" target (e.g. 'help'), do not exit but continue running - $$(if $$(filter-out $(global_targets),$$(call GetRealTarget)),$$(error Cannot continue)) -endef - -define ParseLogLevel - ifeq ($$(origin VERBOSE),undefined) - # Setup logging according to LOG (but only if VERBOSE is not given) - - # If the "nofile" argument is given, act on it and strip it away - ifneq ($$(findstring nofile,$$(LOG)),) - # Reset the build log wrapper, regardless of other values - override BUILD_LOG_WRAPPER= - # COMMA is defined in spec.gmk, but that is not included yet - COMMA=, - # First try to remove ",nofile" if it exists - LOG_STRIPPED1=$$(subst $$(COMMA)nofile,,$$(LOG)) - # Otherwise just remove "nofile" - LOG_STRIPPED2=$$(subst nofile,,$$(LOG_STRIPPED1)) - # We might have ended up with a leading comma. Remove it - LOG_STRIPPED3=$$(strip $$(patsubst $$(COMMA)%,%,$$(LOG_STRIPPED2))) - LOG_LEVEL:=$$(LOG_STRIPPED3) - else - LOG_LEVEL:=$$(LOG) - endif - - ifeq ($$(LOG_LEVEL),) - # Set LOG to "warn" as default if not set (and no VERBOSE given) - override LOG_LEVEL=warn - endif - ifeq ($$(LOG_LEVEL),warn) - VERBOSE=-s - else ifeq ($$(LOG_LEVEL),info) - VERBOSE=-s - else ifeq ($$(LOG_LEVEL),debug) - VERBOSE= - else ifeq ($$(LOG_LEVEL),trace) - VERBOSE= - else - $$(info Error: LOG must be one of: warn, info, debug or trace.) - $$(eval $$(call FatalError)) - endif - else - # Provide resonable interpretations of LOG_LEVEL if VERBOSE is given. - ifeq ($(VERBOSE),) - LOG_LEVEL:=debug - else - LOG_LEVEL:=warn - endif - ifneq ($$(LOG),) - # We have both a VERBOSE and a LOG argument. This is OK only if this is a repeated call by ourselves, - # but complain if this is the top-level make call. - ifeq ($$(MAKELEVEL),0) - $$(info Cannot use LOG=$$(LOG) and VERBOSE=$$(VERBOSE) at the same time. Choose one.) - $$(eval $$(call FatalError)) - endif - endif - endif -endef - -define ParseConfAndSpec - ifneq ($$(filter-out $(global_targets),$$(call GetRealTarget)),) - # If we only have global targets, no need to bother with SPEC or CONF - ifneq ($$(origin SPEC),undefined) - # We have been given a SPEC, check that it works out properly - ifneq ($$(origin CONF),undefined) - # We also have a CONF argument. This is OK only if this is a repeated call by ourselves, - # but complain if this is the top-level make call. - ifeq ($$(MAKELEVEL),0) - $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.) - $$(eval $$(call FatalError)) - endif - endif - ifeq ($$(wildcard $$(SPEC)),) - $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).) - $$(eval $$(call FatalError)) - endif - # ... OK, we're satisfied, we'll use this SPEC later on - else - # Find all spec.gmk files in the build output directory - output_dir=$$(root_dir)/build - all_spec_files=$$(wildcard $$(output_dir)/*/spec.gmk) - ifeq ($$(all_spec_files),) - $$(info Error: No configurations found for $$(root_dir).) - $$(info Please run 'bash configure' to create a configuration.) - $$(eval $$(call FatalError)) - endif - # Extract the configuration names from the path - all_confs=$$(patsubst %/spec.gmk,%,$$(patsubst $$(output_dir)/%,%,$$(all_spec_files))) - - ifneq ($$(origin CONF),undefined) - # User have given a CONF= argument. - ifeq ($$(CONF),) - # If given CONF=, match all configurations - matching_confs=$$(strip $$(all_confs)) - else - # Otherwise select those that contain the given CONF string - matching_confs=$$(strip $$(foreach var,$$(all_confs),$$(if $$(findstring $$(CONF),$$(var)),$$(var)))) - endif - ifeq ($$(matching_confs),) - $$(info Error: No configurations found matching CONF=$$(CONF).) - $$(info Available configurations in $$(output_dir):) - $$(foreach var,$$(all_confs),$$(info * $$(var))) - $$(eval $$(call FatalError)) - else - ifeq ($$(words $$(matching_confs)),1) - $$(info Building '$$(matching_confs)' (matching CONF=$$(CONF))) - else - $$(info Building target '$(call GetRealTarget)' in these configurations (matching CONF=$$(CONF)):) - $$(foreach var,$$(matching_confs),$$(info * $$(var))) - endif - endif - - # Create a SPEC definition. This will contain the path to one or more spec.gmk files. - SPEC=$$(addsuffix /spec.gmk,$$(addprefix $$(output_dir)/,$$(matching_confs))) - else - # No CONF or SPEC given, check the available configurations - ifneq ($$(words $$(all_spec_files)),1) - $$(info Error: No CONF given, but more than one configuration found.) - $$(info Available configurations in $$(output_dir):) - $$(foreach var,$$(all_confs),$$(info * $$(var))) - $$(info Please retry building with CONF= (or SPEC=).) - $$(eval $$(call FatalError)) - endif - - # We found exactly one configuration, use it - SPEC=$$(strip $$(all_spec_files)) - endif - endif - endif -endef - -### Convenience functions from Main.gmk - -# Run the tests specified by $1. -define RunTests - ($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \ - JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \ - TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \ - ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $1) || true -endef - -# Cleans the dir given as $1 -define CleanDir - @$(PRINTF) "Cleaning $(strip $1) build artifacts ..." - @($(CD) $(OUTPUT_ROOT) && $(RM) -r $1) - @$(PRINTF) " done\n" -endef - -define CleanTest - @$(PRINTF) "Cleaning test $(strip $1) ..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) - @$(PRINTF) " done\n" -endef - -define Clean-gensrc - @$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1) - @$(PRINTF) " done\n" -endef - -define Clean-java - @$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." - @$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1) - @$(PRINTF) " done\n" - @$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) - @$(PRINTF) " done\n" -endef - -define Clean-native - @$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1) - @$(PRINTF) " done\n" -endef - -define Clean-include - @$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1) - @$(PRINTF) " done\n" -endef - -define CleanModule - $(call Clean-gensrc, $1) - $(call Clean-java, $1) - $(call Clean-native, $1) - $(call Clean-include, $1) -endef - - -################################################################################ - -MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR) -MAKE_MAKEDIR_LIST := make - -# Helper macro for DeclareRecipesForPhase -# Declare a recipe for calling the module and phase specific makefile. -# If there are multiple makefiles to call, create a rule for each topdir -# that contains a makefile with the target $module-$suffix-$repodir, -# (i.e: java.base-gensrc-jdk) -# Normally there is only one makefile, and the target will just be -# $module-$suffix -# Param 1: Name of list to add targets to -# Param 2: Module name -# Param 3: Topdir -define DeclareRecipeForModuleMakefile - ifeq ($$($1_MULTIPLE_MAKEFILES), true) - $2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3) - $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $3) - - $2-$$($1_TARGET_SUFFIX)-$$(notdir $3): - else - $2-$$($1_TARGET_SUFFIX): - endif - $(ECHO) $(LOG_INFO) "Building $$@" - ifeq ($$($1_USE_WRAPPER), true) - +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \ - -f ModuleWrapper.gmk \ - $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \ - $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ - MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX)) - else - +($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \ - $3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \ - && $(MAKE) $(MAKE_ARGS) \ - -f $$($1_FILE_PREFIX)-$2.gmk \ - $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \ - $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \ - MODULE=$2) - endif - -endef - -# Helper macro for DeclareRecipesForPhase -# Param 1: Name of list to add targets to -# Param 2: Module name -define DeclareRecipesForPhaseAndModule - $1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \ - $$(patsubst $$d/%, $$d, $$(filter $$d/%, \ - $$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \ - $$(foreach s, $(MAKE_MAKEDIR_LIST), \ - $$(addsuffix /$$s, $(MAKE_TOPDIR_LIST)))))))))) - - # Only declare recipes if there are makefiles to call - ifneq ($$($1_$2_TOPDIRS), ) - $$(foreach d, $$($1_$2_TOPDIRS), \ - $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d))) - $1 += $2-$$($1_TARGET_SUFFIX) - $1_MODULES += $2 - endif -endef - -# Declare recipes for a specific module and build phase if there are makefiles -# present for the specific combination. -# Param 1: Name of list to add targets to -# Named params: -# TARGET_SUFFIX : Suffix of target to create for recipe -# MAKE_SUBDIR : Subdir for this build phase -# FILE_PREFIX : File prefix for this build phase -# USE_WRAPPER : Set to true to use ModuleWrapper.gmk -# CHECK_MODULES : List of modules to try -# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in -# phase in multiple repos -# Exported variables: -# $1_MODULES : All modules that had rules generated -# $1_TARGETS : All targets generated -define DeclareRecipesForPhase - $(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE)) - $(if $(8),$(error Internal makefile error: Too many arguments to \ - DeclareRecipesForPhase, please update MakeHelper.gmk)) - - $$(foreach m, $$($(strip $1)_CHECK_MODULES), \ - $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m))) - - $(strip $1)_TARGETS := $$($(strip $1)) -endef - -################################################################################ - -endif # _MAKEHELPERS_GMK diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index 8e789a89319..b144dd7426d 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -32,6 +32,53 @@ ifndef _MAKEBASE_GMK _MAKEBASE_GMK := 1 +ifeq ($(wildcard $(SPEC)),) + $(error MakeBase.gmk needs SPEC set to a proper spec.gmk) +endif + + +############################## +# Functions +############################## + + +### Functions for timers + +# Store the build times in this directory. +BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times + +# Record starting time for build of a sub repository. +define RecordStartTime + $(MKDIR) -p $(BUILDTIMESDIR) + $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) + $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable +endef + +# Record ending time and calculate the difference and store it in a +# easy to read format. Handles builds that cross midnight. Expects +# that a build will never take 24 hours or more. +define RecordEndTime + $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$(strip $1) + $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)_human_readable + $(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$(strip $1)` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$(strip $1)` $1 | \ + $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \ + M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \ + > $(BUILDTIMESDIR)/build_time_diff_$(strip $1) +endef + +# Hook to be called when starting to execute a top-level target +define TargetEnter + $(PRINTF) "## Starting $(patsubst %-only,%,$@)\n" + $(call RecordStartTime,$(patsubst %-only,%,$@)) +endef + +# Hook to be called when finish executing a top-level target +define TargetExit + $(call RecordEndTime,$(patsubst %-only,%,$@)) + $(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \ + "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d ' '`" +endef + ################################################################################ # This macro translates $ into \$ to protect the $ from expansion in the shell. # To make this macro resilient against already escaped strings, first remove @@ -341,7 +388,7 @@ define CreateHgTip endef define SetupLogging - ifeq ($$(LOG_LEVEL),trace) + ifeq ($$(LOG_LEVEL), trace) # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make # For each target executed, will print # Building (from ) ( newer) @@ -349,25 +396,25 @@ define SetupLogging # (and causing a crash on Cygwin). # Default shell seems to always be /bin/sh. Must override with bash to get this to work on Solaris. # Only use time if it's GNU time which supports format and output file. - WRAPPER_SHELL:=$$(BASH) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(SHELL) - SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL) + WRAPPER_SHELL := $$(BASH) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(SHELL) + SHELL := $$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL) endif # Never remove warning messages; this is just for completeness - LOG_WARN= - ifneq ($$(findstring $$(LOG_LEVEL),info debug trace),) - LOG_INFO= + LOG_WARN := + ifneq ($$(findstring $$(LOG_LEVEL), info debug trace),) + LOG_INFO := else - LOG_INFO=> /dev/null + LOG_INFO := > /dev/null endif - ifneq ($$(findstring $$(LOG_LEVEL),debug trace),) - LOG_DEBUG= + ifneq ($$(findstring $$(LOG_LEVEL), debug trace),) + LOG_DEBUG := else - LOG_DEBUG=> /dev/null + LOG_DEBUG := > /dev/null endif - ifneq ($$(findstring $$(LOG_LEVEL),trace),) - LOG_TRACE= + ifneq ($$(findstring $$(LOG_LEVEL), trace),) + LOG_TRACE := else - LOG_TRACE=> /dev/null + LOG_TRACE := > /dev/null endif endef From ba7242fdab9e6541de4a988da918127bec98af20 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 26 Mar 2015 16:17:38 +0100 Subject: [PATCH 050/101] 8076060: Improve make bootstrap process Reviewed-by: erikj --- nashorn/make/Makefile | 49 ------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 nashorn/make/Makefile diff --git a/nashorn/make/Makefile b/nashorn/make/Makefile deleted file mode 100644 index 4570070f45b..00000000000 --- a/nashorn/make/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# Locate this Makefile -ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), ) - makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST)) -else - makefile_path := $(lastword $(MAKEFILE_LIST)) -endif -repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path)) - -# What is the name of this subsystem (langtools, corba, etc)? -subsystem_name := $(notdir $(repo_dir)) - -# Try to locate top-level makefile -top_level_makefile := $(repo_dir)/../Makefile -ifneq ($(wildcard $(top_level_makefile)), ) - $(info Will run $(subsystem_name) target on top-level Makefile) - $(info WARNING: This is a non-recommended way of building!) - $(info ===================================================) -else - $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?) - $(error Build from top-level Makefile instead) -endif - -all: - @$(MAKE) -f $(top_level_makefile) $(subsystem_name) From 01b997136526c08cd56925e2d2d84ef0d663c0d1 Mon Sep 17 00:00:00 2001 From: Alexander Kulyakthin Date: Thu, 26 Mar 2015 16:36:56 +0100 Subject: [PATCH 051/101] 8075586: Add @modules as needed to the open hotspot tests Reviewed-by: sla, ctornqvi, lfoltan, mchung, alanb --- hotspot/test/TEST.ROOT | 4 ++-- .../compiler/arguments/CheckCompileThresholdScaling.java | 4 +++- .../arguments/TestUseBMI1InstructionsOnSupportedCPU.java | 4 +++- .../TestUseBMI1InstructionsOnUnsupportedCPU.java | 4 +++- ...TestUseCountLeadingZerosInstructionOnSupportedCPU.java | 4 +++- ...stUseCountLeadingZerosInstructionOnUnsupportedCPU.java | 4 +++- ...estUseCountTrailingZerosInstructionOnSupportedCPU.java | 4 +++- ...tUseCountTrailingZerosInstructionOnUnsupportedCPU.java | 4 +++- .../test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java | 2 ++ hotspot/test/compiler/c1/6932496/Test6932496.java | 3 ++- hotspot/test/compiler/c2/6589834/Test_ia32.java | 6 +++++- hotspot/test/compiler/c2/6852078/Test6852078.java | 4 +++- hotspot/test/compiler/c2/6857159/Test6857159.java | 2 ++ hotspot/test/compiler/c2/6968348/Test6968348.java | 3 ++- hotspot/test/compiler/c2/7047069/Test7047069.java | 3 ++- hotspot/test/compiler/c2/7068051/Test7068051.java | 4 +++- hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java | 3 ++- hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java | 3 ++- .../test/compiler/c2/8004867/TestIntUnsafeOrdered.java | 3 ++- .../test/compiler/c2/8004867/TestIntUnsafeVolatile.java | 3 ++- hotspot/test/compiler/c2/8005956/PolynomialRoot.java | 2 ++ .../anonymousClass/TestAnonymousClassUnloading.java | 3 ++- .../CheckReservedInitialCodeCacheSizeArgOrder.java | 4 +++- .../test/compiler/codecache/CheckSegmentedCodeCache.java | 4 +++- hotspot/test/compiler/codecache/CheckUpperLimit.java | 4 +++- .../test/compiler/codecache/OverflowCodeCacheTest.java | 3 ++- .../codecache/cli/TestSegmentedCodeCacheOption.java | 6 +++++- .../cli/codeheapsize/TestCodeHeapSizeOptions.java | 6 +++++- .../cli/printcodecache/TestPrintCodeCacheOption.java | 6 +++++- hotspot/test/compiler/codecache/jmx/BeanTypeTest.java | 3 ++- .../compiler/codecache/jmx/CodeHeapBeanPresenceTest.java | 3 ++- hotspot/test/compiler/codecache/jmx/GetUsageTest.java | 4 +++- .../compiler/codecache/jmx/InitialAndMaxUsageTest.java | 4 +++- hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java | 3 ++- .../compiler/codecache/jmx/MemoryPoolsPresenceTest.java | 3 ++- hotspot/test/compiler/codecache/jmx/PeakUsageTest.java | 4 +++- .../codecache/jmx/ThresholdNotificationsTest.java | 4 +++- .../jmx/UsageThresholdExceededSeveralTimesTest.java | 4 +++- .../codecache/jmx/UsageThresholdExceededTest.java | 4 +++- .../codecache/jmx/UsageThresholdIncreasedTest.java | 4 +++- .../codecache/jmx/UsageThresholdNotExceededTest.java | 4 +++- .../codecache/stress/OverloadCompileQueueTest.java | 4 +++- .../compiler/codecache/stress/RandomAllocationTest.java | 4 +++- .../codecache/stress/UnexpectedDeoptimizationTest.java | 4 +++- hotspot/test/compiler/codegen/6896617/Test6896617.java | 5 ++++- hotspot/test/compiler/codegen/7100757/Test7100757.java | 4 +++- hotspot/test/compiler/codegen/7184394/TestAESMain.java | 4 +++- hotspot/test/compiler/codegen/8011901/Test8011901.java | 3 ++- hotspot/test/compiler/cpuflags/RestoreMXCSR.java | 5 +++-- hotspot/test/compiler/debug/VerifyAdapterSharing.java | 5 +++-- .../MonomorphicObjectCall/TestMonomorphicObjectCall.java | 4 +++- .../TestUnsafePutAddressNullObjMustNotEscape.java | 1 + hotspot/test/compiler/floatingpoint/TestPow2.java | 3 ++- hotspot/test/compiler/intrinsics/bmi/TestAndnI.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestAndnL.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java | 4 +++- hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/AddnTestI.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/AddnTestL.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/BlsiTestI.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/BlsiTestL.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/BlsmskTestI.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/BlsmskTestL.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/BlsrTestI.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/BlsrTestL.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/LZcntTestI.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/LZcntTestL.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/TZcntTestI.java | 4 +++- .../compiler/intrinsics/bmi/verifycode/TZcntTestL.java | 4 +++- .../intrinsics/classcast/NullCheckDroppingsTest.java | 4 +++- .../intrinsics/mathexact/AddExactIConstantTest.java | 4 +++- .../compiler/intrinsics/mathexact/AddExactILoadTest.java | 4 +++- .../intrinsics/mathexact/AddExactILoopDependentTest.java | 4 +++- .../intrinsics/mathexact/AddExactINonConstantTest.java | 4 +++- .../intrinsics/mathexact/AddExactIRepeatTest.java | 4 +++- .../intrinsics/mathexact/AddExactLConstantTest.java | 4 +++- .../intrinsics/mathexact/AddExactLNonConstantTest.java | 4 +++- .../test/compiler/intrinsics/mathexact/DecExactITest.java | 4 +++- .../test/compiler/intrinsics/mathexact/DecExactLTest.java | 4 +++- .../test/compiler/intrinsics/mathexact/IncExactITest.java | 4 +++- .../test/compiler/intrinsics/mathexact/IncExactLTest.java | 4 +++- .../intrinsics/mathexact/MulExactIConstantTest.java | 4 +++- .../compiler/intrinsics/mathexact/MulExactILoadTest.java | 4 +++- .../intrinsics/mathexact/MulExactILoopDependentTest.java | 4 +++- .../intrinsics/mathexact/MulExactINonConstantTest.java | 4 +++- .../intrinsics/mathexact/MulExactIRepeatTest.java | 4 +++- .../intrinsics/mathexact/MulExactLConstantTest.java | 4 +++- .../intrinsics/mathexact/MulExactLNonConstantTest.java | 4 +++- .../intrinsics/mathexact/NegExactIConstantTest.java | 4 +++- .../compiler/intrinsics/mathexact/NegExactILoadTest.java | 4 +++- .../intrinsics/mathexact/NegExactILoopDependentTest.java | 4 +++- .../intrinsics/mathexact/NegExactINonConstantTest.java | 4 +++- .../intrinsics/mathexact/NegExactLConstantTest.java | 4 +++- .../intrinsics/mathexact/NegExactLNonConstantTest.java | 4 +++- .../compiler/intrinsics/mathexact/SubExactICondTest.java | 4 +++- .../intrinsics/mathexact/SubExactIConstantTest.java | 4 +++- .../compiler/intrinsics/mathexact/SubExactILoadTest.java | 4 +++- .../intrinsics/mathexact/SubExactILoopDependentTest.java | 4 +++- .../intrinsics/mathexact/SubExactINonConstantTest.java | 4 +++- .../intrinsics/mathexact/SubExactIRepeatTest.java | 4 +++- .../intrinsics/mathexact/SubExactLConstantTest.java | 4 +++- .../intrinsics/mathexact/SubExactLNonConstantTest.java | 4 +++- .../intrinsics/mathexact/sanity/AddExactIntTest.java | 4 +++- .../intrinsics/mathexact/sanity/AddExactLongTest.java | 4 +++- .../mathexact/sanity/DecrementExactIntTest.java | 4 +++- .../mathexact/sanity/DecrementExactLongTest.java | 4 +++- .../mathexact/sanity/IncrementExactIntTest.java | 4 +++- .../mathexact/sanity/IncrementExactLongTest.java | 4 +++- .../intrinsics/mathexact/sanity/MultiplyExactIntTest.java | 4 +++- .../mathexact/sanity/MultiplyExactLongTest.java | 4 +++- .../intrinsics/mathexact/sanity/NegateExactIntTest.java | 4 +++- .../intrinsics/mathexact/sanity/NegateExactLongTest.java | 4 +++- .../intrinsics/mathexact/sanity/SubtractExactIntTest.java | 4 +++- .../mathexact/sanity/SubtractExactLongTest.java | 4 +++- .../cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java | 4 +++- .../cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java | 4 +++- .../cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java | 4 +++- .../TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java | 4 +++- .../cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java | 4 +++- .../TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java | 4 +++- .../sha/cli/TestUseSHAOptionOnSupportedCPU.java | 4 +++- .../sha/cli/TestUseSHAOptionOnUnsupportedCPU.java | 4 +++- .../intrinsics/sha/sanity/TestSHA1Intrinsics.java | 4 +++- .../sha/sanity/TestSHA1MultiBlockIntrinsics.java | 4 +++- .../intrinsics/sha/sanity/TestSHA256Intrinsics.java | 4 +++- .../sha/sanity/TestSHA256MultiBlockIntrinsics.java | 4 +++- .../intrinsics/sha/sanity/TestSHA512Intrinsics.java | 4 +++- .../sha/sanity/TestSHA512MultiBlockIntrinsics.java | 4 +++- .../compiler/intrinsics/unsafe/UnsafeGetAddressTest.java | 3 ++- .../test/compiler/jsr292/ConcurrentClassLoadingTest.java | 4 +++- .../jsr292/CreatesInterfaceDotEqualsCallInfo.java | 4 ++-- .../jsr292/RedefineMethodUsedByMultipleMethodHandles.java | 6 +++++- hotspot/test/compiler/jsr292/VMAnonymousClasses.java | 4 +++- .../jsr292/methodHandleExceptions/TestAMEnotNPE.java | 3 ++- .../test/compiler/oracle/CheckCompileCommandOption.java | 4 +++- hotspot/test/compiler/oracle/TestCompileCommand.java | 2 ++ hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java | 3 ++- .../profiling/spectrapredefineclass/Launcher.java | 5 ++++- .../spectrapredefineclass_classloaders/Launcher.java | 5 ++++- .../test/compiler/rangechecks/TestRangeCheckSmearing.java | 4 +++- ...reciseRTMLockingStatisticsOptionOnSupportedConfig.java | 4 +++- ...ciseRTMLockingStatisticsOptionOnUnsupportedConfig.java | 4 +++- .../rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java | 4 +++- .../cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java | 4 +++- .../compiler/rtm/cli/TestRTMAbortThresholdOption.java | 4 +++- .../rtm/cli/TestRTMLockingCalculationDelayOption.java | 4 +++- .../compiler/rtm/cli/TestRTMLockingThresholdOption.java | 4 +++- .../test/compiler/rtm/cli/TestRTMRetryCountOption.java | 4 +++- .../test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java | 4 +++- .../TestRTMTotalCountIncrRateOptionOnSupportedConfig.java | 4 +++- ...estRTMTotalCountIncrRateOptionOnUnsupportedConfig.java | 4 +++- .../rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java | 4 +++- .../rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java | 4 +++- .../TestUseRTMForStackLocksOptionOnSupportedConfig.java | 4 +++- .../TestUseRTMForStackLocksOptionOnUnsupportedConfig.java | 4 +++- .../rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java | 4 +++- .../rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java | 4 +++- .../rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java | 4 +++- .../rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java | 4 +++- .../compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java | 4 +++- hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java | 4 +++- .../test/compiler/rtm/locking/TestRTMAbortThreshold.java | 4 +++- .../compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java | 4 +++- .../rtm/locking/TestRTMDeoptOnHighAbortRatio.java | 4 +++- .../compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java | 4 +++- .../rtm/locking/TestRTMLockingCalculationDelay.java | 4 +++- .../compiler/rtm/locking/TestRTMLockingThreshold.java | 4 +++- hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java | 4 +++- .../test/compiler/rtm/locking/TestRTMSpinLoopCount.java | 4 +++- .../compiler/rtm/locking/TestRTMTotalCountIncrRate.java | 2 ++ .../rtm/locking/TestUseRTMAfterLockInflation.java | 4 +++- hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java | 4 +++- .../compiler/rtm/locking/TestUseRTMForInflatedLocks.java | 4 +++- .../compiler/rtm/locking/TestUseRTMForStackLocks.java | 4 +++- .../compiler/rtm/locking/TestUseRTMXendForLockBusy.java | 4 +++- .../rtm/method_options/TestNoRTMLockElidingOption.java | 4 +++- .../rtm/method_options/TestUseRTMLockElidingOption.java | 4 +++- .../rtm/print/TestPrintPreciseRTMLockingStatistics.java | 4 +++- hotspot/test/compiler/runtime/8010927/Test8010927.java | 3 ++- .../test/compiler/startup/NumCompilerThreadsCheck.java | 4 +++- hotspot/test/compiler/startup/SmallCodeCacheStartup.java | 4 +++- hotspot/test/compiler/startup/StartupOutput.java | 4 +++- .../compiler/tiered/ConstantGettersTransitionsTest.java | 4 +++- hotspot/test/compiler/tiered/LevelTransitionTest.java | 4 +++- hotspot/test/compiler/tiered/NonTieredLevelsTest.java | 3 ++- hotspot/test/compiler/tiered/TieredLevelsTest.java | 3 ++- .../test/compiler/types/correctness/CorrectnessTest.java | 4 +++- hotspot/test/compiler/types/correctness/OffTest.java | 4 +++- .../test/compiler/uncommontrap/TestUnstableIfTrap.java | 7 ++++++- .../test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java | 3 ++- hotspot/test/compiler/unsafe/UnsafeRaw.java | 4 +++- .../test/compiler/whitebox/AllocationCodeBlobTest.java | 3 ++- hotspot/test/compiler/whitebox/ClearMethodStateTest.java | 3 ++- hotspot/test/compiler/whitebox/DeoptimizeAllTest.java | 3 ++- hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java | 3 ++- hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java | 3 ++- .../test/compiler/whitebox/DeoptimizeMultipleOSRTest.java | 3 ++- .../whitebox/EnqueueMethodForCompilationTest.java | 3 ++- hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java | 3 ++- .../test/compiler/whitebox/GetCodeHeapEntriesTest.java | 3 ++- hotspot/test/compiler/whitebox/GetNMethodTest.java | 3 ++- .../test/compiler/whitebox/IsMethodCompilableTest.java | 4 +++- hotspot/test/compiler/whitebox/LockCompilationTest.java | 3 ++- .../compiler/whitebox/MakeMethodNotCompilableTest.java | 3 ++- .../test/compiler/whitebox/SetDontInlineMethodTest.java | 3 ++- .../test/compiler/whitebox/SetForceInlineMethodTest.java | 3 ++- hotspot/test/gc/6581734/Test6581734.java | 3 ++- hotspot/test/gc/6941923/Test6941923.java | 4 +++- hotspot/test/gc/7072527/TestFullGCCount.java | 3 ++- hotspot/test/gc/TestCardTablePageCommits.java | 4 +++- hotspot/test/gc/TestGCLogRotationViaJcmd.java | 4 +++- hotspot/test/gc/TestObjectAlignment.java | 4 +++- hotspot/test/gc/TestSmallHeap.java | 1 + hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java | 2 ++ hotspot/test/gc/TestVerifyDuringStartup.java | 4 +++- hotspot/test/gc/TestVerifySilently.java | 4 +++- .../test/gc/arguments/TestArrayAllocatorMallocLimit.java | 4 +++- hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java | 4 +++- hotspot/test/gc/arguments/TestCompressedClassFlags.java | 4 +++- hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java | 3 ++- hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java | 3 ++- .../test/gc/arguments/TestG1ConcRefinementThreads.java | 4 +++- hotspot/test/gc/arguments/TestG1HeapRegionSize.java | 3 ++- hotspot/test/gc/arguments/TestG1HeapSizeFlags.java | 4 +++- hotspot/test/gc/arguments/TestG1PercentageOptions.java | 2 ++ hotspot/test/gc/arguments/TestHeapFreeRatio.java | 4 +++- .../test/gc/arguments/TestInitialTenuringThreshold.java | 6 ++++-- hotspot/test/gc/arguments/TestMaxNewSize.java | 4 +++- hotspot/test/gc/arguments/TestMinInitialErgonomics.java | 4 +++- hotspot/test/gc/arguments/TestObjectTenuringFlags.java | 4 +++- hotspot/test/gc/arguments/TestParallelGCThreads.java | 4 +++- hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java | 4 +++- hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java | 4 +++- .../gc/arguments/TestSurvivorAlignmentInBytesOption.java | 4 +++- .../gc/arguments/TestUnrecognizedVMOptionsHandling.java | 4 +++- hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java | 4 +++- hotspot/test/gc/arguments/TestUseNUMAInterleaving.java | 4 +++- .../class_unloading/TestCMSClassUnloadingEnabledHWM.java | 4 +++- .../test/gc/class_unloading/TestG1ClassUnloadingHWM.java | 4 +++- .../test/gc/concurrentMarkSweep/GuardShrinkWarning.java | 4 +++- hotspot/test/gc/defnew/HeapChangeLogging.java | 4 +++- hotspot/test/gc/g1/Test2GbHeap.java | 4 +++- hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java | 4 +++- .../g1/TestEagerReclaimHumongousRegionsClearMarkBits.java | 4 +++- .../gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java | 4 +++- .../gc/g1/TestG1TraceEagerReclaimHumongousObjects.java | 4 +++- hotspot/test/gc/g1/TestGCLogMessages.java | 4 +++- hotspot/test/gc/g1/TestHumongousAllocInitialMark.java | 4 +++- hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java | 4 +++- hotspot/test/gc/g1/TestHumongousShrinkHeap.java | 3 ++- hotspot/test/gc/g1/TestPrintGCDetails.java | 4 +++- hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java | 4 +++- hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java | 4 +++- hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java | 4 +++- hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java | 4 +++- hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java | 4 +++- hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java | 4 +++- hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java | 4 +++- hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java | 4 +++- hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java | 4 +++- .../test/gc/g1/TestStringDeduplicationAgeThreshold.java | 4 +++- hotspot/test/gc/g1/TestStringDeduplicationFullGC.java | 4 +++- hotspot/test/gc/g1/TestStringDeduplicationInterned.java | 4 +++- .../test/gc/g1/TestStringDeduplicationPrintOptions.java | 4 +++- .../test/gc/g1/TestStringDeduplicationTableRehash.java | 4 +++- .../test/gc/g1/TestStringDeduplicationTableResize.java | 4 +++- hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java | 4 +++- hotspot/test/gc/g1/TestStringSymbolTableStats.java | 4 +++- hotspot/test/gc/g1/TestSummarizeRSetStats.java | 4 +++- hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java | 4 +++- hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java | 4 +++- hotspot/test/gc/logging/TestGCId.java | 4 +++- .../gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java | 2 ++ .../test/gc/metaspace/TestCapacityUntilGCWrapAround.java | 4 +++- hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java | 4 +++- hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java | 7 +++++-- hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java | 4 +++- .../test/gc/metaspace/TestPerfCountersAndMemoryPools.java | 5 ++++- hotspot/test/gc/parallelScavenge/AdaptiveGCBoundary.java | 4 +++- hotspot/test/gc/startup_warnings/TestCMS.java | 4 +++- hotspot/test/gc/startup_warnings/TestDefNewCMS.java | 4 +++- .../gc/startup_warnings/TestDefaultMaxRAMFraction.java | 4 +++- hotspot/test/gc/startup_warnings/TestG1.java | 4 +++- hotspot/test/gc/startup_warnings/TestNoParNew.java | 4 +++- hotspot/test/gc/startup_warnings/TestParNewCMS.java | 4 +++- hotspot/test/gc/startup_warnings/TestParNewSerialOld.java | 4 +++- hotspot/test/gc/startup_warnings/TestParallelGC.java | 4 +++- .../startup_warnings/TestParallelScavengeSerialOld.java | 4 +++- hotspot/test/gc/startup_warnings/TestSerialGC.java | 4 +++- .../test/gc/survivorAlignment/TestAllocationInEden.java | 4 +++- .../survivorAlignment/TestPromotionFromEdenToTenured.java | 4 +++- .../TestPromotionFromSurvivorToTenuredAfterFullGC.java | 4 +++- .../TestPromotionFromSurvivorToTenuredAfterMinorGC.java | 4 +++- .../gc/survivorAlignment/TestPromotionToSurvivor.java | 4 +++- hotspot/test/gc/whitebox/TestConcMarkCycleWB.java | 6 +++++- hotspot/test/gc/whitebox/TestWBGC.java | 4 +++- .../test/runtime/6819213/TestBootNativeLibraryPath.java | 3 ++- hotspot/test/runtime/8003720/Test8003720.java | 4 +++- hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java | 4 +++- .../test/runtime/BadObjectClass/BootstrapRedefine.java | 2 ++ .../runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java | 4 +++- .../CDSCompressedKPtrs/CDSCompressedKPtrsError.java | 4 +++- hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java | 4 +++- hotspot/test/runtime/ClassFile/JsrRewriting.java | 5 ++++- .../runtime/ClassFile/OomWhileParsingRepeatedJsr.java | 5 ++++- .../runtime/ClassFile/UnsupportedClassFileVersion.java | 5 ++++- .../runtime/CommandLine/BooleanFlagWithInvalidValue.java | 4 +++- .../runtime/CommandLine/CompilerConfigFileWarning.java | 4 +++- hotspot/test/runtime/CommandLine/ConfigFileParsing.java | 4 +++- hotspot/test/runtime/CommandLine/ConfigFileWarning.java | 4 +++- .../test/runtime/CommandLine/FlagWithInvalidValue.java | 4 +++- .../NonBooleanFlagWithInvalidBooleanPrefix.java | 4 +++- .../runtime/CommandLine/ObsoleteFlagErrorMessage.java | 4 +++- hotspot/test/runtime/CommandLine/TestHexArguments.java | 4 +++- .../test/runtime/CommandLine/TestNullTerminatedFlags.java | 4 +++- hotspot/test/runtime/CommandLine/TestVMOptions.java | 4 +++- hotspot/test/runtime/CommandLine/TraceExceptionsTest.java | 4 +++- .../test/runtime/CommandLine/UnrecognizedVMOption.java | 4 +++- hotspot/test/runtime/CommandLine/VMOptionWarning.java | 4 +++- .../runtime/CompressedOops/CompressedClassPointers.java | 4 +++- .../runtime/CompressedOops/CompressedClassSpaceSize.java | 4 +++- .../CompressedOops/CompressedKlassPointerAndOops.java | 4 +++- hotspot/test/runtime/CompressedOops/ObjectAlignment.java | 4 +++- .../test/runtime/CompressedOops/UseCompressedOops.java | 4 +++- .../test/runtime/EnclosingMethodAttr/EnclMethodAttr.java | 4 +++- .../test/runtime/ErrorHandling/ProblematicFrameTest.java | 4 ++++ .../test/runtime/ErrorHandling/SecondaryErrorTest.java | 2 ++ .../test/runtime/InternalApi/ThreadCpuTimesDeadlock.java | 3 ++- hotspot/test/runtime/LoadClass/LoadClassNegative.java | 4 +++- hotspot/test/runtime/LocalVariableTable/TestLVT.java | 2 ++ hotspot/test/runtime/Metaspace/FragmentMetaspace.java | 3 ++- hotspot/test/runtime/NMT/AutoshutdownNMT.java | 4 +++- hotspot/test/runtime/NMT/BaselineWithParameter.java | 4 +++- hotspot/test/runtime/NMT/CommandLineDetail.java | 4 +++- hotspot/test/runtime/NMT/CommandLineEmptyArgument.java | 4 +++- hotspot/test/runtime/NMT/CommandLineInvalidArgument.java | 4 +++- hotspot/test/runtime/NMT/CommandLineSummary.java | 4 +++- hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java | 4 +++- hotspot/test/runtime/NMT/JcmdBaselineDetail.java | 4 +++- hotspot/test/runtime/NMT/JcmdDetailDiff.java | 4 +++- hotspot/test/runtime/NMT/JcmdScale.java | 4 +++- hotspot/test/runtime/NMT/JcmdScaleDetail.java | 4 +++- hotspot/test/runtime/NMT/JcmdSummaryDiff.java | 4 +++- hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java | 4 +++- hotspot/test/runtime/NMT/MallocRoundingReportTest.java | 4 +++- hotspot/test/runtime/NMT/MallocStressTest.java | 4 +++- hotspot/test/runtime/NMT/MallocTestType.java | 4 +++- hotspot/test/runtime/NMT/MallocTrackingVerify.java | 4 +++- hotspot/test/runtime/NMT/NMTWithCDS.java | 4 +++- .../runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java | 4 +++- hotspot/test/runtime/NMT/ReleaseNoCommit.java | 4 +++- hotspot/test/runtime/NMT/ShutdownTwice.java | 4 +++- hotspot/test/runtime/NMT/SummaryAfterShutdown.java | 4 +++- hotspot/test/runtime/NMT/SummarySanityCheck.java | 4 +++- hotspot/test/runtime/NMT/ThreadedMallocTestType.java | 4 +++- .../test/runtime/NMT/ThreadedVirtualAllocTestType.java | 2 ++ .../runtime/NMT/VirtualAllocCommitUncommitRecommit.java | 2 ++ hotspot/test/runtime/NMT/VirtualAllocTestType.java | 2 ++ hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java | 4 +++- .../test/runtime/RedefineObject/TestRedefineObject.java | 5 ++++- .../test/runtime/RedefineTests/RedefineAnnotations.java | 5 ++++- hotspot/test/runtime/RedefineTests/RedefineFinalizer.java | 5 ++++- .../runtime/RedefineTests/RedefineRunningMethods.java | 5 ++++- .../Safepoint/AssertSafepointCheckConsistency1.java | 4 +++- .../Safepoint/AssertSafepointCheckConsistency2.java | 4 +++- .../Safepoint/AssertSafepointCheckConsistency3.java | 4 +++- .../Safepoint/AssertSafepointCheckConsistency4.java | 4 +++- .../runtime/SharedArchiveFile/ArchiveDoesNotExist.java | 4 +++- .../SharedArchiveFile/CdsDifferentObjectAlignment.java | 4 +++- .../runtime/SharedArchiveFile/CdsSameObjectAlignment.java | 4 +++- .../runtime/SharedArchiveFile/DefaultUseWithClient.java | 4 +++- .../SharedArchiveFile/DumpSymbolAndStringTable.java | 4 +++- .../test/runtime/SharedArchiveFile/LimitSharedSizes.java | 4 +++- .../test/runtime/SharedArchiveFile/MaxMetaspaceSize.java | 2 ++ .../SharedArchiveFile/PrintSharedArchiveAndExit.java | 4 +++- .../test/runtime/SharedArchiveFile/SharedArchiveFile.java | 4 +++- .../test/runtime/SharedArchiveFile/SharedBaseAddress.java | 4 +++- .../SharedArchiveFile/SharedSymbolTableBucketSize.java | 4 +++- .../runtime/SharedArchiveFile/SpaceUtilizationCheck.java | 4 +++- .../runtime/Thread/TestThreadDumpMonitorContention.java | 4 +++- hotspot/test/runtime/Thread/ThreadPriorities.java | 4 +++- hotspot/test/runtime/Unsafe/AllocateInstance.java | 2 ++ hotspot/test/runtime/Unsafe/AllocateMemory.java | 2 ++ hotspot/test/runtime/Unsafe/CopyMemory.java | 2 ++ hotspot/test/runtime/Unsafe/DefineClass.java | 3 +++ hotspot/test/runtime/Unsafe/FieldOffset.java | 2 ++ hotspot/test/runtime/Unsafe/GetField.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutAddress.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutBoolean.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutByte.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutChar.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutDouble.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutFloat.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutInt.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutLong.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutObject.java | 2 ++ hotspot/test/runtime/Unsafe/GetPutShort.java | 2 ++ hotspot/test/runtime/Unsafe/GetUnsafe.java | 1 + hotspot/test/runtime/Unsafe/PageSize.java | 2 ++ hotspot/test/runtime/Unsafe/RangeCheck.java | 4 +++- hotspot/test/runtime/Unsafe/Reallocate.java | 2 ++ hotspot/test/runtime/Unsafe/SetMemory.java | 2 ++ hotspot/test/runtime/Unsafe/ThrowException.java | 2 ++ hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java | 4 +++- .../runtime/classFileParserBug/ClassFileParserBug.java | 4 +++- .../classFileParserBug/TestEmptyBootstrapMethodsAttr.java | 4 +++- hotspot/test/runtime/contended/Basic.java | 4 ++-- hotspot/test/runtime/contended/DefaultValue.java | 3 ++- hotspot/test/runtime/contended/HasNonStatic.java | 3 ++- hotspot/test/runtime/contended/Inheritance1.java | 3 ++- hotspot/test/runtime/contended/OopMaps.java | 3 ++- hotspot/test/runtime/contended/OopMapsSameGroup.java | 3 ++- hotspot/test/runtime/contended/Options.java | 4 +++- .../test/runtime/duplAttributes/DuplAttributesTest.java | 4 +++- hotspot/test/runtime/finalStatic/FinalStatic.java | 3 ++- .../TestConcreteClassWithAbstractMethod.java | 3 ++- .../memory/LargePages/TestLargePageSizeInBytes.java | 4 +++- .../runtime/memory/LargePages/TestLargePagesFlags.java | 4 +++- hotspot/test/runtime/memory/ReadFromNoaccessArea.java | 4 +++- hotspot/test/runtime/memory/ReserveMemory.java | 4 +++- hotspot/test/runtime/memory/RunUnitTestsConcurrently.java | 4 +++- hotspot/test/runtime/verifier/OverriderMsg.java | 5 ++++- hotspot/test/runtime/verifier/TestANewArray.java | 5 ++++- hotspot/test/runtime/verifier/TestMultiANewArray.java | 5 ++++- hotspot/test/serviceability/attach/AttachSetGetFlag.java | 7 ++++++- .../test/serviceability/dcmd/compiler/CodeCacheTest.java | 6 +++++- .../test/serviceability/dcmd/compiler/CodelistTest.java | 6 +++++- .../serviceability/dcmd/compiler/CompilerQueueTest.java | 6 +++++- hotspot/test/serviceability/dcmd/framework/HelpTest.java | 4 ++++ .../serviceability/dcmd/framework/InvalidCommandTest.java | 4 ++++ .../test/serviceability/dcmd/framework/VMVersionTest.java | 4 ++++ .../serviceability/dcmd/gc/ClassHistogramAllTest.java | 4 ++++ .../test/serviceability/dcmd/gc/ClassHistogramTest.java | 4 ++++ hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java | 4 ++++ hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java | 4 ++++ .../test/serviceability/dcmd/gc/RunFinalizationTest.java | 4 ++++ hotspot/test/serviceability/dcmd/gc/RunGCTest.java | 4 ++++ .../dcmd/thread/PrintConcurrentLocksTest.java | 4 ++++ hotspot/test/serviceability/dcmd/thread/PrintTest.java | 4 ++++ .../test/serviceability/dcmd/vm/ClassHierarchyTest.java | 4 ++++ .../test/serviceability/dcmd/vm/ClassLoaderStatsTest.java | 6 +++++- hotspot/test/serviceability/dcmd/vm/CommandLineTest.java | 4 ++++ hotspot/test/serviceability/dcmd/vm/DynLibsTest.java | 4 ++++ hotspot/test/serviceability/dcmd/vm/FlagsTest.java | 4 ++++ .../test/serviceability/dcmd/vm/SystemPropertiesTest.java | 4 ++++ hotspot/test/serviceability/dcmd/vm/UptimeTest.java | 4 ++++ .../test/serviceability/jvmti/GetObjectSizeOverflow.java | 7 ++++++- .../jvmti/TestLambdaFormRetransformation.java | 4 ++++ .../jvmti/TestRedefineWithUnresolvedClass.java | 8 +++++++- .../test/serviceability/sa/jmap-hashcode/Test8028623.java | 6 +++++- .../sa/jmap-hprof/JMapHProfLargeHeapTest.java | 6 +++++- .../testlibrary_tests/OutputAnalyzerReportingTest.java | 4 +++- hotspot/test/testlibrary_tests/OutputAnalyzerTest.java | 4 +++- hotspot/test/testlibrary_tests/RandomGeneratorTest.java | 4 +++- hotspot/test/testlibrary_tests/RedefineClassTest.java | 5 ++++- .../TestMutuallyExclusivePlatformPredicates.java | 4 +++- .../testlibrary_tests/TestPlatformIsTieredSupported.java | 4 +++- hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java | 5 ++++- hotspot/test/testlibrary_tests/ctw/ClassesListTest.java | 5 ++++- hotspot/test/testlibrary_tests/ctw/JarDirTest.java | 7 ++++++- hotspot/test/testlibrary_tests/ctw/JarsTest.java | 7 ++++++- .../testlibrary_tests/whitebox/vm_flags/BooleanTest.java | 6 +++++- .../testlibrary_tests/whitebox/vm_flags/DoubleTest.java | 3 ++- .../testlibrary_tests/whitebox/vm_flags/IntxTest.java | 3 ++- .../testlibrary_tests/whitebox/vm_flags/SizeTTest.java | 4 +++- .../testlibrary_tests/whitebox/vm_flags/StringTest.java | 3 ++- .../testlibrary_tests/whitebox/vm_flags/Uint64Test.java | 3 ++- .../testlibrary_tests/whitebox/vm_flags/UintxTest.java | 4 +++- 476 files changed, 1413 insertions(+), 426 deletions(-) diff --git a/hotspot/test/TEST.ROOT b/hotspot/test/TEST.ROOT index fc23ac90061..c361a5d8b9a 100644 --- a/hotspot/test/TEST.ROOT +++ b/hotspot/test/TEST.ROOT @@ -32,5 +32,5 @@ keys=cte_test jcmd nmt regression gc stress groups=TEST.groups [closed/TEST.groups] requires.properties=sun.arch.data.model -# Tests using jtreg 4.1 b10 features -requiredVersion=4.1 b10 +# Tests using jtreg 4.1 b11 features +requiredVersion=4.1 b11 diff --git a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java index 9c9b94f8c24..2c8621d4a1b 100644 --- a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java +++ b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import com.oracle.java.testlibrary.*; * @bug 8059604 * @summary "Add CompileThresholdScaling flag to control when methods are first compiled (with +/-TieredCompilation)" * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main CheckCompileThresholdScaling */ diff --git a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java index 57b324fda93..800aa8b28e2 100644 --- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify processing of UseBMI1Instructions option on CPU with * BMI1 feature support. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestUseBMI1InstructionsOnSupportedCPU * BMISupportedCPUTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java index 06dbd19c9da..81aa36ad801 100644 --- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify processing of UseBMI1Instructions option on CPU without * BMI1 feature support. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestUseBMI1InstructionsOnUnsupportedCPU * BMIUnsupportedCPUTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java index 200e6bfe9c4..bfbadaf65ba 100644 --- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify processing of UseCountLeadingZerosInstruction option * on CPU with LZCNT support. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestUseCountLeadingZerosInstructionOnSupportedCPU * BMISupportedCPUTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java index 74e6f626d67..64149864197 100644 --- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify processing of UseCountLeadingZerosInstruction option * on CPU without LZCNT support. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestUseCountLeadingZerosInstructionOnUnsupportedCPU * BMIUnsupportedCPUTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java index aadd3180d49..0286b9e6964 100644 --- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify processing of UseCountTrailingZerosInstruction option * on CPU with TZCNT (BMI1 feature) support. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestUseCountTrailingZerosInstructionOnSupportedCPU * BMISupportedCPUTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java index 68483893a53..be3d7469bce 100644 --- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify processing of UseCountTrailingZerosInstruction option * on CPU without TZCNT instruction (BMI1 feature) support. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestUseCountTrailingZerosInstructionOnUnsupportedCPU * BMIUnsupportedCPUTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java index 26ebd39a0a9..c72ff09a4c5 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java @@ -26,6 +26,8 @@ * @bug 8072016 * @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation * @library /testlibrary /../../test/lib /compiler/whitebox + * @modules java.base/sun.misc + * java.management * @build TestArrayCopyNoInitDeopt * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform diff --git a/hotspot/test/compiler/c1/6932496/Test6932496.java b/hotspot/test/compiler/c1/6932496/Test6932496.java index 7f3c1697355..3b75dd79599 100644 --- a/hotspot/test/compiler/c1/6932496/Test6932496.java +++ b/hotspot/test/compiler/c1/6932496/Test6932496.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ * @test * @bug 6932496 * @summary incorrect deopt of jsr subroutine on 64 bit c1 + * @modules java.base/jdk.internal.org.objectweb.asm * @run main/othervm -Xcomp -XX:CompileOnly=Test.test Test6932496 */ import java.lang.reflect.Method; diff --git a/hotspot/test/compiler/c2/6589834/Test_ia32.java b/hotspot/test/compiler/c2/6589834/Test_ia32.java index 193ca35a3f8..e7942f78c7a 100644 --- a/hotspot/test/compiler/c2/6589834/Test_ia32.java +++ b/hotspot/test/compiler/c2/6589834/Test_ia32.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,10 @@ * @summary Safepoint placed between stack pointer increment and decrement leads * to interpreter's stack corruption after deoptimization. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build ClassFileInstaller sun.hotspot.WhiteBox com.oracle.java.testlibrary.* * Test_ia32 InlinedArrayCloneTestCase * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/c2/6852078/Test6852078.java b/hotspot/test/compiler/c2/6852078/Test6852078.java index 6c3ceccec93..274c20b931d 100644 --- a/hotspot/test/compiler/c2/6852078/Test6852078.java +++ b/hotspot/test/compiler/c2/6852078/Test6852078.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 6852078 * @summary Disable SuperWord optimization for unsafe read/write * + * @modules java.corba/com.sun.corba.se.impl.encoding + * java.corba/com.sun.jndi.toolkit.corba * @run main Test6852078 */ diff --git a/hotspot/test/compiler/c2/6857159/Test6857159.java b/hotspot/test/compiler/c2/6857159/Test6857159.java index c0a0349f952..8be3319205c 100644 --- a/hotspot/test/compiler/c2/6857159/Test6857159.java +++ b/hotspot/test/compiler/c2/6857159/Test6857159.java @@ -27,6 +27,8 @@ * @bug 6857159 * @summary local schedule failed with checkcast of Thread.currentThread() * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/compiler/c2/6968348/Test6968348.java b/hotspot/test/compiler/c2/6968348/Test6968348.java index 14568d7526b..c1af273bfc9 100644 --- a/hotspot/test/compiler/c2/6968348/Test6968348.java +++ b/hotspot/test/compiler/c2/6968348/Test6968348.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ * @bug 6968348 * @summary Byteswapped memory access can point to wrong location after JIT * + * @modules java.base/sun.misc * @run main Test6968348 */ diff --git a/hotspot/test/compiler/c2/7047069/Test7047069.java b/hotspot/test/compiler/c2/7047069/Test7047069.java index 5229d62a821..fcfee8c07aa 100644 --- a/hotspot/test/compiler/c2/7047069/Test7047069.java +++ b/hotspot/test/compiler/c2/7047069/Test7047069.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ * @bug 7047069 * @summary Array can dynamically change size when assigned to an object field * + * @modules java.desktop * @run main/othervm -Xbatch Test7047069 */ diff --git a/hotspot/test/compiler/c2/7068051/Test7068051.java b/hotspot/test/compiler/c2/7068051/Test7068051.java index cd35feb76d6..c98475b76cb 100644 --- a/hotspot/test/compiler/c2/7068051/Test7068051.java +++ b/hotspot/test/compiler/c2/7068051/Test7068051.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary SIGSEGV in PhaseIdealLoop::build_loop_late_post on T5440 * @library /testlibrary * + * @modules java.base/sun.misc + * java.management * @run main/othervm -showversion -Xbatch Test7068051 */ diff --git a/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java index 3f97f28e403..d9881d69f6f 100644 --- a/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java +++ b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ * @test * @bug 7190310 * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops + * @modules java.base/sun.misc * @run main/othervm -Xbatch Test7190310_unsafe */ diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java index 9489376c671..0eb50008c2d 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java +++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ * @bug 8004867 * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" * + * @modules java.base/sun.misc * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeCAS * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeCAS */ diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java index 6588d63e869..ef932a1e6b4 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java +++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ * @bug 8004867 * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" * + * @modules java.base/sun.misc * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeOrdered * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeOrdered */ diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java index 84ecd10c2ef..dc6639d2647 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java +++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ * @bug 8004867 * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob" * + * @modules java.base/sun.misc * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeVolatile * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeVolatile */ diff --git a/hotspot/test/compiler/c2/8005956/PolynomialRoot.java b/hotspot/test/compiler/c2/8005956/PolynomialRoot.java index 54cc8f3d5c5..4470c191611 100644 --- a/hotspot/test/compiler/c2/8005956/PolynomialRoot.java +++ b/hotspot/test/compiler/c2/8005956/PolynomialRoot.java @@ -14,6 +14,8 @@ * @bug 8005956 * @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block * @library /testlibrary +* @modules java.base/sun.misc +* java.management * @run main/timeout=300 PolynomialRoot */ diff --git a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java index d6c3ed05d0c..2db398b2933 100644 --- a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java +++ b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ import java.net.URLConnection; * @bug 8054402 * @summary "Tests unloading of anonymous classes." * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc * @compile TestAnonymousClassUnloading.java * @run main ClassFileInstaller TestAnonymousClassUnloading * sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java index eea5c90e9f7..60aa4436179 100644 --- a/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java +++ b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * InitialCodeCacheSize are passed to the VM is irrelevant. * @library /testlibrary * + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java index 654293be030..3ae9b64145c 100644 --- a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java +++ b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ import sun.hotspot.WhiteBox; * @bug 8015774 * @library /testlibrary /../../test/lib * @summary "Checks VM options related to the segmented code cache" + * @modules java.base/sun.misc + * java.management * @build CheckSegmentedCodeCache * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/CheckUpperLimit.java b/hotspot/test/compiler/codecache/CheckUpperLimit.java index e2a2705b554..4b42a1426ba 100644 --- a/hotspot/test/compiler/codecache/CheckUpperLimit.java +++ b/hotspot/test/compiler/codecache/CheckUpperLimit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Test ensures that the ReservedCodeCacheSize is at most MAXINT * @library /testlibrary * + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java index 5ee28556505..a1cdf4be18e 100644 --- a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java +++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ import com.oracle.java.testlibrary.Asserts; * @test OverflowCodeCacheTest * @bug 8059550 * @library /testlibrary /../../test/lib + * @modules java.management * @build OverflowCodeCacheTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java b/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java index 525327a45cc..d5af931e345 100644 --- a/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java +++ b/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,10 @@ import sun.hotspot.code.BlobType; * @bug 8015774 * @summary Verify SegmentedCodeCache option's processing * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build TestSegmentedCodeCacheOption com.oracle.java.testlibrary.* * @run main TestSegmentedCodeCacheOption */ diff --git a/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java b/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java index e1253598e1b..dfcbc0f2f64 100644 --- a/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java +++ b/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,10 @@ import java.util.EnumSet; * @bug 8015774 * @summary Verify processing of options related to code heaps sizing. * @library /testlibrary .. /../../test/lib + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build TestCodeHeapSizeOptions com.oracle.java.testlibrary.* codeheapsize.* * common.* * @run main/timeout=240 codeheapsize.TestCodeHeapSizeOptions diff --git a/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java b/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java index ae42251c77c..00b4431ea7e 100644 --- a/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java +++ b/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,10 @@ import java.util.EnumSet; * @bug 8015774 * @summary Verify that PrintCodeCache option print correct information. * @library /testlibrary .. /../../test/lib + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build TestPrintCodeCacheOption com.oracle.java.testlibrary.* * printcodecache.* common.* * @run main/timeout=240 printcodecache.TestPrintCodeCacheOption diff --git a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java index 9ce162d2c28..e31b5615617 100644 --- a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java +++ b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ import sun.hotspot.code.BlobType; /** * @test BeanTypeTest * @library /testlibrary /../../test/lib + * @modules java.management * @build BeanTypeTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java index 1ebacf95971..a9fb122450d 100644 --- a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ import sun.hotspot.code.BlobType; /** * @test CodeHeapBeanPresenceTest * @library /testlibrary /../../test/lib + * @modules java.management * @build CodeHeapBeanPresenceTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/GetUsageTest.java b/hotspot/test/compiler/codecache/jmx/GetUsageTest.java index 87139abd65f..7ce9c7973ef 100644 --- a/hotspot/test/compiler/codecache/jmx/GetUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/GetUsageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ import sun.hotspot.code.BlobType; /* * @test GetUsageTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build GetUsageTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java index eaf137b9e4c..ca4fa6e6b83 100644 --- a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ import sun.hotspot.code.BlobType; /* * @test InitialAndMaxUsageTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build InitialAndMaxUsageTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java index 57be84e2b48..5d89732c0c7 100644 --- a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java +++ b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ import sun.hotspot.code.BlobType; /** * @test ManagerNamesTest * @library /testlibrary /../../test/lib + * @modules java.management * @build ManagerNamesTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java index d850e926eb1..b2e46833039 100644 --- a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import sun.hotspot.code.BlobType; /** * @test MemoryPoolsPresenceTest * @library /testlibrary /../../test/lib + * @modules java.management * @build MemoryPoolsPresenceTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java index b77e054c374..c9e0cdbca3d 100644 --- a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import sun.hotspot.code.BlobType; /* * @test PeakUsageTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build PeakUsageTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java index fea786ebe1a..56b26a9f1f8 100644 --- a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java +++ b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,8 @@ import sun.hotspot.code.BlobType; /* * @test ThresholdNotificationsTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build ThresholdNotificationsTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java index ad2ddc8603c..ca1e8dc1d63 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ /* * @test UsageThresholdExceededSeveralTimesTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build UsageThresholdExceededTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java index 50e455627d5..dc8a8a0948f 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import sun.hotspot.code.BlobType; /* * @test UsageThresholdExceededTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build UsageThresholdExceededTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java index 276ba90bd63..2c681804796 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import sun.hotspot.code.BlobType; /* * @test UsageThresholdIncreasedTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build UsageThresholdIncreasedTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java index 23fdf9c7b82..b87a7d4256e 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import sun.hotspot.code.BlobType; /* * @test UsageThresholdNotExceededTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build UsageThresholdNotExceededTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java index ec29cf5d729..3ff2a43e8d0 100644 --- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java +++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ import com.oracle.java.testlibrary.Platform; /* * @test OverloadCompileQueueTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @ignore 8071905 * @build OverloadCompileQueueTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java index 466bcc4b895..400b99af378 100644 --- a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java +++ b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ import sun.hotspot.code.BlobType; /* * @test RandomAllocationTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build RandomAllocationTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java index f8ff8e5deb4..d7c7f074d6d 100644 --- a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java +++ b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ /* * @test UnexpectedDeoptimizationTest * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build UnexpectedDeoptimizationTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/codegen/6896617/Test6896617.java b/hotspot/test/compiler/codegen/6896617/Test6896617.java index 38835e0e420..a3650ad595d 100644 --- a/hotspot/test/compiler/codegen/6896617/Test6896617.java +++ b/hotspot/test/compiler/codegen/6896617/Test6896617.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,9 @@ * @bug 6896617 * @summary Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() with SSE instructions on x86 * @library /testlibrary + * @modules java.base/sun.misc + * java.base/sun.nio.cs + * java.management * @run main/othervm/timeout=1200 -Xbatch -Xmx256m Test6896617 * */ diff --git a/hotspot/test/compiler/codegen/7100757/Test7100757.java b/hotspot/test/compiler/codegen/7100757/Test7100757.java index 50ee9e11550..0358d7b51bd 100644 --- a/hotspot/test/compiler/codegen/7100757/Test7100757.java +++ b/hotspot/test/compiler/codegen/7100757/Test7100757.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 7100757 * @summary The BitSet.nextSetBit() produces incorrect result in 32bit VM on Sparc * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/timeout=300 Test7100757 */ diff --git a/hotspot/test/compiler/codegen/7184394/TestAESMain.java b/hotspot/test/compiler/codegen/7184394/TestAESMain.java index d09a305a3b4..e1fa387021f 100644 --- a/hotspot/test/compiler/codegen/7184394/TestAESMain.java +++ b/hotspot/test/compiler/codegen/7184394/TestAESMain.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary add intrinsics to use AES instructions * @library /testlibrary * + * @modules java.base/sun.misc + * java.management * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 TestAESMain * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1 TestAESMain diff --git a/hotspot/test/compiler/codegen/8011901/Test8011901.java b/hotspot/test/compiler/codegen/8011901/Test8011901.java index 6ff0a932118..a9172888dcb 100644 --- a/hotspot/test/compiler/codegen/8011901/Test8011901.java +++ b/hotspot/test/compiler/codegen/8011901/Test8011901.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test * @bug 8011901 * @summary instruct xaddL_no_res shouldn't allow 64 bit constants. + * @modules java.base/sun.misc * @run main/othervm -XX:-BackgroundCompilation Test8011901 * */ diff --git a/hotspot/test/compiler/cpuflags/RestoreMXCSR.java b/hotspot/test/compiler/cpuflags/RestoreMXCSR.java index 0e4bce85262..098ae0e9aa9 100644 --- a/hotspot/test/compiler/cpuflags/RestoreMXCSR.java +++ b/hotspot/test/compiler/cpuflags/RestoreMXCSR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,8 @@ * @bug 8020433 * @summary Crash when using -XX:+RestoreMXCSROnJNICalls * @library /testlibrary - * + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/compiler/debug/VerifyAdapterSharing.java b/hotspot/test/compiler/debug/VerifyAdapterSharing.java index 1aac5387d33..4c26bd78092 100644 --- a/hotspot/test/compiler/debug/VerifyAdapterSharing.java +++ b/hotspot/test/compiler/debug/VerifyAdapterSharing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,8 @@ * @bug 8030783 * @summary Regression test for 8026478 * @library /testlibrary - * + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java index 8884ce404c5..c36118fe922 100644 --- a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java +++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ import com.oracle.java.testlibrary.*; * @bug 8050079 * @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java * @run main TestMonomorphicObjectCall */ diff --git a/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java index e016a993c8a..d70ec5cb268 100644 --- a/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java +++ b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java @@ -25,6 +25,7 @@ * @test * @bug 8038048 * @summary assert(null_obj->escape_state() == PointsToNode::NoEscape,etc) + * @modules java.base/sun.misc * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DoEscapeAnalysis -XX:-TieredCompilation -Xbatch TestUnsafePutAddressNullObjMustNotEscape * @author Richard Reingruber richard DOT reingruber AT sap DOT com */ diff --git a/hotspot/test/compiler/floatingpoint/TestPow2.java b/hotspot/test/compiler/floatingpoint/TestPow2.java index 699904b6e4f..f46a9a717cc 100644 --- a/hotspot/test/compiler/floatingpoint/TestPow2.java +++ b/hotspot/test/compiler/floatingpoint/TestPow2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ * @bug 8063086 * @summary X^2 special case for C2 yields different result than interpreter * @library /testlibrary /../../test/lib /compiler/whitebox + * @modules java.management * @build TestPow2 * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI diff --git a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java index 84d32ffae41..55d0897e2fc 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of ANDN instruction * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestAndnI BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java index d6b33a6f079..33dd7a1f27b 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of ANDN instruction * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestAndnL BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java index d8dfc41b6db..c0768120911 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of BLSI instruction * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestBlsiI BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java index 9e0cd016dda..6515496dbdb 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of BLSI instruction * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestBlsiL BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java index 869aff8c230..efbd0c7cb49 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of BLSMSK instruction * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestBlsmskI BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java index 2e8d8ae7d0e..c9a4cce706a 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of BLSMSK instruction * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestBlsmskL BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java index f9dc1928497..352c524497d 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of BLSR instruction * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestBlsrI BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java index c6c2f2d401f..fe4e0b4852a 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of BLSR instruction * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestBlsrL BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java index acd1b1628cd..4fb1a437fb8 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of intrinsic * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestLzcntI BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java index 63891cdef67..18f3c66afaf 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of intrinsic * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestLzcntL BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java index 6e4894a968a..caf3fb76106 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of intrinsic * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestTzcntI BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java index d2f634cb498..f56634f4322 100644 --- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java +++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that results of computations are the same w/ * and w/o usage of intrinsic * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestTzcntL BMITestRunner Expr * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java index ea9e6df5abe..04fe2f81115 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build AddnTestI * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java index 0859ba15523..b9647cfb27c 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build AddnTestL * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java index 8a6aa8b69f3..3a583dfa463 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build BlsiTestI * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java index 9b087263b48..55696375968 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build BlsiTestL * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java index 31c747ea531..aba4b327829 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build BlsmskTestI * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java index 07887bcaac7..b58e7b382d2 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build BlsmskTestL * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java index 2424d936b99..4b3434dc56f 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build BlsrTestI * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java index 050520367ba..81b9fa81c44 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build BlsrTestL * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java index 46892c7bb3f..dd45d49a3fd 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build LZcntTestI * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java index 64002d93876..4515d253aa0 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build LZcntTestL * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java index d9669f69745..5d078b629f2 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build TZcntTestI * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java index 7ba85b3c3de..0758a441a2b 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8031321 * @library /testlibrary /../../test/lib /compiler/whitebox .. + * @modules java.base/sun.misc + * java.management * @build TZcntTestL * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/classcast/NullCheckDroppingsTest.java b/hotspot/test/compiler/intrinsics/classcast/NullCheckDroppingsTest.java index 9e05df15341..3d6eb8a2880 100644 --- a/hotspot/test/compiler/intrinsics/classcast/NullCheckDroppingsTest.java +++ b/hotspot/test/compiler/intrinsics/classcast/NullCheckDroppingsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8054492 * @summary "Casting can result in redundant null checks in generated code" * @library /testlibrary /../../test/lib /testlibrary/com/oracle/java/testlibrary + * @modules java.base/sun.misc + * java.management * @build NullCheckDroppingsTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java index 71e1a9762fa..1507a53abef 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8024924 * @summary Test constant addExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile AddExactIConstantTest.java Verify.java * @run main AddExactIConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java index 81bcc240ad5..f24c2417537 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8024924 * @summary Test non constant addExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile AddExactILoadTest.java Verify.java * @run main AddExactILoadTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java index f0adb45018e..b4a22eb3c91 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8024924 * @summary Test non constant addExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile AddExactILoopDependentTest.java Verify.java * @run main AddExactILoopDependentTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java index 96c0b6014df..5833d78fdea 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8024924 * @summary Test non constant addExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile AddExactINonConstantTest.java Verify.java * @run main AddExactINonConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java index 2ba7268838d..3e6ae5a73f8 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8025657 * @summary Test repeating addExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile AddExactIRepeatTest.java Verify.java * @run main AddExactIRepeatTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java index f36c925f7fd..c42914f06c5 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test constant addExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile AddExactLConstantTest.java Verify.java * @run main AddExactLConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java index 01860ba94a7..6f8c898baae 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test non constant addExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile AddExactLNonConstantTest.java Verify.java * @run main AddExactLNonConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java b/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java index 256aa916563..ac769b91513 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test decrementExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile DecExactITest.java Verify.java * @run main DecExactITest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java b/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java index 1a9f0c86aa1..416ec96102d 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test decrementExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile DecExactLTest.java Verify.java * @run main DecExactLTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java b/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java index 14ab592a885..6037ddf5073 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test incrementExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile IncExactITest.java Verify.java * @run main IncExactITest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java b/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java index 5665b8080c1..0dd009c86c5 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test incrementExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile IncExactLTest.java Verify.java * @run main IncExactLTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java index 3d3f23ea90e..c47794474d9 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test constant multiplyExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile MulExactIConstantTest.java Verify.java * @run main MulExactIConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java index 4551e9d4d62..32ea6074eb7 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test multiplyExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile MulExactILoadTest.java Verify.java * @run main MulExactILoadTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java index b324135ab53..2a5b3ea53e1 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test loop dependent multiplyExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile MulExactILoopDependentTest.java Verify.java * @run main MulExactILoopDependentTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java index 5f60c66c611..ec2ba1ec403 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test non constant multiplyExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile MulExactINonConstantTest.java Verify.java * @run main MulExactINonConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java index 5d1784e8560..a978a78b59d 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test repeating multiplyExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile MulExactIRepeatTest.java Verify.java * @run main MulExactIRepeatTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java index d830cf54812..a0f5e9bb378 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test constant mulExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile MulExactLConstantTest.java Verify.java * @run main MulExactLConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java index c0f97a9c143..22e475f67a3 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test non constant mulExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile MulExactLNonConstantTest.java Verify.java * @run main MulExactLNonConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java index a8e6c7c9984..c2f77b943c5 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test constant negExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile NegExactIConstantTest.java Verify.java * @run main NegExactIConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java index dfa8ba21d11..d4a92dc09ea 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test negExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile NegExactILoadTest.java Verify.java * @run main NegExactILoadTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java index 17e49739e71..3897a1fcae9 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test negExact loop dependent * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile NegExactILoopDependentTest.java Verify.java * @run main NegExactILoopDependentTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java index 883dc4f82b7..703cf25065c 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test non constant negExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile NegExactINonConstantTest.java Verify.java * @run main NegExactINonConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java index 6425f81b4b2..52ea8a70547 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test constant negExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile NegExactLConstantTest.java Verify.java * @run main NegExactLConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java index 105b80d539e..3932147cba2 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test constant negExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile NegExactLNonConstantTest.java Verify.java * @run main NegExactLNonConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java index 213aa02c29b..cef59196493 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test subtractExact as condition * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile SubExactICondTest.java Verify.java * @run main SubExactICondTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java index 094b47497ac..96127d1e396 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test constant subtractExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile SubExactIConstantTest.java Verify.java * @run main SubExactIConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java index 976bf9babc4..7b8f017c805 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test non constant subtractExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile SubExactILoadTest.java Verify.java * @run main SubExactILoadTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java index 959bbb9eb92..71ea0dc3628 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test non constant subtractExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile SubExactILoopDependentTest.java Verify.java * @run main SubExactILoopDependentTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java index 74f41f38a0e..c0de7d3d959 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test non constant subtractExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile SubExactINonConstantTest.java Verify.java * @run main SubExactINonConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java index a7494c77583..698b36ed928 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026844 * @summary Test repeating subtractExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile SubExactIRepeatTest.java Verify.java * @run main SubExactIRepeatTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java index 67427615f29..722886847ef 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8027353 * @summary Test constant subtractExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile SubExactLConstantTest.java Verify.java * @run main SubExactLConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java index ec68f88e061..942939ed132 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8027353 * @summary Test non constant subtractExact * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile SubExactLNonConstantTest.java Verify.java * @run main SubExactLNonConstantTest * diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java index 5db9df2cbf1..99948387c4d 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build AddExactIntTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java index 7b68e7072d3..f13cabda852 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build AddExactLongTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java index a261d4cf1f2..1569e13308d 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build DecrementExactIntTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java index 527bdc769fe..7dc1f329937 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build DecrementExactLongTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java index dee345c22ae..f3b9df23778 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build IncrementExactIntTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java index e72ebb2dbc2..da230bbe6f4 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build IncrementExactLongTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java index 195c00dd708..f529dfe8fad 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build MultiplyExactIntTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java index 3773000bc16..0829f1f67f0 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build MultiplyExactLongTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java index 1151cf03fde..c0f07f51e16 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build NegateExactIntTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java index c54ce3b6359..7c8da0e65cb 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build NegateExactLongTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java index c9d9bacdd39..23f10d69f19 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build SubtractExactIntTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java index ca61982eb57..cf40b140f9d 100644 --- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java +++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @library /testlibrary /../../test/lib /compiler/whitebox * /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build SubtractExactLongTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java index ce6de958285..335fd0dd60b 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8035968 * @summary Verify UseSHA1Intrinsics option processing on supported CPU, * @library /testlibrary /../../test/lib /compiler/testlibrary testcases + * @modules java.base/sun.misc + * java.management * @build TestUseSHA1IntrinsicsOptionOnSupportedCPU * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java index 097d3b2872f..fe7b61b44d0 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8035968 * @summary Verify UseSHA1Intrinsics option processing on unsupported CPU, * @library /testlibrary /../../test/lib /compiler/testlibrary testcases + * @modules java.base/sun.misc + * java.management * @build TestUseSHA1IntrinsicsOptionOnUnsupportedCPU * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java index 576b3e9d593..fb73192e32f 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8035968 * @summary Verify UseSHA256Intrinsics option processing on supported CPU, * @library /testlibrary /../../test/lib /compiler/testlibrary testcases + * @modules java.base/sun.misc + * java.management * @build TestUseSHA256IntrinsicsOptionOnSupportedCPU * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java index 37c76b866ea..bfe7eb7b98b 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8035968 * @summary Verify UseSHA256Intrinsics option processing on unsupported CPU, * @library /testlibrary /../../test/lib /compiler/testlibrary testcases + * @modules java.base/sun.misc + * java.management * @build TestUseSHA256IntrinsicsOptionOnUnsupportedCPU * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java index f030e3fe851..65c5dc1d311 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8035968 * @summary Verify UseSHA512Intrinsics option processing on supported CPU. * @library /testlibrary /../../test/lib /compiler/testlibrary testcases + * @modules java.base/sun.misc + * java.management * @build TestUseSHA512IntrinsicsOptionOnSupportedCPU * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java index 2c6fb68bd07..d000438e844 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8035968 * @summary Verify UseSHA512Intrinsics option processing on unsupported CPU, * @library /testlibrary /../../test/lib /compiler/testlibrary testcases + * @modules java.base/sun.misc + * java.management * @build TestUseSHA512IntrinsicsOptionOnUnsupportedCPU * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java index 68f48be26a8..e6b2400c5a6 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8035968 * @summary Verify UseSHA option processing on supported CPU, * @library /testlibrary /../../test/lib /compiler/testlibrary testcases + * @modules java.base/sun.misc + * java.management * @build TestUseSHAOptionOnSupportedCPU * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java index fb666af0cbe..3fbcd67fd28 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8035968 * @summary Verify UseSHA option processing on unsupported CPU. * @library /testlibrary /../../test/lib /compiler/testlibrary testcases + * @modules java.base/sun.misc + * java.management * @build TestUseSHAOptionOnUnsupportedCPU * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java index d3e60ee4bad..9423521bb2a 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8035968 * @summary Verify that SHA-1 intrinsic is actually used. * @library /testlibrary /../../test/lib /compiler/testlibrary ../ + * @modules java.base/sun.misc + * java.management * @build TestSHA intrinsics.Verifier TestSHA1Intrinsics * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java index 1fca2770109..88c597240c4 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import sha.predicate.IntrinsicPredicates; * @bug 8035968 * @summary Verify that SHA-1 multi block intrinsic is actually used. * @library /testlibrary /../../test/lib /compiler/testlibrary ../ + * @modules java.base/sun.misc + * java.management * @build TestSHA intrinsics.Verifier TestSHA1MultiBlockIntrinsics * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java index 0bc38aeb820..d579659f131 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import sha.predicate.IntrinsicPredicates; * @bug 8035968 * @summary Verify that SHA-256 intrinsic is actually used. * @library /testlibrary /../../test/lib /compiler/testlibrary ../ + * @modules java.base/sun.misc + * java.management * @build TestSHA intrinsics.Verifier TestSHA256Intrinsics * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java index 39a55078d5c..665d8d1f046 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import sha.predicate.IntrinsicPredicates; * @bug 8035968 * @summary Verify that SHA-256 multi block intrinsic is actually used. * @library /testlibrary /../../test/lib /compiler/testlibrary ../ + * @modules java.base/sun.misc + * java.management * @build TestSHA intrinsics.Verifier TestSHA256MultiBlockIntrinsics * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java index e97d3a3e55d..57a1cc9daa4 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import sha.predicate.IntrinsicPredicates; * @bug 8035968 * @summary Verify that SHA-512 intrinsic is actually used. * @library /testlibrary /../../test/lib /compiler/testlibrary ../ + * @modules java.base/sun.misc + * java.management * @build TestSHA intrinsics.Verifier TestSHA512Intrinsics * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java index d096d27d8e7..f6958d70862 100644 --- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java +++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import sha.predicate.IntrinsicPredicates; * @bug 8035968 * @summary Verify that SHA-512 multi block intrinsic is actually used. * @library /testlibrary /../../test/lib /compiler/testlibrary ../ + * @modules java.base/sun.misc + * java.management * @build TestSHA intrinsics.Verifier TestSHA512MultiBlockIntrinsics * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java index 9e5772a944d..468a99df521 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java +++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test * @bug 6653795 * @summary C2 intrinsic for Unsafe.getAddress performs pointer sign extension on 32-bit systems + * @modules java.base/sun.misc * @run main UnsafeGetAddressTest * */ diff --git a/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java b/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java index 3aa6b061204..56b25269a0f 100644 --- a/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java +++ b/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8022595 * @summary JSR292: deadlock during class loading of MethodHandles, MethodHandleImpl & MethodHandleNatives * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm ConcurrentClassLoadingTest */ import com.oracle.java.testlibrary.Utils; diff --git a/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java index 0230702d7ed..85810645833 100644 --- a/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java +++ b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test * @bug 8026124 * @summary Javascript file provoked assertion failure in linkResolver.cpp - * + * @modules jdk.scripting.nashorn/jdk.nashorn.tools * @run main/othervm CreatesInterfaceDotEqualsCallInfo */ diff --git a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java index 1695c35558a..deee0ecdeef 100644 --- a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java +++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,10 @@ * @test * @bug 8042235 * @summary redefining method used by multiple MethodHandles crashes VM + * @modules java.base/jdk.internal.org.objectweb.asm + * java.compiler + * java.instrument + * java.management * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java * @run main RedefineMethodUsedByMultipleMethodHandles */ diff --git a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java index dc8b577c81e..efe252f9067 100644 --- a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java +++ b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ /** * @test * @bug 8058828 + * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/sun.misc * @run main/bootclasspath -Xbatch VMAnonymousClasses */ diff --git a/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java b/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java index 0e525dec2f2..93fe9bddeb5 100644 --- a/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java +++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ import p.Dok; * @test @bug 8025260 8016839 * @summary Ensure that AbstractMethodError and IllegalAccessError are thrown appropriately, not NullPointerException * + * @modules java.base/jdk.internal.org.objectweb.asm * @compile -XDignore.symbol.file TestAMEnotNPE.java ByteClassLoader.java p/C.java p/Dok.java p/E.java p/F.java p/I.java p/Tdirect.java p/Treflect.java * * @run main/othervm TestAMEnotNPE diff --git a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java index 6d69b5e7dd4..b78d2ffbd71 100644 --- a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java +++ b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ import com.oracle.java.testlibrary.*; * @bug 8055286 8056964 8059847 8069035 * @summary "Checks parsing of -XX:CompileCommand=option" * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main CheckCompileCommandOption */ diff --git a/hotspot/test/compiler/oracle/TestCompileCommand.java b/hotspot/test/compiler/oracle/TestCompileCommand.java index e2575ed1fa5..62c59dbf52d 100644 --- a/hotspot/test/compiler/oracle/TestCompileCommand.java +++ b/hotspot/test/compiler/oracle/TestCompileCommand.java @@ -31,6 +31,8 @@ import com.oracle.java.testlibrary.*; * @bug 8069389 * @summary "Regression tests of -XX:CompileCommand" * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main TestCompileCommand */ diff --git a/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java b/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java index 82bbfc2ae4c..516d4855f19 100644 --- a/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java +++ b/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*; * @test * @bug 8051344 * @summary Force OSR compilation with non-empty stack at the OSR entry point. + * @modules java.base/jdk.internal.org.objectweb.asm * @compile -XDignore.symbol.file TestOSRWithNonEmptyStack.java * @run main/othervm -XX:CompileOnly=TestCase.test TestOSRWithNonEmptyStack */ diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java index 7a645ab0b8f..0f6d325caa1 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,9 @@ import com.oracle.java.testlibrary.*; * @test * @bug 8038636 * @library /testlibrary + * @modules java.base/sun.misc + * java.instrument + * java.management * @build Agent * @run main ClassFileInstaller Agent * @run main Launcher diff --git a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java index 3c49cd58ea7..dc7f6938e62 100644 --- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java +++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,9 @@ import com.oracle.java.testlibrary.*; * @test * @bug 8040237 * @library /testlibrary + * @modules java.base/sun.misc + * java.instrument + * java.management * @build Agent Test A B * @run main ClassFileInstaller Agent * @run main Launcher diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java index 4eae3809ef8..33ca4c37d4e 100644 --- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8066103 * @summary C2's range check smearing allows out of bound array accesses * @library /testlibrary /../../test/lib /compiler/whitebox + * @modules java.base/sun.misc + * java.management * @build TestRangeCheckSmearing * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java index cf3ebabb925..5cc74800b96 100644 --- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify PrintPreciseRTMLockingStatistics on CPUs with * rtm support and on VM with rtm locking support, * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java index b3e7bbe4a2c..afd4949bee0 100644 --- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify PrintPreciseRTMLockingStatistics on CPUs without * rtm support and/or unsupported VM. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java index a44cf8c53de..37f94390a4c 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify RTMAbortRatio option processing on CPU with rtm * support and on VM with rtm locking support. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMAbortRatioOptionOnSupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java index 3dfd8937ea1..c110e3cca30 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify RTMAbortRatio option processing on CPU without rtm * support or on VM that does not support rtm locking. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMAbortRatioOptionOnUnsupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java index 120d6f9d379..d43e7c26eae 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify processing of RTMAbortThreshold option. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMAbortThresholdOption * @run main/othervm TestRTMAbortThresholdOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java index 90e85e692e8..7a059c1d6cc 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify processing of RTMLockingCalculationDelay option. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMLockingCalculationDelayOption * @run main/othervm TestRTMLockingCalculationDelayOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java index 81f2e60e43a..9f13b74dd98 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify processing of RTMLockingThreshold option. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMLockingThresholdOption * @run main/othervm TestRTMLockingThresholdOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java index 0d4e52ce52d..f0832480f1d 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify processing of RTMRetryCount option. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMRetryCountOption * @run main/othervm TestRTMRetryCountOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java index 33015d03c0b..ec59cdbe58c 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify processing of RTMSpinLoopCount option. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMSpinLoopCountOption * @run main/othervm TestRTMSpinLoopCountOption */ diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java index 3e982c6945c..93e0222fd34 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify RTMTotalCountIncrRate option processing on CPU with * rtm support and on VM with rtm locking support. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMTotalCountIncrRateOptionOnSupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java index 69617d423bf..1a90edaee0d 100644 --- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ import rtm.predicate.SupportedVM; * @summary Verify RTMTotalCountIncrRate option processing on CPU without * rtm support and/or on VM without rtm locking support. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMTotalCountIncrRateOptionOnUnsupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java index de40746ec9f..1dbd945bf1f 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify UseRTMDeopt option processing on CPUs with rtm support * when rtm locking is supported by VM. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMDeoptOptionOnSupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java index 59f9f450feb..31a1c624cd2 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify UseRTMDeopt option processing on CPUs without rtm support * or on VMs without rtm locking support. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMDeoptOptionOnUnsupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java index 692c396354c..d0227f50b70 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify UseRTMForStackLocks option processing on CPU with * rtm support when VM supports rtm locking. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMForStackLocksOptionOnSupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java index 829cb560368..6952b22be26 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify UseRTMForStackLocks option processing on CPUs without * rtm support and/or on VMs without rtm locking support. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMForStackLocksOptionOnUnsupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java index 6012d56c11c..69158c1393f 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify UseRTMLocking option processing on CPU with rtm support and * on VM with rtm-locking support. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMLockingOptionOnSupportedConfig * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java index 3fba16e1e09..63adae5e4b6 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify UseRTMLocking option processing on CPU without * rtm support. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMLockingOptionOnUnsupportedCPU * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java index a03122491d1..75d3930072e 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify UseRTMLocking option processing on CPU with rtm support * in case when VM should not support this option. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMLockingOptionOnUnsupportedVM * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java index ed82aec36c4..1a7299e3c3e 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify processing of UseRTMLocking and UseBiasedLocking * options combination on CPU and VM with rtm support. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMLockingOptionWithBiasedLocking * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java index 0d112ce03b8..af76b83a9c6 100644 --- a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java +++ b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify processing of UseRTMXendForLockBusy option. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMXendForLockBusyOption * @run main/othervm TestUseRTMXendForLockBusyOption */ diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java index 4a41d3768c5..1d3da36e63d 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that RTMAbortRatio affects amount of aborts before * deoptimization. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMAbortRatio * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java index 7bf1548a991..f177308d5e7 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that RTMAbortThreshold option affects * amount of aborts after which abort ratio is calculated. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMAbortThreshold * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java index 5269a25974b..1b4647d126e 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ * method's RTM state. And if we don't use RTMDeopt, then * RTM state remain the same after such deoptimization. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMAfterNonRTMDeopt * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java index 0362bc97b77..d10ae072304 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that on high abort ratio method will be recompiled * without rtm locking. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMDeoptOnHighAbortRatio * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java index ae39ffb25c0..c3ba476f8b8 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify that on low abort ratio method will be recompiled. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMDeoptOnLowAbortRatio * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java index 61544942bd6..6cb146a12bd 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that RTMLockingCalculationDelay affect when * abort ratio calculation is started. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMLockingCalculationDelay * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java index 66daef96ff5..0a2ffa6153a 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that RTMLockingThreshold affects rtm state transition * ProfileRTM => UseRTM. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMLockingThreshold * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java index 2c22c417f9f..d4af4add270 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify that RTMRetryCount affects actual amount of retries. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMRetryCount * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java index 121f5d36092..dccefd4997e 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that RTMSpinLoopCount affects time spent * between locking attempts. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMSpinLoopCount * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java index 56a66d0804f..9ea2d98ed9f 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java @@ -28,6 +28,8 @@ * @summary Verify that RTMTotalCountIncrRate option affects * RTM locking statistics. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestRTMTotalCountIncrRate * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java index a6334703c76..5f331042a5e 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that rtm locking is used for stack locks before * inflation and after it used for inflated locks. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMAfterLockInflation * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java index 008e502e508..22af94d77f1 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that UseRTMDeopt affects uncommon trap installation in * copmpiled methods with synchronized block. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMDeopt * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java index 1555939e7d8..1f62b7bd46d 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify that rtm locking is used for inflated locks. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMForInflatedLocks * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java index 4c89320ad83..1e8b21c95ae 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8031320 * @summary Verify that rtm locking is used for stack locks. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMForStackLocks * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java index f703dc8cc3f..4d36b4d27eb 100644 --- a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java +++ b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that UseRTMXendForLockBusy option affects * method behaviour if lock is busy. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMXendForLockBusy * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java index dc308b5172b..ff53c5e2901 100644 --- a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java +++ b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Verify that NoRTMLockEliding option could be applied to * specified method and that such method will not use rtm. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestNoRTMLockElidingOption * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java index e2376ba181d..0fb71a23e4a 100644 --- a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java +++ b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ * specified method and that such method will not be deoptimized * on high abort ratio. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestUseRTMLockElidingOption * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java index 291d4cabef5..a93c84e742d 100644 --- a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java +++ b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ * different types. Test also verify that VM output does not * contain rtm locking statistics when it should not. * @library /testlibrary /../../test/lib /compiler/testlibrary + * @modules java.base/sun.misc + * java.management * @build TestPrintPreciseRTMLockingStatistics * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/runtime/8010927/Test8010927.java b/hotspot/test/compiler/runtime/8010927/Test8010927.java index bb52c4c5817..c00e81415c8 100644 --- a/hotspot/test/compiler/runtime/8010927/Test8010927.java +++ b/hotspot/test/compiler/runtime/8010927/Test8010927.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ * @bug 8010927 * @summary Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy * @library /../../test/lib /testlibrary + * @modules java.base/sun.misc * @build Test8010927 * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java index 1cfd757fd0f..f13d8830774 100644 --- a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java +++ b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8034775 * @summary Ensures correct minimal number of compiler threads (provided by -XX:CICompilerCount=) * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java index fa7a8b8ee9a..011ba282185 100644 --- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java +++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * to initialize all compiler threads. The option -Xcomp gives the VM more time to * trigger the old bug. * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; import static com.oracle.java.testlibrary.Asserts.assertTrue; diff --git a/hotspot/test/compiler/startup/StartupOutput.java b/hotspot/test/compiler/startup/StartupOutput.java index e4a1b4cd4c5..b408f2c932d 100644 --- a/hotspot/test/compiler/startup/StartupOutput.java +++ b/hotspot/test/compiler/startup/StartupOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8026949 * @summary Test ensures correct VM output during startup * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java index c55207a162e..3b3271d2938 100644 --- a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java +++ b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ import java.util.concurrent.Callable; /** * @test ConstantGettersTransitionsTest * @library /testlibrary /../../test/lib /compiler/whitebox + * @modules java.base/sun.misc + * java.management * @build TransitionsTestExecutor ConstantGettersTransitionsTest * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions diff --git a/hotspot/test/compiler/tiered/LevelTransitionTest.java b/hotspot/test/compiler/tiered/LevelTransitionTest.java index 852060975b1..26236ea8542 100644 --- a/hotspot/test/compiler/tiered/LevelTransitionTest.java +++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ import java.util.concurrent.Callable; /** * @test LevelTransitionTest * @library /testlibrary /../../test/lib /compiler/whitebox + * @modules java.base/sun.misc + * java.management * @ignore 8067651 * @build TransitionsTestExecutor LevelTransitionTest * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java index 51b478f2f9c..510d7f6ae47 100644 --- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ import java.util.function.IntPredicate; /** * @test NonTieredLevelsTest * @library /testlibrary /../../test/lib /compiler/whitebox + * @modules java.management * @build NonTieredLevelsTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/tiered/TieredLevelsTest.java b/hotspot/test/compiler/tiered/TieredLevelsTest.java index 1411a07b3ab..92c65c0af59 100644 --- a/hotspot/test/compiler/tiered/TieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /** * @test TieredLevelsTest * @library /testlibrary /../../test/lib /compiler/whitebox + * @modules java.management * @build TieredLevelsTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/types/correctness/CorrectnessTest.java b/hotspot/test/compiler/types/correctness/CorrectnessTest.java index c5239df8942..2d896eac266 100644 --- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java +++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test CorrectnessTest * @bug 8038418 * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @ignore 8066173 * @compile execution/TypeConflict.java execution/TypeProfile.java * execution/MethodHandleDelegate.java diff --git a/hotspot/test/compiler/types/correctness/OffTest.java b/hotspot/test/compiler/types/correctness/OffTest.java index 0125fe76af5..0c628b1c565 100644 --- a/hotspot/test/compiler/types/correctness/OffTest.java +++ b/hotspot/test/compiler/types/correctness/OffTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test CorrectnessTest * @bug 8038418 * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @ignore 8066173 * @compile execution/TypeConflict.java execution/TypeProfile.java * execution/MethodHandleDelegate.java diff --git a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java index 87aaf66d247..fe78d4c814c 100644 --- a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java +++ b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,11 @@ import uncommontrap.Verifier; * @test * @bug 8030976 8059226 * @library /testlibrary /compiler/testlibrary /../../test/lib + * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build TestUnstableIfTrap com.oracle.java.testlibrary.* uncommontrap.Verifier * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java index c3f455274dd..a32769f4603 100644 --- a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java +++ b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test * @bug 8016474 * @summary The bug only happens with C1 and G1 using a different ObjectAlignmentInBytes than KlassAlignmentInBytes (which is 8) + * @modules java.base/sun.misc * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 GetUnsafeObjectG1PreBarrier */ diff --git a/hotspot/test/compiler/unsafe/UnsafeRaw.java b/hotspot/test/compiler/unsafe/UnsafeRaw.java index f2a19ff06af..d5dda818156 100644 --- a/hotspot/test/compiler/unsafe/UnsafeRaw.java +++ b/hotspot/test/compiler/unsafe/UnsafeRaw.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8058744 * @summary Invalid pattern-matching of address computations in raw unsafe * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -Xbatch UnsafeRaw */ diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java index 56def58f5c3..8bda23a7197 100644 --- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java +++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ import com.oracle.java.testlibrary.InfiniteLoop; * @test AllocationCodeBlobTest * @bug 8059624 8064669 * @library /testlibrary /../../test/lib + * @modules java.management * @build AllocationCodeBlobTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java index 8a13a689c1d..be2cbdd2300 100644 --- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java +++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import java.util.function.Function; * @test ClearMethodStateTest * @bug 8006683 8007288 8022832 * @library /testlibrary /../../test/lib + * @modules java.management * @build ClearMethodStateTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java index 910eb95dc99..90169717ab3 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test DeoptimizeAllTest * @bug 8006683 8007288 8022832 * @library /testlibrary /../../test/lib + * @modules java.management * @build DeoptimizeAllTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java index 40d7be385bf..99cec702a54 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test DeoptimizeFramesTest * @bug 8028595 * @library /testlibrary /../../test/lib + * @modules java.management * @build DeoptimizeFramesTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java index 667e3d56ae7..3b08717b20a 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test DeoptimizeMethodTest * @bug 8006683 8007288 8022832 * @library /testlibrary /../../test/lib + * @modules java.management * @build DeoptimizeMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java index b4d729bedbd..54851c4d61d 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ import java.lang.reflect.Method; * @test DeoptimizeMultipleOSRTest * @bug 8061817 * @library /testlibrary /../../test/lib + * @modules java.management * @build DeoptimizeMultipleOSRTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java index f068eeb1226..2560d81fc30 100644 --- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java +++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test EnqueueMethodForCompilationTest * @bug 8006683 8007288 8022832 * @library /testlibrary /../../test/lib + * @modules java.management * @build EnqueueMethodForCompilationTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java index 0f90d898625..83f6640a0a6 100644 --- a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java +++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ import com.oracle.java.testlibrary.InfiniteLoop; * @test * @bug 8059624 8064669 * @library /testlibrary /../../test/lib + * @modules java.management * @build ForceNMethodSweepTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java index 9a3036346ac..d247d606f35 100644 --- a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java +++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ import com.oracle.java.testlibrary.Asserts; * @test GetCodeHeapEntriesTest * @bug 8059624 * @library /testlibrary /../../test/lib + * @modules java.management * @build GetCodeHeapEntriesTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java index 28d0e4312f9..92807b2ebe0 100644 --- a/hotspot/test/compiler/whitebox/GetNMethodTest.java +++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,7 @@ import com.oracle.java.testlibrary.Asserts; * @test GetNMethodTest * @bug 8038240 * @library /testlibrary /../../test/lib + * @modules java.management * @build GetNMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java index 0017d0ca1ed..97c896170c9 100644 --- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java +++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test IsMethodCompilableTest * @bug 8007270 8006683 8007288 8022832 * @library /testlibrary /../../test/lib /testlibrary/com/oracle/java/testlibrary + * @modules java.base/sun.misc + * java.management * @build IsMethodCompilableTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/LockCompilationTest.java b/hotspot/test/compiler/whitebox/LockCompilationTest.java index 25080fe606a..a920fcc5530 100644 --- a/hotspot/test/compiler/whitebox/LockCompilationTest.java +++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test LockCompilationTest * @bug 8059624 * @library /testlibrary /../../test/lib + * @modules java.management * @build LockCompilationTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java index ca5ff1f709b..faac33515d4 100644 --- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java +++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test MakeMethodNotCompilableTest * @bug 8012322 8006683 8007288 8022832 * @library /testlibrary /../../test/lib + * @modules java.management * @build MakeMethodNotCompilableTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java index 0c4ee8d104e..1638a5eff28 100644 --- a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test SetDontInlineMethodTest * @bug 8006683 8007288 8022832 * @library /testlibrary /../../test/lib + * @modules java.management * @build SetDontInlineMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java index caca0f6fbb4..a9e19915927 100644 --- a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test SetForceInlineMethodTest * @bug 8006683 8007288 8022832 * @library /testlibrary /../../test/lib + * @modules java.management * @build SetForceInlineMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/6581734/Test6581734.java b/hotspot/test/gc/6581734/Test6581734.java index 9ec55c85732..5201a751dfa 100644 --- a/hotspot/test/gc/6581734/Test6581734.java +++ b/hotspot/test/gc/6581734/Test6581734.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ * @bug 6581734 * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" * @summary CMS Old Gen's collection usage is zero after GC which is incorrect + * @modules java.management * @run main/othervm -Xmx512m -verbose:gc -XX:+UseConcMarkSweepGC Test6581734 * */ diff --git a/hotspot/test/gc/6941923/Test6941923.java b/hotspot/test/gc/6941923/Test6941923.java index 8ba13a8b108..d667624f00e 100644 --- a/hotspot/test/gc/6941923/Test6941923.java +++ b/hotspot/test/gc/6941923/Test6941923.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 6941923 * @summary test flags for gc log rotation * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm/timeout=600 Test6941923 * */ diff --git a/hotspot/test/gc/7072527/TestFullGCCount.java b/hotspot/test/gc/7072527/TestFullGCCount.java index 96b66c1e4d1..fcd422ff389 100644 --- a/hotspot/test/gc/7072527/TestFullGCCount.java +++ b/hotspot/test/gc/7072527/TestFullGCCount.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test TestFullGCount.java * @bug 7072527 * @summary CMS: JMM GC counters overcount in some cases + * @modules java.management * @run main/othervm -XX:+PrintGC TestFullGCCount */ import java.util.*; diff --git a/hotspot/test/gc/TestCardTablePageCommits.java b/hotspot/test/gc/TestCardTablePageCommits.java index 0dec3d83b93..d8ceb00bf7c 100644 --- a/hotspot/test/gc/TestCardTablePageCommits.java +++ b/hotspot/test/gc/TestCardTablePageCommits.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ import com.oracle.java.testlibrary.Platform; * @bug 8059066 * @summary Tests that the card table does not commit the same page twice * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run driver TestCardTablePageCommits */ public class TestCardTablePageCommits { diff --git a/hotspot/test/gc/TestGCLogRotationViaJcmd.java b/hotspot/test/gc/TestGCLogRotationViaJcmd.java index fd71d368b88..bcd170a4371 100644 --- a/hotspot/test/gc/TestGCLogRotationViaJcmd.java +++ b/hotspot/test/gc/TestGCLogRotationViaJcmd.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 7090324 * @summary test for gc log rotation via jcmd * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -Xloggc:test.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=3 TestGCLogRotationViaJcmd * */ diff --git a/hotspot/test/gc/TestObjectAlignment.java b/hotspot/test/gc/TestObjectAlignment.java index 8cfc9709f16..674903c1840 100644 --- a/hotspot/test/gc/TestObjectAlignment.java +++ b/hotspot/test/gc/TestObjectAlignment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8021823 * @summary G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=8 * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 diff --git a/hotspot/test/gc/TestSmallHeap.java b/hotspot/test/gc/TestSmallHeap.java index 3b05574ac0d..32eee646078 100644 --- a/hotspot/test/gc/TestSmallHeap.java +++ b/hotspot/test/gc/TestSmallHeap.java @@ -29,6 +29,7 @@ * @requires vm.compMode != "Xcomp" * @summary Verify that starting the VM with a small heap works * @library /testlibrary /../../test/lib + * @modules java.management/sun.management * @build TestSmallHeap * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseParallelGC TestSmallHeap diff --git a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java index abf6f80e369..860f49db4e7 100644 --- a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java +++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java @@ -26,6 +26,8 @@ * @key gc * @summary Tests that all SoftReferences has been cleared at time of OOM. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @ignore 8073669 * @build TestSoftReferencesBehaviorOnOOME * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k diff --git a/hotspot/test/gc/TestVerifyDuringStartup.java b/hotspot/test/gc/TestVerifyDuringStartup.java index f4ac347f80e..3bf6388385c 100644 --- a/hotspot/test/gc/TestVerifyDuringStartup.java +++ b/hotspot/test/gc/TestVerifyDuringStartup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8010463 8011343 8011898 * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463 * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.JDKToolFinder; diff --git a/hotspot/test/gc/TestVerifySilently.java b/hotspot/test/gc/TestVerifySilently.java index deefd4863e4..52dba6c1263 100644 --- a/hotspot/test/gc/TestVerifySilently.java +++ b/hotspot/test/gc/TestVerifySilently.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8032771 * @summary Test silent verification. * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java b/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java index 3bbe15075a4..57a717df0ab 100644 --- a/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java +++ b/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @bug 8054823 * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run driver TestArrayAllocatorMallocLimit */ diff --git a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java index 01fed8df0dc..b2b017b0ffe 100644 --- a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8006088 * @summary Tests argument processing for initial and maximum heap size for the CMS collector * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestCMSHeapSizeFlags TestMaxHeapSizeTools * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/arguments/TestCompressedClassFlags.java b/hotspot/test/gc/arguments/TestCompressedClassFlags.java index 4135debd89c..eefc04a7edb 100644 --- a/hotspot/test/gc/arguments/TestCompressedClassFlags.java +++ b/hotspot/test/gc/arguments/TestCompressedClassFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ import com.oracle.java.testlibrary.*; * @summary Tests that VM prints a warning when -XX:CompressedClassSpaceSize * is used together with -XX:-UseCompressedClassPointers * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ public class TestCompressedClassFlags { public static void main(String[] args) throws Exception { diff --git a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java index 53728b8187b..45d0df27abe 100644 --- a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ import com.oracle.java.testlibrary.DynamicVMOption; * @bug 8028391 * @summary Verify that MaxHeapFreeRatio flag is manageable * @library /testlibrary + * @modules java.management * @run main TestDynMaxHeapFreeRatio * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestDynMaxHeapFreeRatio * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:-UseAdaptiveSizePolicy TestDynMaxHeapFreeRatio diff --git a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java index bbf0ecf3f5f..5e696e2169e 100644 --- a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ * @bug 8028391 * @summary Verify that MinHeapFreeRatio flag is manageable * @library /testlibrary + * @modules java.management * @run main TestDynMinHeapFreeRatio * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestDynMinHeapFreeRatio * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:-UseAdaptiveSizePolicy TestDynMinHeapFreeRatio diff --git a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java index 1d73b1c74c6..86dffc24b6b 100644 --- a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java +++ b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8047976 * @summary Tests argument processing for G1ConcRefinementThreads * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java index 41c2e1cc095..c15a798cda4 100644 --- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java +++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ * @key gc * @bug 8021879 * @summary Verify that the flag G1HeapRegionSize is updated properly + * @modules java.management/sun.management * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576 * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152 * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152 diff --git a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java index daa02c455f6..32c55bddb63 100644 --- a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8006088 * @summary Tests argument processing for initial and maximum heap size for the G1 collector * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestG1HeapSizeFlags TestMaxHeapSizeTools * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/arguments/TestG1PercentageOptions.java b/hotspot/test/gc/arguments/TestG1PercentageOptions.java index f66656f80da..c641dc50170 100644 --- a/hotspot/test/gc/arguments/TestG1PercentageOptions.java +++ b/hotspot/test/gc/arguments/TestG1PercentageOptions.java @@ -27,6 +27,8 @@ * @bug 8068942 * @summary Test argument processing of various percentage options * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run driver TestG1PercentageOptions */ diff --git a/hotspot/test/gc/arguments/TestHeapFreeRatio.java b/hotspot/test/gc/arguments/TestHeapFreeRatio.java index 11e259df038..36e0b95878d 100644 --- a/hotspot/test/gc/arguments/TestHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestHeapFreeRatio.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8025661 * @summary Test parsing of -Xminf and -Xmaxf * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm TestHeapFreeRatio */ diff --git a/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java b/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java index 130ff744d08..65f1f3a8d6a 100644 --- a/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java +++ b/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8014765 * @summary Tests argument processing for initial tenuring threshold * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm TestInitialTenuringThreshold * @author thomas.schatzl@oracle.com */ @@ -72,4 +74,4 @@ public class TestInitialTenuringThreshold { runWithThresholds(16, 8, true); runWithThresholds(8, 17, true); } -} \ No newline at end of file +} diff --git a/hotspot/test/gc/arguments/TestMaxNewSize.java b/hotspot/test/gc/arguments/TestMaxNewSize.java index af20cb819e3..a49df8a9958 100644 --- a/hotspot/test/gc/arguments/TestMaxNewSize.java +++ b/hotspot/test/gc/arguments/TestMaxNewSize.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Make sure that MaxNewSize always has a useful value after argument * processing. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build TestMaxNewSize * @run main TestMaxNewSize -XX:+UseSerialGC * @run main TestMaxNewSize -XX:+UseParallelGC diff --git a/hotspot/test/gc/arguments/TestMinInitialErgonomics.java b/hotspot/test/gc/arguments/TestMinInitialErgonomics.java index 3b297266cbe..3310411f163 100644 --- a/hotspot/test/gc/arguments/TestMinInitialErgonomics.java +++ b/hotspot/test/gc/arguments/TestMinInitialErgonomics.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8006088 * @summary Test ergonomics decisions related to minimum and initial heap size. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestMinInitialErgonomics TestMaxHeapSizeTools * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/arguments/TestObjectTenuringFlags.java b/hotspot/test/gc/arguments/TestObjectTenuringFlags.java index 64ddeb46744..c4c73260b06 100644 --- a/hotspot/test/gc/arguments/TestObjectTenuringFlags.java +++ b/hotspot/test/gc/arguments/TestObjectTenuringFlags.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Tests argument processing for NeverTenure, AlwaysTenure, * and MaxTenuringThreshold * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build TestObjectTenuringFlags FlagsValue * @run main/othervm TestObjectTenuringFlags */ diff --git a/hotspot/test/gc/arguments/TestParallelGCThreads.java b/hotspot/test/gc/arguments/TestParallelGCThreads.java index f70da25b1b5..c7b81224853 100644 --- a/hotspot/test/gc/arguments/TestParallelGCThreads.java +++ b/hotspot/test/gc/arguments/TestParallelGCThreads.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8059527 * @summary Tests argument processing for ParallelGCThreads * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run driver TestParallelGCThreads */ diff --git a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java index 8276e68c234..fa12fa133a2 100644 --- a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary Tests argument processing for initial and maximum heap size for the * parallel collectors. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestParallelHeapSizeFlags TestMaxHeapSizeTools * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java b/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java index 4e568268edd..f5e320e0400 100644 --- a/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java +++ b/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8006088 * @summary Tests argument processing for initial and maximum heap size for the Serial collector * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestSerialHeapSizeFlags TestMaxHeapSizeTools * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java b/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java index 3841bfb9fde..6e31893ca27 100644 --- a/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java +++ b/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,8 @@ import com.oracle.java.testlibrary.cli.CommandLineOptionTest; * & vm.opt.UnlockExperimentalVMOptions == null * & (vm.opt.IgnoreUnrecognizedVMOptions == null * | vm.opt.IgnoreUnrecognizedVMOptions == "false") + * @modules java.base/sun.misc + * java.management * @run main TestSurvivorAlignmentInBytesOption */ public class TestSurvivorAlignmentInBytesOption { diff --git a/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java b/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java index a61b5f30940..1e8532ed3f1 100644 --- a/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java +++ b/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8017611 * @summary Tests handling unrecognized VM options * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm TestUnrecognizedVMOptionsHandling */ diff --git a/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java b/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java index 09a54a0a790..5a2005e643c 100644 --- a/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java +++ b/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8010722 * @summary Tests ergonomics for UseCompressedOops. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management/sun.management * @build TestUseCompressedOopsErgo TestUseCompressedOopsErgoTools * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java b/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java index edc6f9faf2f..831dd1f3c9b 100644 --- a/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java +++ b/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @bug 8059614 * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run driver TestUseNUMAInterleaving */ import com.oracle.java.testlibrary.ProcessTools; diff --git a/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java b/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java index c7985dfd47d..d51d32775bc 100644 --- a/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java +++ b/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key gc * @bug 8049831 * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestCMSClassUnloadingEnabledHWM * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java b/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java index 374184e3944..d62670e0d22 100644 --- a/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java +++ b/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key gc * @bug 8049831 * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestG1ClassUnloadingHWM * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/concurrentMarkSweep/GuardShrinkWarning.java b/hotspot/test/gc/concurrentMarkSweep/GuardShrinkWarning.java index a2d47625713..a44da1321a4 100644 --- a/hotspot/test/gc/concurrentMarkSweep/GuardShrinkWarning.java +++ b/hotspot/test/gc/concurrentMarkSweep/GuardShrinkWarning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @key gc * @key regression * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm GuardShrinkWarning * @author jon.masamitsu@oracle.com */ diff --git a/hotspot/test/gc/defnew/HeapChangeLogging.java b/hotspot/test/gc/defnew/HeapChangeLogging.java index e2be82a0e4d..8c2066cab79 100644 --- a/hotspot/test/gc/defnew/HeapChangeLogging.java +++ b/hotspot/test/gc/defnew/HeapChangeLogging.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test HeapChangeLogging.java * @bug 8027440 * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build HeapChangeLogging * @summary Allocate to get a promotion failure and verify that that heap change logging is present. * @run main HeapChangeLogging diff --git a/hotspot/test/gc/g1/Test2GbHeap.java b/hotspot/test/gc/g1/Test2GbHeap.java index 6b0cd3b8de2..17391c6e45a 100644 --- a/hotspot/test/gc/g1/Test2GbHeap.java +++ b/hotspot/test/gc/g1/Test2GbHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @key gc * @key regression * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import java.util.ArrayList; diff --git a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java index b920e7ab832..3243b738da6 100644 --- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java +++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * up the heap with humongous objects that should be eagerly reclaimable to avoid Full GC. * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import java.util.regex.Pattern; diff --git a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java index 5b4e694770f..a61c0d4d581 100644 --- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java +++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * mark bitmaps at reclaim. * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import java.util.ArrayList; diff --git a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java index d12e25af720..1ad308451d1 100644 --- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java +++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ * should still be eagerly reclaimable to avoid Full GC. * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import java.util.regex.Pattern; diff --git a/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java b/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java index e653554c94e..0a4e915c0b6 100644 --- a/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java +++ b/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * includes the expected necessary messages. * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.ProcessTools; diff --git a/hotspot/test/gc/g1/TestGCLogMessages.java b/hotspot/test/gc/g1/TestGCLogMessages.java index 938d17bfec4..0d5ad2b6395 100644 --- a/hotspot/test/gc/g1/TestGCLogMessages.java +++ b/hotspot/test/gc/g1/TestGCLogMessages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * includes the expected necessary messages. * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.ProcessTools; diff --git a/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java b/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java index b6e5c3d66d3..b8f7b3ad782 100644 --- a/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java +++ b/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 7168848 * @summary G1: humongous object allocations should initiate marking cycles when necessary * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java b/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java index c24b3ecf867..131ebe516c2 100644 --- a/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java +++ b/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @key gc * @bug 8027756 * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestHumongousCodeCacheRoots * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java index 764cfab3d51..32856cac06b 100644 --- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java +++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ * @summary Verify that heap shrinks after GC in the presence of fragmentation * due to humongous objects * @library /testlibrary + * @modules java.management/sun.management * @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10 * -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc * TestHumongousShrinkHeap diff --git a/hotspot/test/gc/g1/TestPrintGCDetails.java b/hotspot/test/gc/g1/TestPrintGCDetails.java index 4280a19cd25..1d07a7d7223 100644 --- a/hotspot/test/gc/g1/TestPrintGCDetails.java +++ b/hotspot/test/gc/g1/TestPrintGCDetails.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @key gc * @key regression * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.ProcessTools; diff --git a/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java b/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java index 6bf41391b4f..97934bf6924 100644 --- a/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java +++ b/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8014240 * @summary Test output of G1PrintRegionRememberedSetInfo * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main TestPrintRegionRememberedSetInfo * @author thomas.schatzl@oracle.com */ diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java index 7d36e821048..64110845227 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData00 * @run driver/timeout=720 TestShrinkAuxiliaryData00 */ diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java index 403b7bfe5aa..87812ca00c2 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData05 * @run driver/timeout=720 TestShrinkAuxiliaryData05 */ diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java index ad2ab4155b8..7d333860694 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10 * @run driver/timeout=720 TestShrinkAuxiliaryData10 */ diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java index 76d54ae67e9..f3cefc5a59b 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15 * @run driver/timeout=720 TestShrinkAuxiliaryData15 */ diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java index 43c349e6c63..979c4a063bb 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20 * @run driver/timeout=720 TestShrinkAuxiliaryData20 */ diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java index e86d75a20ee..ab038f9ec12 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25 * @run driver/timeout=720 TestShrinkAuxiliaryData25 */ diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java index 08904841ad9..bb63a94c272 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30 * @run driver/timeout=720 TestShrinkAuxiliaryData30 */ diff --git a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java index c23c8721af3..43c35a38b37 100644 --- a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java +++ b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ * 3. invoke gc and check that memory returned to the system (amount of committed memory got down) * * @library /testlibrary + * @modules java.base/sun.misc + * java.management/sun.management */ import java.lang.management.ManagementFactory; import java.lang.management.MemoryUsage; diff --git a/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java b/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java index 8bdac8d07f6..cfa4b1f0931 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8029075 * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ public class TestStringDeduplicationAgeThreshold { diff --git a/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java b/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java index 0e47db75c4c..8265f30d6e3 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8029075 * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ public class TestStringDeduplicationFullGC { diff --git a/hotspot/test/gc/g1/TestStringDeduplicationInterned.java b/hotspot/test/gc/g1/TestStringDeduplicationInterned.java index 680fa860ea8..24fcb718793 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationInterned.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationInterned.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8029075 * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ public class TestStringDeduplicationInterned { diff --git a/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java b/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java index 58279644490..83401a47da2 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8029075 * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ public class TestStringDeduplicationPrintOptions { diff --git a/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java b/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java index 9b5d09215dd..0a37b95d522 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8029075 * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ public class TestStringDeduplicationTableRehash { diff --git a/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java b/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java index 803c63bbb20..7106527ac15 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8029075 * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ public class TestStringDeduplicationTableResize { diff --git a/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java b/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java index c856d019205..66c6ee42324 100644 --- a/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java +++ b/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8029075 * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ public class TestStringDeduplicationYoungGC { diff --git a/hotspot/test/gc/g1/TestStringSymbolTableStats.java b/hotspot/test/gc/g1/TestStringSymbolTableStats.java index f95aea87d00..658aaab2e4e 100644 --- a/hotspot/test/gc/g1/TestStringSymbolTableStats.java +++ b/hotspot/test/gc/g1/TestStringSymbolTableStats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Ensure that the G1TraceStringSymbolTableScrubbing prints the expected message. * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.ProcessTools; diff --git a/hotspot/test/gc/g1/TestSummarizeRSetStats.java b/hotspot/test/gc/g1/TestSummarizeRSetStats.java index e78e2df21a3..f57a8bd97e6 100644 --- a/hotspot/test/gc/g1/TestSummarizeRSetStats.java +++ b/hotspot/test/gc/g1/TestSummarizeRSetStats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test TestSummarizeRSetStats.java * @bug 8013895 * @library /testlibrary + * @modules java.base/sun.misc + * java.management/sun.management * @build TestSummarizeRSetStatsTools TestSummarizeRSetStats * @summary Verify output of -XX:+G1SummarizeRSetStats * @run main TestSummarizeRSetStats diff --git a/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java b/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java index 437cbc2c70e..8430060e175 100644 --- a/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java +++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test TestSummarizeRSetStatsPerRegion.java * @bug 8014078 * @library /testlibrary + * @modules java.base/sun.misc + * java.management/sun.management * @build TestSummarizeRSetStatsTools TestSummarizeRSetStatsPerRegion * @summary Verify output of -XX:+G1SummarizeRSetStats in regards to per-region type output * @run main TestSummarizeRSetStatsPerRegion diff --git a/hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java b/hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java index 2723042499d..512d88fe321 100644 --- a/hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java +++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * refinement threads do not crash the VM. * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management/sun.management */ import java.util.regex.Matcher; diff --git a/hotspot/test/gc/logging/TestGCId.java b/hotspot/test/gc/logging/TestGCId.java index 98f9491467b..57e52f43c65 100644 --- a/hotspot/test/gc/logging/TestGCId.java +++ b/hotspot/test/gc/logging/TestGCId.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Ensure that the GCId is logged * @key gc * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.ProcessTools; diff --git a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java index bad06bb09a2..20ea7d11deb 100644 --- a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java +++ b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java @@ -26,6 +26,8 @@ * @bug 8004924 * @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:CompressedClassSpaceSize=50m CompressedClassSpaceSizeInJmapHeap */ diff --git a/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java b/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java index a95d6f072d6..279bdd7a359 100644 --- a/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java +++ b/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key gc * @bug 8049831 * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestCapacityUntilGCWrapAround * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java b/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java index bf9e74c8ab0..4170e95c48a 100644 --- a/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java +++ b/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ import static com.oracle.java.testlibrary.Asserts.*; * @summary Tests that a MemoryPoolMXBeans is created for metaspace and that a * MemoryManagerMXBean is created. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops TestMetaspaceMemoryPool * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:MaxMetaspaceSize=60m TestMetaspaceMemoryPool * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers TestMetaspaceMemoryPool diff --git a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java index a02f5b45f58..173994b1223 100644 --- a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java +++ b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,10 @@ import static com.oracle.java.testlibrary.Asserts.*; * @library /testlibrary * @summary Tests that performance counters for metaspace and compressed class * space exists and works. - * + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseSerialGC TestMetaspacePerfCounters * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseParallelGC -XX:+UseParallelOldGC TestMetaspacePerfCounters * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseG1GC TestMetaspacePerfCounters diff --git a/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java b/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java index c67b8dc5ce9..d990eebb3b5 100644 --- a/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java +++ b/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,8 @@ import com.oracle.java.testlibrary.ProcessTools; * @bug 8024650 * @summary Test that metaspace size flags can be set correctly * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ public class TestMetaspaceSizeFlags { public static final long K = 1024L; diff --git a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java index 4aaa8ac174b..84a3510fded 100644 --- a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java +++ b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,9 @@ import static com.oracle.java.testlibrary.Asserts.*; * @requires vm.gc=="Serial" | vm.gc=="null" * @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace * report the same data. + * @modules java.base/sun.misc + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools */ diff --git a/hotspot/test/gc/parallelScavenge/AdaptiveGCBoundary.java b/hotspot/test/gc/parallelScavenge/AdaptiveGCBoundary.java index 57125599649..589c974d39f 100644 --- a/hotspot/test/gc/parallelScavenge/AdaptiveGCBoundary.java +++ b/hotspot/test/gc/parallelScavenge/AdaptiveGCBoundary.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @key gc * @key regression * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm AdaptiveGCBoundary * @author jon.masamitsu@oracle.com */ diff --git a/hotspot/test/gc/startup_warnings/TestCMS.java b/hotspot/test/gc/startup_warnings/TestCMS.java index 93bb56311e2..24deea0cb63 100644 --- a/hotspot/test/gc/startup_warnings/TestCMS.java +++ b/hotspot/test/gc/startup_warnings/TestCMS.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8006398 * @summary Test that CMS does not print a warning message * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java index c17b9444631..a98e8ededed 100644 --- a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java +++ b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8065972 * @summary Test that the unsupported DefNew+CMS combination does not start * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java b/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java index 059a526acf4..47983027410 100644 --- a/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java +++ b/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8021967 * @summary Test that the deprecated TestDefaultMaxRAMFraction flag print a warning message * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/startup_warnings/TestG1.java b/hotspot/test/gc/startup_warnings/TestG1.java index b1dfaa427f2..84ae8223ddb 100644 --- a/hotspot/test/gc/startup_warnings/TestG1.java +++ b/hotspot/test/gc/startup_warnings/TestG1.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8006398 * @summary Test that the G1 collector does not print a warning message * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/startup_warnings/TestNoParNew.java b/hotspot/test/gc/startup_warnings/TestNoParNew.java index bc9d8bdb4b9..4b10a25b4fc 100644 --- a/hotspot/test/gc/startup_warnings/TestNoParNew.java +++ b/hotspot/test/gc/startup_warnings/TestNoParNew.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8065972 * @summary Test that specifying -XX:-UseParNewGC on the command line logs a warning message * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/startup_warnings/TestParNewCMS.java b/hotspot/test/gc/startup_warnings/TestParNewCMS.java index f78b75f631e..2c5179c4550 100644 --- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java +++ b/hotspot/test/gc/startup_warnings/TestParNewCMS.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8065972 * @summary Test that specifying -XX:+UseParNewGC on the command line logs a warning message * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java index 8bacb7b831a..a5a72a8ba6e 100644 --- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java +++ b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8065972 * @summary Test that the unsupported ParNew+SerialOld combination does not start * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/startup_warnings/TestParallelGC.java b/hotspot/test/gc/startup_warnings/TestParallelGC.java index e21630913c0..b8c36e839ff 100644 --- a/hotspot/test/gc/startup_warnings/TestParallelGC.java +++ b/hotspot/test/gc/startup_warnings/TestParallelGC.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8006398 * @summary Test that ParallelGC does not print a warning message * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java b/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java index 5d1cbddb025..7d2dd7bdf28 100644 --- a/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java +++ b/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8006398 * @summary Test that the ParallelScavenge+SerialOld combination does not print a warning message * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/startup_warnings/TestSerialGC.java b/hotspot/test/gc/startup_warnings/TestSerialGC.java index 4ce1af2b440..84cd0a494d2 100644 --- a/hotspot/test/gc/startup_warnings/TestSerialGC.java +++ b/hotspot/test/gc/startup_warnings/TestSerialGC.java @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8006398 * @summary Test that SerialGC does not print a warning message * @library /testlibrary +* @modules java.base/sun.misc +* java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java index 61f0c482047..0b1b112a87a 100644 --- a/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java +++ b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify that object's alignment in eden space is not affected by * SurvivorAlignmentInBytes option. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestAllocationInEden SurvivorAlignmentTestMain AlignmentHelper * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java index d72e78cbcec..6b40f0813cf 100644 --- a/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java +++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify that objects promoted from eden space to tenured space during * full GC are not aligned to SurvivorAlignmentInBytes value. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestPromotionFromEdenToTenured SurvivorAlignmentTestMain * AlignmentHelper * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java index da496c03744..ba05dc6ff6e 100644 --- a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java +++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify that objects promoted from survivor space to tenured space * during full GC are not aligned to SurvivorAlignmentInBytes value. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestPromotionFromSurvivorToTenuredAfterFullGC * SurvivorAlignmentTestMain AlignmentHelper * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java index 754349c9b43..15c9b1dfe29 100644 --- a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java +++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * when their age exceeded tenuring threshold are not aligned to * SurvivorAlignmentInBytes value. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestPromotionFromSurvivorToTenuredAfterMinorGC * SurvivorAlignmentTestMain AlignmentHelper * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java index 20407c217ef..548a8fd230e 100644 --- a/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java +++ b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Verify that objects promoted from eden space to survivor space after * minor GC are aligned to SurvivorAlignmentInBytes. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestPromotionToSurvivor * SurvivorAlignmentTestMain AlignmentHelper * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java index e7a048309be..fb82616a300 100644 --- a/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java +++ b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,10 @@ * @bug 8065579 * @requires vm.gc=="null" | vm.gc=="G1" * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.WhiteBox TestConcMarkCycleWB * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/gc/whitebox/TestWBGC.java b/hotspot/test/gc/whitebox/TestWBGC.java index e10474ad4e7..e16d862b522 100644 --- a/hotspot/test/gc/whitebox/TestWBGC.java +++ b/hotspot/test/gc/whitebox/TestWBGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8055098 * @summary Test verify that WB methods isObjectInOldGen and youngGC works correctly. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestWBGC * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run driver TestWBGC diff --git a/hotspot/test/runtime/6819213/TestBootNativeLibraryPath.java b/hotspot/test/runtime/6819213/TestBootNativeLibraryPath.java index c31d7b6b409..95f4c4b5d99 100644 --- a/hotspot/test/runtime/6819213/TestBootNativeLibraryPath.java +++ b/hotspot/test/runtime/6819213/TestBootNativeLibraryPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test TestBootNativeLibraryPath.java * @bug 6819213 + * @modules java.compiler * @compile -XDignore.symbol.file TestBootNativeLibraryPath.java * @summary verify sun.boot.native.library.path is expandable on 32 bit systems * @run main TestBootNativeLibraryPath diff --git a/hotspot/test/runtime/8003720/Test8003720.java b/hotspot/test/runtime/8003720/Test8003720.java index 0963628a80a..0fd5ef3e4ab 100644 --- a/hotspot/test/runtime/8003720/Test8003720.java +++ b/hotspot/test/runtime/8003720/Test8003720.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @test * @bug 8003720 * @summary Method in interpreter stack frame can be deallocated + * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/sun.misc * @compile -XDignore.symbol.file Victim.java * @run main/othervm -Xverify:all -Xint Test8003720 */ diff --git a/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java index c3de30edf86..4dd6657412d 100644 --- a/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java +++ b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Test invokespecial of host class method from an anonymous class * @author Robert Field * @library /testlibrary + * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/sun.misc * @compile -XDignore.symbol.file InvokeSpecialAnonTest.java * @run main ClassFileInstaller InvokeSpecialAnonTest AnonTester * @run main/othervm -Xbootclasspath/a:. -Xverify:all InvokeSpecialAnonTest diff --git a/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java b/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java index 08ed2f09366..6bc38bf9a15 100644 --- a/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java +++ b/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java @@ -26,6 +26,8 @@ * @bug 6583051 * @summary Give error if java.lang.Object has been incompatibly overridden on the bootpath * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile Object.java * @run main BootstrapRedefine */ diff --git a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java index c32c05ebd27..3355f94ef81 100644 --- a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java +++ b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8003424 * @summary Testing UseCompressedClassPointers with CDS * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main CDSCompressedKPtrs */ diff --git a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java index 05b4ac9af28..38267dcf825 100644 --- a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java +++ b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8003424 * @summary Test that cannot use CDS if UseCompressedClassPointers is turned off. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main CDSCompressedKPtrsError */ diff --git a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java index 458a781de80..6bf45d7ce9c 100644 --- a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java +++ b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8005933 * @summary Test that -Xshare:auto uses CDS when explicitly specified with -server. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main XShareAuto */ diff --git a/hotspot/test/runtime/ClassFile/JsrRewriting.java b/hotspot/test/runtime/ClassFile/JsrRewriting.java index 856658f9bf3..5e5ed31301b 100644 --- a/hotspot/test/runtime/ClassFile/JsrRewriting.java +++ b/hotspot/test/runtime/ClassFile/JsrRewriting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,9 @@ * @bug 7149464 * @key cte_test * @library /testlibrary + * @modules java.base/sun.misc + * java.desktop + * java.management * @run main JsrRewriting */ diff --git a/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java b/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java index ad08b183e59..4c21b579494 100644 --- a/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java +++ b/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,9 @@ * @bug 7123945 * @bug 8016029 * @library /testlibrary + * @modules java.base/sun.misc + * java.desktop + * java.management * @run main OomWhileParsingRepeatedJsr */ diff --git a/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java b/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java index 7978d285a84..7aef4a22817 100644 --- a/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java +++ b/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,9 @@ /* * @test * @library /testlibrary + * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/sun.misc + * java.management * @compile -XDignore.symbol.file UnsupportedClassFileVersion.java * @run main UnsupportedClassFileVersion */ diff --git a/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java b/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java index be035e2ca43..30c9baed6ad 100644 --- a/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java +++ b/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8006298 * @summary Setting an invalid value for a bool argument should result in a useful error message * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java b/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java index c546272641a..f8bee37ce2f 100644 --- a/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java +++ b/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 7167142 * @summary Warn if unused .hotspot_compiler file is present * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import java.io.PrintWriter; diff --git a/hotspot/test/runtime/CommandLine/ConfigFileParsing.java b/hotspot/test/runtime/CommandLine/ConfigFileParsing.java index 10a8c0b46d7..0e8003157e7 100644 --- a/hotspot/test/runtime/CommandLine/ConfigFileParsing.java +++ b/hotspot/test/runtime/CommandLine/ConfigFileParsing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 7158804 * @summary Improve config file parsing * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import java.io.PrintWriter; diff --git a/hotspot/test/runtime/CommandLine/ConfigFileWarning.java b/hotspot/test/runtime/CommandLine/ConfigFileWarning.java index 8f04a076b76..11b0688a1be 100644 --- a/hotspot/test/runtime/CommandLine/ConfigFileWarning.java +++ b/hotspot/test/runtime/CommandLine/ConfigFileWarning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 7167142 * @summary Warn if unused .hotspot_rc file is present * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import java.io.PrintWriter; diff --git a/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java b/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java index 22abc53c50d..a3c980a217f 100644 --- a/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java +++ b/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8006298 * @summary Setting a flag to an invalid value should print a useful error message * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java b/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java index 7933aef1a0a..7a69f2b145f 100644 --- a/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java +++ b/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8006298 * @summary Using a bool (+/-) prefix on non-bool flag should result in a useful error message * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java index 3af8408fcbe..05292ba557f 100644 --- a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java +++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8060449 * @summary Newly obsolete command line options should still give useful error messages when used improperly. * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CommandLine/TestHexArguments.java b/hotspot/test/runtime/CommandLine/TestHexArguments.java index f62435ed28d..7dceef294d6 100644 --- a/hotspot/test/runtime/CommandLine/TestHexArguments.java +++ b/hotspot/test/runtime/CommandLine/TestHexArguments.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Make sure there is no error using hexadecimal format in vm options * @author Yumin Qi * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import java.io.File; diff --git a/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java b/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java index f439065b670..87267ebb232 100644 --- a/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java +++ b/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import com.oracle.java.testlibrary.*; * @bug 6522873 * @summary Test that the VM don't allow random junk characters at the end of valid command line flags. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run driver TestNullTerminatedFlags */ public class TestNullTerminatedFlags { diff --git a/hotspot/test/runtime/CommandLine/TestVMOptions.java b/hotspot/test/runtime/CommandLine/TestVMOptions.java index 354c6ed27a4..158d0377908 100644 --- a/hotspot/test/runtime/CommandLine/TestVMOptions.java +++ b/hotspot/test/runtime/CommandLine/TestVMOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8060256 * @summary Test various command line options * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main TestVMOptions */ diff --git a/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java b/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java index f8aa86298c7..b49fb47e4a6 100644 --- a/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java +++ b/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8048933 * @summary TraceExceptions output should have the exception message - useful for ClassNotFoundExceptions especially * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java b/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java index 040704f0880..dbb7a392b69 100644 --- a/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java +++ b/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8006298 * @summary Using an unrecognized VM option should print the name of the option * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CommandLine/VMOptionWarning.java b/hotspot/test/runtime/CommandLine/VMOptionWarning.java index 164cec00975..42e97baca5a 100644 --- a/hotspot/test/runtime/CommandLine/VMOptionWarning.java +++ b/hotspot/test/runtime/CommandLine/VMOptionWarning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8027314 * @summary Warn if diagnostic or experimental vm option is used and -XX:+UnlockDiagnosticVMOptions or -XX:+UnlockExperimentalVMOptions, respectively, isn't specified. Warn if develop or notproduct vm option is used with product version of VM. * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java index 1ec42fd622d..25b7d15b883 100644 --- a/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java +++ b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8024927 * @summary Testing address of compressed class pointer space as best as possible. * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java b/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java index 0a0a553cbae..bc0da6573d9 100644 --- a/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java +++ b/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8022865 * @summary Tests for the -XX:CompressedClassSpaceSize command line option * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main CompressedClassSpaceSize */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java b/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java index 228d8cb6a7a..1b90d7e4dae 100644 --- a/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java +++ b/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @key regression * @summary NPG: UseCompressedClassPointers asserts with ObjectAlignmentInBytes=32 * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CompressedOops/ObjectAlignment.java b/hotspot/test/runtime/CompressedOops/ObjectAlignment.java index 63d267ae953..9a57fd9d206 100644 --- a/hotspot/test/runtime/CompressedOops/ObjectAlignment.java +++ b/hotspot/test/runtime/CompressedOops/ObjectAlignment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8022865 * @summary Tests for the -XX:ObjectAlignmentInBytes command line option * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main ObjectAlignment */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/CompressedOops/UseCompressedOops.java b/hotspot/test/runtime/CompressedOops/UseCompressedOops.java index edc3d336420..68176d417d5 100644 --- a/hotspot/test/runtime/CompressedOops/UseCompressedOops.java +++ b/hotspot/test/runtime/CompressedOops/UseCompressedOops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8022865 * @summary Tests for different combination of UseCompressedOops options * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main UseCompressedOops */ import java.util.ArrayList; diff --git a/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java index 82b5424813f..76950d49d91 100644 --- a/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java +++ b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8044738 * @library /testlibrary * @summary Check attribute_length of EnclosingMethod attribute + * @modules java.base/sun.misc + * java.management * @run main EnclMethodAttr */ diff --git a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java index 2ad3fc12686..04cc2a1b581 100644 --- a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java +++ b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java @@ -26,6 +26,10 @@ * @bug 8050167 * @summary Test that error is not occurred during printing problematic frame * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @run driver ProblematicFrameTest */ diff --git a/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java b/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java index 380809b365c..f3e5e155ff7 100644 --- a/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java +++ b/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java @@ -14,6 +14,8 @@ import com.oracle.java.testlibrary.ProcessTools; * @summary Synchronous signals during error reporting may terminate or hang VM process * @library /testlibrary * @author Thomas Stuefe (SAP) + * @modules java.base/sun.misc + * java.management */ public class SecondaryErrorTest { diff --git a/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java b/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java index 3416ce45fec..0ea4f2c7a7a 100644 --- a/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java +++ b/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ * @bug 7196045 * @bug 8014294 * @summary Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API. + * @modules java.management/sun.management * @run main/othervm -XX:+UsePerfData -Xmx32m ThreadCpuTimesDeadlock */ diff --git a/hotspot/test/runtime/LoadClass/LoadClassNegative.java b/hotspot/test/runtime/LoadClass/LoadClassNegative.java index 43d5a923f3e..a9b41420b47 100644 --- a/hotspot/test/runtime/LoadClass/LoadClassNegative.java +++ b/hotspot/test/runtime/LoadClass/LoadClassNegative.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8020675 * @summary make sure there is no fatal error if a class is loaded from an invalid jar file which is in the bootclasspath * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @build TestForName * @build LoadClassNegative * @run main LoadClassNegative diff --git a/hotspot/test/runtime/LocalVariableTable/TestLVT.java b/hotspot/test/runtime/LocalVariableTable/TestLVT.java index 337de2c8750..009898bed4d 100644 --- a/hotspot/test/runtime/LocalVariableTable/TestLVT.java +++ b/hotspot/test/runtime/LocalVariableTable/TestLVT.java @@ -26,6 +26,8 @@ * @bug 8049632 * @summary Test ClassFileParser::copy_localvariable_table cases * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @compile -g -XDignore.symbol.file TestLVT.java * @run main TestLVT */ diff --git a/hotspot/test/runtime/Metaspace/FragmentMetaspace.java b/hotspot/test/runtime/Metaspace/FragmentMetaspace.java index f44bce8cfd9..d4423a38552 100644 --- a/hotspot/test/runtime/Metaspace/FragmentMetaspace.java +++ b/hotspot/test/runtime/Metaspace/FragmentMetaspace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /** * @test * @library /runtime/testlibrary + * @modules java.compiler * @build GeneratedClassLoader * @run main/othervm/timeout=200 -Xmx300m FragmentMetaspace */ diff --git a/hotspot/test/runtime/NMT/AutoshutdownNMT.java b/hotspot/test/runtime/NMT/AutoshutdownNMT.java index 8739dc8d99f..04a75f26aea 100644 --- a/hotspot/test/runtime/NMT/AutoshutdownNMT.java +++ b/hotspot/test/runtime/NMT/AutoshutdownNMT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt * @summary Test for deprecated message if -XX:-AutoShutdownNMT is specified * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/NMT/BaselineWithParameter.java b/hotspot/test/runtime/NMT/BaselineWithParameter.java index ff10b28a060..5f1430546ef 100644 --- a/hotspot/test/runtime/NMT/BaselineWithParameter.java +++ b/hotspot/test/runtime/NMT/BaselineWithParameter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @key nmt jcmd regression * @summary Regression test for invoking a jcmd with baseline=false, result was that the target VM crashed * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:NativeMemoryTracking=detail BaselineWithParameter */ diff --git a/hotspot/test/runtime/NMT/CommandLineDetail.java b/hotspot/test/runtime/NMT/CommandLineDetail.java index 01b0d0d3fae..15bcff8d308 100644 --- a/hotspot/test/runtime/NMT/CommandLineDetail.java +++ b/hotspot/test/runtime/NMT/CommandLineDetail.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt * @summary Running with NMT detail should not result in an error * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java b/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java index 956cdd26006..1bc88723eea 100644 --- a/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java +++ b/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt * @summary Empty argument to NMT should result in an informative error message * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java b/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java index 79cc2de9442..a3768a65562 100644 --- a/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java +++ b/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt * @summary Invalid argument to NMT should result in an informative error message * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/NMT/CommandLineSummary.java b/hotspot/test/runtime/NMT/CommandLineSummary.java index d07bc7eae63..7c68040a51f 100644 --- a/hotspot/test/runtime/NMT/CommandLineSummary.java +++ b/hotspot/test/runtime/NMT/CommandLineSummary.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt * @summary Running with NMT summary should not result in an error * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java b/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java index 4193c9775d4..9ad6ff98ff0 100644 --- a/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java +++ b/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt * @summary Turning off NMT should not result in an error * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/NMT/JcmdBaselineDetail.java b/hotspot/test/runtime/NMT/JcmdBaselineDetail.java index 501b860f8bc..660ccd46ec6 100644 --- a/hotspot/test/runtime/NMT/JcmdBaselineDetail.java +++ b/hotspot/test/runtime/NMT/JcmdBaselineDetail.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt jcmd * @summary Verify that jcmd correctly reports that baseline succeeds with NMT enabled with detailed tracking. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:NativeMemoryTracking=detail JcmdBaselineDetail */ diff --git a/hotspot/test/runtime/NMT/JcmdDetailDiff.java b/hotspot/test/runtime/NMT/JcmdDetailDiff.java index a7c6184012f..bdef6eb0561 100644 --- a/hotspot/test/runtime/NMT/JcmdDetailDiff.java +++ b/hotspot/test/runtime/NMT/JcmdDetailDiff.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @summary run NMT baseline, allocate memory and verify output from detail.diff * @key nmt jcmd * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @ignore * @build JcmdDetailDiff * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/NMT/JcmdScale.java b/hotspot/test/runtime/NMT/JcmdScale.java index 3d8a9518760..c1a03f83f21 100644 --- a/hotspot/test/runtime/NMT/JcmdScale.java +++ b/hotspot/test/runtime/NMT/JcmdScale.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt jcmd * @summary Test the NMT scale parameter * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:NativeMemoryTracking=summary JcmdScale */ diff --git a/hotspot/test/runtime/NMT/JcmdScaleDetail.java b/hotspot/test/runtime/NMT/JcmdScaleDetail.java index 97c809dc0a0..b0ba1465669 100644 --- a/hotspot/test/runtime/NMT/JcmdScaleDetail.java +++ b/hotspot/test/runtime/NMT/JcmdScaleDetail.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt jcmd * @summary Test the NMT scale parameter with detail tracking level * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:NativeMemoryTracking=detail JcmdScaleDetail */ diff --git a/hotspot/test/runtime/NMT/JcmdSummaryDiff.java b/hotspot/test/runtime/NMT/JcmdSummaryDiff.java index 11cb68f8fc4..867b4873d5c 100644 --- a/hotspot/test/runtime/NMT/JcmdSummaryDiff.java +++ b/hotspot/test/runtime/NMT/JcmdSummaryDiff.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @summary run NMT baseline, allocate memory and verify output from summary.diff * @key nmt jcmd * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build JcmdSummaryDiff * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=summary JcmdSummaryDiff diff --git a/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java b/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java index 9ef37434937..cdaaaaf8815 100644 --- a/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java +++ b/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt jcmd * @summary Verify that jcmd correctly reports that NMT is not enabled * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main JcmdWithNMTDisabled 1 */ diff --git a/hotspot/test/runtime/NMT/MallocRoundingReportTest.java b/hotspot/test/runtime/NMT/MallocRoundingReportTest.java index 4827cf0fc0e..b2cb9883ae8 100644 --- a/hotspot/test/runtime/NMT/MallocRoundingReportTest.java +++ b/hotspot/test/runtime/NMT/MallocRoundingReportTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @summary Test consistency of NMT by creating allocations of the Test type with various sizes and verifying visibility with jcmd * @key nmt jcmd * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build MallocRoundingReportTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocRoundingReportTest diff --git a/hotspot/test/runtime/NMT/MallocStressTest.java b/hotspot/test/runtime/NMT/MallocStressTest.java index 54711517c7d..542296126e8 100644 --- a/hotspot/test/runtime/NMT/MallocStressTest.java +++ b/hotspot/test/runtime/NMT/MallocStressTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @summary Stress test for malloc tracking * @key nmt jcmd stress * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build MallocStressTest * @ignore - This test is disabled since it will stress NMT and timeout during normal testing * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/NMT/MallocTestType.java b/hotspot/test/runtime/NMT/MallocTestType.java index 614285371ca..b7bf6097a07 100644 --- a/hotspot/test/runtime/NMT/MallocTestType.java +++ b/hotspot/test/runtime/NMT/MallocTestType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @summary Test consistency of NMT by leaking a few select allocations of the Test type and then verify visibility with jcmd * @key nmt jcmd * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build MallocTestType * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/NMT/MallocTrackingVerify.java b/hotspot/test/runtime/NMT/MallocTrackingVerify.java index 31c4ae76920..c609a018c81 100644 --- a/hotspot/test/runtime/NMT/MallocTrackingVerify.java +++ b/hotspot/test/runtime/NMT/MallocTrackingVerify.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @summary Test to verify correctness of malloc tracking * @key nmt jcmd * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build MallocTrackingVerify * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocTrackingVerify diff --git a/hotspot/test/runtime/NMT/NMTWithCDS.java b/hotspot/test/runtime/NMT/NMTWithCDS.java index 1d865618f67..efbb0529791 100644 --- a/hotspot/test/runtime/NMT/NMTWithCDS.java +++ b/hotspot/test/runtime/NMT/NMTWithCDS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8055061 * @key nmt * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main NMTWithCDS */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java b/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java index 1c25f284d4b..1a4ec17b7ea 100644 --- a/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java +++ b/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt * @summary Trying to enable PrintNMTStatistics should result in a warning * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/NMT/ReleaseNoCommit.java b/hotspot/test/runtime/NMT/ReleaseNoCommit.java index 227c1dbb351..6c58993e93e 100644 --- a/hotspot/test/runtime/NMT/ReleaseNoCommit.java +++ b/hotspot/test/runtime/NMT/ReleaseNoCommit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @summary Release uncommitted memory and make sure NMT handles it correctly * @key nmt regression * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build ReleaseNoCommit * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=summary ReleaseNoCommit diff --git a/hotspot/test/runtime/NMT/ShutdownTwice.java b/hotspot/test/runtime/NMT/ShutdownTwice.java index 436e0c2c643..b5b84c7f39b 100644 --- a/hotspot/test/runtime/NMT/ShutdownTwice.java +++ b/hotspot/test/runtime/NMT/ShutdownTwice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt jcmd * @summary Run shutdown twice * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:NativeMemoryTracking=detail ShutdownTwice */ diff --git a/hotspot/test/runtime/NMT/SummaryAfterShutdown.java b/hotspot/test/runtime/NMT/SummaryAfterShutdown.java index ea1f3a60737..2832b26e953 100644 --- a/hotspot/test/runtime/NMT/SummaryAfterShutdown.java +++ b/hotspot/test/runtime/NMT/SummaryAfterShutdown.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt jcmd * @summary Verify that jcmd correctly reports that NMT is not enabled after a shutdown * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:NativeMemoryTracking=detail SummaryAfterShutdown */ diff --git a/hotspot/test/runtime/NMT/SummarySanityCheck.java b/hotspot/test/runtime/NMT/SummarySanityCheck.java index 183e791215f..93e1c9540b2 100644 --- a/hotspot/test/runtime/NMT/SummarySanityCheck.java +++ b/hotspot/test/runtime/NMT/SummarySanityCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @key nmt jcmd * @summary Sanity check the output of NMT * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build SummarySanityCheck * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/NMT/ThreadedMallocTestType.java b/hotspot/test/runtime/NMT/ThreadedMallocTestType.java index c67ea6e7f13..72e55c12d56 100644 --- a/hotspot/test/runtime/NMT/ThreadedMallocTestType.java +++ b/hotspot/test/runtime/NMT/ThreadedMallocTestType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @key nmt jcmd * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build ThreadedMallocTestType * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java b/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java index d5e75cad767..21884691bfa 100644 --- a/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java +++ b/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java @@ -25,6 +25,8 @@ * @test * @key nmt jcmd * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build ThreadedVirtualAllocTestType * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java b/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java index ec8561648f9..32074d5f84d 100644 --- a/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java +++ b/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java @@ -26,6 +26,8 @@ * @summary Test reserve/commit/uncommit/release of virtual memory and that we track it correctly * @key nmt jcmd * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build VirtualAllocCommitUncommitRecommit * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail VirtualAllocCommitUncommitRecommit diff --git a/hotspot/test/runtime/NMT/VirtualAllocTestType.java b/hotspot/test/runtime/NMT/VirtualAllocTestType.java index fe3b0fe3fa6..ae7e2b332d9 100644 --- a/hotspot/test/runtime/NMT/VirtualAllocTestType.java +++ b/hotspot/test/runtime/NMT/VirtualAllocTestType.java @@ -26,6 +26,8 @@ * @summary Test Reserve/Commit/Uncommit/Release of virtual memory and that we track it correctly * @key nmt jcmd * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build VirtualAllocTestType * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java b/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java index fc46f6bf20b..ce06c6d1c26 100644 --- a/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java +++ b/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8030955 * @summary Allow multiple calls to PerfMemory::destroy() without asserting. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main PerfMemDestroy */ diff --git a/hotspot/test/runtime/RedefineObject/TestRedefineObject.java b/hotspot/test/runtime/RedefineObject/TestRedefineObject.java index 184c90c4595..37f702d1c1c 100644 --- a/hotspot/test/runtime/RedefineObject/TestRedefineObject.java +++ b/hotspot/test/runtime/RedefineObject/TestRedefineObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,9 @@ import com.oracle.java.testlibrary.*; * @bug 8005056 * @bug 8009728 * @library /testlibrary + * @modules java.base/sun.misc + * java.instrument + * java.management * @build Agent * @run main ClassFileInstaller Agent * @run main TestRedefineObject diff --git a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java index eb74b68426e..3c9c816f026 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java +++ b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,9 @@ * @test * @library /testlibrary * @summary Test that type annotations are retained after a retransform + * @modules java.base/jdk.internal.org.objectweb.asm + * java.instrument + * jdk.jartool/sun.tools.jar * @run main RedefineAnnotations buildagent * @run main/othervm -javaagent:redefineagent.jar RedefineAnnotations */ diff --git a/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java b/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java index 227b9e8186e..394e31c3907 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java +++ b/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,9 @@ * @bug 6904403 * @summary Don't assert if we redefine finalize method * @library /testlibrary + * @modules java.compiler + * java.instrument + * jdk.jartool/sun.tools.jar * @build RedefineClassHelper * @run main RedefineClassHelper * @run main/othervm -javaagent:redefineagent.jar RedefineFinalizer diff --git a/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java b/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java index 693ecd9b697..525d890b4b7 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java +++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,9 @@ * @bug 8055008 * @summary Redefine EMCP and non-EMCP methods that are running in an infinite loop * @library /testlibrary + * @modules java.compiler + * java.instrument + * jdk.jartool/sun.tools.jar * @build RedefineClassHelper * @run main RedefineClassHelper * @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethods diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java index f9f6434d143..472845d696b 100644 --- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java +++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8047290 * @summary Ensure that a Monitor::lock_without_safepoint_check fires an assert when it incorrectly acquires a lock which must always have safepoint checks. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build AssertSafepointCheckConsistency1 * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java index c6df9d7045e..5c3980b5e55 100644 --- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java +++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8047290 * @summary Ensure that a Monitor::lock fires an assert when it incorrectly acquires a lock which must never have safepoint checks. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build AssertSafepointCheckConsistency2 * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java index a3c79e2f4cf..90b67d86af3 100644 --- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java +++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8047290 * @summary Ensure that Monitor::lock_without_safepoint_check does not assert when it correctly acquires a lock which must never have safepoint checks. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build AssertSafepointCheckConsistency3 * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java index 79096ebe2f9..b1615d99b15 100644 --- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java +++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8047290 * @summary Ensure that Monitor::lock does not assert when it correctly acquires a lock which must always have safepoint checks. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build AssertSafepointCheckConsistency4 * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java b/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java index ec184bbcbee..08244c726c5 100644 --- a/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java +++ b/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * when sharing mode is ON, and continue w/o sharing if sharing * mode is AUTO. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main ArchiveDoesNotExist */ diff --git a/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java b/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java index 9ecb1dae390..e1cc78a2bfb 100644 --- a/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java +++ b/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ * should fail when loading. * @library /testlibrary * @bug 8025642 + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java b/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java index 5c91f604a8e..763aa842683 100644 --- a/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java +++ b/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @summary Testing CDS (class data sharing) using varying object alignment. * Using same object alignment for each dump/load pair * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java b/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java index 52cae81cc4f..d904448709b 100644 --- a/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java +++ b/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test DefaultUseWithClient * @summary Test default behavior of sharing with -client * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main DefaultUseWithClient * @bug 8032224 */ diff --git a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java index 0bad2c31bc9..a50e8ba24a0 100644 --- a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java +++ b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8059510 * @summary Test jcmd VM.symboltable and VM.stringtable options * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:+UnlockDiagnosticVMOptions DumpSymbolAndStringTable */ diff --git a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java index f38b85ad9af..8f2ebf7d640 100644 --- a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java +++ b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ /* @test LimitSharedSizes * @summary Test handling of limits on shared space size * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main LimitSharedSizes */ diff --git a/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java b/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java index 9d8c4984377..abf1ad7d802 100644 --- a/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java +++ b/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java @@ -26,6 +26,8 @@ * @bug 8067187 * @summary Testing CDS dumping with the -XX:MaxMetaspaceSize= option * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java b/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java index e3e81ca9d43..d3f74a20ab5 100644 --- a/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java +++ b/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8066670 * @summary Testing -XX:+PrintSharedArchiveAndExit option * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java b/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java index 802e251bd03..d8221ef7933 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8014138 * @summary Testing new -XX:SharedArchiveFile= option * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java b/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java index 388fe7d0659..e47ce0f15af 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @summary Test variety of values for SharedBaseAddress, making sure * VM handles normal values as well as edge values w/o a crash. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main SharedBaseAddress */ diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java b/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java index 1c71e4b739c..208d834a0e0 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8059510 * @summary Test SharedSymbolTableBucketSize option * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java b/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java index a95979f355c..dc5468d8e3f 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java +++ b/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test SpaceUtilizationCheck * @summary Check if the space utilization for shared spaces is adequate * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main SpaceUtilizationCheck */ diff --git a/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java b/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java index 979aefcd446..0cde6565868 100644 --- a/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java +++ b/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ * whether jstack reports "locked" by more than one thread. * * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm TestThreadDumpMonitorContention */ diff --git a/hotspot/test/runtime/Thread/ThreadPriorities.java b/hotspot/test/runtime/Thread/ThreadPriorities.java index 18a75c1d35e..30374b02b9c 100644 --- a/hotspot/test/runtime/Thread/ThreadPriorities.java +++ b/hotspot/test/runtime/Thread/ThreadPriorities.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * whether jstack reports correct priorities for them. * * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main ThreadPriorities */ diff --git a/hotspot/test/runtime/Unsafe/AllocateInstance.java b/hotspot/test/runtime/Unsafe/AllocateInstance.java index 1339572e1d0..066be74ebea 100644 --- a/hotspot/test/runtime/Unsafe/AllocateInstance.java +++ b/hotspot/test/runtime/Unsafe/AllocateInstance.java @@ -25,6 +25,8 @@ * @test * @summary Verifies the behaviour of Unsafe.allocateInstance * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main AllocateInstance */ diff --git a/hotspot/test/runtime/Unsafe/AllocateMemory.java b/hotspot/test/runtime/Unsafe/AllocateMemory.java index 9f4cf530bd6..bf52207cc74 100644 --- a/hotspot/test/runtime/Unsafe/AllocateMemory.java +++ b/hotspot/test/runtime/Unsafe/AllocateMemory.java @@ -25,6 +25,8 @@ * @test * @summary Verifies behaviour of Unsafe.allocateMemory * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m AllocateMemory */ diff --git a/hotspot/test/runtime/Unsafe/CopyMemory.java b/hotspot/test/runtime/Unsafe/CopyMemory.java index c5b1ac49eb2..794a20dccd6 100644 --- a/hotspot/test/runtime/Unsafe/CopyMemory.java +++ b/hotspot/test/runtime/Unsafe/CopyMemory.java @@ -25,6 +25,8 @@ * @test * @summary Verifies behaviour of Unsafe.copyMemory * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main CopyMemory */ diff --git a/hotspot/test/runtime/Unsafe/DefineClass.java b/hotspot/test/runtime/Unsafe/DefineClass.java index a22bc57a8b1..5837f0baac6 100644 --- a/hotspot/test/runtime/Unsafe/DefineClass.java +++ b/hotspot/test/runtime/Unsafe/DefineClass.java @@ -25,6 +25,9 @@ * @test * @summary Verifies the behaviour of Unsafe.defineClass * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management * @run main DefineClass */ diff --git a/hotspot/test/runtime/Unsafe/FieldOffset.java b/hotspot/test/runtime/Unsafe/FieldOffset.java index 72b168ddd7e..eacc23c109c 100644 --- a/hotspot/test/runtime/Unsafe/FieldOffset.java +++ b/hotspot/test/runtime/Unsafe/FieldOffset.java @@ -25,6 +25,8 @@ * @test * @summary Verifies the behaviour of Unsafe.fieldOffset * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main FieldOffset */ diff --git a/hotspot/test/runtime/Unsafe/GetField.java b/hotspot/test/runtime/Unsafe/GetField.java index d5e58c9d8c6..e35354d3b47 100644 --- a/hotspot/test/runtime/Unsafe/GetField.java +++ b/hotspot/test/runtime/Unsafe/GetField.java @@ -25,6 +25,8 @@ * @test * @summary Verifies behaviour of Unsafe.getField * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetField */ diff --git a/hotspot/test/runtime/Unsafe/GetPutAddress.java b/hotspot/test/runtime/Unsafe/GetPutAddress.java index 9bf105b7513..e21b3f85524 100644 --- a/hotspot/test/runtime/Unsafe/GetPutAddress.java +++ b/hotspot/test/runtime/Unsafe/GetPutAddress.java @@ -25,6 +25,8 @@ * @test * Verify behaviour of Unsafe.get/putAddress and Unsafe.addressSize * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutAddress */ diff --git a/hotspot/test/runtime/Unsafe/GetPutBoolean.java b/hotspot/test/runtime/Unsafe/GetPutBoolean.java index 93f0b3df053..aee3b30f339 100644 --- a/hotspot/test/runtime/Unsafe/GetPutBoolean.java +++ b/hotspot/test/runtime/Unsafe/GetPutBoolean.java @@ -25,6 +25,8 @@ * @test * @summary Verify behaviour of Unsafe.get/putBoolean * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutBoolean */ diff --git a/hotspot/test/runtime/Unsafe/GetPutByte.java b/hotspot/test/runtime/Unsafe/GetPutByte.java index 44546f91a27..d046e885d5a 100644 --- a/hotspot/test/runtime/Unsafe/GetPutByte.java +++ b/hotspot/test/runtime/Unsafe/GetPutByte.java @@ -25,6 +25,8 @@ * @test * @summary Verify behaviour of Unsafe.get/putByte * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutByte */ diff --git a/hotspot/test/runtime/Unsafe/GetPutChar.java b/hotspot/test/runtime/Unsafe/GetPutChar.java index a0c2a0e0310..3a2d6376db2 100644 --- a/hotspot/test/runtime/Unsafe/GetPutChar.java +++ b/hotspot/test/runtime/Unsafe/GetPutChar.java @@ -25,6 +25,8 @@ * @test * @summary Verify behaviour of Unsafe.get/putChar * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutChar */ diff --git a/hotspot/test/runtime/Unsafe/GetPutDouble.java b/hotspot/test/runtime/Unsafe/GetPutDouble.java index 17b2bdfe9e1..170450b1eee 100644 --- a/hotspot/test/runtime/Unsafe/GetPutDouble.java +++ b/hotspot/test/runtime/Unsafe/GetPutDouble.java @@ -25,6 +25,8 @@ * @test * @summary Verify behaviour of Unsafe.get/putDouble * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutDouble */ diff --git a/hotspot/test/runtime/Unsafe/GetPutFloat.java b/hotspot/test/runtime/Unsafe/GetPutFloat.java index 239bf1078f5..8d0b5373614 100644 --- a/hotspot/test/runtime/Unsafe/GetPutFloat.java +++ b/hotspot/test/runtime/Unsafe/GetPutFloat.java @@ -25,6 +25,8 @@ * @test * @summary Verify behaviour of Unsafe.get/putFloat * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutFloat */ diff --git a/hotspot/test/runtime/Unsafe/GetPutInt.java b/hotspot/test/runtime/Unsafe/GetPutInt.java index e93aeb8b2ac..a9cffce976a 100644 --- a/hotspot/test/runtime/Unsafe/GetPutInt.java +++ b/hotspot/test/runtime/Unsafe/GetPutInt.java @@ -24,6 +24,8 @@ /* * @test * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutInt */ diff --git a/hotspot/test/runtime/Unsafe/GetPutLong.java b/hotspot/test/runtime/Unsafe/GetPutLong.java index 2ea4a196e4c..96b28e138f4 100644 --- a/hotspot/test/runtime/Unsafe/GetPutLong.java +++ b/hotspot/test/runtime/Unsafe/GetPutLong.java @@ -25,6 +25,8 @@ * @test * @summary Verify behaviour of Unsafe.get/putLong * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutLong */ diff --git a/hotspot/test/runtime/Unsafe/GetPutObject.java b/hotspot/test/runtime/Unsafe/GetPutObject.java index bd186bcf307..5a8071aad20 100644 --- a/hotspot/test/runtime/Unsafe/GetPutObject.java +++ b/hotspot/test/runtime/Unsafe/GetPutObject.java @@ -25,6 +25,8 @@ * @test * @summary Verify behaviour of Unsafe.get/putObject * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutObject */ diff --git a/hotspot/test/runtime/Unsafe/GetPutShort.java b/hotspot/test/runtime/Unsafe/GetPutShort.java index d89fcc26d42..1930e8b0eee 100644 --- a/hotspot/test/runtime/Unsafe/GetPutShort.java +++ b/hotspot/test/runtime/Unsafe/GetPutShort.java @@ -25,6 +25,8 @@ * @test * @summary Verify behaviour of Unsafe.get/putShort * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main GetPutShort */ diff --git a/hotspot/test/runtime/Unsafe/GetUnsafe.java b/hotspot/test/runtime/Unsafe/GetUnsafe.java index 14c6880e6e2..334cce2c276 100644 --- a/hotspot/test/runtime/Unsafe/GetUnsafe.java +++ b/hotspot/test/runtime/Unsafe/GetUnsafe.java @@ -25,6 +25,7 @@ * @test * @summary Verifies that getUnsafe() actually throws SecurityException when unsafeAccess is prohibited. * @library /testlibrary + * @modules java.base/sun.misc * @run main GetUnsafe */ diff --git a/hotspot/test/runtime/Unsafe/PageSize.java b/hotspot/test/runtime/Unsafe/PageSize.java index 786277c8974..2ba708d2d21 100644 --- a/hotspot/test/runtime/Unsafe/PageSize.java +++ b/hotspot/test/runtime/Unsafe/PageSize.java @@ -25,6 +25,8 @@ * @test * @summary Make sure pageSize() returns a value that is a power of two * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main PageSize */ diff --git a/hotspot/test/runtime/Unsafe/RangeCheck.java b/hotspot/test/runtime/Unsafe/RangeCheck.java index 4d4ea2e048a..00513055a03 100644 --- a/hotspot/test/runtime/Unsafe/RangeCheck.java +++ b/hotspot/test/runtime/Unsafe/RangeCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8001071 * @summary Add simple range check into VM implemenation of Unsafe access methods * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.*; diff --git a/hotspot/test/runtime/Unsafe/Reallocate.java b/hotspot/test/runtime/Unsafe/Reallocate.java index 19442038374..4cd3450481d 100644 --- a/hotspot/test/runtime/Unsafe/Reallocate.java +++ b/hotspot/test/runtime/Unsafe/Reallocate.java @@ -25,6 +25,8 @@ * @test * @bug 8058897 * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m Reallocate */ diff --git a/hotspot/test/runtime/Unsafe/SetMemory.java b/hotspot/test/runtime/Unsafe/SetMemory.java index ea7c03f84e3..726479aa80c 100644 --- a/hotspot/test/runtime/Unsafe/SetMemory.java +++ b/hotspot/test/runtime/Unsafe/SetMemory.java @@ -25,6 +25,8 @@ * @test * @summary Verifies that setMemory works correctly * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main SetMemory */ diff --git a/hotspot/test/runtime/Unsafe/ThrowException.java b/hotspot/test/runtime/Unsafe/ThrowException.java index d0347b542ce..c6fa4286a6e 100644 --- a/hotspot/test/runtime/Unsafe/ThrowException.java +++ b/hotspot/test/runtime/Unsafe/ThrowException.java @@ -25,6 +25,8 @@ * @test * @summary Verify that throwException() can throw an exception * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main ThrowException */ diff --git a/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java b/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java index ac22b7493bd..e66af049857 100644 --- a/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java +++ b/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 7051189 8023393 * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main XCheckJSig */ diff --git a/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java b/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java index 7da7a872459..7ca392566cb 100644 --- a/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java +++ b/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8040018 * @library /testlibrary * @summary Check for exception instead of assert. + * @modules java.base/sun.misc + * java.management * @run main ClassFileParserBug */ diff --git a/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java b/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java index fa33c1e3c62..51aab9482b2 100644 --- a/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java +++ b/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8041918 * @library /testlibrary * @summary Test empty bootstrap_methods table within BootstrapMethods attribute + * @modules java.base/sun.misc + * java.management * @compile TestEmptyBootstrapMethodsAttr.java * @run main TestEmptyBootstrapMethodsAttr */ diff --git a/hotspot/test/runtime/contended/Basic.java b/hotspot/test/runtime/contended/Basic.java index e15461451a7..ddc685e4ff2 100644 --- a/hotspot/test/runtime/contended/Basic.java +++ b/hotspot/test/runtime/contended/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import sun.misc.Contended; * @test * @bug 8003985 * @summary Support Contended Annotation - JEP 142 - * + * @modules java.base/sun.misc * @run main/othervm -XX:-RestrictContended Basic */ public class Basic { diff --git a/hotspot/test/runtime/contended/DefaultValue.java b/hotspot/test/runtime/contended/DefaultValue.java index 6f60672428b..05cc698f3ef 100644 --- a/hotspot/test/runtime/contended/DefaultValue.java +++ b/hotspot/test/runtime/contended/DefaultValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,7 @@ import sun.misc.Contended; * @bug 8014509 * @summary \@Contended: explicit default value behaves differently from the implicit value * + * @modules java.base/sun.misc * @run main/othervm -XX:-RestrictContended DefaultValue */ public class DefaultValue { diff --git a/hotspot/test/runtime/contended/HasNonStatic.java b/hotspot/test/runtime/contended/HasNonStatic.java index 6792adf6abb..6ff21826428 100644 --- a/hotspot/test/runtime/contended/HasNonStatic.java +++ b/hotspot/test/runtime/contended/HasNonStatic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,7 @@ import sun.misc.Contended; * @bug 8015270 * @summary \@Contended: fix multiple issues in the layout code * + * @modules java.base/sun.misc * @run main/othervm -XX:-RestrictContended HasNonStatic */ public class HasNonStatic { diff --git a/hotspot/test/runtime/contended/Inheritance1.java b/hotspot/test/runtime/contended/Inheritance1.java index 70b8e4c71bc..e6cf2bd1a7f 100644 --- a/hotspot/test/runtime/contended/Inheritance1.java +++ b/hotspot/test/runtime/contended/Inheritance1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,7 @@ import sun.misc.Contended; * @bug 8012939 * @summary \@Contended doesn't work correctly with inheritance * + * @modules java.base/sun.misc * @run main/othervm -XX:-RestrictContended Inheritance1 */ public class Inheritance1 { diff --git a/hotspot/test/runtime/contended/OopMaps.java b/hotspot/test/runtime/contended/OopMaps.java index 8faa0bee2ac..2501ec1f06f 100644 --- a/hotspot/test/runtime/contended/OopMaps.java +++ b/hotspot/test/runtime/contended/OopMaps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,7 @@ import sun.misc.Contended; * @bug 8015493 * @summary \@Contended: fix multiple issues in the layout code * + * @modules java.base/sun.misc * @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMaps */ public class OopMaps { diff --git a/hotspot/test/runtime/contended/OopMapsSameGroup.java b/hotspot/test/runtime/contended/OopMapsSameGroup.java index 4f4bbfee272..d17ae1ee9f6 100644 --- a/hotspot/test/runtime/contended/OopMapsSameGroup.java +++ b/hotspot/test/runtime/contended/OopMapsSameGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,7 @@ import sun.misc.Contended; * @bug 8015272 * @summary \@Contended within the same group to use the same oop map * + * @modules java.base/sun.misc * @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMapsSameGroup */ public class OopMapsSameGroup { diff --git a/hotspot/test/runtime/contended/Options.java b/hotspot/test/runtime/contended/Options.java index 589ec9b4131..21bd120e24c 100644 --- a/hotspot/test/runtime/contended/Options.java +++ b/hotspot/test/runtime/contended/Options.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ import com.oracle.java.testlibrary.*; * @summary ContendedPaddingWidth should be range-checked * * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main Options */ public class Options { diff --git a/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java b/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java index 8b5235ebc01..f2c708c85ce 100644 --- a/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java +++ b/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 8040292 * @library /testlibrary * @summary Throw exceptions when duplicate attributes are detected. + * @modules java.base/sun.misc + * java.management * @run main DuplAttributesTest */ diff --git a/hotspot/test/runtime/finalStatic/FinalStatic.java b/hotspot/test/runtime/finalStatic/FinalStatic.java index 314b1928f41..20c6ddd630e 100644 --- a/hotspot/test/runtime/finalStatic/FinalStatic.java +++ b/hotspot/test/runtime/finalStatic/FinalStatic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test * @bug 8028553 * @summary Test that VerifyError is not thrown when 'overriding' a static method. + * @modules java.base/jdk.internal.org.objectweb.asm * @run main FinalStatic */ diff --git a/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java b/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java index 0fd1a426679..646a0945d7b 100644 --- a/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java +++ b/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ * @test * @bug 8032010 * @summary method lookup on an abstract method in a concrete class should be successful + * @modules java.base/jdk.internal.org.objectweb.asm * @run main TestConcreteClassWithAbstractMethod */ diff --git a/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java b/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java index 0f90d5fb1ab..356acc6a65a 100644 --- a/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java +++ b/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @summary Tests that the flag -XX:LargePageSizeInBytes does not cause warnings on Solaris * @bug 8049536 * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run driver TestLargePageSizeInBytes */ diff --git a/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java b/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java index 58044c695e9..0320ce53c97 100644 --- a/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java +++ b/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ /* @test TestLargePagesFlags * @summary Tests how large pages are choosen depending on the given large pages flag combinations. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main TestLargePagesFlags */ diff --git a/hotspot/test/runtime/memory/ReadFromNoaccessArea.java b/hotspot/test/runtime/memory/ReadFromNoaccessArea.java index 77ad2de1688..11e0e01309e 100644 --- a/hotspot/test/runtime/memory/ReadFromNoaccessArea.java +++ b/hotspot/test/runtime/memory/ReadFromNoaccessArea.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @summary Test that touching noaccess area in class ReservedHeapSpace results in SIGSEGV/ACCESS_VIOLATION * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build ReadFromNoaccessArea * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/memory/ReserveMemory.java b/hotspot/test/runtime/memory/ReserveMemory.java index 76e6c5b12d7..385ad6cacf5 100644 --- a/hotspot/test/runtime/memory/ReserveMemory.java +++ b/hotspot/test/runtime/memory/ReserveMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,8 @@ * @bug 8012015 * @summary Make sure reserved (but uncommitted) memory is not accessible * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build ReserveMemory * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java b/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java index 34576662150..2ee2aec70db 100644 --- a/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java +++ b/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @summary Test launches unit tests inside vm concurrently * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build RunUnitTestsConcurrently * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/runtime/verifier/OverriderMsg.java b/hotspot/test/runtime/verifier/OverriderMsg.java index f8c7155ee57..80564973b38 100644 --- a/hotspot/test/runtime/verifier/OverriderMsg.java +++ b/hotspot/test/runtime/verifier/OverriderMsg.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,9 @@ import com.oracle.java.testlibrary.*; * @test OverriderMsg * @bug 8026894 * @library /testlibrary + * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/sun.misc + * java.management * @compile -XDignore.symbol.file OverriderMsg.java * @run main/othervm OverriderMsg */ diff --git a/hotspot/test/runtime/verifier/TestANewArray.java b/hotspot/test/runtime/verifier/TestANewArray.java index e8f58da2a41..d2d9d53cfc8 100644 --- a/hotspot/test/runtime/verifier/TestANewArray.java +++ b/hotspot/test/runtime/verifier/TestANewArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,9 @@ import com.oracle.java.testlibrary.*; * @test * @summary Test that anewarray bytecode is valid only if it specifies 255 or fewer dimensions. * @library /testlibrary + * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/sun.misc + * java.management * @compile -XDignore.symbol.file TestANewArray.java * @run main/othervm TestANewArray 49 * @run main/othervm TestANewArray 50 diff --git a/hotspot/test/runtime/verifier/TestMultiANewArray.java b/hotspot/test/runtime/verifier/TestMultiANewArray.java index 52afd435d8c..2d9124a4cce 100644 --- a/hotspot/test/runtime/verifier/TestMultiANewArray.java +++ b/hotspot/test/runtime/verifier/TestMultiANewArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,9 @@ import com.oracle.java.testlibrary.*; * @test TestMultiANewArray * @bug 8038076 * @library /testlibrary + * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/sun.misc + * java.management * @compile -XDignore.symbol.file TestMultiANewArray.java * @run main/othervm TestMultiANewArray 49 * @run main/othervm TestMultiANewArray 50 diff --git a/hotspot/test/serviceability/attach/AttachSetGetFlag.java b/hotspot/test/serviceability/attach/AttachSetGetFlag.java index 230ef3c8c27..a878b0456f3 100644 --- a/hotspot/test/serviceability/attach/AttachSetGetFlag.java +++ b/hotspot/test/serviceability/attach/AttachSetGetFlag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,11 @@ * @bug 8054823 * @summary Tests the setFlag and printFlag attach command * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.attach/sun.tools.attach + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* AttachSetGetFlag * @run driver AttachSetGetFlag */ diff --git a/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java b/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java index f7b4dd6b923..4bf851442c8 100644 --- a/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java +++ b/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,10 @@ * @test CodeCacheTest * @bug 8054889 * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng/othervm -XX:+SegmentedCodeCache CodeCacheTest diff --git a/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java b/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java index 57f5521094f..2de08479243 100644 --- a/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java +++ b/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,10 @@ * @test CodelistTest * @bug 8054889 * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @build MethodIdentifierParser diff --git a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java index 0b15dceb1c3..b252e60b7be 100644 --- a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java +++ b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,10 @@ * @test CompilerQueueTest * @bug 8054889 * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @ignore 8069160 * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* diff --git a/hotspot/test/serviceability/dcmd/framework/HelpTest.java b/hotspot/test/serviceability/dcmd/framework/HelpTest.java index 323dae74e21..05e9c84ae57 100644 --- a/hotspot/test/serviceability/dcmd/framework/HelpTest.java +++ b/hotspot/test/serviceability/dcmd/framework/HelpTest.java @@ -33,6 +33,10 @@ import org.testng.annotations.Test; * @test * @summary Test of diagnostic command help (tests all DCMD executors) * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @ignore 8072440 * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* diff --git a/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java b/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java index 8c5d68cdae7..f198fdbee31 100644 --- a/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java +++ b/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java @@ -33,6 +33,10 @@ import org.testng.annotations.Test; * @test * @summary Test of invalid diagnostic command (tests all DCMD executors) * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @ignore 8072440 * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* diff --git a/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java b/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java index 8d0f2eaa5ab..d7896d86898 100644 --- a/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java +++ b/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java @@ -34,6 +34,10 @@ import org.testng.annotations.Test; * @test * @summary Test of diagnostic command VM.version (tests all DCMD executors) * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @ignore 8072440 * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* diff --git a/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java b/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java index f205dec936a..a59fffd3cb1 100644 --- a/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java +++ b/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java @@ -25,6 +25,10 @@ * @test * @summary Test of diagnostic command GC.class_histogram -all=true * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @build ClassHistogramTest diff --git a/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java b/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java index a4f618acbd1..a3f19ab2ab9 100644 --- a/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java +++ b/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java @@ -33,6 +33,10 @@ import com.oracle.java.testlibrary.dcmd.JMXExecutor; * @test * @summary Test of diagnostic command GC.class_histogram * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng ClassHistogramTest diff --git a/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java b/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java index 4894200205f..0872987ab92 100644 --- a/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java +++ b/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java @@ -25,6 +25,10 @@ * @test * @summary Test of diagnostic command GC.heap_dump -all=true * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @build HeapDumpTest diff --git a/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java b/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java index 132f9a2e86d..a662cdfdbca 100644 --- a/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java +++ b/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java @@ -35,6 +35,10 @@ import com.oracle.java.testlibrary.dcmd.PidJcmdExecutor; * @test * @summary Test of diagnostic command GC.heap_dump * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng HeapDumpTest diff --git a/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java b/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java index 6e8f4668302..48c5987a3d5 100644 --- a/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java +++ b/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java @@ -35,6 +35,10 @@ import com.oracle.java.testlibrary.dcmd.JMXExecutor; * @test * @summary Test of diagnostic command GC.run_finalization * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng RunFinalizationTest diff --git a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java index ec135bbc352..7773e1a8406 100644 --- a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java +++ b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java @@ -37,6 +37,10 @@ import com.oracle.java.testlibrary.dcmd.JMXExecutor; * @test * @summary Test of diagnostic command GC.run * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng/othervm -XX:+PrintGCDetails -Xloggc:RunGC.gclog -XX:-ExplicitGCInvokesConcurrent RunGCTest diff --git a/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java b/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java index 8d9b8d861f3..3904f409dfc 100644 --- a/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java +++ b/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java @@ -25,6 +25,10 @@ * @test * @summary Test of diagnostic command Thread.print -l=true * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @build PrintTest diff --git a/hotspot/test/serviceability/dcmd/thread/PrintTest.java b/hotspot/test/serviceability/dcmd/thread/PrintTest.java index faf1a71d73f..c6781442dfc 100644 --- a/hotspot/test/serviceability/dcmd/thread/PrintTest.java +++ b/hotspot/test/serviceability/dcmd/thread/PrintTest.java @@ -38,6 +38,10 @@ import java.util.regex.Pattern; * @test * @summary Test of diagnostic command Thread.print * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng PrintTest diff --git a/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java b/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java index e0c9c8875ef..d5264061e21 100644 --- a/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java +++ b/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java @@ -25,6 +25,10 @@ * @test * @summary Test of diagnostic command VM.class_hierarchy * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng ClassHierarchyTest diff --git a/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java b/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java index 50c4f6cf5f1..68bda40f1aa 100644 --- a/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java +++ b/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,10 @@ * @test * @summary Test of diagnostic command VM.classloader_stats * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng ClassLoaderStatsTest diff --git a/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java b/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java index cf22153f640..0caeba23db2 100644 --- a/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java +++ b/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java @@ -31,6 +31,10 @@ import com.oracle.java.testlibrary.dcmd.JMXExecutor; * @test * @summary Test of diagnostic command VM.command_line * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+ThereShouldNotBeAnyVMOptionNamedLikeThis CommandLineTest diff --git a/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java b/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java index 3f8c8ddfca7..e26d7b0e2d1 100644 --- a/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java +++ b/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java @@ -33,6 +33,10 @@ import com.oracle.java.testlibrary.dcmd.JMXExecutor; * @test * @summary Test of VM.dynlib diagnostic command via MBean * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng DynLibsTest diff --git a/hotspot/test/serviceability/dcmd/vm/FlagsTest.java b/hotspot/test/serviceability/dcmd/vm/FlagsTest.java index 960104e4415..ed57bfb255c 100644 --- a/hotspot/test/serviceability/dcmd/vm/FlagsTest.java +++ b/hotspot/test/serviceability/dcmd/vm/FlagsTest.java @@ -30,6 +30,10 @@ import org.testng.annotations.Test; * @test * @summary Test of diagnostic command VM.flags * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng/othervm -Xmx129m -XX:+PrintGC -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+ThereShouldNotBeAnyVMOptionNamedLikeThis_Right -XX:-TieredCompilation FlagsTest diff --git a/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java b/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java index 8b21ae9f28c..cae33cd91bc 100644 --- a/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java +++ b/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java @@ -31,6 +31,10 @@ import com.oracle.java.testlibrary.dcmd.JMXExecutor; * @test * @summary Test of diagnostic command VM.system_properties * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng SystemPropertiesTest diff --git a/hotspot/test/serviceability/dcmd/vm/UptimeTest.java b/hotspot/test/serviceability/dcmd/vm/UptimeTest.java index b646f570faa..4da1aad2327 100644 --- a/hotspot/test/serviceability/dcmd/vm/UptimeTest.java +++ b/hotspot/test/serviceability/dcmd/vm/UptimeTest.java @@ -35,6 +35,10 @@ import java.text.ParseException; * @test * @summary Test of diagnostic command VM.uptime * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* * @build com.oracle.java.testlibrary.dcmd.* * @run testng UptimeTest diff --git a/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java b/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java index 9acefe511f5..eeb5dd4956f 100644 --- a/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java +++ b/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,11 @@ import com.oracle.java.testlibrary.*; * @test * @bug 8027230 * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.instrument + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build ClassFileInstaller com.oracle.java.testlibrary.* GetObjectSizeOverflowAgent * @run main ClassFileInstaller GetObjectSizeOverflowAgent * @run main GetObjectSizeOverflow diff --git a/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java b/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java index 9ba16d810fa..6e1777df241 100644 --- a/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java +++ b/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java @@ -27,6 +27,10 @@ * @bug 8008678 * @summary JSR 292: constant pool reconstitution must support pseudo strings * @library /testlibrary + * @modules java.base/sun.misc + * java.instrument + * java.management + * jdk.jartool/sun.tools.jar * @compile -XDignore.symbol.file TestLambdaFormRetransformation.java * @run main TestLambdaFormRetransformation */ diff --git a/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java b/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java index 14ffea90bd5..fc62079c61d 100644 --- a/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java +++ b/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,12 @@ * @summary Redefine a class with an UnresolvedClass reference in the constant pool. * @bug 8035150 * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.instrument + * java.management + * jdk.jartool/sun.tools.jar + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* UnresolvedClassAgent * @run main TestRedefineWithUnresolvedClass */ diff --git a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java index 169c0432999..fd014e3c48b 100644 --- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java +++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,10 @@ * @bug 8028623 * @summary Test hashing of extended characters in Serviceability Agent. * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @ignore 8044416 * @build com.oracle.java.testlibrary.* * @compile -encoding utf8 Test8028623.java diff --git a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java index eeeecba0da4..47fcc3f2ac5 100644 --- a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java +++ b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,10 @@ import com.oracle.java.testlibrary.ProcessTools; * @key regression * @summary Regression test for hprof export issue due to large heaps (>2G) * @library /testlibrary + * @modules java.base/sun.misc + * java.compiler + * java.management/sun.management + * jdk.jvmstat/sun.jvmstat.monitor * @build com.oracle.java.testlibrary.* JMapHProfLargeHeapProc * @run main JMapHProfLargeHeapTest */ diff --git a/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java b/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java index 068f193efcf..008f8286f34 100644 --- a/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java +++ b/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * such as printing additional diagnostic info * (exit code, stdout, stderr, command line, etc.) * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import java.io.ByteArrayOutputStream; diff --git a/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java b/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java index 2fd677783a8..463ec98656a 100644 --- a/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java +++ b/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @summary Test the OutputAnalyzer utility class * @library /testlibrary + * @modules java.base/sun.misc + * java.management */ import com.oracle.java.testlibrary.OutputAnalyzer; diff --git a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java index 84103c301f0..253495c230f 100644 --- a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java +++ b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @summary Verify correctnes of the random generator from Utility.java * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run driver RandomGeneratorTest SAME_SEED * @run driver RandomGeneratorTest NO_SEED * @run driver RandomGeneratorTest DIFFERENT_SEED diff --git a/hotspot/test/testlibrary_tests/RedefineClassTest.java b/hotspot/test/testlibrary_tests/RedefineClassTest.java index e812e43cded..c57e86ed918 100644 --- a/hotspot/test/testlibrary_tests/RedefineClassTest.java +++ b/hotspot/test/testlibrary_tests/RedefineClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,9 @@ * @test * @library /testlibrary * @summary Proof of concept test for RedefineClassHelper + * @modules java.compiler + * java.instrument + * jdk.jartool/sun.tools.jar * @build RedefineClassHelper * @run main RedefineClassHelper * @run main/othervm -javaagent:redefineagent.jar RedefineClassTest diff --git a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java index 1f022a9d0f8..bf33c254f08 100644 --- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java +++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,8 @@ import java.util.Set; * in com.oracle.java.testlibrary.Platform one and only one predicate * evaluates to true. * @library /testlibrary + * @modules java.base/sun.misc + * java.management * @run main TestMutuallyExclusivePlatformPredicates */ public class TestMutuallyExclusivePlatformPredicates { diff --git a/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java b/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java index 9caa869c29a..51931dcfd79 100644 --- a/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java +++ b/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ import sun.hotspot.WhiteBox; * @test * @summary Verifies that Platform::isTieredSupported returns correct value. * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management * @build TestPlatformIsTieredSupported * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java index 656f36438c6..dce204f88c6 100644 --- a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java +++ b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,9 @@ * @test * @bug 8012447 * @library /testlibrary /../../test/lib /testlibrary/ctw/src + * @modules java.base/sun.misc + * java.base/sun.reflect + * java.management * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java index 8c92fb038a6..7d33504001f 100644 --- a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java +++ b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,9 @@ * @test * @bug 8012447 * @library /testlibrary /../../test/lib /testlibrary/ctw/src + * @modules java.base/sun.misc + * java.base/sun.reflect + * java.management * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java index fef89f8dd8d..6d31da6d3e3 100644 --- a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java +++ b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,11 @@ * @test * @bug 8012447 * @library /testlibrary /../../test/lib /testlibrary/ctw/src + * @modules java.base/sun.misc + * java.base/sun.reflect + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/ctw/JarsTest.java b/hotspot/test/testlibrary_tests/ctw/JarsTest.java index 277cc1f808a..f58465d4c61 100644 --- a/hotspot/test/testlibrary_tests/ctw/JarsTest.java +++ b/hotspot/test/testlibrary_tests/ctw/JarsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,11 @@ * @test * @bug 8012447 * @library /testlibrary /../../test/lib /testlibrary/ctw/src + * @modules java.base/sun.misc + * java.base/sun.reflect + * java.compiler + * java.management + * jdk.jvmstat/sun.jvmstat.monitor * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java index 1857c5828d2..c6c750f2783 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,10 @@ * @test BooleanTest * @bug 8028756 * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.compiler + * java.management/sun.management + * jdk.jvmstat/sun.jvmstat.monitor * @build BooleanTest ClassFileInstaller sun.hotspot.WhiteBox com.oracle.java.testlibrary.* * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java index d9cff2f6475..2bb93a1ddd0 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test DoubleTest * @bug 8028756 * @library /testlibrary /../../test/lib + * @modules java.management/sun.management * @build DoubleTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java index dc37d7a2ed0..ab49784c94e 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test IntxTest * @bug 8028756 * @library /testlibrary /../../test/lib + * @modules java.management/sun.management * @build IntxTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java index 9696bd36158..ac910a453b0 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test SizeTTest * @bug 8054823 * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management/sun.management * @build SizeTTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java index ae26e370bcf..e085c693905 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test StringTest * @bug 8028756 * @library /testlibrary /../../test/lib + * @modules java.management/sun.management * @build StringTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java index 7ab5f318356..c81667ecd64 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test Uint64Test * @bug 8028756 * @library /testlibrary /../../test/lib + * @modules java.management/sun.management * @build Uint64Test * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java index 469ecc2e59a..65ec0c33acc 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test UintxTest * @bug 8028756 * @library /testlibrary /../../test/lib + * @modules java.base/sun.misc + * java.management/sun.management * @build UintxTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission From 9c48863bb1f4523828a204a1a59045a86a127732 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Thu, 26 Mar 2015 17:39:04 +0100 Subject: [PATCH 052/101] 8075610: java.desktop module dependency can be eliminated in tools/javac/generics/inference/5073060/GenericsAndPackages.java Reviewed-by: jjg --- .../generics/inference/5073060/GenericsAndPackages.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/langtools/test/tools/javac/generics/inference/5073060/GenericsAndPackages.java b/langtools/test/tools/javac/generics/inference/5073060/GenericsAndPackages.java index 15e9a1c96fc..0779e9d38a8 100644 --- a/langtools/test/tools/javac/generics/inference/5073060/GenericsAndPackages.java +++ b/langtools/test/tools/javac/generics/inference/5073060/GenericsAndPackages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /** * @test - * @bug 5073060 + * @bug 5073060 8075610 * @summary Package private members not found for intersection types * @author Bruce Eckel * see http://www.artima.com/forums/flat.jsp?forum=106&thread=136204 @@ -33,7 +33,7 @@ package code; interface HasColor { - java.awt.Color getColor(); + String getColor(); } class Dimension { @@ -44,6 +44,6 @@ class ColoredDimension { T item; ColoredDimension(T item) { this.item = item; } T getItem() { return item; } - java.awt.Color f() { return item.getColor(); } + String f() { return item.getColor(); } int getX() { return item.x; } } From c74264d67531535aaabf5277d44e4f39ce0fdd8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Thu, 26 Mar 2015 21:39:25 +0100 Subject: [PATCH 053/101] 8075366: Slow scope access to global let/const does not work Reviewed-by: sundar, attila, lagergren --- .../classes/jdk/nashorn/internal/objects/Global.java | 12 ++++++++++++ .../jdk/nashorn/internal/runtime/ScriptObject.java | 2 +- .../jdk/nashorn/internal/runtime/WithObject.java | 2 +- nashorn/test/script/basic/es6/let-eval.js | 6 ++++++ nashorn/test/script/basic/es6/let-eval.js.EXPECTED | 4 ++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java index 76a787fa922..e6eba091c40 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java @@ -60,6 +60,7 @@ import jdk.nashorn.internal.objects.annotations.ScriptClass; import jdk.nashorn.internal.objects.annotations.Setter; import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.ECMAErrors; +import jdk.nashorn.internal.runtime.FindProperty; import jdk.nashorn.internal.runtime.GlobalConstants; import jdk.nashorn.internal.runtime.GlobalFunctions; import jdk.nashorn.internal.runtime.JSType; @@ -2203,6 +2204,17 @@ public final class Global extends ScriptObject implements Scope { return invocation; } + @Override + protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) { + if (lexicalScope != null && start != this && start.isScope()) { + final FindProperty find = lexicalScope.findProperty(key, false); + if (find != null) { + return find; + } + } + return super.findProperty(key, deep, start); + } + @Override public GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final LinkRequest request) { final boolean isScope = NashornCallSiteDescriptor.isScope(desc); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java index 358cc05c960..284505a9baf 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java @@ -812,7 +812,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { * * @return FindPropertyData or null if not found. */ - FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) { + protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) { final PropertyMap selfMap = getMap(); final Property property = selfMap.findProperty(key); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java index 20510dfd36b..a717a21852a 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java @@ -198,7 +198,7 @@ public final class WithObject extends ScriptObject implements Scope { * @return FindPropertyData or null if not found. */ @Override - FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) { + protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) { // We call findProperty on 'expression' with 'expression' itself as start parameter. // This way in ScriptObject.setObject we can tell the property is from a 'with' expression // (as opposed from another non-scope object in the proto chain such as Object.prototype). diff --git a/nashorn/test/script/basic/es6/let-eval.js b/nashorn/test/script/basic/es6/let-eval.js index b08fa98ad84..d1855dc9513 100644 --- a/nashorn/test/script/basic/es6/let-eval.js +++ b/nashorn/test/script/basic/es6/let-eval.js @@ -96,3 +96,9 @@ function f() { f(); print(typeof a, typeof b, typeof c, typeof x, typeof z); + +let v = 1; +eval("print('v: ' + v); v = 2; print ('v: ' + v);"); +print("this.v: " + this.v); +print("v: " + v); + diff --git a/nashorn/test/script/basic/es6/let-eval.js.EXPECTED b/nashorn/test/script/basic/es6/let-eval.js.EXPECTED index 96f9a6d04bc..d6ccc59756e 100644 --- a/nashorn/test/script/basic/es6/let-eval.js.EXPECTED +++ b/nashorn/test/script/basic/es6/let-eval.js.EXPECTED @@ -14,3 +14,7 @@ c: 0 2 1 0 2 1 0 undefined undefined undefined undefined undefined undefined +v: 1 +v: 2 +this.v: undefined +v: 2 From 0f4227cfdedfe99bae9175d6bc31c5c50ce93581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Thu, 26 Mar 2015 22:13:41 +0100 Subject: [PATCH 054/101] 8075231: Typed array setters are very slow when index exceeds capacity Reviewed-by: attila, lagergren --- .../internal/objects/NativeFloat32Array.java | 9 ++++----- .../internal/objects/NativeFloat64Array.java | 9 ++++----- .../internal/objects/NativeInt16Array.java | 9 ++++----- .../internal/objects/NativeInt32Array.java | 10 +++++----- .../internal/objects/NativeInt8Array.java | 9 ++++----- .../internal/objects/NativeUint16Array.java | 9 ++++----- .../internal/objects/NativeUint32Array.java | 9 ++++----- .../internal/objects/NativeUint8Array.java | 9 ++++----- .../objects/NativeUint8ClampedArray.java | 19 +++++++++---------- 9 files changed, 42 insertions(+), 50 deletions(-) diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java index ef7a1ff8396..b75d50690e2 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java @@ -114,12 +114,11 @@ public final class NativeFloat32Array extends ArrayBufferView { private void setElem(final int index, final double elem) { try { - nb.put(index, (float)elem); - } catch (final IndexOutOfBoundsException e) { - //swallow valid array indexes. it's ok. - if (index < 0) { - throw new ClassCastException(); + if (index < nb.limit()) { + nb.put(index, (float) elem); } + } catch (final IndexOutOfBoundsException e) { + throw new ClassCastException(); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java index d0413d08b9f..9a2e319ba86 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java @@ -114,12 +114,11 @@ public final class NativeFloat64Array extends ArrayBufferView { private void setElem(final int index, final double elem) { try { - nb.put(index, elem); - } catch (final IndexOutOfBoundsException e) { - //swallow valid array indexes. it's ok. - if (index < 0) { - throw new ClassCastException(); + if (index < nb.limit()) { + nb.put(index, elem); } + } catch (final IndexOutOfBoundsException e) { + throw new ClassCastException(); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java index e4cdce51469..c2eb5556251 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java @@ -115,12 +115,11 @@ public final class NativeInt16Array extends ArrayBufferView { private void setElem(final int index, final int elem) { try { - nb.put(index, (short)elem); - } catch (final IndexOutOfBoundsException e) { - //swallow valid array indexes. it's ok. - if (index < 0) { - throw new ClassCastException(); + if (index < nb.limit()) { + nb.put(index, (short) elem); } + } catch (final IndexOutOfBoundsException e) { + throw new ClassCastException(); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java index 9e664ed78ca..a266fc519bd 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java @@ -104,11 +104,11 @@ public final class NativeInt32Array extends ArrayBufferView { private void setElem(final int index, final int elem) { try { - nb.put(index, elem); - } catch (final IndexOutOfBoundsException e) { - if (index < 0) { - throw new ClassCastException(); - } + if (index < nb.limit()) { + nb.put(index, elem); + } + } catch (final IndexOutOfBoundsException e) { + throw new ClassCastException(); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java index c336d2745ed..be9bacf987c 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java @@ -113,12 +113,11 @@ public final class NativeInt8Array extends ArrayBufferView { private void setElem(final int index, final int elem) { try { - nb.put(index, (byte)elem); - } catch (final IndexOutOfBoundsException e) { - //swallow valid array indexes. it's ok. - if (index < 0) { - throw new ClassCastException(); + if (index < nb.limit()) { + nb.put(index, (byte) elem); } + } catch (final IndexOutOfBoundsException e) { + throw new ClassCastException(); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java index 2fc2c51a380..30dc68140f4 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java @@ -104,12 +104,11 @@ public final class NativeUint16Array extends ArrayBufferView { private void setElem(final int index, final int elem) { try { - nb.put(index, (char)elem); - } catch (final IndexOutOfBoundsException e) { - //swallow valid array indexes. it's ok. - if (index < 0) { - throw new ClassCastException(); + if (index < nb.limit()) { + nb.put(index, (char) elem); } + } catch (final IndexOutOfBoundsException e) { + throw new ClassCastException(); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java index 4c83cc01701..85035175696 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java @@ -113,12 +113,11 @@ public final class NativeUint32Array extends ArrayBufferView { private void setElem(final int index, final int elem) { try { - nb.put(index, elem); - } catch (final IndexOutOfBoundsException e) { - //swallow valid array indexes. it's ok. - if (index < 0) { - throw new ClassCastException(); + if (index < nb.limit()) { + nb.put(index, elem); } + } catch (final IndexOutOfBoundsException e) { + throw new ClassCastException(); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java index 6e69ebadb1e..f5ccce64b6e 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java @@ -104,12 +104,11 @@ public final class NativeUint8Array extends ArrayBufferView { private void setElem(final int index, final int elem) { try { - nb.put(index, (byte)elem); - } catch (final IndexOutOfBoundsException e) { - //swallow valid array indexes. it's ok. - if (index < 0) { - throw new ClassCastException(); + if (index < nb.limit()) { + nb.put(index, (byte) elem); } + } catch (final IndexOutOfBoundsException e) { + throw new ClassCastException(); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java index 2dff261292b..28d72d1701a 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java @@ -133,18 +133,17 @@ public final class NativeUint8ClampedArray extends ArrayBufferView { private void setElem(final int index, final int elem) { try { - final byte clamped; - if ((elem & 0xffff_ff00) == 0) { - clamped = (byte)elem; - } else { - clamped = elem < 0 ? 0 : (byte)0xff; + if (index < nb.limit()) { + final byte clamped; + if ((elem & 0xffff_ff00) == 0) { + clamped = (byte) elem; + } else { + clamped = elem < 0 ? 0 : (byte) 0xff; + } + nb.put(index, clamped); } - nb.put(index, clamped); } catch (final IndexOutOfBoundsException e) { - //swallow valid array indexes. it's ok. - if (index < 0) { - throw new ClassCastException(); - } + throw new ClassCastException(); } } From 90284ff64ab8508c017fa8988c95584484f12682 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Fri, 27 Mar 2015 14:11:26 +0100 Subject: [PATCH 055/101] 8076123: 9-dev build fail: make/Init.gmk:142: *** multiple target patterns. Stop Reviewed-by: ihse --- common/autoconf/basics.m4 | 9 ++++ common/autoconf/generated-configure.sh | 60 +++++++++++++++++++++++++- common/autoconf/spec.gmk.in | 3 ++ make/Init.gmk | 2 +- make/InitSupport.gmk | 13 +++++- make/Main.gmk | 3 +- 6 files changed, 85 insertions(+), 5 deletions(-) diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index 2e483b28d77..d9df0877703 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -459,12 +459,21 @@ AC_DEFUN_ONCE([BASIC_SETUP_PATHS], AC_MSG_RESULT([$TOPDIR]) AC_SUBST(TOPDIR) + # Save the original version of TOPDIR for string comparisons + ORIGINAL_TOPDIR="$TOPDIR" + AC_SUBST(ORIGINAL_TOPDIR) + # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS. BASIC_FIXUP_PATH(CURDIR) BASIC_FIXUP_PATH(TOPDIR) # SRC_ROOT is a traditional alias for TOPDIR. SRC_ROOT=$TOPDIR + # Calculate a canonical version of TOPDIR for string comparisons + CANONICAL_TOPDIR=$TOPDIR + BASIC_REMOVE_SYMBOLIC_LINKS([CANONICAL_TOPDIR]) + AC_SUBST(CANONICAL_TOPDIR) + # Locate the directory of this script. AUTOCONF_DIR=$TOPDIR/common/autoconf ]) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 79bab4baf45..b22230972c1 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -907,6 +907,8 @@ JVM_VARIANTS JVM_INTERPRETER JDK_VARIANT SET_OPENJDK +CANONICAL_TOPDIR +ORIGINAL_TOPDIR TOPDIR PATH_SEP ZERO_ARCHDEF @@ -4363,7 +4365,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1427382753 +DATE_WHEN_GENERATED=1427461839 ############################################################################### # @@ -14135,6 +14137,10 @@ $as_echo_n "checking for top-level directory... " >&6; } $as_echo "$TOPDIR" >&6; } + # Save the original version of TOPDIR for string comparisons + ORIGINAL_TOPDIR="$TOPDIR" + + # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS. # Only process if variable expands to non-empty @@ -14391,6 +14397,58 @@ $as_echo "$as_me: The path of TOPDIR, which resolves as \"$path\", is invalid." # SRC_ROOT is a traditional alias for TOPDIR. SRC_ROOT=$TOPDIR + # Calculate a canonical version of TOPDIR for string comparisons + CANONICAL_TOPDIR=$TOPDIR + + if test "x$OPENJDK_BUILD_OS" != xwindows; then + # Follow a chain of symbolic links. Use readlink + # where it exists, else fall back to horribly + # complicated shell code. + if test "x$READLINK_TESTED" != yes; then + # On MacOSX there is a readlink tool with a different + # purpose than the GNU readlink tool. Check the found readlink. + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` + if test "x$ISGNU" = x; then + # A readlink that we do not know how to use. + # Are there other non-GNU readlinks out there? + READLINK_TESTED=yes + READLINK= + fi + fi + + if test "x$READLINK" != x; then + CANONICAL_TOPDIR=`$READLINK -f $CANONICAL_TOPDIR` + else + # Save the current directory for restoring afterwards + STARTDIR=$PWD + COUNTER=0 + sym_link_dir=`$DIRNAME $CANONICAL_TOPDIR` + sym_link_file=`$BASENAME $CANONICAL_TOPDIR` + cd $sym_link_dir + # Use -P flag to resolve symlinks in directories. + cd `$THEPWDCMD -P` + sym_link_dir=`$THEPWDCMD -P` + # Resolve file symlinks + while test $COUNTER -lt 20; do + ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` + if test "x$ISLINK" == x; then + # This is not a symbolic link! We are done! + break + fi + # Again resolve directory symlinks since the target of the just found + # link could be in a different directory + cd `$DIRNAME $ISLINK` + sym_link_dir=`$THEPWDCMD -P` + sym_link_file=`$BASENAME $ISLINK` + let COUNTER=COUNTER+1 + done + cd $STARTDIR + CANONICAL_TOPDIR=$sym_link_dir/$sym_link_file + fi + fi + + + # Locate the directory of this script. AUTOCONF_DIR=$TOPDIR/common/autoconf diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 89f070cadb0..35437b11670 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -133,6 +133,9 @@ OVERRIDE_SRC_ROOT:=@OVERRIDE_SRC_ROOT@ # The top-level directory of the forest (SRC_ROOT is a traditional alias) TOPDIR:=@TOPDIR@ +# These two versions of TOPDIR are used in string comparisons +ORIGINAL_TOPDIR:=@ORIGINAL_TOPDIR@ +CANONICAL_TOPDIR:=@CANONICAL_TOPDIR@ SRC_ROOT:=@TOPDIR@ OUTPUT_ROOT:=@OUTPUT_ROOT@ diff --git a/make/Init.gmk b/make/Init.gmk index 7d7fada35ea..59f98fa3977 100644 --- a/make/Init.gmk +++ b/make/Init.gmk @@ -52,7 +52,7 @@ include $(topdir)/make/Help.gmk # Extract main targets from Main.gmk. ifneq ($(any_spec_file), ) - ifeq ($(wildcard $(dir $(any_spec_file))/make-support),) + ifeq ($(wildcard $(dir $(any_spec_file))/make-support/module-deps.gmk),) # If make-support does not exist, we need to build the genmodules java tool first. $(info Creating data for first make execution in new configuration...) ignore_output := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \ diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index 536502acba6..cc733cf1542 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -264,8 +264,17 @@ else # $(HAS_SPEC)=true # Sanity check the spec file, so it matches this source code define CheckSpecSanity ifneq ($$(topdir), $$(TOPDIR)) - $$(info Error: SPEC mismatch. $$$$(TOPDIR) does not match current directory.) - $$(error Cannot continue) + ifneq ($$(topdir), $$(ORIGINAL_TOPDIR)) + ifneq ($$(topdir), $$(CANONICAL_TOPDIR)) + $$(info Error: SPEC mismatch! Current working directory) + $$(info $$(topdir)) + $$(info does not match either TOPDIR, ORIGINAL_TOPDIR or CANONICAL_TOPDIR) + $$(info $$(TOPDIR)) + $$(info $$(ORIGINAL_TOPDIR)) + $$(info $$(CANONICAL_TOPDIR)) + $$(error Cannot continue) + endif + endif endif endef diff --git a/make/Main.gmk b/make/Main.gmk index 03c84034ba7..a6aef4647bd 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -220,7 +220,8 @@ $(SUPPORT_OUTPUTDIR)/source_tips: FRC BOOTCYCLE_TARGET := product-images bootcycle-images: @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image - +$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET) + +$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Main.gmk \ + SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET) zip-security: +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk) From d4502a832f32cb78f1c8719915ca983220f8e827 Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Mon, 30 Mar 2015 14:54:57 +0300 Subject: [PATCH 056/101] 8074297: substring in XSLT returns wrong character if string contains supplementary chars Reviewed-by: joehw --- .../internal/xsltc/runtime/BasisLibrary.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java index 8d05e9e8cf7..b50a3a3cfd3 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java @@ -270,7 +270,7 @@ public final class BasisLibrary { if (Double.isNaN(start)) return(EMPTYSTRING); - final int strlen = value.length(); + final int strlen = getStringLength(value); int istart = (int)Math.round(start) - 1; if (istart > strlen) @@ -278,6 +278,7 @@ public final class BasisLibrary { if (istart < 1) istart = 0; try { + istart = value.offsetByCodePoints(0, istart); return value.substring(istart); } catch (IndexOutOfBoundsException e) { runTimeError(RUN_TIME_INTERNAL_ERR, "substring()"); @@ -297,13 +298,14 @@ public final class BasisLibrary { return(EMPTYSTRING); int istart = (int)Math.round(start) - 1; + final int ilength = (int)Math.round(length); final int isum; if (Double.isInfinite(length)) isum = Integer.MAX_VALUE; else - isum = istart + (int)Math.round(length); + isum = istart + ilength; - final int strlen = value.length(); + final int strlen = getStringLength(value); if (isum < 0 || istart > strlen) return(EMPTYSTRING); @@ -311,10 +313,13 @@ public final class BasisLibrary { istart = 0; try { - if (isum > strlen) + istart = value.offsetByCodePoints(0, istart); + if (isum > strlen) { return value.substring(istart); - else - return value.substring(istart, isum); + } else { + int offset = value.offsetByCodePoints(istart, ilength); + return value.substring(istart, offset); + } } catch (IndexOutOfBoundsException e) { runTimeError(RUN_TIME_INTERNAL_ERR, "substring()"); return null; From 15d518465285db7e85a3e3ac6b0127a6b6337fc7 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Mon, 30 Mar 2015 16:38:59 +0100 Subject: [PATCH 057/101] 8075752: jdk.compiler dependency can be eliminated in MethodReferenceNullCheckTest.java Reviewed-by: jjg --- .../MethodReferenceNullCheckTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java index fd2bf655649..c0fcedd068a 100644 --- a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java +++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceNullCheckTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ /** * @test - * @bug 8024696 + * @bug 8024696 8075752 * @summary Missing null check in bound method reference capture */ -import com.sun.tools.javac.util.Assert; -import java.util.function.*; +import java.util.function.Supplier; public class MethodReferenceNullCheckTest { public static void main(String[] args) { @@ -41,7 +40,8 @@ public class MethodReferenceNullCheckTest { } catch (NullPointerException npe) { npeFired = true; } finally { - Assert.check(npeFired, "NPE should have been thrown"); + if (!npeFired) + throw new AssertionError("NPE should have been thrown"); } } } From 75f2048a842bee1c368ea58024db0ae5ea023831 Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Wed, 1 Apr 2015 16:01:10 +0300 Subject: [PATCH 058/101] 8076290: JCK test api/xsl/conf/string/string17 starts failing after JDK-8074297 Reviewed-by: joehw --- .../apache/xalan/internal/xsltc/runtime/BasisLibrary.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java index b50a3a3cfd3..242e2ff3936 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java @@ -298,7 +298,7 @@ public final class BasisLibrary { return(EMPTYSTRING); int istart = (int)Math.round(start) - 1; - final int ilength = (int)Math.round(length); + int ilength = (int)Math.round(length); final int isum; if (Double.isInfinite(length)) isum = Integer.MAX_VALUE; @@ -309,8 +309,10 @@ public final class BasisLibrary { if (isum < 0 || istart > strlen) return(EMPTYSTRING); - if (istart < 0) + if (istart < 0) { + ilength += istart; istart = 0; + } try { istart = value.offsetByCodePoints(0, istart); From c1e2102b1ad3e5d886724356988758c5c7766440 Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Wed, 1 Apr 2015 17:07:50 +0300 Subject: [PATCH 059/101] 8073385: Bad error message on parsing illegal character in XML attribute Reviewed-by: joehw --- .../internal/impl/XMLDTDScannerImpl.java | 2 +- .../impl/XMLDocumentFragmentScannerImpl.java | 2 +- .../impl/XMLNSDocumentScannerImpl.java | 2 +- .../xerces/internal/impl/XMLScanner.java | 11 ++- .../javax/xml/parsers/Bug8073385.java | 93 +++++++++++++++++++ 5 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8073385.java diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java index 74db88ca6cd..9bb176c13da 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java @@ -1417,7 +1417,7 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler { // AttValue boolean isVC = !fStandalone && (fSeenExternalDTD || fSeenExternalPE) ; scanAttributeValue(defaultVal, nonNormalizedDefaultVal, atName, - fAttributes, 0, isVC); + fAttributes, 0, isVC, elName); } return defaultType; diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java index 1d599a700b2..6b49a147bc1 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java @@ -1547,7 +1547,7 @@ public class XMLDocumentFragmentScannerImpl scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, - attIndex, isVC); + attIndex, isVC, fCurrentElement.rawname); // content int oldLen = attributes.getLength(); diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java index ab2a341f287..a4fb84f3721 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java @@ -437,7 +437,7 @@ public class XMLNSDocumentScannerImpl XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, - attrIndex, isVC); + attrIndex, isVC, fCurrentElement.rawname); String value = null; //fTempString.toString(); diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java index 58700e2934b..97e5d2b1baa 100644 --- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java +++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java @@ -811,6 +811,7 @@ public abstract class XMLScanner * @param attrIndex The index of the attribute to use from the list. * @param checkEntities true if undeclared entities should be reported as VC violation, * false if undeclared entities should be reported as WFC violation. + * @param eleName The name of element to which this attribute belongs. * * Note: This method uses fStringBuffer2, anything in it * at the time of calling is lost. @@ -819,13 +820,13 @@ public abstract class XMLScanner XMLString nonNormalizedValue, String atName, XMLAttributes attributes, int attrIndex, - boolean checkEntities) + boolean checkEntities, String eleName) throws IOException, XNIException { XMLStringBuffer stringBuffer = null; // quote int quote = fEntityScanner.peekChar(); if (quote != '\'' && quote != '"') { - reportFatalError("OpenQuoteExpected", new Object[]{atName}); + reportFatalError("OpenQuoteExpected", new Object[]{eleName, atName}); } fEntityScanner.scanChar(); @@ -951,7 +952,7 @@ public abstract class XMLScanner } } else if (c == '<') { reportFatalError("LessthanInAttValue", - new Object[] { null, atName }); + new Object[] { eleName, atName }); fEntityScanner.scanChar(); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append((char)c); @@ -987,7 +988,7 @@ public abstract class XMLScanner } } else if (c != -1 && isInvalidLiteral(c)) { reportFatalError("InvalidCharInAttValue", - new Object[] {Integer.toString(c, 16)}); + new Object[] {eleName, atName, Integer.toString(c, 16)}); fEntityScanner.scanChar(); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append((char)c); @@ -1016,7 +1017,7 @@ public abstract class XMLScanner // quote int cquote = fEntityScanner.scanChar(); if (cquote != quote) { - reportFatalError("CloseQuoteExpected", new Object[]{atName}); + reportFatalError("CloseQuoteExpected", new Object[]{eleName, atName}); } } // scanAttributeValue() diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8073385.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8073385.java new file mode 100644 index 00000000000..1d3aa66ce08 --- /dev/null +++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8073385.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.xml.parsers; + +import java.io.StringReader; +import java.util.Locale; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.DocumentBuilder; +import org.xml.sax.SAXException; +import org.xml.sax.InputSource; + +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import static org.testng.Assert.assertTrue; + +/** + * @bug 8073385 + * @summary test that invalid XML character exception string contains + * information about character value, element and attribute names + */ +public class Bug8073385 { + + private Locale defLoc; + + @BeforeClass + private void setup() { + defLoc = Locale.getDefault(); + Locale.setDefault(Locale.ENGLISH); + } + + @AfterClass + private void cleanup() { + Locale.setDefault(defLoc); + } + + @DataProvider(name = "illegalCharactersData") + public static Object[][] illegalCharactersData() { + return new Object[][]{ + {0x00}, + {0xFFFE}, + {0xFFFF} + }; + } + + @Test(dataProvider = "illegalCharactersData") + public void test(int character) throws Exception { + // Construct the XML document as a String + int[] cps = new int[]{character}; + String txt = new String(cps, 0, cps.length); + String inxml = ""; + String exceptionText = "NO EXCEPTION OBSERVED"; + String hexString = "0x" + Integer.toHexString(character); + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + dbf.setValidating(false); + DocumentBuilder db = dbf.newDocumentBuilder(); + InputSource isrc = new InputSource(new StringReader(inxml)); + + try { + db.parse(isrc); + } catch (SAXException e) { + exceptionText = e.toString(); + } + System.out.println("Got Exception:" + exceptionText); + assertTrue(exceptionText.contains("attribute \"attTest\"")); + assertTrue(exceptionText.contains("element is \"topElement\"")); + assertTrue(exceptionText.contains("Unicode: " + hexString)); + } +} From 465e4dca9a8502e7c3e17f1f4a616caa272489f5 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 2 Apr 2015 15:56:07 -0700 Subject: [PATCH 060/101] 8076420: Consolidate javac file handling in javac.file package Reviewed-by: jlahoda --- .../sun/tools/javac/api/JavacTaskImpl.java | 1 + .../com/sun/tools/javac/api/JavacTool.java | 2 +- .../javac/{util => file}/BaseFileManager.java | 6 +- .../sun/tools/javac/file/BaseFileObject.java | 1 - .../com/sun/tools/javac/file/JRTIndex.java | 1 - .../tools/javac/file/JavacFileManager.java | 4 - .../com/sun/tools/javac/file/Locations.java | 22 +- .../javac/{nio => file}/PathFileObject.java | 4 +- .../com/sun/tools/javac/main/Arguments.java | 2 +- .../com/sun/tools/javac/main/Main.java | 1 + .../tools/javac/nio/JavacPathFileManager.java | 547 ------------------ .../sun/tools/javac/nio/PathFileManager.java | 126 ---- .../internal/toolkit/util/DocFileFactory.java | 13 +- .../toolkit/util/PathDocFileFactory.java | 320 ---------- .../classes/com/sun/tools/javadoc/Start.java | 2 +- .../sun/tools/javadoc/api/JavadocTool.java | 2 +- .../api/basic/GetTask_FileManagerTest.java | 4 +- 17 files changed, 21 insertions(+), 1037 deletions(-) rename langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/{util => file}/BaseFileManager.java (98%) rename langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/{nio => file}/PathFileObject.java (99%) delete mode 100644 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java delete mode 100644 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileManager.java delete mode 100644 langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java index 20dc4160aa2..f51b575410d 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java @@ -40,6 +40,7 @@ import com.sun.source.tree.*; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Symbol.ClassSymbol; import com.sun.tools.javac.comp.*; +import com.sun.tools.javac.file.BaseFileManager; import com.sun.tools.javac.main.*; import com.sun.tools.javac.main.JavaCompiler; import com.sun.tools.javac.parser.Parser; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java index b7811f5719e..99b79820762 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTool.java @@ -44,7 +44,7 @@ import com.sun.source.util.JavacTask; import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.main.Arguments; import com.sun.tools.javac.main.Option; -import com.sun.tools.javac.util.BaseFileManager; +import com.sun.tools.javac.file.BaseFileManager; import com.sun.tools.javac.util.ClientCodeException; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.DefinedBy; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java similarity index 98% rename from langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java rename to langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java index 93a5c68ceef..26d23361bb3 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java @@ -23,7 +23,7 @@ * questions. */ -package com.sun.tools.javac.util; +package com.sun.tools.javac.file; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -60,8 +60,12 @@ import com.sun.tools.javac.file.Locations; import com.sun.tools.javac.main.Option; import com.sun.tools.javac.main.OptionHelper; import com.sun.tools.javac.main.OptionHelper.GrumpyHelper; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.DefinedBy; import com.sun.tools.javac.util.DefinedBy.Api; import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition; +import com.sun.tools.javac.util.Log; +import com.sun.tools.javac.util.Options; /** * Utility methods for building a filemanager. diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java index a14881b74fe..71c869fc1a3 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java @@ -38,7 +38,6 @@ import javax.lang.model.element.NestingKind; import javax.tools.FileObject; import javax.tools.JavaFileObject; -import com.sun.tools.javac.util.BaseFileManager; import com.sun.tools.javac.util.DefinedBy; import com.sun.tools.javac.util.DefinedBy.Api; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java index 889ef82d6a6..85752a263c7 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java @@ -48,7 +48,6 @@ import java.util.Set; import javax.tools.FileObject; import com.sun.tools.javac.file.RelativePath.RelativeDirectory; -import com.sun.tools.javac.nio.PathFileObject; import com.sun.tools.javac.util.Context; /** diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java index d513e3763d9..bf9dec5e7f0 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java @@ -63,8 +63,6 @@ import javax.tools.StandardJavaFileManager; import com.sun.tools.javac.file.RelativePath.RelativeDirectory; import com.sun.tools.javac.file.RelativePath.RelativeFile; -import com.sun.tools.javac.nio.PathFileObject; -import com.sun.tools.javac.util.BaseFileManager; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.DefinedBy; import com.sun.tools.javac.util.DefinedBy.Api; @@ -73,8 +71,6 @@ import com.sun.tools.javac.util.ListBuffer; import static javax.tools.StandardLocation.*; -import static com.sun.tools.javac.util.BaseFileManager.getKind; - /** * This class provides access to the source, class and other files * used by the compiler and related tools. diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java index 4192482045c..b45aa9bf82f 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java @@ -108,37 +108,23 @@ public class Locations { // Locations can use Paths.get(URI.create("jrt:")) static final Path JRT_MARKER_FILE = Paths.get("JRT_MARKER_FILE"); - public Locations() { + Locations() { initHandlers(); } // could replace Lint by "boolean warn" - public void update(Log log, Lint lint, FSInfo fsInfo) { + void update(Log log, Lint lint, FSInfo fsInfo) { this.log = log; warn = lint.isEnabled(Lint.LintCategory.PATH); this.fsInfo = fsInfo; } - public Collection bootClassPath() { - return getLocation(PLATFORM_CLASS_PATH); - } - - public boolean isDefaultBootClassPath() { + boolean isDefaultBootClassPath() { BootClassPathLocationHandler h = (BootClassPathLocationHandler) getHandler(PLATFORM_CLASS_PATH); return h.isDefault(); } - public Collection userClassPath() { - return getLocation(CLASS_PATH); - } - - public Collection sourcePath() { - Collection p = getLocation(SOURCE_PATH); - // TODO: this should be handled by the LocationHandler - return p == null || p.isEmpty() ? null : p; - } - /** * Split a search path into its elements. Empty path elements will be ignored. * @@ -753,7 +739,7 @@ public class Locations { } } - public boolean handleOption(Option option, String value) { + boolean handleOption(Option option, String value) { LocationHandler h = handlersForOption.get(option); return (h == null ? false : h.handleOption(option, value)); } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java similarity index 99% rename from langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java rename to langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java index 36bd8162799..5a5c3761a74 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java @@ -23,7 +23,7 @@ * questions. */ -package com.sun.tools.javac.nio; +package com.sun.tools.javac.file; import java.io.IOException; import java.io.InputStream; @@ -40,11 +40,11 @@ import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; import java.util.Objects; + import javax.lang.model.element.Modifier; import javax.lang.model.element.NestingKind; import javax.tools.JavaFileObject; -import com.sun.tools.javac.util.BaseFileManager; import com.sun.tools.javac.util.DefinedBy; import com.sun.tools.javac.util.DefinedBy.Api; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java index a37f37aa084..c08b59febdc 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java @@ -42,7 +42,7 @@ import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.jvm.Profile; import com.sun.tools.javac.jvm.Target; import com.sun.tools.javac.main.OptionHelper.GrumpyHelper; -import com.sun.tools.javac.util.BaseFileManager; +import com.sun.tools.javac.file.BaseFileManager; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.ListBuffer; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java index 909cb2b505d..46d591ee93e 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java @@ -39,6 +39,7 @@ import javax.tools.JavaFileManager; import com.sun.tools.javac.api.BasicJavacTask; import com.sun.tools.javac.file.CacheFSInfo; +import com.sun.tools.javac.file.BaseFileManager; import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.processing.AnnotationProcessingError; import com.sun.tools.javac.util.*; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java deleted file mode 100644 index 3161afeb8c0..00000000000 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java +++ /dev/null @@ -1,547 +0,0 @@ -/* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javac.nio; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.FileSystem; -import java.nio.file.FileSystems; -import java.nio.file.FileVisitOption; -import java.nio.file.FileVisitResult; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.SimpleFileVisitor; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; - -import javax.lang.model.SourceVersion; -import javax.tools.FileObject; -import javax.tools.JavaFileManager; -import javax.tools.JavaFileObject; -import javax.tools.JavaFileObject.Kind; -import javax.tools.StandardLocation; - -import com.sun.tools.javac.util.BaseFileManager; -import com.sun.tools.javac.util.Context; -import com.sun.tools.javac.util.DefinedBy; -import com.sun.tools.javac.util.DefinedBy.Api; -import com.sun.tools.javac.util.List; -import com.sun.tools.javac.util.ListBuffer; - -import static java.nio.file.FileVisitOption.*; - -import static javax.tools.StandardLocation.*; - -import static com.sun.tools.javac.main.Option.*; - - -// NOTE the imports carefully for this compilation unit. -// -// Path: java.nio.file.Path -- the new NIO type for which this file manager exists -// -// Paths: com.sun.tools.javac.file.Paths -- legacy javac type for handling path options -// The other Paths (java.nio.file.Paths) is not used - -// NOTE this and related classes depend on new API in JDK 7. -// This requires special handling while bootstrapping the JDK build, -// when these classes might not yet have been compiled. To workaround -// this, the build arranges to make stubs of these classes available -// when compiling this and related classes. The set of stub files -// is specified in make/build.properties. - -/** - * Implementation of PathFileManager: a JavaFileManager based on the use - * of java.nio.file.Path. - * - *

Just as a Path is somewhat analagous to a File, so too is this - * JavacPathFileManager analogous to JavacFileManager, as it relates to the - * support of FileObjects based on File objects (i.e. just RegularFileObject, - * not ZipFileObject and its variants.) - * - *

The default values for the standard locations supported by this file - * manager are the same as the default values provided by JavacFileManager -- - * i.e. as determined by the javac.file.Paths class. To override these values, - * call {@link #setLocation}. - * - *

To reduce confusion with Path objects, the locations such as "class path", - * "source path", etc, are generically referred to here as "search paths". - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - */ -public class JavacPathFileManager extends BaseFileManager implements PathFileManager { - protected FileSystem defaultFileSystem; - - /** - * Create a JavacPathFileManager using a given context, optionally registering - * it as the JavaFileManager for that context. - */ - public JavacPathFileManager(Context context, boolean register, Charset charset) { - super(charset); - if (register) - context.put(JavaFileManager.class, this); - pathsForLocation = new HashMap<>(); - fileSystems = new HashMap<>(); - setContext(context); - } - - /** - * Set the context for JavacPathFileManager. - */ - @Override - public void setContext(Context context) { - super.setContext(context); - } - - @Override - public FileSystem getDefaultFileSystem() { - if (defaultFileSystem == null) - defaultFileSystem = FileSystems.getDefault(); - return defaultFileSystem; - } - - @Override - public void setDefaultFileSystem(FileSystem fs) { - defaultFileSystem = fs; - } - - @Override @DefinedBy(Api.COMPILER) - public void flush() throws IOException { - contentCache.clear(); - } - - @Override @DefinedBy(Api.COMPILER) - public void close() throws IOException { - for (FileSystem fs: fileSystems.values()) - fs.close(); - } - - @Override @DefinedBy(Api.COMPILER) - public ClassLoader getClassLoader(Location location) { - nullCheck(location); - Iterable path = getLocation(location); - if (path == null) - return null; - ListBuffer lb = new ListBuffer<>(); - for (Path p: path) { - try { - lb.append(p.toUri().toURL()); - } catch (MalformedURLException e) { - throw new AssertionError(e); - } - } - - return getClassLoader(lb.toArray(new URL[lb.size()])); - } - - // - - @DefinedBy(Api.COMPILER) - public boolean hasLocation(Location location) { - return (getLocation(location) != null); - } - - public Iterable getLocation(Location location) { - nullCheck(location); - lazyInitSearchPaths(); - PathsForLocation path = pathsForLocation.get(location); - if (path == null && !pathsForLocation.containsKey(location)) { - setDefaultForLocation(location); - path = pathsForLocation.get(location); - } - return path; - } - - private Path getOutputLocation(Location location) { - Iterable paths = getLocation(location); - return (paths == null ? null : paths.iterator().next()); - } - - public void setLocation(Location location, Iterable searchPath) - throws IOException - { - nullCheck(location); - lazyInitSearchPaths(); - if (searchPath == null) { - setDefaultForLocation(location); - } else { - if (location.isOutputLocation()) - checkOutputPath(searchPath); - PathsForLocation pl = new PathsForLocation(); - for (Path p: searchPath) - pl.add(p); // TODO -Xlint:path warn if path not found - pathsForLocation.put(location, pl); - } - } - - private void checkOutputPath(Iterable searchPath) throws IOException { - Iterator pathIter = searchPath.iterator(); - if (!pathIter.hasNext()) - throw new IllegalArgumentException("empty path for directory"); - Path path = pathIter.next(); - if (pathIter.hasNext()) - throw new IllegalArgumentException("path too long for directory"); - if (!isDirectory(path)) - throw new IOException(path + ": not a directory"); - } - - private void setDefaultForLocation(Location locn) { - Collection files = null; - if (locn instanceof StandardLocation) { - switch ((StandardLocation) locn) { - case CLASS_PATH: - files = locations.userClassPath(); - break; - case PLATFORM_CLASS_PATH: - files = locations.bootClassPath(); - break; - case SOURCE_PATH: - files = locations.sourcePath(); - break; - case CLASS_OUTPUT: { - String arg = options.get(D); - files = (arg == null ? null : Collections.singleton(Paths.get(arg))); - break; - } - case SOURCE_OUTPUT: { - String arg = options.get(S); - files = (arg == null ? null : Collections.singleton(Paths.get(arg))); - break; - } - } - } - - PathsForLocation pl = new PathsForLocation(); - if (files != null) { - for (Path f: files) - pl.add(f); - } - if (!pl.isEmpty()) - pathsForLocation.put(locn, pl); - } - - private void lazyInitSearchPaths() { - if (!inited) { - setDefaultForLocation(PLATFORM_CLASS_PATH); - setDefaultForLocation(CLASS_PATH); - setDefaultForLocation(SOURCE_PATH); - inited = true; - } - } - // where - private boolean inited = false; - - private Map pathsForLocation; - - private static class PathsForLocation extends LinkedHashSet { - private static final long serialVersionUID = 6788510222394486733L; - } - - // - - // - - @Override - public Path getPath(FileObject fo) { - nullCheck(fo); - if (!(fo instanceof PathFileObject)) - throw new IllegalArgumentException(); - return ((PathFileObject) fo).getPath(); - } - - @Override @DefinedBy(Api.COMPILER) - public boolean isSameFile(FileObject a, FileObject b) { - nullCheck(a); - nullCheck(b); - if (!(a instanceof PathFileObject)) - throw new IllegalArgumentException("Not supported: " + a); - if (!(b instanceof PathFileObject)) - throw new IllegalArgumentException("Not supported: " + b); - return ((PathFileObject) a).isSameFile((PathFileObject) b); - } - - @Override @DefinedBy(Api.COMPILER) - public Iterable list(Location location, - String packageName, Set kinds, boolean recurse) - throws IOException { - // validatePackageName(packageName); - nullCheck(packageName); - nullCheck(kinds); - - Iterable paths = getLocation(location); - if (paths == null) - return List.nil(); - ListBuffer results = new ListBuffer<>(); - - for (Path path : paths) - list(path, packageName, kinds, recurse, results); - - return results.toList(); - } - - private void list(Path path, String packageName, final Set kinds, - boolean recurse, final ListBuffer results) - throws IOException { - if (!Files.exists(path)) - return; - - final Path pathDir; - if (isDirectory(path)) - pathDir = path; - else { - FileSystem fs = getFileSystem(path); - if (fs == null) - return; - pathDir = fs.getRootDirectories().iterator().next(); - } - String sep = path.getFileSystem().getSeparator(); - Path packageDir = packageName.isEmpty() ? pathDir - : pathDir.resolve(packageName.replace(".", sep)); - if (!Files.exists(packageDir)) - return; - -/* Alternate impl of list, superceded by use of Files.walkFileTree */ -// Deque queue = new LinkedList(); -// queue.add(packageDir); -// -// Path dir; -// while ((dir = queue.poll()) != null) { -// DirectoryStream ds = dir.newDirectoryStream(); -// try { -// for (Path p: ds) { -// String name = p.getFileName().toString(); -// if (isDirectory(p)) { -// if (recurse && SourceVersion.isIdentifier(name)) { -// queue.add(p); -// } -// } else { -// if (kinds.contains(getKind(name))) { -// JavaFileObject fe = -// PathFileObject.createDirectoryPathFileObject(this, p, pathDir); -// results.append(fe); -// } -// } -// } -// } finally { -// ds.close(); -// } -// } - int maxDepth = (recurse ? Integer.MAX_VALUE : 1); - Set opts = EnumSet.of(FOLLOW_LINKS); - Files.walkFileTree(packageDir, opts, maxDepth, - new SimpleFileVisitor() { - @Override - public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { - Path name = dir.getFileName(); - if (name == null || SourceVersion.isIdentifier(name.toString())) - return FileVisitResult.CONTINUE; - else - return FileVisitResult.SKIP_SUBTREE; - } - - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { - if (attrs.isRegularFile() && kinds.contains(getKind(file.getFileName().toString()))) { - // WORKAROUND for .jimage files - if (!file.isAbsolute()) - file = pathDir.resolve(file); - JavaFileObject fe = - PathFileObject.createDirectoryPathFileObject( - JavacPathFileManager.this, file, pathDir); - results.append(fe); - } - return FileVisitResult.CONTINUE; - } - }); - } - - @Override - public Iterable getJavaFileObjectsFromPaths( - Iterable paths) { - ArrayList result; - if (paths instanceof Collection) - result = new ArrayList<>(((Collection)paths).size()); - else - result = new ArrayList<>(); - for (Path p: paths) - result.add(PathFileObject.createSimplePathFileObject(this, nullCheck(p))); - return result; - } - - @Override - public Iterable getJavaFileObjects(Path... paths) { - return getJavaFileObjectsFromPaths(Arrays.asList(nullCheck(paths))); - } - - @Override @DefinedBy(Api.COMPILER) - public JavaFileObject getJavaFileForInput(Location location, - String className, Kind kind) throws IOException { - return getFileForInput(location, getRelativePath(className, kind)); - } - - @Override @DefinedBy(Api.COMPILER) - public FileObject getFileForInput(Location location, - String packageName, String relativeName) throws IOException { - return getFileForInput(location, getRelativePath(packageName, relativeName)); - } - - private JavaFileObject getFileForInput(Location location, String relativePath) - throws IOException { - for (Path p: getLocation(location)) { - if (isDirectory(p)) { - Path f = resolve(p, relativePath); - if (Files.exists(f)) - return PathFileObject.createDirectoryPathFileObject(this, f, p); - } else { - FileSystem fs = getFileSystem(p); - if (fs != null) { - Path file = getPath(fs, relativePath); - if (Files.exists(file)) - return PathFileObject.createJarPathFileObject(this, file); - } - } - } - return null; - } - - @Override @DefinedBy(Api.COMPILER) - public JavaFileObject getJavaFileForOutput(Location location, - String className, Kind kind, FileObject sibling) throws IOException { - return getFileForOutput(location, getRelativePath(className, kind), sibling); - } - - @Override @DefinedBy(Api.COMPILER) - public FileObject getFileForOutput(Location location, String packageName, - String relativeName, FileObject sibling) - throws IOException { - return getFileForOutput(location, getRelativePath(packageName, relativeName), sibling); - } - - private JavaFileObject getFileForOutput(Location location, - String relativePath, FileObject sibling) { - Path dir = getOutputLocation(location); - if (dir == null) { - if (location == CLASS_OUTPUT) { - Path siblingDir = null; - if (sibling != null && sibling instanceof PathFileObject) { - siblingDir = ((PathFileObject) sibling).getPath().getParent(); - } - return PathFileObject.createSiblingPathFileObject(this, - siblingDir.resolve(getBaseName(relativePath)), - relativePath); - } else if (location == SOURCE_OUTPUT) { - dir = getOutputLocation(CLASS_OUTPUT); - } - } - - Path file; - if (dir != null) { - file = resolve(dir, relativePath); - return PathFileObject.createDirectoryPathFileObject(this, file, dir); - } else { - file = getPath(getDefaultFileSystem(), relativePath); - return PathFileObject.createSimplePathFileObject(this, file); - } - - } - - @Override @DefinedBy(Api.COMPILER) - public String inferBinaryName(Location location, JavaFileObject fo) { - nullCheck(fo); - // Need to match the path semantics of list(location, ...) - Iterable paths = getLocation(location); - if (paths == null) { - return null; - } - - if (!(fo instanceof PathFileObject)) - throw new IllegalArgumentException(fo.getClass().getName()); - - return ((PathFileObject) fo).inferBinaryName(paths); - } - - private FileSystem getFileSystem(Path p) throws IOException { - FileSystem fs = fileSystems.get(p); - if (fs == null) { - fs = FileSystems.newFileSystem(p, null); - fileSystems.put(p, fs); - } - return fs; - } - - private Map fileSystems; - - // - - // - - private static String getRelativePath(String className, Kind kind) { - return className.replace(".", "/") + kind.extension; - } - - private static String getRelativePath(String packageName, String relativeName) { - return packageName.isEmpty() - ? relativeName : packageName.replace(".", "/") + "/" + relativeName; - } - - private static String getBaseName(String relativePath) { - int lastSep = relativePath.lastIndexOf("/"); - return relativePath.substring(lastSep + 1); // safe if "/" not found - } - - private static boolean isDirectory(Path path) throws IOException { - BasicFileAttributes attrs = Files.readAttributes(path, BasicFileAttributes.class); - return attrs.isDirectory(); - } - - private static Path getPath(FileSystem fs, String relativePath) { - return fs.getPath(relativePath.replace("/", fs.getSeparator())); - } - - private static Path resolve(Path base, String relativePath) { - FileSystem fs = base.getFileSystem(); - Path rp = fs.getPath(relativePath.replace("/", fs.getSeparator())); - return base.resolve(rp); - } - - // - -} diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileManager.java deleted file mode 100644 index 762b8ed21fe..00000000000 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileManager.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javac.nio; - -import java.io.IOException; -import java.nio.file.FileSystem; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import javax.tools.FileObject; -import javax.tools.JavaFileManager; -import javax.tools.JavaFileObject; - -/** - * File manager based on {@link java.nio.file.Path}. - * - * Eventually, this should be moved to javax.tools. - * Also, JavaCompiler might reasonably provide a method getPathFileManager, - * similar to {@link javax.tools.JavaCompiler#getStandardFileManager - * getStandardFileManager}. However, would need to be handled carefully - * as another forward reference from langtools to jdk. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - */ -public interface PathFileManager extends JavaFileManager { - /** - * Get the default file system used to create paths. If no value has been - * set, the default file system is {@link FileSystems#getDefault}. - */ - FileSystem getDefaultFileSystem(); - - /** - * Set the default file system used to create paths. - * @param fs the default file system used to create any new paths. - */ - void setDefaultFileSystem(FileSystem fs); - - /** - * Get file objects representing the given files. - * - * @param paths a list of paths - * @return a list of file objects - * @throws IllegalArgumentException if the list of paths includes - * a directory - */ - Iterable getJavaFileObjectsFromPaths( - Iterable paths); - - /** - * Get file objects representing the given paths. - * Convenience method equivalent to: - * - *

-     *     getJavaFileObjectsFromPaths({@linkplain java.util.Arrays#asList Arrays.asList}(paths))
-     * 
- * - * @param paths an array of paths - * @return a list of file objects - * @throws IllegalArgumentException if the array of files includes - * a directory - * @throws NullPointerException if the given array contains null - * elements - */ - Iterable getJavaFileObjects(Path... paths); - - /** - * Return the Path for a file object that has been obtained from this - * file manager. - * - * @param fo A file object that has been obtained from this file manager. - * @return The underlying Path object. - * @throws IllegalArgumentException is the file object was not obtained from - * from this file manager. - */ - Path getPath(FileObject fo); - - /** - * Get the search path associated with the given location. - * - * @param location a location - * @return a list of paths or {@code null} if this location has no - * associated search path - * @see #setLocation - */ - Iterable getLocation(Location location); - - /** - * Associate the given search path with the given location. Any - * previous value will be discarded. - * - * @param location a location - * @param searchPath a list of files, if {@code null} use the default - * search path for this location - * @see #getLocation - * @throws IllegalArgumentException if location is an output - * location and searchpath does not contain exactly one element - * @throws IOException if location is an output location and searchpath - * does not represent an existing directory - */ - void setLocation(Location location, Iterable searchPath) throws IOException; -} diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java index af11b189914..db34c5cc5c9 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFileFactory.java @@ -56,17 +56,10 @@ abstract class DocFileFactory { DocFileFactory f = factories.get(configuration); if (f == null) { JavaFileManager fm = configuration.getFileManager(); - if (fm instanceof StandardJavaFileManager) + if (fm instanceof StandardJavaFileManager) { f = new StandardDocFileFactory(configuration); - else { - try { - Class pathFileManagerClass = - Class.forName("com.sun.tools.javac.nio.PathFileManager"); - if (pathFileManagerClass.isAssignableFrom(fm.getClass())) - f = new PathDocFileFactory(configuration); - } catch (Throwable t) { - throw new IllegalStateException(t); - } + } else { + throw new IllegalStateException(); } factories.put(configuration, f); } diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java deleted file mode 100644 index 8d208aa5fcf..00000000000 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.tools.doclets.internal.toolkit.util; - - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.nio.file.DirectoryStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import javax.tools.DocumentationTool; -import javax.tools.FileObject; -import javax.tools.JavaFileManager.Location; -import javax.tools.JavaFileObject; -import javax.tools.StandardLocation; - -import com.sun.tools.doclets.internal.toolkit.Configuration; -import com.sun.tools.javac.nio.PathFileManager; - - -/** - * Implementation of DocFileFactory using a {@link PathFileManager}. - * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - * - * @since 1.8 - */ -class PathDocFileFactory extends DocFileFactory { - private final PathFileManager fileManager; - private final Path destDir; - - public PathDocFileFactory(Configuration configuration) { - super(configuration); - fileManager = (PathFileManager) configuration.getFileManager(); - - if (!configuration.destDirName.isEmpty() - || !fileManager.hasLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT)) { - try { - String dirName = configuration.destDirName.isEmpty() ? "." : configuration.destDirName; - Path dir = fileManager.getDefaultFileSystem().getPath(dirName); - fileManager.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(dir)); - } catch (IOException e) { - throw new DocletAbortException(e); - } - } - - destDir = fileManager.getLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT).iterator().next(); - } - - public DocFile createFileForDirectory(String file) { - return new StandardDocFile(fileManager.getDefaultFileSystem().getPath(file)); - } - - public DocFile createFileForInput(String file) { - return new StandardDocFile(fileManager.getDefaultFileSystem().getPath(file)); - } - - public DocFile createFileForOutput(DocPath path) { - return new StandardDocFile(DocumentationTool.Location.DOCUMENTATION_OUTPUT, path); - } - - @Override - Iterable list(Location location, DocPath path) { - if (location != StandardLocation.SOURCE_PATH) - throw new IllegalArgumentException(); - - Set files = new LinkedHashSet<>(); - if (fileManager.hasLocation(location)) { - for (Path f: fileManager.getLocation(location)) { - if (Files.isDirectory(f)) { - f = f.resolve(path.getPath()); - if (Files.exists(f)) - files.add(new StandardDocFile(f)); - } - } - } - return files; - } - - class StandardDocFile extends DocFile { - private Path file; - - /** Create a StandardDocFile for a given file. */ - private StandardDocFile(Path file) { - super(configuration); - this.file = file; - } - - /** Create a StandardDocFile for a given location and relative path. */ - private StandardDocFile(Location location, DocPath path) { - super(configuration, location, path); - this.file = destDir.resolve(path.getPath()); - } - - /** Open an input stream for the file. */ - public InputStream openInputStream() throws IOException { - JavaFileObject fo = getJavaFileObjectForInput(file); - return new BufferedInputStream(fo.openInputStream()); - } - - /** - * Open an output stream for the file. - * The file must have been created with a location of - * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path. - */ - public OutputStream openOutputStream() throws IOException, UnsupportedEncodingException { - if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT) - throw new IllegalStateException(); - - OutputStream out = getFileObjectForOutput(path).openOutputStream(); - return new BufferedOutputStream(out); - } - - /** - * Open an writer for the file, using the encoding (if any) given in the - * doclet configuration. - * The file must have been created with a location of - * {@link DocumentationTool.Location#DOCUMENTATION_OUTPUT} and a corresponding relative path. - */ - public Writer openWriter() throws IOException, UnsupportedEncodingException { - if (location != DocumentationTool.Location.DOCUMENTATION_OUTPUT) - throw new IllegalStateException(); - - OutputStream out = getFileObjectForOutput(path).openOutputStream(); - if (configuration.docencoding == null) { - return new BufferedWriter(new OutputStreamWriter(out)); - } else { - return new BufferedWriter(new OutputStreamWriter(out, configuration.docencoding)); - } - } - - /** Return true if the file can be read. */ - public boolean canRead() { - return Files.isReadable(file); - } - - /** Return true if the file can be written. */ - public boolean canWrite() { - return Files.isWritable(file); - } - - /** Return true if the file exists. */ - public boolean exists() { - return Files.exists(file); - } - - /** Return the base name (last component) of the file name. */ - public String getName() { - return file.getFileName().toString(); - } - - /** Return the file system path for this file. */ - public String getPath() { - return file.toString(); - } - - /** Return true is file has an absolute path name. */ - public boolean isAbsolute() { - return file.isAbsolute(); - } - - /** Return true is file identifies a directory. */ - public boolean isDirectory() { - return Files.isDirectory(file); - } - - /** Return true is file identifies a file. */ - public boolean isFile() { - return Files.isRegularFile(file); - } - - /** Return true if this file is the same as another. */ - public boolean isSameFile(DocFile other) { - if (!(other instanceof StandardDocFile)) - return false; - - try { - return Files.isSameFile(file, ((StandardDocFile) other).file); - } catch (IOException e) { - return false; - } - } - - /** If the file is a directory, list its contents. */ - public Iterable list() throws IOException { - List files = new ArrayList<>(); - try (DirectoryStream ds = Files.newDirectoryStream(file)) { - for (Path f: ds) { - files.add(new StandardDocFile(f)); - } - } - return files; - } - - /** Create the file as a directory, including any parent directories. */ - public boolean mkdirs() { - try { - Files.createDirectories(file); - return true; - } catch (IOException e) { - return false; - } - } - - /** - * Derive a new file by resolving a relative path against this file. - * The new file will inherit the configuration and location of this file - * If this file has a path set, the new file will have a corresponding - * new path. - */ - public DocFile resolve(DocPath p) { - return resolve(p.getPath()); - } - - /** - * Derive a new file by resolving a relative path against this file. - * The new file will inherit the configuration and location of this file - * If this file has a path set, the new file will have a corresponding - * new path. - */ - public DocFile resolve(String p) { - if (location == null && path == null) { - return new StandardDocFile(file.resolve(p)); - } else { - return new StandardDocFile(location, path.resolve(p)); - } - } - - /** - * Resolve a relative file against the given output location. - * @param locn Currently, only - * {@link DocumentationTool.Location.DOCUMENTATION_OUTPUT} is supported. - */ - public DocFile resolveAgainst(Location locn) { - if (locn != DocumentationTool.Location.DOCUMENTATION_OUTPUT) - throw new IllegalArgumentException(); - return new StandardDocFile(destDir.resolve(file)); - } - - /** Return a string to identify the contents of this object, - * for debugging purposes. - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("PathDocFile["); - if (location != null) - sb.append("locn:").append(location).append(","); - if (path != null) - sb.append("path:").append(path.getPath()).append(","); - sb.append("file:").append(file); - sb.append("]"); - return sb.toString(); - } - - private JavaFileObject getJavaFileObjectForInput(Path file) { - return fileManager.getJavaFileObjects(file).iterator().next(); - } - - private FileObject getFileObjectForOutput(DocPath path) throws IOException { - // break the path into a package-part and the rest, by finding - // the position of the last '/' before an invalid character for a - // package name, such as the "." before an extension or the "-" - // in filenames like package-summary.html, doc-files or src-html. - String p = path.getPath(); - int lastSep = -1; - for (int i = 0; i < p.length(); i++) { - char ch = p.charAt(i); - if (ch == '/') { - lastSep = i; - } else if (i == lastSep + 1 && !Character.isJavaIdentifierStart(ch) - || !Character.isJavaIdentifierPart(ch)) { - break; - } - } - String pkg = (lastSep == -1) ? "" : p.substring(0, lastSep); - String rest = p.substring(lastSep + 1); - return fileManager.getFileForOutput(location, pkg, rest, null); - } - } - -} diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java index 7b8aa70ea27..0d893a634dd 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/Start.java @@ -42,7 +42,7 @@ import com.sun.javadoc.*; import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.main.CommandLine; import com.sun.tools.javac.main.Option; -import com.sun.tools.javac.util.BaseFileManager; +import com.sun.tools.javac.file.BaseFileManager; import com.sun.tools.javac.util.ClientCodeException; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.List; diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java index eb63a51473a..2aa5c1691dd 100644 --- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java +++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/api/JavadocTool.java @@ -46,7 +46,7 @@ import javax.tools.StandardJavaFileManager; import com.sun.tools.javac.api.ClientCodeWrapper; import com.sun.tools.javac.file.JavacFileManager; -import com.sun.tools.javac.util.BaseFileManager; +import com.sun.tools.javac.file.BaseFileManager; import com.sun.tools.javac.util.ClientCodeException; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.DefinedBy; diff --git a/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java b/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java index d5b34bd15a6..c86bdc56bbf 100644 --- a/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java +++ b/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java @@ -45,8 +45,6 @@ import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; import com.sun.tools.javac.file.JavacFileManager; -import com.sun.tools.javac.nio.JavacPathFileManager; -import com.sun.tools.javac.nio.PathFileManager; import com.sun.tools.javac.util.Context; /** @@ -59,7 +57,7 @@ public class GetTask_FileManagerTest extends APITest { /** * Verify that an alternate file manager can be specified: - * in this case, a PathFileManager. + * in this case, a TestFileManager. */ @Test public void testFileManager() throws Exception { From 44b017bd9098852e6b4f2d1b39c0db439ec44e05 Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Fri, 3 Apr 2015 19:09:34 +0530 Subject: [PATCH 061/101] 8076646: nashorn tests should avoid using package names used by nashorn sources Reviewed-by: hannesw --- nashorn/make/build.xml | 8 ++++---- nashorn/test/script/sandbox/interfaceimpl.js | 4 ++-- nashorn/test/script/trusted/JDK-8025629.js | 2 +- nashorn/test/src/META-INF/services/java.sql.Driver | 2 +- .../dynalink/beans/{ => test}/CallerSensitiveTest.java | 3 ++- .../api/javaaccess/{ => test}/ArrayConversionTest.java | 2 +- .../api/javaaccess/{ => test}/BooleanAccessTest.java | 2 +- .../nashorn/api/javaaccess/{ => test}/ConsStringTest.java | 2 +- .../api/javaaccess/{ => test}/MethodAccessTest.java | 2 +- .../api/javaaccess/{ => test}/NumberAccessTest.java | 2 +- .../api/javaaccess/{ => test}/NumberBoxingTest.java | 2 +- .../api/javaaccess/{ => test}/ObjectAccessTest.java | 2 +- .../src/jdk/nashorn/api/javaaccess/{ => test}/Person.java | 2 +- .../nashorn/api/javaaccess/{ => test}/SharedObject.java | 2 +- .../api/javaaccess/{ => test}/StringAccessTest.java | 2 +- .../nashorn/api/scripting/{ => test}/InvocableTest.java | 2 +- .../api/scripting/{ => test}/MultipleEngineTest.java | 2 +- .../api/scripting/{ => test}/PluggableJSObjectTest.java | 3 ++- .../jdk/nashorn/api/scripting/{ => test}/ScopeTest.java | 4 +++- .../scripting/{ => test}/ScriptEngineSecurityTest.java | 4 +++- .../api/scripting/{ => test}/ScriptEngineTest.java | 5 +++-- .../api/scripting/{ => test}/ScriptObjectMirrorTest.java | 4 +++- .../scripting/{ => test}/VariableArityTestInterface.java | 2 +- .../src/jdk/nashorn/api/scripting/{ => test}/Window.java | 4 +++- .../api/scripting/{ => test}/WindowEventHandler.java | 2 +- .../nashorn/api/scripting/{ => test}/resources/func.js | 0 .../api/scripting/{ => test}/resources/gettersetter.js | 0 .../api/scripting/{ => test}/resources/witheval.js | 0 .../src/jdk/nashorn/api/{ => test}/NashornSQLDriver.java | 2 +- .../src/jdk/nashorn/api/tree/{ => test}/ParseAPITest.java | 5 ++++- .../nashorn/internal/codegen/{ => test}/CompilerTest.java | 2 +- .../nashorn/internal/parser/{ => test}/ParserTest.java | 3 ++- .../internal/runtime/regexp/joni/{ => test}/JoniTest.java | 3 ++- .../internal/runtime/regexp/{ => test}/JdkRegExpTest.java | 5 ++++- .../internal/runtime/{ => test}/ClassFilterTest.java | 2 +- .../internal/runtime/{ => test}/CodeStoreAndPathTest.java | 2 +- .../internal/runtime/{ => test}/ConsStringTest.java | 3 ++- .../nashorn/internal/runtime/{ => test}/ContextTest.java | 8 +++++++- .../runtime/{ => test}/ExceptionsNotSerializable.java | 4 +++- .../nashorn/internal/runtime/{ => test}/JSTypeTest.java | 4 +++- .../internal/runtime/{ => test}/LexicalBindingTest.java | 2 +- .../runtime/{ => test}/NoPersistenceCachingTest.java | 2 +- .../nashorn/internal/runtime/{ => test}/SourceTest.java | 3 ++- .../runtime/{ => test}/TrustedScriptEngineTest.java | 3 ++- .../internal/runtime/{ => test}/resources/load_test.js | 0 45 files changed, 78 insertions(+), 46 deletions(-) rename nashorn/test/src/jdk/internal/dynalink/beans/{ => test}/CallerSensitiveTest.java (94%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/ArrayConversionTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/BooleanAccessTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/ConsStringTest.java (98%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/MethodAccessTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/NumberAccessTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/NumberBoxingTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/ObjectAccessTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/Person.java (97%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/SharedObject.java (99%) rename nashorn/test/src/jdk/nashorn/api/javaaccess/{ => test}/StringAccessTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/InvocableTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/MultipleEngineTest.java (98%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/PluggableJSObjectTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/ScopeTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/ScriptEngineSecurityTest.java (98%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/ScriptEngineTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/ScriptObjectMirrorTest.java (99%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/VariableArityTestInterface.java (97%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/Window.java (95%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/WindowEventHandler.java (97%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/resources/func.js (100%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/resources/gettersetter.js (100%) rename nashorn/test/src/jdk/nashorn/api/scripting/{ => test}/resources/witheval.js (100%) rename nashorn/test/src/jdk/nashorn/api/{ => test}/NashornSQLDriver.java (98%) rename nashorn/test/src/jdk/nashorn/api/tree/{ => test}/ParseAPITest.java (97%) rename nashorn/test/src/jdk/nashorn/internal/codegen/{ => test}/CompilerTest.java (99%) rename nashorn/test/src/jdk/nashorn/internal/parser/{ => test}/ParserTest.java (98%) rename nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/{ => test}/JoniTest.java (95%) rename nashorn/test/src/jdk/nashorn/internal/runtime/regexp/{ => test}/JdkRegExpTest.java (91%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/ClassFilterTest.java (99%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/CodeStoreAndPathTest.java (99%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/ConsStringTest.java (98%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/ContextTest.java (94%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/ExceptionsNotSerializable.java (94%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/JSTypeTest.java (98%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/LexicalBindingTest.java (99%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/NoPersistenceCachingTest.java (99%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/SourceTest.java (98%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/TrustedScriptEngineTest.java (99%) rename nashorn/test/src/jdk/nashorn/internal/runtime/{ => test}/resources/load_test.js (100%) diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml index bd85a06aba9..bd87590d69c 100644 --- a/nashorn/make/build.xml +++ b/nashorn/make/build.xml @@ -281,12 +281,12 @@ - - + + - - + + diff --git a/nashorn/test/script/sandbox/interfaceimpl.js b/nashorn/test/script/sandbox/interfaceimpl.js index 0745318c816..17745fc9bb9 100644 --- a/nashorn/test/script/sandbox/interfaceimpl.js +++ b/nashorn/test/script/sandbox/interfaceimpl.js @@ -29,8 +29,8 @@ * @security */ -var Window = Java.type("jdk.nashorn.api.scripting.Window"); -var WindowEventHandler = Java.type("jdk.nashorn.api.scripting.WindowEventHandler"); +var Window = Java.type("jdk.nashorn.api.scripting.test.Window"); +var WindowEventHandler = Java.type("jdk.nashorn.api.scripting.test.WindowEventHandler"); var w = new Window(); diff --git a/nashorn/test/script/trusted/JDK-8025629.js b/nashorn/test/script/trusted/JDK-8025629.js index 609cfe8b84a..f3f4cbad42b 100644 --- a/nashorn/test/script/trusted/JDK-8025629.js +++ b/nashorn/test/script/trusted/JDK-8025629.js @@ -28,6 +28,6 @@ * @run */ -load("classpath:jdk/nashorn/internal/runtime/resources/load_test.js") +load("classpath:jdk/nashorn/internal/runtime/test/resources/load_test.js") Assert.assertEquals(loadedFunc("hello"), "HELLO"); diff --git a/nashorn/test/src/META-INF/services/java.sql.Driver b/nashorn/test/src/META-INF/services/java.sql.Driver index 295fe48075f..d1bb7d3328d 100644 --- a/nashorn/test/src/META-INF/services/java.sql.Driver +++ b/nashorn/test/src/META-INF/services/java.sql.Driver @@ -1 +1 @@ -jdk.nashorn.api.NashornSQLDriver +jdk.nashorn.api.test.NashornSQLDriver diff --git a/nashorn/test/src/jdk/internal/dynalink/beans/CallerSensitiveTest.java b/nashorn/test/src/jdk/internal/dynalink/beans/test/CallerSensitiveTest.java similarity index 94% rename from nashorn/test/src/jdk/internal/dynalink/beans/CallerSensitiveTest.java rename to nashorn/test/src/jdk/internal/dynalink/beans/test/CallerSensitiveTest.java index d9a44551741..2a6b746e485 100644 --- a/nashorn/test/src/jdk/internal/dynalink/beans/CallerSensitiveTest.java +++ b/nashorn/test/src/jdk/internal/dynalink/beans/test/CallerSensitiveTest.java @@ -23,8 +23,9 @@ * questions. */ -package jdk.internal.dynalink.beans; +package jdk.internal.dynalink.beans.test; +import jdk.internal.dynalink.beans.BeansLinker; import jdk.nashorn.test.models.ClassLoaderAware; import org.testng.annotations.Test; diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ArrayConversionTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/ArrayConversionTest.java index 1da767b77e5..a7a17a2c224 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ArrayConversionTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java index 234484f720f..f460927f05c 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ConsStringTest.java similarity index 98% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/ConsStringTest.java index 2b12b04628c..db8794b19d8 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ConsStringTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; import static org.testng.AssertJUnit.assertEquals; import java.util.HashMap; diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java index 8bac7e6a864..91487a8819c 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java index fd4ab9da4e3..ffe7db32a31 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java index 40db6845fa9..fb9aa6a0933 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java index 00798a4efa3..fdecf257fde 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; import static org.testng.AssertJUnit.assertEquals; import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/Person.java similarity index 97% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/Person.java index 32b1c9b795b..3e563b1113a 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/Person.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; @SuppressWarnings("javadoc") public class Person { diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/SharedObject.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/SharedObject.java index 93c93e19f70..3c41ac101b2 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/SharedObject.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; import javax.script.Invocable; import javax.script.ScriptEngine; diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java rename to nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java index 1e0a96aaf9c..8ec43e63d39 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.javaaccess; +package jdk.nashorn.api.javaaccess.test; import static org.testng.AssertJUnit.assertEquals; import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals; diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/InvocableTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/InvocableTest.java index 4e44a296983..bba4ce50240 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/InvocableTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java similarity index 98% rename from nashorn/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java index 218deff1e89..1dd6908e089 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/PluggableJSObjectTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/PluggableJSObjectTest.java index d6b9dcde1e5..0d9dc4d6cff 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/PluggableJSObjectTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; @@ -36,6 +36,7 @@ import java.util.LinkedHashMap; import java.util.Set; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; +import jdk.nashorn.api.scripting.AbstractJSObject; import org.testng.annotations.Test; /** diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScopeTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/ScopeTest.java index f3e613b4474..6bc0c3bfd1f 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScopeTest.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; @@ -35,6 +35,8 @@ import javax.script.ScriptEngineManager; import javax.script.ScriptException; import javax.script.SimpleBindings; import javax.script.SimpleScriptContext; +import jdk.nashorn.api.scripting.ScriptObjectMirror; +import jdk.nashorn.api.scripting.URLReader; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java similarity index 98% rename from nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java index 06b89e83b19..dfebd44d60a 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; import static org.testng.Assert.fail; import java.lang.reflect.InvocationHandler; @@ -32,6 +32,8 @@ import java.lang.reflect.Proxy; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; +import jdk.nashorn.api.scripting.ClassFilter; +import jdk.nashorn.api.scripting.NashornScriptEngineFactory; import org.testng.annotations.Test; /** diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java index 1c412c688bc..258c6bc6beb 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; @@ -51,6 +51,7 @@ import javax.script.ScriptEngineFactory; import javax.script.ScriptEngineManager; import javax.script.ScriptException; import javax.script.SimpleScriptContext; +import jdk.nashorn.api.scripting.ScriptObjectMirror; import org.testng.annotations.Test; /** @@ -541,7 +542,7 @@ public class ScriptEngineTest { final ScriptEngineManager m = new ScriptEngineManager(); final ScriptEngine e = m.getEngineByName("nashorn"); e.eval("obj = { foo: 'hello' }"); - e.put("Window", e.eval("Packages.jdk.nashorn.api.scripting.Window")); + e.put("Window", e.eval("Packages.jdk.nashorn.api.scripting.test.Window")); assertEquals(e.eval("Window.funcJSObject(obj)"), "hello"); assertEquals(e.eval("Window.funcScriptObjectMirror(obj)"), "hello"); assertEquals(e.eval("Window.funcMap(obj)"), "hello"); diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptObjectMirrorTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptObjectMirrorTest.java index ce3b421ce50..f9c78fc7abf 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptObjectMirrorTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; @@ -41,6 +41,8 @@ import javax.script.ScriptContext; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; +import jdk.nashorn.api.scripting.JSObject; +import jdk.nashorn.api.scripting.ScriptObjectMirror; import org.testng.annotations.Test; /** diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/VariableArityTestInterface.java similarity index 97% rename from nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/VariableArityTestInterface.java index 8ce5e4902af..7761a3d6e4a 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/VariableArityTestInterface.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; @SuppressWarnings("javadoc") public interface VariableArityTestInterface { diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/Window.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/Window.java similarity index 95% rename from nashorn/test/src/jdk/nashorn/api/scripting/Window.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/Window.java index 7a7476f5e86..6c60b163b7f 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/Window.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/Window.java @@ -23,10 +23,12 @@ * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; import java.util.Map; import javax.script.Bindings; +import jdk.nashorn.api.scripting.JSObject; +import jdk.nashorn.api.scripting.ScriptObjectMirror; @SuppressWarnings("javadoc") public class Window { diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/WindowEventHandler.java similarity index 97% rename from nashorn/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java rename to nashorn/test/src/jdk/nashorn/api/scripting/test/WindowEventHandler.java index dfcad5a9ff8..ddc879c89f2 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/WindowEventHandler.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api.scripting; +package jdk.nashorn.api.scripting.test; @SuppressWarnings("javadoc") public interface WindowEventHandler { diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/resources/func.js b/nashorn/test/src/jdk/nashorn/api/scripting/test/resources/func.js similarity index 100% rename from nashorn/test/src/jdk/nashorn/api/scripting/resources/func.js rename to nashorn/test/src/jdk/nashorn/api/scripting/test/resources/func.js diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/resources/gettersetter.js b/nashorn/test/src/jdk/nashorn/api/scripting/test/resources/gettersetter.js similarity index 100% rename from nashorn/test/src/jdk/nashorn/api/scripting/resources/gettersetter.js rename to nashorn/test/src/jdk/nashorn/api/scripting/test/resources/gettersetter.js diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/resources/witheval.js b/nashorn/test/src/jdk/nashorn/api/scripting/test/resources/witheval.js similarity index 100% rename from nashorn/test/src/jdk/nashorn/api/scripting/resources/witheval.js rename to nashorn/test/src/jdk/nashorn/api/scripting/test/resources/witheval.js diff --git a/nashorn/test/src/jdk/nashorn/api/NashornSQLDriver.java b/nashorn/test/src/jdk/nashorn/api/test/NashornSQLDriver.java similarity index 98% rename from nashorn/test/src/jdk/nashorn/api/NashornSQLDriver.java rename to nashorn/test/src/jdk/nashorn/api/test/NashornSQLDriver.java index dd624096d37..d1a5377f747 100644 --- a/nashorn/test/src/jdk/nashorn/api/NashornSQLDriver.java +++ b/nashorn/test/src/jdk/nashorn/api/test/NashornSQLDriver.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.api; +package jdk.nashorn.api.test; import java.sql.Connection; import java.sql.Driver; diff --git a/nashorn/test/src/jdk/nashorn/api/tree/ParseAPITest.java b/nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java similarity index 97% rename from nashorn/test/src/jdk/nashorn/api/tree/ParseAPITest.java rename to nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java index e198512953a..00504d93cd6 100644 --- a/nashorn/test/src/jdk/nashorn/api/tree/ParseAPITest.java +++ b/nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java @@ -22,13 +22,16 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.nashorn.api.tree; +package jdk.nashorn.api.tree.test; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import jdk.nashorn.api.tree.Parser; +import jdk.nashorn.api.tree.SimpleTreeVisitorES5_1; +import jdk.nashorn.api.tree.Tree; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java b/nashorn/test/src/jdk/nashorn/internal/codegen/test/CompilerTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java rename to nashorn/test/src/jdk/nashorn/internal/codegen/test/CompilerTest.java index 0c67af89192..a6e86feaceb 100644 --- a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/codegen/test/CompilerTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.internal.codegen; +package jdk.nashorn.internal.codegen.test; import static jdk.nashorn.internal.runtime.Source.readFully; import static jdk.nashorn.internal.runtime.Source.sourceFor; diff --git a/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java b/nashorn/test/src/jdk/nashorn/internal/parser/test/ParserTest.java similarity index 98% rename from nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java rename to nashorn/test/src/jdk/nashorn/internal/parser/test/ParserTest.java index 24d507a786c..17259cc9682 100644 --- a/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/parser/test/ParserTest.java @@ -23,11 +23,12 @@ * questions. */ -package jdk.nashorn.internal.parser; +package jdk.nashorn.internal.parser.test; import static jdk.nashorn.internal.runtime.Source.readFully; import static jdk.nashorn.internal.runtime.Source.sourceFor; import java.io.File; +import jdk.nashorn.internal.parser.Parser; import jdk.nashorn.internal.runtime.Context; import jdk.nashorn.internal.runtime.ErrorManager; import jdk.nashorn.internal.runtime.Source; diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java similarity index 95% rename from nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java index 616f769f949..a208d02cb82 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java @@ -23,8 +23,9 @@ * questions. */ -package jdk.nashorn.internal.runtime.regexp.joni; +package jdk.nashorn.internal.runtime.regexp.joni.test; +import jdk.nashorn.internal.runtime.regexp.joni.Regex; import org.testng.annotations.Test; /** diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/JdkRegExpTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java similarity index 91% rename from nashorn/test/src/jdk/nashorn/internal/runtime/regexp/JdkRegExpTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java index 8156b7864fa..87a27d00023 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/JdkRegExpTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java @@ -23,8 +23,11 @@ * questions. */ -package jdk.nashorn.internal.runtime.regexp; +package jdk.nashorn.internal.runtime.regexp.test; +import jdk.nashorn.internal.runtime.regexp.RegExp; +import jdk.nashorn.internal.runtime.regexp.RegExpFactory; +import jdk.nashorn.internal.runtime.regexp.RegExpMatcher; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ClassFilterTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/ClassFilterTest.java index 5c69141dfc1..7f535405663 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ClassFilterTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; import static org.testng.Assert.fail; import java.io.File; diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java index 2ca4820be7b..1d10d81d571 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/ConsStringTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java similarity index 98% rename from nashorn/test/src/jdk/nashorn/internal/runtime/ConsStringTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java index 16c360686bf..161a2123415 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/ConsStringTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java @@ -23,8 +23,9 @@ * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; +import jdk.nashorn.internal.runtime.ConsString; import static org.testng.Assert.assertEquals; import org.testng.annotations.Test; diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java similarity index 94% rename from nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java index 6770d7ec3e7..fbe20d88a98 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; import static jdk.nashorn.internal.runtime.Source.sourceFor; import static org.testng.Assert.assertEquals; @@ -31,6 +31,12 @@ import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; import java.util.Map; import jdk.nashorn.internal.objects.Global; +import jdk.nashorn.internal.runtime.Context; +import jdk.nashorn.internal.runtime.ErrorManager; +import jdk.nashorn.internal.runtime.ScriptFunction; +import jdk.nashorn.internal.runtime.ScriptObject; +import jdk.nashorn.internal.runtime.ScriptRuntime; +import jdk.nashorn.internal.runtime.Source; import jdk.nashorn.internal.runtime.options.Options; import org.testng.annotations.Test; diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java similarity index 94% rename from nashorn/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java index 3b6d91b25d6..1c80bdeb36b 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; @@ -34,6 +34,8 @@ import java.io.ObjectOutputStream; import javax.script.ScriptEngine; import javax.script.ScriptException; import jdk.nashorn.api.scripting.NashornScriptEngineFactory; +import jdk.nashorn.internal.runtime.RewriteException; +import jdk.nashorn.internal.runtime.UnwarrantedOptimismException; import org.testng.annotations.Test; /** diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/JSTypeTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java similarity index 98% rename from nashorn/test/src/jdk/nashorn/internal/runtime/JSTypeTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java index 406ce1c3ed3..71f818ccf61 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/JSTypeTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java @@ -23,8 +23,10 @@ * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; +import jdk.nashorn.internal.runtime.JSType; +import jdk.nashorn.internal.runtime.ScriptRuntime; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/LexicalBindingTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/internal/runtime/LexicalBindingTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java index 2cd0bf01ee1..eb68232cdaf 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/LexicalBindingTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; import jdk.nashorn.api.scripting.NashornScriptEngineFactory; import org.testng.annotations.Test; diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java index 91f19606771..0872448106e 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; import static org.testng.Assert.fail; import java.io.ByteArrayOutputStream; diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/SourceTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java similarity index 98% rename from nashorn/test/src/jdk/nashorn/internal/runtime/SourceTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java index 12645c05896..d62b2f47ba6 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/SourceTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; import static jdk.nashorn.internal.runtime.Source.sourceFor; import static org.testng.Assert.assertEquals; @@ -36,6 +36,7 @@ import java.io.Reader; import java.net.URL; import java.util.Arrays; import jdk.nashorn.api.scripting.URLReader; +import jdk.nashorn.internal.runtime.Source; import org.testng.annotations.Test; /** diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/TrustedScriptEngineTest.java similarity index 99% rename from nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/TrustedScriptEngineTest.java index 09c90dc6f8c..416a204bdc3 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/TrustedScriptEngineTest.java @@ -23,7 +23,7 @@ * questions. */ -package jdk.nashorn.internal.runtime; +package jdk.nashorn.internal.runtime.test; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; @@ -36,6 +36,7 @@ import javax.script.ScriptException; import javax.script.SimpleScriptContext; import jdk.nashorn.api.scripting.ClassFilter; import jdk.nashorn.api.scripting.NashornScriptEngineFactory; +import jdk.nashorn.internal.runtime.Version; import org.testng.annotations.Test; /** diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/resources/load_test.js b/nashorn/test/src/jdk/nashorn/internal/runtime/test/resources/load_test.js similarity index 100% rename from nashorn/test/src/jdk/nashorn/internal/runtime/resources/load_test.js rename to nashorn/test/src/jdk/nashorn/internal/runtime/test/resources/load_test.js From 4b07750bb17f6fb41ec1ade04dd5196ece9b3a49 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 3 Apr 2015 15:23:02 -0700 Subject: [PATCH 062/101] 8076583: move jdk.Exported from langtools to jdk Reviewed-by: darcy, alanb, tbell, mchung, jlahoda --- langtools/make/CompileInterim.gmk | 1 - langtools/make/build.properties | 11 ++- langtools/make/build.xml | 4 - langtools/make/intellij/langtools.iml | 2 - langtools/make/intellij/workspace.xml | 12 +-- .../netbeans/langtools/nbproject/project.xml | 60 +------------- .../java.base/share/classes/jdk/Exported.java | 80 ------------------- 7 files changed, 14 insertions(+), 156 deletions(-) delete mode 100644 langtools/src/java.base/share/classes/jdk/Exported.java diff --git a/langtools/make/CompileInterim.gmk b/langtools/make/CompileInterim.gmk index d3c78279b2a..c957a904978 100644 --- a/langtools/make/CompileInterim.gmk +++ b/langtools/make/CompileInterim.gmk @@ -43,7 +43,6 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_LANGTOOLS, \ $(LANGTOOLS_TOPDIR)/src/jdk.compiler/share/classes \ $(LANGTOOLS_TOPDIR)/src/jdk.dev/share/classes \ $(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/classes \ - $(LANGTOOLS_TOPDIR)/src/java.base/share/classes \ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.compiler \ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.dev \ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.javadoc, \ diff --git a/langtools/make/build.properties b/langtools/make/build.properties index 2a12dbec711..dd902e0ad9e 100644 --- a/langtools/make/build.properties +++ b/langtools/make/build.properties @@ -47,12 +47,11 @@ boot.javac.source = 8 boot.javac.target = 8 #configuration of submodules (share by both the bootstrap and normal compilation): -langtools.modules=java.base:java.compiler:jdk.compiler:jdk.dev:jdk.javadoc -java.base.dependencies= -java.compiler.dependencies=java.base -jdk.compiler.dependencies=java.base:java.compiler -jdk.javadoc.dependencies=java.base:java.compiler:jdk.compiler -jdk.dev.dependencies=java.base:java.compiler:jdk.compiler +langtools.modules=java.compiler:jdk.compiler:jdk.dev:jdk.javadoc +java.compiler.dependencies= +jdk.compiler.dependencies=java.compiler +jdk.javadoc.dependencies=java.compiler:jdk.compiler +jdk.dev.dependencies=java.compiler:jdk.compiler javac.resource.includes = \ com/sun/tools/javac/resources/compiler.properties diff --git a/langtools/make/build.xml b/langtools/make/build.xml index bdaae283bde..e88cf9e76c4 100644 --- a/langtools/make/build.xml +++ b/langtools/make/build.xml @@ -254,7 +254,6 @@ warningsProperty="findbugs.all.warnings" jvm="${target.java.home}/bin/java" jvmargs="-Xmx512M"> - @@ -461,7 +460,6 @@ - @@ -522,8 +520,6 @@ - - - diff --git a/langtools/make/intellij/workspace.xml b/langtools/make/intellij/workspace.xml index bff7ec024c2..135f05a0fd3 100644 --- a/langtools/make/intellij/workspace.xml +++ b/langtools/make/intellij/workspace.xml @@ -10,7 +10,7 @@

If in one release a type or package is - * @Exported(true), in a subsequent major release such a - * type or package can transition to @Exported(false). - * - *

If a type or package is @Exported(false) in a - * release, it may be removed in a subsequent major release. - * - *

If a top-level type has an @Exported annotation, - * any nested member types with the top-level type should have an - * @Exported annotation with the same value. - * - * (In exceptional cases, if a nested type is going to be removed - * before its enclosing type, the nested type's could be - * @Exported(false) while its enclosing type was - * @Exported(true).) - * - * Likewise, if a package has an @Exported annotation, - * top-level types within that package should also have an - * @Exported annotation. - * - * Sometimes a top-level type may have a different - * @Exported value than its package. - * - * @since 1.8 - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE, ElementType.PACKAGE}) -@Exported -public @interface Exported { - /** - * Whether or not the annotated type or package is an exported - * part of the JDK. - * @return whether or not the annotated type or package is an exported - * part of the JDK - */ - boolean value() default true; -} From fcb7a559234c7a2cef3e0f774786d0a2ea05ff8c Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Tue, 7 Apr 2015 00:13:18 +0530 Subject: [PATCH 063/101] 8076972: Several nashorn tests failing Reviewed-by: lagergren, jlaskey --- nashorn/make/build.xml | 16 ++++++++-------- .../api/javaaccess/test/BooleanAccessTest.java | 6 +++--- .../api/javaaccess/test/MethodAccessTest.java | 12 ++++++------ .../api/javaaccess/test/NumberAccessTest.java | 6 +++--- .../api/javaaccess/test/NumberBoxingTest.java | 6 +++--- .../api/javaaccess/test/ObjectAccessTest.java | 16 ++++++++-------- .../api/javaaccess/test/StringAccessTest.java | 6 +++--- .../api/scripting/test/MultipleEngineTest.java | 2 +- .../api/scripting/test/ScriptEngineTest.java | 4 ++-- .../runtime/regexp/joni/test/JoniTest.java | 2 +- .../runtime/regexp/test/JdkRegExpTest.java | 2 +- .../runtime/test/CodeStoreAndPathTest.java | 3 ++- .../internal/runtime/test/ConsStringTest.java | 2 +- .../internal/runtime/test/ContextTest.java | 2 +- .../runtime/test/ExceptionsNotSerializable.java | 2 +- .../internal/runtime/test/JSTypeTest.java | 2 +- .../runtime/test/LexicalBindingTest.java | 2 +- .../runtime/test/NoPersistenceCachingTest.java | 2 +- .../internal/runtime/test/SourceTest.java | 2 +- 19 files changed, 48 insertions(+), 47 deletions(-) diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml index bd87590d69c..df478ee1fb5 100644 --- a/nashorn/make/build.xml +++ b/nashorn/make/build.xml @@ -402,14 +402,14 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" { - - - - - - - - + + + + + + + + diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java index f460927f05c..80304198700 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java @@ -38,8 +38,8 @@ import org.testng.annotations.Test; /** * @test - * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest - * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest + * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.BooleanAccessTest + * @run testng/othervm jdk.nashorn.api.javaaccess.test.BooleanAccessTest */ @SuppressWarnings("javadoc") public class BooleanAccessTest { @@ -57,7 +57,7 @@ public class BooleanAccessTest { e = m.getEngineByName("nashorn"); o = new SharedObject(); e.put("o", o); - e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;"); + e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;"); } @AfterClass diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java index 91487a8819c..ba3460da6cc 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java @@ -41,8 +41,8 @@ import org.testng.annotations.Test; /** * @test - * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest - * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest + * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.MethodAccessTest + * @run testng/othervm jdk.nashorn.api.javaaccess.test.MethodAccessTest */ @SuppressWarnings("javadoc") public class MethodAccessTest { @@ -61,8 +61,8 @@ public class MethodAccessTest { o = new SharedObject(); o.setEngine(e); e.put("o", o); - e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;"); - e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.Person;"); + e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;"); + e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.test.Person;"); } @AfterClass @@ -338,13 +338,13 @@ public class MethodAccessTest { @Test public void accessDefaultConstructor() throws ScriptException { - e.eval("var dc = new Packages.jdk.nashorn.api.javaaccess.Person()"); + e.eval("var dc = new Packages.jdk.nashorn.api.javaaccess.test.Person()"); assertEquals(new Person(), e.get("dc")); } @Test public void accessCustomConstructor() throws ScriptException { - e.eval("var cc = new Packages.jdk.nashorn.api.javaaccess.Person(17)"); + e.eval("var cc = new Packages.jdk.nashorn.api.javaaccess.test.Person(17)"); assertEquals(new Person(17), e.get("cc")); } diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java index ffe7db32a31..882ed069421 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java @@ -38,8 +38,8 @@ import org.testng.annotations.Test; /** * @test - * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest - * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest + * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.NumberAccessTest + * @run testng/othervm jdk.nashorn.api.javaaccess.test.NumberAccessTest */ @SuppressWarnings("javadoc") public class NumberAccessTest { @@ -57,7 +57,7 @@ public class NumberAccessTest { e = m.getEngineByName("nashorn"); o = new SharedObject(); e.put("o", o); - e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;"); + e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;"); } @AfterClass diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java index fb9aa6a0933..9d5a2f7a2d6 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java @@ -37,8 +37,8 @@ import org.testng.annotations.Test; /** * @test - * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest - * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest + * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.NumberBoxingTest + * @run testng/othervm jdk.nashorn.api.javaaccess.test.NumberBoxingTest */ @SuppressWarnings("javadoc") public class NumberBoxingTest { @@ -56,7 +56,7 @@ public class NumberBoxingTest { e = m.getEngineByName("nashorn"); o = new SharedObject(); e.put("o", o); - e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;"); + e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;"); } @AfterClass diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java index fdecf257fde..80a325e4ce0 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java @@ -37,8 +37,8 @@ import org.testng.annotations.Test; /** * @test - * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest - * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest + * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.ObjectAccessTest + * @run testng/othervm jdk.nashorn.api.javaaccess.test.ObjectAccessTest */ @SuppressWarnings("javadoc") public class ObjectAccessTest { @@ -56,8 +56,8 @@ public class ObjectAccessTest { e = m.getEngineByName("nashorn"); o = new SharedObject(); e.put("o", o); - e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;"); - e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.Person;"); + e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;"); + e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.test.Person;"); } @AfterClass @@ -80,7 +80,7 @@ public class ObjectAccessTest { e.eval("var p_object_array = o.publicObjectArray;"); assertEquals(o.publicObjectArray[0], e.eval("o.publicObjectArray[0]")); assertArrayEquals(o.publicObjectArray, (Object[])e.get("p_object_array")); - e.eval("var t_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" + + e.eval("var t_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.test.Person[]\"))(3);" + "t_object_arr[0] = new Person(100);" + "t_object_arr[1] = new Person(120);" + "t_object_arr[2] = new Person(140);" + @@ -104,7 +104,7 @@ public class ObjectAccessTest { e.eval("var ps_object_array = SharedObject.publicStaticObjectArray;"); assertEquals(SharedObject.publicStaticObjectArray[0], e.eval("SharedObject.publicStaticObjectArray[0]")); assertArrayEquals(SharedObject.publicStaticObjectArray, (Object[])e.get("ps_object_array")); - e.eval("var ts_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" + + e.eval("var ts_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.test.Person[]\"))(3);" + "ts_object_arr[0] = new Person(100);" + "ts_object_arr[1] = new Person(120);" + "ts_object_arr[2] = new Person(140);" + @@ -128,7 +128,7 @@ public class ObjectAccessTest { e.eval("var pf_object_array = o.publicFinalObjectArray;"); assertEquals(o.publicFinalObjectArray[0], e.eval("o.publicFinalObjectArray[0]")); assertArrayEquals(o.publicFinalObjectArray, (Object[])e.get("pf_object_array")); - e.eval("var tf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" + + e.eval("var tf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.test.Person[]\"))(3);" + "tf_object_arr[0] = new Person(100);" + "tf_object_arr[1] = new Person(120);" + "tf_object_arr[2] = new Person(140);" + @@ -152,7 +152,7 @@ public class ObjectAccessTest { e.eval("var psf_object_array = SharedObject.publicStaticFinalObjectArray;"); assertEquals(SharedObject.publicStaticFinalObjectArray[0], e.eval("SharedObject.publicStaticFinalObjectArray[0]")); assertArrayEquals(SharedObject.publicStaticFinalObjectArray, (Object[])e.get("psf_object_array")); - e.eval("var tsf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" + + e.eval("var tsf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.test.Person[]\"))(3);" + "tsf_object_arr[0] = new Person(100);" + "tsf_object_arr[1] = new Person(120);" + "tsf_object_arr[2] = new Person(140);" + diff --git a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java index 8ec43e63d39..909ddb48a4b 100644 --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java @@ -37,8 +37,8 @@ import org.testng.annotations.Test; /** * @test - * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest - * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest + * @build jdk.nashorn.api.javaaccess.test.SharedObject jdk.nashorn.api.javaaccess.test.Person jdk.nashorn.api.javaaccess.test.StringAccessTest + * @run testng/othervm jdk.nashorn.api.javaaccess.test.StringAccessTest */ @SuppressWarnings("javadoc") public class StringAccessTest { @@ -56,7 +56,7 @@ public class StringAccessTest { e = m.getEngineByName("nashorn"); o = new SharedObject(); e.put("o", o); - e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;"); + e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.test.SharedObject;"); } @AfterClass diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java index 1dd6908e089..76982faef8a 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java @@ -35,7 +35,7 @@ import org.testng.annotations.Test; * independently. * * @test - * @run testng jdk.nashorn.api.scripting.MultipleEngineTest + * @run testng jdk.nashorn.api.scripting.test.MultipleEngineTest */ @SuppressWarnings("javadoc") public class MultipleEngineTest { diff --git a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java index 258c6bc6beb..3b683e2d24b 100644 --- a/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java +++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java @@ -58,8 +58,8 @@ import org.testng.annotations.Test; * Tests for JSR-223 script engine for Nashorn. * * @test - * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.VariableArityTestInterface jdk.nashorn.api.scripting.ScriptEngineTest - * @run testng/othervm jdk.nashorn.api.scripting.ScriptEngineTest + * @build jdk.nashorn.api.scripting.test.Window jdk.nashorn.api.scripting.test.WindowEventHandler jdk.nashorn.api.scripting.test.VariableArityTestInterface jdk.nashorn.api.scripting.test.ScriptEngineTest + * @run testng/othervm jdk.nashorn.api.scripting.test.ScriptEngineTest */ @SuppressWarnings("javadoc") public class ScriptEngineTest { diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java index a208d02cb82..a907f8f1989 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java @@ -32,7 +32,7 @@ import org.testng.annotations.Test; * Joni coverage tests * * @test - * @run testng jdk.nashorn.internal.runtime.regexp.joni.JoniTest + * @run testng jdk.nashorn.internal.runtime.regexp.joni.test.JoniTest */ @SuppressWarnings("javadoc") public class JoniTest { diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java index 87a27d00023..20cb36722f0 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java @@ -38,7 +38,7 @@ import org.testng.annotations.Test; * Basic tests for the JDK based RegExp implementation. * * @test - * @run testng jdk.nashorn.internal.runtime.regexp.JdkRegExpTest + * @run testng jdk.nashorn.internal.runtime.regexp.test.JdkRegExpTest */ public class JdkRegExpTest { diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java index 1d10d81d571..31342ce292d 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java @@ -38,10 +38,11 @@ import jdk.nashorn.api.scripting.NashornScriptEngineFactory; import org.testng.annotations.Test; /** + * @ignore Fails with jtreg, but passes with ant test run. Ignore for now. * @test * @bug 8039185 8039403 * @summary Test for persistent code cache and path handling - * @run testng jdk.nashorn.internal.runtime.CodeStoreAndPathTest + * @run testng jdk.nashorn.internal.runtime.test.CodeStoreAndPathTest */ @SuppressWarnings("javadoc") public class CodeStoreAndPathTest { diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java index 161a2123415..f86c5b75d2c 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java @@ -34,7 +34,7 @@ import org.testng.annotations.Test; * Tests for JSType methods. * * @test - * @run testng jdk.nashorn.internal.runtime.ConsStringTest + * @run testng jdk.nashorn.internal.runtime.test.ConsStringTest */ public class ConsStringTest { diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java index fbe20d88a98..b927de2e965 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java @@ -44,7 +44,7 @@ import org.testng.annotations.Test; * Basic Context API tests. * * @test - * @run testng jdk.nashorn.internal.runtime.ContextTest + * @run testng jdk.nashorn.internal.runtime.test.ContextTest */ @SuppressWarnings("javadoc") public class ContextTest { diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java index 1c80bdeb36b..3cb27ad09b1 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java @@ -42,7 +42,7 @@ import org.testng.annotations.Test; * JDK-8044518: Ensure exceptions related to optimistic recompilation are not serializable * * @test - * @run testng jdk.nashorn.internal.runtime.ExceptionsNotSerializable + * @run testng jdk.nashorn.internal.runtime.test.ExceptionsNotSerializable */ @SuppressWarnings("javadoc") public class ExceptionsNotSerializable { diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java index 71f818ccf61..a91a442adf9 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java @@ -37,7 +37,7 @@ import org.testng.annotations.Test; * Tests for JSType methods. * * @test - * @run testng jdk.nashorn.internal.runtime.JSTypeTest + * @run testng jdk.nashorn.internal.runtime.test.JSTypeTest */ public class JSTypeTest { /** diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java index eb68232cdaf..713a33caad9 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java @@ -40,7 +40,7 @@ import static org.testng.Assert.assertEquals; * Top-level lexical binding tests. * * @test - * @run testng jdk.nashorn.internal.runtime.LexicalBindingTest + * @run testng jdk.nashorn.internal.runtime.test.LexicalBindingTest */ @SuppressWarnings("javadoc") public class LexicalBindingTest { diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java index 0872448106e..d9643e650bb 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java @@ -43,7 +43,7 @@ import org.testng.annotations.Test; * @test * @bug 8037378 * @summary Sanity tests for no persistence caching - * @run testng/othervm jdk.nashorn.internal.runtime.NoPersistenceCachingTest + * @run testng/othervm jdk.nashorn.internal.runtime.test.NoPersistenceCachingTest */ @SuppressWarnings("javadoc") public class NoPersistenceCachingTest { diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java index d62b2f47ba6..fdf406c54f4 100644 --- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java +++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java @@ -49,7 +49,7 @@ public class SourceTest { final private static String SOURCE_STRING = "var x = 1;"; final private static char[] SOURCE_CHARS = SOURCE_STRING.toCharArray(); final private static String RESOURCE_PATH = "resources/load_test.js"; - final private static File SOURCE_FILE = new File("build/test/classes/jdk/nashorn/internal/runtime/" + RESOURCE_PATH); + final private static File SOURCE_FILE = new File("build/test/classes/jdk/nashorn/internal/runtime/test/" + RESOURCE_PATH); final private static URL SOURCE_URL = SourceTest.class.getResource(RESOURCE_PATH); From 2de64493a20db8cad4540d3323c2da5d508c6456 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Mon, 6 Apr 2015 13:41:10 -0700 Subject: [PATCH 064/101] 8076641: getNextEntry throws ArrayIndexOutOfBoundsException when unzipping file To add extra sanity check for entry extra data Reviewed-by: alanb --- .../share/classes/java/util/zip/ZipEntry.java | 2 + .../classes/jdk/nio/zipfs/ZipFileSystem.java | 2 + jdk/test/java/util/zip/TestExtraTime.java | 42 ++++++++++++++++++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java b/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java index b61e334c131..aa93bcb368d 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java +++ b/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java @@ -481,6 +481,8 @@ class ZipEntry implements ZipConstants, Cloneable { } break; case EXTID_NTFS: + if (sz < 32) // reserved 4 bytes + tag 2 bytes + size 2 bytes + break; // m[a|c]time 24 bytes int pos = off + 4; // reserved 4 bytes if (get16(extra, pos) != 0x0001 || get16(extra, pos + 2) != 24) break; diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java index d5cd4cf1125..17acf262266 100644 --- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java +++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java @@ -2271,6 +2271,8 @@ class ZipFileSystem extends FileSystem { } break; case EXTID_NTFS: + if (sz < 32) + break; pos += 4; // reserved 4 bytes if (SH(extra, pos) != 0x0001) break; diff --git a/jdk/test/java/util/zip/TestExtraTime.java b/jdk/test/java/util/zip/TestExtraTime.java index 20d9e36cc79..666121cdbfe 100644 --- a/jdk/test/java/util/zip/TestExtraTime.java +++ b/jdk/test/java/util/zip/TestExtraTime.java @@ -23,7 +23,7 @@ /** * @test - * @bug 4759491 6303183 7012868 8015666 8023713 8068790 + * @bug 4759491 6303183 7012868 8015666 8023713 8068790 8076641 * @summary Test ZOS and ZIS timestamp in extra field correctly */ @@ -40,7 +40,6 @@ import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; - public class TestExtraTime { public static void main(String[] args) throws Throwable{ @@ -71,6 +70,7 @@ public class TestExtraTime { } testNullHandling(); + testTagOnlyHandling(); testTimeConversions(); } @@ -208,4 +208,42 @@ public class TestExtraTime { } } } + + static void check(ZipEntry ze, byte[] extra) { + if (extra != null) { + byte[] extra1 = ze.getExtra(); + if (extra1 == null || extra1.length < extra.length || + !Arrays.equals(Arrays.copyOfRange(extra1, + extra1.length - extra.length, + extra1.length), + extra)) { + throw new RuntimeException("Timestamp: storing extra field failed!"); + } + } + } + + static void testTagOnlyHandling() throws Throwable { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] extra = new byte[] { 0x0a, 0, 4, 0, 0, 0, 0, 0 }; + try (ZipOutputStream zos = new ZipOutputStream(baos)) { + ZipEntry ze = new ZipEntry("TestExtraTime.java"); + ze.setExtra(extra); + zos.putNextEntry(ze); + zos.write(new byte[] { 1,2 ,3, 4}); + } + try (ZipInputStream zis = new ZipInputStream( + new ByteArrayInputStream(baos.toByteArray()))) { + ZipEntry ze = zis.getNextEntry(); + check(ze, extra); + } + Path zpath = Paths.get(System.getProperty("test.dir", "."), + "TestExtraTime.zip"); + Files.copy(new ByteArrayInputStream(baos.toByteArray()), zpath); + try (ZipFile zf = new ZipFile(zpath.toFile())) { + ZipEntry ze = zf.getEntry("TestExtraTime.java"); + check(ze, extra); + } finally { + Files.delete(zpath); + } + } } From 7ba3b4538299580a97784250deda5dfd99812c65 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Tue, 7 Apr 2015 09:06:24 +0200 Subject: [PATCH 065/101] 8076465: New Init.gmk needs improvements Reviewed-by: erikj, tbell --- common/autoconf/spec.gmk.in | 3 +- make/Help.gmk | 17 +-- make/Init.gmk | 266 +++++++++++++++++++++--------------- make/InitSupport.gmk | 67 ++++++--- make/Main.gmk | 9 +- 5 files changed, 217 insertions(+), 145 deletions(-) diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 35437b11670..a29e90b60d2 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -59,7 +59,7 @@ SPEC:=@SPEC@ MAKE := @MAKE@ # The default make arguments -MAKE_ARGS = $(MAKE_LOG_FLAGS) -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \ +MAKE_ARGS = $(MAKE_LOG_FLAGS) -r -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \ MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" LOG_LEVEL=$(LOG_LEVEL) OUTPUT_SYNC_SUPPORTED:=@OUTPUT_SYNC_SUPPORTED@ @@ -231,7 +231,6 @@ BUILD_OUTPUT:=@BUILD_OUTPUT@ # Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools -MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/makesupport HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk diff --git a/make/Help.gmk b/make/Help.gmk index 4f2dae1647b..739a85e2ee7 100644 --- a/make/Help.gmk +++ b/make/Help.gmk @@ -88,28 +88,15 @@ help: $(info $(_) # make test TEST="jdk_lang jdk_net") $(info ) $(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))),\ - $(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration)) + $(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration.)) # We need a dummy rule otherwise make will complain @true -print-targets: - $(if $(any_spec_file), ,\ - @echo "Note: More targets will be available when at least one configuration exists." 1>&2\ - ) - @echo $(ALL_TARGETS) - -print-modules: - $(if $(any_spec_file), \ - @$(MAKE) -s -f $(topdir)/make/Main.gmk -I $(topdir)/make/common SPEC=$(any_spec_file) print-modules \ - , \ - @echo print-modules can currently only be run when at least one configuration exists \ - ) - print-configurations: $(foreach var, $(all_confs), $(info $(var))) # We need a dummy rule otherwise make will complain @true -ALL_GLOBAL_TARGETS := help print-modules print-targets print-configurations +ALL_GLOBAL_TARGETS := help print-configurations .PHONY: $(ALL_GLOBAL_TARGETS) diff --git a/make/Init.gmk b/make/Init.gmk index 59f98fa3977..431b3a7f7b5 100644 --- a/make/Init.gmk +++ b/make/Init.gmk @@ -37,84 +37,102 @@ default: # serially, regardless of -j. .NOTPARALLEL: -# If included from the top-level Makefile then topdir is set, but not when -# recursively calling ourself with a spec. -ifeq ($(topdir),) - topdir := $(strip $(patsubst %/make/, %, $(dir $(lastword $(MAKEFILE_LIST))))) -endif - -# Our helper functions. Will include $(SPEC) if $(HAS_SPEC) is true. -include $(topdir)/make/InitSupport.gmk - -# Here are "global" targets, i.e. targets that can be executed without having a configuration. -# This will define ALL_GLOBAL_TARGETS. -include $(topdir)/make/Help.gmk - -# Extract main targets from Main.gmk. -ifneq ($(any_spec_file), ) - ifeq ($(wildcard $(dir $(any_spec_file))/make-support/module-deps.gmk),) - # If make-support does not exist, we need to build the genmodules java tool first. - $(info Creating data for first make execution in new configuration...) - ignore_output := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \ - -I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true FRC) - $(info Done) - endif - ALL_MAIN_TARGETS := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \ - -I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true print-targets) -else - # Without at least a single valid configuration, we cannot extract any real - # targets. To provide a helpful error message about the missing configuration - # later on, accept whatever targets the user has provided for now. - ALL_MAIN_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default) -endif - -# Targets provided by this file. -ALL_INIT_TARGETS := reconfigure - -ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)) - -ifneq ($(findstring qp, $(MAKEFLAGS)),) +ifeq ($(HAS_SPEC),) ############################################################################## - # When called with -qp, assume an external part (e.g. bash completion) is trying - # to understand our targets. Just list our targets and do no more checking. + # This is the default mode. We have not been recursively called with a SPEC. ############################################################################## - $(ALL_TARGETS): + # Include our helper functions. + include $(topdir)/make/InitSupport.gmk - .PHONY: $(ALL_TARGETS) + # Here are "global" targets, i.e. targets that can be executed without having + # a configuration. This will define ALL_GLOBAL_TARGETS. + include $(topdir)/make/Help.gmk -else ifeq ($(HAS_SPEC),) - - ############################################################################## - # This is the normal case, we have been called from the command line by the - # user and we need to call ourself back with a proper SPEC. - ############################################################################## - - $(eval $(call CheckControlVariables)) - $(eval $(call CheckDeprecatedEnvironment)) - $(eval $(call CheckInvalidMakeFlags)) - - $(eval $(call ParseConfCheckOption)) - - # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS. - $(eval $(call ParseLogLevel)) - - ifneq ($(findstring $(LOG_LEVEL),info debug trace),) - $(info Running make as '$(strip $(MAKE) $(MFLAGS) $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))') - endif + # Targets provided by Init.gmk. + ALL_INIT_TARGETS := print-modules print-targets reconfigure # CALLED_TARGETS is the list of targets that the user provided, # or "default" if unspecified. CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default) - CALLED_SPEC_TARGETS := $(filter $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS), $(CALLED_TARGETS)) - ifneq ($(CALLED_SPEC_TARGETS),) - # We have at least one non-global target, which need a SPEC - $(eval $(call ParseConfAndSpec)) - # Now SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails) + # Extract non-global targets that require a spec file. + CALLED_SPEC_TARGETS := $(filter-out $(ALL_GLOBAL_TARGETS), $(CALLED_TARGETS)) + + # If we have only global targets, or if we are called with -qp (assuming an + # external part, e.g. bash completion, is trying to understand our targets), + # we will skip SPEC location and the sanity checks. + ifeq ($(CALLED_SPEC_TARGETS), ) + ONLY_GLOBAL_TARGETS := true + endif + ifneq ($(findstring qp, $(MAKEFLAGS)),) + ONLY_GLOBAL_TARGETS := true + endif + + ifeq ($(ONLY_GLOBAL_TARGETS), true) + ############################################################################ + # We have only global targets, or are called with -pq. + ############################################################################ + + ifeq ($(wildcard $(SPEC)), ) + # If we have no SPEC provided, we will just make a "best effort" target list. + # First try to grab any available pre-existing main-targets.gmk. + main_targets_file := $(firstword $(wildcard $(build_dir)/*/make-support/main-targets.gmk)) + ifneq ($(main_targets_file), ) + # Extract the SPEC that corresponds to this main-targets.gmk file. + SPEC := $(patsubst %/make-support/main-targets.gmk, %/spec.gmk, $(main_targets_file)) + else + # None found, pick an arbitrary SPEC for which to generate a file + SPEC := $(firstword $(all_spec_files)) + endif + endif + + ifneq ($(wildcard $(SPEC)), ) + $(eval $(call DefineMainTargets, LAZY, $(SPEC))) + else + # If we have no configurations we can not provide any main targets. + ALL_MAIN_TARGETS := + endif + + ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)) + + # Just list all our targets. + $(ALL_TARGETS): + + .PHONY: $(ALL_TARGETS) + + else + ############################################################################ + # This is the normal case, we have been called from the command line by the + # user and we need to call ourself back with a proper SPEC. + # We have at least one non-global target, so we need to find a spec file. + ############################################################################ + + # Basic checks on environment and command line. + $(eval $(call CheckControlVariables)) + $(eval $(call CheckDeprecatedEnvironment)) + $(eval $(call CheckInvalidMakeFlags)) + + # Check that CONF_CHECK is valid. + $(eval $(call ParseConfCheckOption)) + + # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS. + $(eval $(call ParseLogLevel)) + + # After this SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails). + $(eval $(call ParseConfAndSpec)) + + # Extract main targets from Main.gmk using the spec(s) provided. In theory, + # with multiple specs, we should find the intersection of targets provided + # by all specs, but we approximate this by an arbitrary spec from the list. + # This will setup ALL_MAIN_TARGETS. + $(eval $(call DefineMainTargets, FORCE, $(firstword $(SPECS)))) + + # Separate called targets depending on type. INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS)) - SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(CALLED_SPEC_TARGETS)) - PARALLEL_TARGETS := $(filter-out $(INIT_TARGETS) $(SEQUENTIAL_TARGETS), $(CALLED_SPEC_TARGETS)) + MAIN_TARGETS := $(filter $(ALL_MAIN_TARGETS), $(CALLED_SPEC_TARGETS)) + SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(MAIN_TARGETS)) + PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS)) # The spec files depend on the autoconf source code. This check makes sure # the configuration is up to date after changes to configure. @@ -126,30 +144,41 @@ else ifeq ($(HAS_SPEC),) else ifeq ($(CONF_CHECK), auto) @echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'." @( cd $(topdir) && \ - $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -f $(topdir)/make/Init.gmk SPEC=$@ HAS_SPEC=true \ + $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -f $(topdir)/make/Init.gmk \ + SPEC=$@ HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \ reconfigure ) else ifeq ($(CONF_CHECK), ignore) # Do nothing endif - # Unless reconfigure is explicitely called, let all targets depend on the spec files to be up to date. - ifeq ($(findstring reconfigure, $(CALLED_SPEC_TARGETS)), ) - $(CALLED_SPEC_TARGETS): $(SPECS) + # Unless reconfigure is explicitely called, let all main targets depend on + # the spec files to be up to date. + ifeq ($(findstring reconfigure, $(INIT_TARGETS)), ) + $(MAIN_TARGETS): $(SPECS) endif - # The recipe will be run once for every target specified, but we only want to execute the - # recipe a single time, hence the TARGET_DONE with a dummy command if true. - $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS): + make-info: + ifneq ($(findstring $(LOG_LEVEL),info debug trace),) + $(info Running make as '$(strip $(MAKE) $(MFLAGS) \ + $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))') + endif + + # Now the init and main targets will be called, once for each SPEC. The + # recipe will be run once for every target specified, but we only want to + # execute the recipe a single time, hence the TARGET_DONE with a dummy + # command if true. + $(ALL_INIT_TARGETS) $(ALL_MAIN_TARGETS): make-info @$(if $(TARGET_DONE), \ true \ , \ $(foreach spec, $(SPECS), \ ( cd $(topdir) && \ - $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -j 1 -f $(topdir)/make/Init.gmk \ - SPEC=$(spec) HAS_SPEC=true \ + $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -r -R -j 1 -f $(topdir)/make/Init.gmk \ + SPEC=$(spec) HAS_SPEC=true ACTUAL_TOPDIR=$(topdir) \ USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \ LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) \ - INIT_TARGETS="$(INIT_TARGETS)" SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \ + INIT_TARGETS="$(INIT_TARGETS)" \ + SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \ PARALLEL_TARGETS="$(PARALLEL_TARGETS)" \ main ) && \ ) true \ @@ -158,7 +187,7 @@ else ifeq ($(HAS_SPEC),) .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS) - endif # has $(CALLED_SPEC_TARGETS) + endif # $(ONLY_GLOBAL_TARGETS)!=true else # HAS_SPEC=true @@ -168,6 +197,14 @@ else # HAS_SPEC=true # file. ############################################################################## + include $(SPEC) + + # Our helper functions. + include $(TOPDIR)/make/InitSupport.gmk + + # Verify that the spec file we included seems okay. + $(eval $(call CheckSpecSanity)) + ifeq ($(LOG_NOFILE), true) # Disable log wrapper if LOG=[level,]nofile was given override BUILD_LOG_WRAPPER := @@ -177,7 +214,19 @@ else # HAS_SPEC=true OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC) endif - $(eval $(call CheckSpecSanity)) + ############################################################################## + # Init targets + ############################################################################## + + print-modules: + ( cd $(TOPDIR) && \ + $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ + NO_RECIPES=true print-modules ) + + print-targets: + ( cd $(TOPDIR) && \ + $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ + NO_RECIPES=true print-targets ) reconfigure: ifneq ($(CONFIGURE_COMMAND_LINE), ) @@ -188,42 +237,43 @@ else # HAS_SPEC=true ( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \ $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) ) - main-init: - $(call RotateLogFiles) - $(BUILD_LOG_WRAPPER) $(PRINTF) "Building target(s) '$(strip \ - $(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \ - )' in configuration '$(CONF_NAME)'\n" + ############################################################################## + # The main target, for delegating into Main.gmk + ############################################################################## + MAIN_TARGETS := $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) + TARGET_DESCRIPTION := target$(if $(word 2, $(MAIN_TARGETS)),s) \ + '$(strip $(MAIN_TARGETS))' in configuration '$(CONF_NAME)' # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls. # We need to clear it of the init-specific variables. The user-specified # variables are explicitely propagated using $(USER_MAKE_VARS). main: MAKEOVERRIDES := - main: $(INIT_TARGETS) main-init - ifneq ($(SEQUENTIAL_TARGETS), ) - # Don't touch build output dir since we might be cleaning. That means - # no log wrapper. - ( cd $(TOPDIR) && \ - $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ - $(SEQUENTIAL_TARGETS) \ - ) + main: $(INIT_TARGETS) + ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), ) + $(call RotateLogFiles) + $(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" + ifneq ($(SEQUENTIAL_TARGETS), ) + # Don't touch build output dir since we might be cleaning. That + # means no log wrapper. + ( cd $(TOPDIR) && \ + $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \ + $(SEQUENTIAL_TARGETS) ) + endif + ifneq ($(PARALLEL_TARGETS), ) + $(call StartGlobalTimer) + $(call PrepareSmartJavac) + ( cd $(TOPDIR) && \ + $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \ + -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \ + $(PARALLEL_TARGETS) ) + $(call CleanupSmartJavac) + $(call StopGlobalTimer) + $(call ReportBuildTimes) + endif + $(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" endif - ifneq ($(PARALLEL_TARGETS), ) - $(call StartGlobalTimer) - $(call PrepareSmartJavac) - ( cd $(TOPDIR) && \ - $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \ - -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \ - $(PARALLEL_TARGETS) \ - ) - $(call CleanupSmartJavac) - $(call StopGlobalTimer) - $(call ReportBuildTimes) - endif - $(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building target(s) '$(strip \ - $(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \ - )' in configuration '$(CONF_NAME)'\n" - .PHONY: reconfigure main-init main + .PHONY: print-targets print-modules reconfigure main endif diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index cc733cf1542..b41b10808a4 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -32,13 +32,6 @@ ifndef _INITSUPPORT_GMK _INITSUPPORT_GMK := 1 -# Setup information about available configurations, if any. -build_dir=$(topdir)/build -all_spec_files=$(wildcard $(build_dir)/*/spec.gmk) -# Extract the configuration names from the path -all_confs=$(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files))) -any_spec_file=$(firstword $(all_spec_files)) - ifeq ($(HAS_SPEC),) ############################################################################## # Helper functions for the initial part of Init.gmk, before the spec file is @@ -62,17 +55,24 @@ ifeq ($(HAS_SPEC),) # line, but in reverse order to what the user entered. COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES)))) - # A list like FOO="val1" BAR="val2" containing all user-supplied make variables - # that we should propagate. + # A list like FOO="val1" BAR="val2" containing all user-supplied make + # variables that we should propagate. USER_MAKE_VARS := $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \ $(MAKEOVERRIDES)) + # Setup information about available configurations, if any. + build_dir=$(topdir)/build + all_spec_files=$(wildcard $(build_dir)/*/spec.gmk) + # Extract the configuration names from the path + all_confs=$(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files))) + # Check for unknown command-line variables define CheckControlVariables command_line_variables := $$(strip $$(foreach var, \ $$(subst \ ,_,$$(MAKEOVERRIDES)), \ $$(firstword $$(subst =, , $$(var))))) - unknown_command_line_variables := $$(strip $$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables))) + unknown_command_line_variables := $$(strip \ + $$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables))) ifneq ($$(unknown_command_line_variables), ) $$(info Note: Command line contains non-control variables:) $$(foreach var, $$(unknown_command_line_variables), $$(info * $$(var)=$$($$(var)))) @@ -182,7 +182,7 @@ ifeq ($(HAS_SPEC),) override SPEC := else # Use spec.gmk files in the build output directory - ifeq ($$(any_spec_file),) + ifeq ($$(all_spec_files),) $$(info Error: No configurations found for $$(topdir).) $$(info Please run 'bash configure' to create a configuration.) $$(info ) @@ -196,7 +196,8 @@ ifeq ($(HAS_SPEC),) matching_confs := $$(strip $$(all_confs)) else # Otherwise select those that contain the given CONF string - matching_confs := $$(strip $$(foreach var, $$(all_confs), $$(if $$(findstring $$(CONF), $$(var)), $$(var)))) + matching_confs := $$(strip $$(foreach var, $$(all_confs), \ + $$(if $$(findstring $$(CONF), $$(var)), $$(var)))) endif ifeq ($$(matching_confs),) $$(info Error: No configurations found matching CONF=$$(CONF).) @@ -231,6 +232,37 @@ ifeq ($(HAS_SPEC),) endif endef + # Extract main targets from Main.gmk using the spec provided in $2. + # + # Param 1: FORCE = force generation of main-targets.gmk or LAZY = do not force. + # Param 2: The SPEC file to use. + define DefineMainTargets + + # We will start by making sure the main-targets.gmk file is removed, if + # make has not been restarted. By the -include, we will trigger the + # rule for generating the file (which is never there since we removed it), + # thus generating it fresh, and make will restart, incrementing the restart + # count. + main_targets_file := $$(dir $(strip $2))make-support/main-targets.gmk + + ifeq ($$(MAKE_RESTARTS),) + # Only do this if make has not been restarted, and if we do not force it. + ifeq ($(strip $1), FORCE) + $$(shell rm -f $$(main_targets_file)) + endif + endif + + $$(main_targets_file): + @( cd $$(topdir) && \ + $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \ + -I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \ + LOG_LEVEL=$$(LOG_LEVEL) \ + create-main-targets-include ) + + # Now include main-targets.gmk. This will define ALL_MAIN_TARGETS. + -include $$(main_targets_file) + endef + define PrintConfCheckFailed @echo ' ' @echo "Please rerun configure! Easiest way to do this is by running" @@ -242,10 +274,9 @@ ifeq ($(HAS_SPEC),) else # $(HAS_SPEC)=true ############################################################################## # Helper functions for the 'main' target. These functions assume a single, - # proper and existing SPEC is provided, and will load it. + # proper and existing SPEC is included. ############################################################################## - include $(SPEC) include $(SRC_ROOT)/make/common/MakeBase.gmk # Define basic logging setup @@ -263,11 +294,11 @@ else # $(HAS_SPEC)=true # Sanity check the spec file, so it matches this source code define CheckSpecSanity - ifneq ($$(topdir), $$(TOPDIR)) - ifneq ($$(topdir), $$(ORIGINAL_TOPDIR)) - ifneq ($$(topdir), $$(CANONICAL_TOPDIR)) + ifneq ($$(ACTUAL_TOPDIR), $$(TOPDIR)) + ifneq ($$(ACTUAL_TOPDIR), $$(ORIGINAL_TOPDIR)) + ifneq ($$(ACTUAL_TOPDIR), $$(CANONICAL_TOPDIR)) $$(info Error: SPEC mismatch! Current working directory) - $$(info $$(topdir)) + $$(info $$(ACTUAL_TOPDIR)) $$(info does not match either TOPDIR, ORIGINAL_TOPDIR or CANONICAL_TOPDIR) $$(info $$(TOPDIR)) $$(info $$(ORIGINAL_TOPDIR)) diff --git a/make/Main.gmk b/make/Main.gmk index a6aef4647bd..9d7bed14277 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -607,14 +607,19 @@ include $(SRC_ROOT)/make/Jprt.gmk ################################################################################ +# The following targets are intentionally not added to ALL_TARGETS since they +# are internal only, to support Init.gmk. + print-targets: @$(ECHO) $(sort $(ALL_TARGETS)) print-modules: @$(ECHO) $(sort $(ALL_MODULES)) -# print-* targets intentionally not added to ALL_TARGETS since they are internal only. -# The corresponding external targets are in Help.gmk +create-main-targets-include: + @$(ECHO) $(LOG_INFO) Generating main target list + @$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \ + $(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk ################################################################################ From 7e6f12e6e96d4f526c14724efff177eaf0bc3a7d Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Tue, 7 Apr 2015 10:33:08 +0100 Subject: [PATCH 066/101] 8076442: Cannot fully read BitSet.stream() if bit Integer.MAX_VALUE is set Reviewed-by: alanb, henryjen --- jdk/src/java.base/share/classes/java/util/BitSet.java | 2 +- jdk/test/java/util/BitSet/BitSetStreamTest.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jdk/src/java.base/share/classes/java/util/BitSet.java b/jdk/src/java.base/share/classes/java/util/BitSet.java index 901a5a75800..f444072a185 100644 --- a/jdk/src/java.base/share/classes/java/util/BitSet.java +++ b/jdk/src/java.base/share/classes/java/util/BitSet.java @@ -1229,7 +1229,7 @@ public class BitSet implements Cloneable, java.io.Serializable { public int nextInt() { if (next != -1) { int ret = next; - next = nextSetBit(next+1); + next = (next == Integer.MAX_VALUE) ? -1 : nextSetBit(next+1); return ret; } else { throw new NoSuchElementException(); diff --git a/jdk/test/java/util/BitSet/BitSetStreamTest.java b/jdk/test/java/util/BitSet/BitSetStreamTest.java index 394f3ac3337..d4e2d8d4919 100644 --- a/jdk/test/java/util/BitSet/BitSetStreamTest.java +++ b/jdk/test/java/util/BitSet/BitSetStreamTest.java @@ -43,7 +43,7 @@ import static org.testng.Assert.fail; /** * @test * @summary test BitSet stream - * @bug 8012645 + * @bug 8012645 8076442 * @run testng BitSetStreamTest */ public class BitSetStreamTest { @@ -70,6 +70,7 @@ public class BitSetStreamTest { { "step 5", IntStream.range(0, 255).map(f -> f * 5) }, { "step 7", IntStream.range(0, 255).map(f -> f * 7) }, { "1, 10, 100, 1000", IntStream.of(1, 10, 100, 1000) }, + { "max int", IntStream.of(Integer.MAX_VALUE) }, { "25 fibs", IntStream.generate(new Fibs()).limit(25) } }; @@ -106,6 +107,8 @@ public class BitSetStreamTest { for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) { assertTrue(it.hasNext()); assertEquals(it.nextInt(), i); + if (i == Integer.MAX_VALUE) + break; // or (i+1) would overflow } assertFalse(it.hasNext()); } From 7d3885b23964b7d8e9b6e8f4a748625ac23cb387 Mon Sep 17 00:00:00 2001 From: Joel Borggren-Franck Date: Tue, 7 Apr 2015 11:04:29 -0700 Subject: [PATCH 067/101] 8031744: Annotations on many Language Model elements are not returned Co-authored-by: Maurizio Cimadamore Reviewed-by: jfranck, mcimadamore, emc, jlahoda, jjg --- .../com/sun/tools/javac/api/JavacTrees.java | 3 +- .../com/sun/tools/javac/code/ClassFinder.java | 23 +- .../com/sun/tools/javac/code/Symbol.java | 36 +- .../com/sun/tools/javac/code/Type.java | 259 ++- .../javac/code/TypeAnnotationPosition.java | 6 +- .../sun/tools/javac/code/TypeAnnotations.java | 524 +++--- .../sun/tools/javac/code/TypeMetadata.java | 137 +- .../com/sun/tools/javac/code/Types.java | 197 +- .../com/sun/tools/javac/comp/Annotate.java | 1620 ++++++++++------- .../com/sun/tools/javac/comp/Attr.java | 77 +- .../com/sun/tools/javac/comp/AttrContext.java | 6 + .../com/sun/tools/javac/comp/Check.java | 146 +- .../sun/tools/javac/comp/DeferredAttr.java | 4 +- .../com/sun/tools/javac/comp/Enter.java | 10 +- .../com/sun/tools/javac/comp/Lower.java | 14 - .../com/sun/tools/javac/comp/MemberEnter.java | 64 +- .../com/sun/tools/javac/comp/TransTypes.java | 12 + .../com/sun/tools/javac/comp/TypeEnter.java | 21 +- .../com/sun/tools/javac/jvm/ClassReader.java | 120 +- .../classes/com/sun/tools/javac/jvm/Gen.java | 63 +- .../tools/javac/jvm/UninitializedType.java | 4 +- .../com/sun/tools/javac/model/JavacTypes.java | 13 +- .../com/sun/tools/javac/tree/JCTree.java | 10 +- .../javac/util/RichDiagnosticFormatter.java | 5 +- .../api/AnnotatedArrayOrder.java | 4 +- .../newlocations/BasicTest.java | 10 +- langtools/test/tools/javac/lib/DPrinter.java | 4 +- .../processing/model/type/BasicAnnoTests.java | 364 +++- .../tools/javac/warnings/6747671/T6747671.out | 2 +- 29 files changed, 2201 insertions(+), 1557 deletions(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java index 35174e9832a..ddd7a881d91 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java @@ -696,7 +696,8 @@ public class JavacTrees extends DocTrees { @DefinedBy(Api.COMPILER_TREE) public TypeMirror getTypeMirror(TreePath path) { Tree t = path.getLeaf(); - return ((JCTree)t).type; + Type ty = ((JCTree)t).type; + return ty == null ? null : ty.stripMetadataIfNeeded(); } @DefinedBy(Api.COMPILER_TREE) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java index 40802254d72..a2abf1bc46b 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,8 @@ package com.sun.tools.javac.code; -import java.io.*; +import java.io.IOException; +import java.io.File; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; @@ -38,16 +39,15 @@ import javax.tools.JavaFileObject; import javax.tools.StandardJavaFileManager; import com.sun.tools.javac.code.Scope.WriteableScope; -import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Symbol.ClassSymbol; import com.sun.tools.javac.code.Symbol.Completer; import com.sun.tools.javac.code.Symbol.CompletionFailure; import com.sun.tools.javac.code.Symbol.PackageSymbol; import com.sun.tools.javac.code.Symbol.TypeSymbol; import com.sun.tools.javac.comp.Annotate; +import com.sun.tools.javac.comp.Enter; import com.sun.tools.javac.file.JRTIndex; import com.sun.tools.javac.file.JavacFileManager; -import com.sun.tools.javac.file.RelativePath.RelativeDirectory; import com.sun.tools.javac.jvm.ClassReader; import com.sun.tools.javac.jvm.Profile; import com.sun.tools.javac.util.*; @@ -75,7 +75,7 @@ public class ClassFinder { ClassReader reader; - Annotate annotate; + private final Annotate annotate; /** Switch: verbose output. */ @@ -272,18 +272,13 @@ public class ClassFinder { try { ClassSymbol c = (ClassSymbol) sym; dependencies.push(c, CompletionCause.CLASS_READER); + annotate.blockAnnotations(); c.members_field = new Scope.ErrorScope(c); // make sure it's always defined - annotate.enterStart(); - try { - completeOwners(c.owner); - completeEnclosing(c); - } finally { - // The flush needs to happen only after annotations - // are filled in. - annotate.enterDoneWithoutFlush(); - } + completeOwners(c.owner); + completeEnclosing(c); fillIn(c); } finally { + annotate.unblockAnnotationsNoFlush(); dependencies.pop(); } } else if (sym.kind == PCK) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java index e4b88fa22c8..d19cda62150 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,11 @@ import java.util.concurrent.Callable; import javax.lang.model.element.*; import javax.tools.JavaFileObject; +import com.sun.tools.javac.code.Attribute.Compound; +import com.sun.tools.javac.code.TypeAnnotations.AnnotationType; +import com.sun.tools.javac.code.TypeMetadata.Entry; +import com.sun.tools.javac.comp.Annotate.AnnotationTypeCompleter; +import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata; import com.sun.tools.javac.code.Scope.WriteableScope; import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.comp.Attr; @@ -738,6 +743,13 @@ public abstract class Symbol extends AnnoConstruct implements Element { return list; } + public AnnotationTypeMetadata getAnnotationTypeMetadata() { + Assert.error("Only on ClassSymbol"); + return null; //unreachable + } + + public boolean isAnnotationType() { return false; } + @Override public R accept(Symbol.Visitor v, P p) { return v.visitTypeSymbol(this, p); @@ -958,6 +970,9 @@ public abstract class Symbol extends AnnoConstruct implements Element { */ public Pool pool; + /** the annotation metadata attached to this class */ + private AnnotationTypeMetadata annotationTypeMetadata; + public ClassSymbol(long flags, Name name, Type type, Symbol owner) { super(TYP, flags, name, type, owner); this.members_field = null; @@ -966,6 +981,7 @@ public abstract class Symbol extends AnnoConstruct implements Element { this.sourcefile = null; this.classfile = null; this.pool = null; + this.annotationTypeMetadata = AnnotationTypeMetadata.notAnAnnotationType(); } public ClassSymbol(long flags, Name name, Symbol owner) { @@ -1202,8 +1218,24 @@ public abstract class Symbol extends AnnoConstruct implements Element { t.all_interfaces_field = null; } metadata = null; + annotationTypeMetadata = AnnotationTypeMetadata.notAnAnnotationType(); } + @Override + public AnnotationTypeMetadata getAnnotationTypeMetadata() { + return annotationTypeMetadata; + } + + @Override + public boolean isAnnotationType() { + return (flags_field & Flags.ANNOTATION) != 0; + } + + public void setAnnotationTypeMetadata(AnnotationTypeMetadata a) { + Assert.checkNonNull(a); + Assert.check(!annotationTypeMetadata.isMetadataForAnnotationType()); + this.annotationTypeMetadata = a; + } } @@ -1360,7 +1392,7 @@ public abstract class Symbol extends AnnoConstruct implements Element { /** The names of the parameters */ public List savedParameterNames; - /** For an attribute field accessor, its default value if any. + /** For an annotation type element, its default value if any. * The value is null if none appeared in the method * declaration. */ diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java index e2d3208c211..ad9e6291796 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ import java.util.function.Function; import javax.lang.model.type.*; import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.code.Types.MapVisitor; +import com.sun.tools.javac.code.TypeMetadata.Entry; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.DefinedBy.Api; import static com.sun.tools.javac.code.BoundKind.*; @@ -87,11 +87,10 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { return metadata; } - public TypeMetadata.Element getMetadataOfKind(final TypeMetadata.Element.Kind kind) { + public Entry getMetadataOfKind(final Entry.Kind kind) { return metadata != null ? metadata.get(kind) : null; } - /** Constant type: no type at all. */ public static final JCNoType noType = new JCNoType() { @Override @DefinedBy(Api.LANGUAGE_MODEL) @@ -238,7 +237,12 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { List typarams = t.getTypeArguments(); List typarams1 = visit(typarams, s); if (outer1 == outer && typarams1 == typarams) return t; - else return new ClassType(outer1, typarams1, t.tsym, t.metadata); + else return new ClassType(outer1, typarams1, t.tsym, t.metadata) { + @Override + protected boolean needsStripping() { + return true; + } + }; } @Override @@ -249,7 +253,12 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { if (t == wt.type) return wt; else - return new WildcardType(t, wt.kind, wt.tsym, wt.bound, wt.metadata); + return new WildcardType(t, wt.kind, wt.tsym, wt.bound, wt.metadata) { + @Override + protected boolean needsStripping() { + return true; + } + }; } @Override @@ -257,7 +266,12 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { Type elemtype = t.elemtype; Type elemtype1 = visit(elemtype, s); if (elemtype1 == elemtype) return t; - else return new ArrayType(elemtype1, t.tsym, t.metadata); + else return new ArrayType(elemtype1, t.tsym, t.metadata) { + @Override + protected boolean needsStripping() { + return true; + } + }; } @Override @@ -271,7 +285,12 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { if (argtypes1 == argtypes && restype1 == restype && thrown1 == thrown) return t; - else return new MethodType(argtypes1, restype1, thrown1, t.tsym); + else return new MethodType(argtypes1, restype1, thrown1, t.tsym) { + @Override + protected boolean needsStripping() { + return true; + } + }; } @Override @@ -313,38 +332,78 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } /** - * Create a new type with exactly the given metadata. The - * argument is guaranteed to always be non-empty, and should have - * already been copied/combined with the current type's metadata. - * This is used internally by other methods. - * + * Returns the original version of this type, before metadata were added. This routine is meant + * for internal use only (i.e. {@link Type#equalsIgnoreMetadata(Type)}, {@link Type#stripMetadata}); + * it should not be used outside this class. */ - public abstract Type clone(TypeMetadata md); - - public Type combineMetadata(final TypeMetadata.Element md) { - return clone(metadata.combine(md)); + protected Type typeNoMetadata() { + return metadata == TypeMetadata.EMPTY ? this : baseType(); } + /** + * Create a new copy of this type but with the specified TypeMetadata. + */ + public abstract Type cloneWithMetadata(TypeMetadata metadata); + + /** + * Does this type require annotation stripping for API clients? + */ + protected boolean needsStripping() { + return false; + } + + /** + * Strip all metadata associated with this type - this could return a new clone of the type. + * This routine is only used to present the correct annotated types back to the users when types + * are accessed through compiler APIs; it should not be used anywhere in the compiler internals + * as doing so might result in performance penalties. + */ + public Type stripMetadataIfNeeded() { + return needsStripping() ? + accept(stripMetadata, null) : + this; + } + //where + private final static TypeMapping stripMetadata = new TypeMapping() { + @Override + public Type visitClassType(ClassType t, Void aVoid) { + return super.visitClassType((ClassType)t.typeNoMetadata(), aVoid); + } + + @Override + public Type visitArrayType(ArrayType t, Void aVoid) { + return super.visitArrayType((ArrayType)t.typeNoMetadata(), aVoid); + } + + @Override + public Type visitTypeVar(TypeVar t, Void aVoid) { + return super.visitTypeVar((TypeVar)t.typeNoMetadata(), aVoid); + } + + @Override + public Type visitWildcardType(WildcardType wt, Void aVoid) { + return super.visitWildcardType((WildcardType)wt.typeNoMetadata(), aVoid); + } + }; + public Type annotatedType(final List annos) { - final TypeMetadata.Element annoMetadata = new TypeMetadata.Annotations(annos); - return combineMetadata(annoMetadata); + final Entry annoMetadata = new TypeMetadata.Annotations(annos); + return cloneWithMetadata(metadata.combine(annoMetadata)); } public boolean isAnnotated() { final TypeMetadata.Annotations metadata = - (TypeMetadata.Annotations)getMetadataOfKind(TypeMetadata.Element.Kind.ANNOTATIONS); + (TypeMetadata.Annotations)getMetadataOfKind(Entry.Kind.ANNOTATIONS); return null != metadata && !metadata.getAnnotations().isEmpty(); } - private static final List noAnnotations = List.nil(); - @Override @DefinedBy(Api.LANGUAGE_MODEL) public List getAnnotationMirrors() { final TypeMetadata.Annotations metadata = - (TypeMetadata.Annotations)getMetadataOfKind(TypeMetadata.Element.Kind.ANNOTATIONS); + (TypeMetadata.Annotations)getMetadataOfKind(Entry.Kind.ANNOTATIONS); - return metadata == null ? noAnnotations : metadata.getAnnotations(); + return metadata == null ? List.nil() : metadata.getAnnotations(); } @@ -431,13 +490,15 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } /** - * This method is analogous to isSameType, but weaker, since we - * never complete classes. Where isSameType would complete a - * class, equals assumes that the two types are different. + * Override this method with care. For most Type instances this should behave as ==. */ @Override @DefinedBy(Api.LANGUAGE_MODEL) public boolean equals(Object t) { - return super.equals(t); + return this == t; + } + + public boolean equalsIgnoreMetadata(Type t) { + return typeNoMetadata().equals(t.typeNoMetadata()); } @Override @DefinedBy(Api.LANGUAGE_MODEL) @@ -547,7 +608,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { * Does this type contain occurrences of type t? */ public boolean contains(Type t) { - return t == this; + return t.equalsIgnoreMetadata(this); } public static boolean contains(List ts, Type t) { @@ -615,19 +676,21 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { TypeTag tag; public JCPrimitiveType(TypeTag tag, TypeSymbol tsym) { - this(tag, tsym, TypeMetadata.empty); + this(tag, tsym, TypeMetadata.EMPTY); } - private JCPrimitiveType(TypeTag tag, TypeSymbol tsym, - TypeMetadata metadata) { + private JCPrimitiveType(TypeTag tag, TypeSymbol tsym, TypeMetadata metadata) { super(tsym, metadata); this.tag = tag; Assert.check(tag.isPrimitive); } @Override - public JCPrimitiveType clone(TypeMetadata md) { - return new JCPrimitiveType(tag, tsym, md); + public JCPrimitiveType cloneWithMetadata(TypeMetadata md) { + return new JCPrimitiveType(tag, tsym, md) { + @Override + public Type baseType() { return JCPrimitiveType.this.baseType(); } + }; } @Override @@ -740,7 +803,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) { - this(type, kind, tsym, null, TypeMetadata.empty); + this(type, kind, tsym, null, TypeMetadata.EMPTY); } public WildcardType(Type type, BoundKind kind, TypeSymbol tsym, @@ -750,7 +813,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { public WildcardType(Type type, BoundKind kind, TypeSymbol tsym, TypeVar bound) { - this(type, kind, tsym, bound, TypeMetadata.empty); + this(type, kind, tsym, bound, TypeMetadata.EMPTY); } public WildcardType(Type type, BoundKind kind, TypeSymbol tsym, @@ -762,8 +825,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } @Override - public WildcardType clone(TypeMetadata md) { - return new WildcardType(type, kind, tsym, bound, md); + public WildcardType cloneWithMetadata(TypeMetadata md) { + return new WildcardType(type, kind, tsym, bound, md) { + @Override + public Type baseType() { return WildcardType.this.baseType(); } + }; } @Override @@ -883,7 +949,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { public List all_interfaces_field; public ClassType(Type outer, List typarams, TypeSymbol tsym) { - this(outer, typarams, tsym, TypeMetadata.empty); + this(outer, typarams, tsym, TypeMetadata.EMPTY); } public ClassType(Type outer, List typarams, TypeSymbol tsym, @@ -897,13 +963,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } @Override - public ClassType clone(TypeMetadata md) { - final ClassType out = - new ClassType(outer_field, typarams_field, tsym, md); - out.allparams_field = allparams_field; - out.supertype_field = supertype_field; - out.interfaces_field = interfaces_field; - return out; + public ClassType cloneWithMetadata(TypeMetadata md) { + return new ClassType(outer_field, typarams_field, tsym, md) { + @Override + public Type baseType() { return ClassType.this.baseType(); } + }; } @Override @@ -935,14 +999,16 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { @DefinedBy(Api.LANGUAGE_MODEL) public String toString() { StringBuilder buf = new StringBuilder(); - appendAnnotationsString(buf); if (getEnclosingType().hasTag(CLASS) && tsym.owner.kind == TYP) { buf.append(getEnclosingType().toString()); buf.append("."); + appendAnnotationsString(buf); buf.append(className(tsym, false)); } else { + appendAnnotationsString(buf); buf.append(className(tsym, true)); } + if (getTypeArguments().nonEmpty()) { buf.append('<'); buf.append(getTypeArguments().toString()); @@ -1050,7 +1116,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { public boolean contains(Type elem) { return - elem == this + elem.equalsIgnoreMetadata(this) || (isParameterized() && (getEnclosingType().contains(elem) || contains(getTypeArguments(), elem))) || (isCompound() @@ -1073,10 +1139,6 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } public static class ErasedClassType extends ClassType { - public ErasedClassType(Type outer, TypeSymbol tsym) { - super(outer, List.nil(), tsym); - } - public ErasedClassType(Type outer, TypeSymbol tsym, TypeMetadata metadata) { super(outer, List.nil(), tsym, metadata); @@ -1104,7 +1166,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } @Override - public UnionClassType clone(TypeMetadata md) { + public UnionClassType cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to a union type"); } @@ -1155,7 +1217,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } @Override - public IntersectionClassType clone(TypeMetadata md) { + public IntersectionClassType cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to an intersection type"); } @@ -1196,7 +1258,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { public Type elemtype; public ArrayType(Type elemtype, TypeSymbol arrayClass) { - this(elemtype, arrayClass, TypeMetadata.empty); + this(elemtype, arrayClass, TypeMetadata.EMPTY); } public ArrayType(Type elemtype, TypeSymbol arrayClass, @@ -1205,9 +1267,18 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { this.elemtype = elemtype; } + public ArrayType(ArrayType that) { + //note: type metadata is deliberately shared here, as we want side-effects from annotation + //processing to flow from original array to the cloned array. + this(that.elemtype, that.tsym, that.getMetadata()); + } + @Override - public ArrayType clone(TypeMetadata md) { - return new ArrayType(elemtype, tsym, md); + public ArrayType cloneWithMetadata(TypeMetadata md) { + return new ArrayType(elemtype, tsym, md) { + @Override + public Type baseType() { return ArrayType.this.baseType(); } + }; } @Override @@ -1228,12 +1299,15 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { return sb.toString(); } - @DefinedBy(Api.LANGUAGE_MODEL) + @Override @DefinedBy(Api.LANGUAGE_MODEL) public boolean equals(Object obj) { - return - this == obj || - (obj instanceof ArrayType && - this.elemtype.equals(((ArrayType)obj).elemtype)); + if (obj instanceof ArrayType) { + ArrayType that = (ArrayType)obj; + return this == that || + elemtype.equals(that.elemtype); + } + + return false; } @DefinedBy(Api.LANGUAGE_MODEL) @@ -1279,7 +1353,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } public boolean contains(Type elem) { - return elem == this || elemtype.contains(elem); + return elem.equalsIgnoreMetadata(this) || elemtype.contains(elem); } public void complete() { @@ -1318,14 +1392,14 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { TypeSymbol methodClass) { // Presently no way to refer to a method type directly, so // we cannot put type annotations on it. - super(methodClass, TypeMetadata.empty); + super(methodClass, TypeMetadata.EMPTY); this.argtypes = argtypes; this.restype = restype; this.thrown = thrown; } @Override - public MethodType clone(TypeMetadata md) { + public MethodType cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to a method type"); } @@ -1370,7 +1444,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } public boolean contains(Type elem) { - return elem == this || contains(argtypes, elem) || restype.contains(elem) || contains(thrown, elem); + return elem.equalsIgnoreMetadata(this) || contains(argtypes, elem) || restype.contains(elem) || contains(thrown, elem); } public MethodType asMethodType() { return this; } @@ -1408,11 +1482,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { PackageType(TypeSymbol tsym) { // Package types cannot be annotated - super(tsym, TypeMetadata.empty); + super(tsym, TypeMetadata.EMPTY); } @Override - public PackageType clone(TypeMetadata md) { + public PackageType cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to a package type"); } @@ -1464,14 +1538,14 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { public Type lower; public TypeVar(Name name, Symbol owner, Type lower) { - super(null, TypeMetadata.empty); + super(null, TypeMetadata.EMPTY); tsym = new TypeVariableSymbol(0, name, this, owner); - this.bound = bound; + this.bound = null; this.lower = lower; } public TypeVar(TypeSymbol tsym, Type bound, Type lower) { - this(tsym, bound, lower, TypeMetadata.empty); + this(tsym, bound, lower, TypeMetadata.EMPTY); } public TypeVar(TypeSymbol tsym, Type bound, Type lower, @@ -1482,8 +1556,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } @Override - public TypeVar clone(TypeMetadata md) { - return new TypeVar(tsym, bound, lower, md); + public TypeVar cloneWithMetadata(TypeMetadata md) { + return new TypeVar(tsym, bound, lower, md) { + @Override + public Type baseType() { return TypeVar.this.baseType(); } + }; } @Override @@ -1566,8 +1643,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } @Override - public CapturedType clone(TypeMetadata md) { - return new CapturedType(tsym, bound, bound, lower, wildcard, md); + public CapturedType cloneWithMetadata(TypeMetadata md) { + return new CapturedType(tsym, bound, bound, lower, wildcard, md) { + @Override + public Type baseType() { return CapturedType.this.baseType(); } + }; } @Override @@ -1597,7 +1677,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { public TypeTag tag; public DelegatedType(TypeTag tag, Type qtype) { - this(tag, qtype, TypeMetadata.empty); + this(tag, qtype, TypeMetadata.EMPTY); } public DelegatedType(TypeTag tag, Type qtype, @@ -1635,7 +1715,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } @Override - public ForAll clone(TypeMetadata md) { + public ForAll cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to a forall type"); } @@ -1785,7 +1865,7 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } @Override - public UndetVar clone(TypeMetadata md) { + public UndetVar cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to an UndetVar type"); } @@ -1940,11 +2020,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { // Need to use List.nil(), because JCNoType constructor // gets called in static initializers in Type, where // noAnnotations is also defined. - super(null, TypeMetadata.empty); + super(null, TypeMetadata.EMPTY); } @Override - public JCNoType clone(TypeMetadata md) { + public JCNoType cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to a JCNoType"); } @@ -1973,11 +2053,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { public JCVoidType() { // Void cannot be annotated - super(null, TypeMetadata.empty); + super(null, TypeMetadata.EMPTY); } @Override - public JCVoidType clone(TypeMetadata md) { + public JCVoidType cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to a void type"); } @@ -2008,11 +2088,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { static class BottomType extends Type implements NullType { public BottomType() { // Bottom is a synthesized internal type, so it cannot be annotated - super(null, TypeMetadata.empty); + super(null, TypeMetadata.EMPTY); } @Override - public BottomType clone(TypeMetadata md) { + public BottomType cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to a bottom type"); } @@ -2077,8 +2157,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { } @Override - public ErrorType clone(TypeMetadata md) { - return new ErrorType(originalType, tsym, md); + public ErrorType cloneWithMetadata(TypeMetadata md) { + return new ErrorType(originalType, tsym, md) { + @Override + public Type baseType() { return ErrorType.this.baseType(); } + }; } @Override @@ -2145,11 +2228,11 @@ public abstract class Type extends AnnoConstruct implements TypeMirror { public UnknownType() { // Unknown is a synthesized internal type, so it cannot be // annotated. - super(null, TypeMetadata.empty); + super(null, TypeMetadata.EMPTY); } @Override - public UnknownType clone(TypeMetadata md) { + public UnknownType cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to an unknown type"); } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java index d3aecdb2126..3d1c6b5e795 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -118,14 +118,10 @@ public class TypeAnnotationPosition { public static final List emptyPath = List.nil(); - // NOTE: All of these will be converted to final fields eventually. - public final TargetType type; // For generic/array types. - // This field is in the process of being made final. Do not - // introduce new mutations. public List location; // Tree position. diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java index d7a03ee4665..1bc02106b2e 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ import javax.lang.model.type.TypeKind; import javax.tools.JavaFileObject; +import com.sun.tools.javac.code.Attribute.Array; import com.sun.tools.javac.code.Attribute.TypeCompound; import com.sun.tools.javac.code.Type.ArrayType; import com.sun.tools.javac.code.Type.CapturedType; @@ -47,8 +48,8 @@ import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntry; import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntryKind; import com.sun.tools.javac.code.Symbol.VarSymbol; import com.sun.tools.javac.code.Symbol.MethodSymbol; +import com.sun.tools.javac.code.TypeMetadata.Entry.Kind; import com.sun.tools.javac.comp.Annotate; -import com.sun.tools.javac.comp.Annotate.Worker; import com.sun.tools.javac.comp.Attr; import com.sun.tools.javac.comp.AttrContext; import com.sun.tools.javac.comp.Env; @@ -71,7 +72,6 @@ import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Names; -import com.sun.tools.javac.util.Options; import static com.sun.tools.javac.code.Kinds.Kind.*; @@ -105,7 +105,6 @@ public class TypeAnnotations { syms = Symtab.instance(context); annotate = Annotate.instance(context); attr = Attr.instance(context); - Options options = Options.instance(context); } /** @@ -113,12 +112,9 @@ public class TypeAnnotations { * determine the correct positions for type annotations. * This version only visits types in signatures and should be * called from MemberEnter. - * The method takes the Annotate object as parameter and - * adds an Annotate.Worker to the correct Annotate queue for - * later processing. */ public void organizeTypeAnnotationsSignatures(final Env env, final JCClassDecl tree) { - annotate.afterRepeated( new Worker() { + annotate.afterTypes(new Runnable() { @Override public void run() { JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); @@ -129,11 +125,11 @@ public class TypeAnnotations { log.useSource(oldSource); } } - } ); + }); } public void validateTypeAnnotationsSignatures(final Env env, final JCClassDecl tree) { - annotate.validate(new Worker() { //validate annotations + annotate.validate(new Runnable() { //validate annotations @Override public void run() { JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); @@ -144,7 +140,7 @@ public class TypeAnnotations { log.useSource(oldSource); } } - } ); + }); } /** @@ -155,101 +151,106 @@ public class TypeAnnotations { new TypeAnnotationPositions(false).scan(tree); } - public enum AnnotationType { DECLARATION, TYPE, BOTH } + public enum AnnotationType { DECLARATION, TYPE, NONE, BOTH } + + public List annotationTargets(Attribute.Compound anno) { + Attribute.Compound atTarget = anno.type.tsym.getAnnotationTypeMetadata().getTarget(); + if (atTarget == null) { + return null; + } + + Attribute atValue = atTarget.member(names.value); + if (!(atValue instanceof Attribute.Array)) { + return null; + } + + List targets = ((Array)atValue).getValue(); + if (targets.stream().anyMatch(a -> !(a instanceof Attribute.Enum))) { + return null; + } + + return targets; + } /** * Determine whether an annotation is a declaration annotation, * a type annotation, or both. */ - public AnnotationType annotationType(Attribute.Compound a, Symbol s) { - Attribute.Compound atTarget = - a.type.tsym.attribute(syms.annotationTargetType.tsym); - if (atTarget == null) { - return inferTargetMetaInfo(a, s); - } - Attribute atValue = atTarget.member(names.value); - if (!(atValue instanceof Attribute.Array)) { - Assert.error("annotationType(): bad @Target argument " + atValue + - " (" + atValue.getClass() + ")"); - return AnnotationType.DECLARATION; // error recovery - } - Attribute.Array arr = (Attribute.Array) atValue; - boolean isDecl = false, isType = false; - for (Attribute app : arr.values) { - if (!(app instanceof Attribute.Enum)) { - Assert.error("annotationType(): unrecognized Attribute kind " + app + - " (" + app.getClass() + ")"); - isDecl = true; - continue; - } - Attribute.Enum e = (Attribute.Enum) app; - if (e.value.name == names.TYPE) { - if (s.kind == TYP) - isDecl = true; - } else if (e.value.name == names.FIELD) { - if (s.kind == VAR && - s.owner.kind != MTH) - isDecl = true; - } else if (e.value.name == names.METHOD) { - if (s.kind == MTH && - !s.isConstructor()) - isDecl = true; - } else if (e.value.name == names.PARAMETER) { - if (s.kind == VAR && - s.owner.kind == MTH && - (s.flags() & Flags.PARAMETER) != 0) - isDecl = true; - } else if (e.value.name == names.CONSTRUCTOR) { - if (s.kind == MTH && - s.isConstructor()) - isDecl = true; - } else if (e.value.name == names.LOCAL_VARIABLE) { - if (s.kind == VAR && - s.owner.kind == MTH && - (s.flags() & Flags.PARAMETER) == 0) - isDecl = true; - } else if (e.value.name == names.ANNOTATION_TYPE) { - if (s.kind == TYP && - (s.flags() & Flags.ANNOTATION) != 0) - isDecl = true; - } else if (e.value.name == names.PACKAGE) { - if (s.kind == PCK) - isDecl = true; - } else if (e.value.name == names.TYPE_USE) { - if (s.kind == TYP || - s.kind == VAR || - (s.kind == MTH && !s.isConstructor() && - !s.type.getReturnType().hasTag(TypeTag.VOID)) || - (s.kind == MTH && s.isConstructor())) - isType = true; - } else if (e.value.name == names.TYPE_PARAMETER) { - /* Irrelevant in this case */ - // TYPE_PARAMETER doesn't aid in distinguishing between - // Type annotations and declaration annotations on an - // Element - } else { - Assert.error("annotationType(): unrecognized Attribute name " + e.value.name + - " (" + e.value.name.getClass() + ")"); - isDecl = true; - } - } - if (isDecl && isType) { + public AnnotationType annotationTargetType(Attribute.Compound a, Symbol s) { + List targets = annotationTargets(a); + return (targets == null) ? + AnnotationType.DECLARATION : + targets.stream() + .map(attr -> targetToAnnotationType(attr, s)) + .reduce(AnnotationType.NONE, this::combineAnnotationType); + } + + private AnnotationType combineAnnotationType(AnnotationType at1, AnnotationType at2) { + if (at1 == AnnotationType.NONE) { + return at2; + } else if (at2 == AnnotationType.NONE) { + return at1; + } else if (at1 != at2) { return AnnotationType.BOTH; - } else if (isType) { - return AnnotationType.TYPE; } else { + return at1; + } + } + + private AnnotationType targetToAnnotationType(Attribute a, Symbol s) { + Attribute.Enum e = (Attribute.Enum)a; + if (e.value.name == names.TYPE) { + if (s.kind == TYP) + return AnnotationType.DECLARATION; + } else if (e.value.name == names.FIELD) { + if (s.kind == VAR && + s.owner.kind != MTH) + return AnnotationType.DECLARATION; + } else if (e.value.name == names.METHOD) { + if (s.kind == MTH && + !s.isConstructor()) + return AnnotationType.DECLARATION; + } else if (e.value.name == names.PARAMETER) { + if (s.kind == VAR && + s.owner.kind == MTH && + (s.flags() & Flags.PARAMETER) != 0) + return AnnotationType.DECLARATION; + } else if (e.value.name == names.CONSTRUCTOR) { + if (s.kind == MTH && + s.isConstructor()) + return AnnotationType.DECLARATION; + } else if (e.value.name == names.LOCAL_VARIABLE) { + if (s.kind == VAR && + s.owner.kind == MTH && + (s.flags() & Flags.PARAMETER) == 0) + return AnnotationType.DECLARATION; + } else if (e.value.name == names.ANNOTATION_TYPE) { + if (s.kind == TYP && + (s.flags() & Flags.ANNOTATION) != 0) + return AnnotationType.DECLARATION; + } else if (e.value.name == names.PACKAGE) { + if (s.kind == PCK) + return AnnotationType.DECLARATION; + } else if (e.value.name == names.TYPE_USE) { + if (s.kind == TYP || + s.kind == VAR || + (s.kind == MTH && !s.isConstructor() && + !s.type.getReturnType().hasTag(TypeTag.VOID)) || + (s.kind == MTH && s.isConstructor())) + return AnnotationType.TYPE; + } else if (e.value.name == names.TYPE_PARAMETER) { + /* Irrelevant in this case */ + // TYPE_PARAMETER doesn't aid in distinguishing between + // Type annotations and declaration annotations on an + // Element + } else { + Assert.error("annotationTargetType(): unrecognized Attribute name " + e.value.name + + " (" + e.value.name.getClass() + ")"); return AnnotationType.DECLARATION; } + return AnnotationType.NONE; } - /** Infer the target annotation kind, if none is give. - * We only infer declaration annotations. - */ - private static AnnotationType inferTargetMetaInfo(Attribute.Compound a, Symbol s) { - return AnnotationType.DECLARATION; - } - - private class TypeAnnotationPositions extends TreeScanner { private final boolean sigOnly; @@ -262,18 +263,29 @@ public class TypeAnnotations { * When traversing the AST we keep the "frames" of visited * trees in order to determine the position of annotations. */ - private ListBuffer frames = new ListBuffer<>(); + private List frames = List.nil(); - protected void push(JCTree t) { frames = frames.prepend(t); } - protected JCTree pop() { return frames.next(); } + protected void push(JCTree t) { + frames = frames.prepend(t); + } + protected JCTree pop() { + JCTree t = frames.head; + frames = frames.tail; + return t; + } // could this be frames.elems.tail.head? - private JCTree peek2() { return frames.toList().tail.head; } + private JCTree peek2() { + return frames.tail.head; + } @Override public void scan(JCTree tree) { push(tree); - super.scan(tree); - pop(); + try { + super.scan(tree); + } finally { + pop(); + } } /** @@ -283,41 +295,44 @@ public class TypeAnnotations { * we never build an JCAnnotatedType. This step finds these * annotations and marks them as if they were part of the type. */ - private void separateAnnotationsKinds(JCTree typetree, Type type, Symbol sym, - TypeAnnotationPosition pos) { - List annotations = sym.getRawAttributes(); + private void separateAnnotationsKinds(JCTree typetree, Type type, + Symbol sym, TypeAnnotationPosition pos) + { + List allAnnotations = sym.getRawAttributes(); ListBuffer declAnnos = new ListBuffer<>(); ListBuffer typeAnnos = new ListBuffer<>(); ListBuffer onlyTypeAnnos = new ListBuffer<>(); - for (Attribute.Compound a : annotations) { - switch (annotationType(a, sym)) { - case DECLARATION: - declAnnos.append(a); - break; - case BOTH: { - declAnnos.append(a); - Attribute.TypeCompound ta = toTypeCompound(a, pos); - typeAnnos.append(ta); - break; - } - case TYPE: { - Attribute.TypeCompound ta = toTypeCompound(a, pos); - typeAnnos.append(ta); - // Also keep track which annotations are only type annotations - onlyTypeAnnos.append(ta); - break; - } + for (Attribute.Compound a : allAnnotations) { + switch (annotationTargetType(a, sym)) { + case DECLARATION: + declAnnos.append(a); + break; + case BOTH: { + declAnnos.append(a); + Attribute.TypeCompound ta = toTypeCompound(a, pos); + typeAnnos.append(ta); + break; + } + case TYPE: { + Attribute.TypeCompound ta = toTypeCompound(a, pos); + typeAnnos.append(ta); + // Also keep track which annotations are only type annotations + onlyTypeAnnos.append(ta); + break; + } } } - sym.resetAnnotations(); - sym.setDeclarationAttributes(declAnnos.toList()); - + // If we have no type annotations we are done for this Symbol if (typeAnnos.isEmpty()) { return; } + // Reset decl annotations to the set {all - type only} + sym.resetAnnotations(); + sym.setDeclarationAttributes(declAnnos.toList()); + List typeAnnotations = typeAnnos.toList(); if (type == null) { @@ -328,7 +343,7 @@ public class TypeAnnotations { // Declaration annotations are always allowed on constructor returns. // Therefore, use typeAnnotations instead of onlyTypeAnnos. - type = typeWithAnnotations(typetree, type, typeAnnotations, typeAnnotations); + typeWithAnnotations(typetree, type, typeAnnotations, typeAnnotations, pos); // Note that we don't use the result, the call to // typeWithAnnotations side-effects the type annotation positions. // This is important for constructors of nested classes. @@ -336,8 +351,8 @@ public class TypeAnnotations { return; } - // type is non-null and annotations are added to that type - type = typeWithAnnotations(typetree, type, typeAnnotations, onlyTypeAnnos.toList()); + // type is non-null, add type annotations from declaration context to the type + type = typeWithAnnotations(typetree, type, typeAnnotations, onlyTypeAnnos.toList(), pos); if (sym.getKind() == ElementKind.METHOD) { sym.type.asMethodType().restype = type; @@ -390,59 +405,23 @@ public class TypeAnnotations { // Note that it is assumed that all annotations share the same position. private Type typeWithAnnotations(final JCTree typetree, final Type type, final List annotations, - final List onlyTypeAnnotations) { - //System.err.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s, onlyTypeAnnotations: %s)%n", - // typetree, type, annotations, onlyTypeAnnotations); + final List onlyTypeAnnotations, + final TypeAnnotationPosition pos) + { if (annotations.isEmpty()) { return type; } - if (type.hasTag(TypeTag.ARRAY)) { - Type.ArrayType arType = (Type.ArrayType) type; - Type.ArrayType tomodify = new Type.ArrayType(null, arType.tsym); - Type toreturn; - if (type.isAnnotated()) { - toreturn = tomodify.annotatedType(type.getAnnotationMirrors()); - } else { - toreturn = tomodify; - } - JCArrayTypeTree arTree = arrayTypeTree(typetree); + if (type.hasTag(TypeTag.ARRAY)) + return rewriteArrayType((ArrayType)type, annotations, pos); - ListBuffer depth = new ListBuffer<>(); - depth = depth.append(TypePathEntry.ARRAY); - while (arType.elemtype.hasTag(TypeTag.ARRAY)) { - if (arType.elemtype.isAnnotated()) { - Type aelemtype = arType.elemtype; - arType = (Type.ArrayType) aelemtype; - ArrayType prevToMod = tomodify; - tomodify = new Type.ArrayType(null, arType.tsym); - prevToMod.elemtype = tomodify.annotatedType(arType.elemtype.getAnnotationMirrors()); - } else { - arType = (Type.ArrayType) arType.elemtype; - tomodify.elemtype = new Type.ArrayType(null, arType.tsym); - tomodify = (Type.ArrayType) tomodify.elemtype; - } - arTree = arrayTypeTree(arTree.elemtype); - depth = depth.append(TypePathEntry.ARRAY); - } - Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations, onlyTypeAnnotations); - tomodify.elemtype = arelemType; - { - // All annotations share the same position; modify the first one. - Attribute.TypeCompound a = annotations.get(0); - TypeAnnotationPosition p = a.position; - p.location = p.location.prependList(depth.toList()); - } - typetree.type = toreturn; - return toreturn; - } else if (type.hasTag(TypeTag.TYPEVAR)) { - // Nothing to do for type variables. - return type; + if (type.hasTag(TypeTag.TYPEVAR)) { + return type.annotatedType(onlyTypeAnnotations); } else if (type.getKind() == TypeKind.UNION) { // There is a TypeKind, but no TypeTag. - JCTypeUnion tutree = (JCTypeUnion) typetree; + JCTypeUnion tutree = (JCTypeUnion)typetree; JCExpression fst = tutree.alternatives.get(0); - Type res = typeWithAnnotations(fst, fst.type, annotations, onlyTypeAnnotations); + Type res = typeWithAnnotations(fst, fst.type, annotations, onlyTypeAnnotations, pos); fst.type = res; // TODO: do we want to set res as first element in uct.alternatives? // UnionClassType uct = (com.sun.tools.javac.code.Type.UnionClassType)type; @@ -459,8 +438,8 @@ public class TypeAnnotations { enclTy.getKind() != TypeKind.NONE && enclTy.getKind() != TypeKind.ERROR && (enclTr.getKind() == JCTree.Kind.MEMBER_SELECT || - enclTr.getKind() == JCTree.Kind.PARAMETERIZED_TYPE || - enclTr.getKind() == JCTree.Kind.ANNOTATED_TYPE)) { + enclTr.getKind() == JCTree.Kind.PARAMETERIZED_TYPE || + enclTr.getKind() == JCTree.Kind.ANNOTATED_TYPE)) { // Iterate also over the type tree, not just the type: the type is already // completely resolved and we cannot distinguish where the annotation // belongs for a nested type. @@ -483,20 +462,20 @@ public class TypeAnnotations { if (enclTy != null && enclTy.hasTag(TypeTag.NONE)) { switch (onlyTypeAnnotations.size()) { - case 0: - // Don't issue an error if all type annotations are - // also declaration annotations. - // If the annotations are also declaration annotations, they are - // illegal as type annotations but might be legal as declaration annotations. - // The normal declaration annotation checks make sure that the use is valid. - break; - case 1: - log.error(typetree.pos(), "cant.type.annotate.scoping.1", - onlyTypeAnnotations); - break; - default: - log.error(typetree.pos(), "cant.type.annotate.scoping", - onlyTypeAnnotations); + case 0: + // Don't issue an error if all type annotations are + // also declaration annotations. + // If the annotations are also declaration annotations, they are + // illegal as type annotations but might be legal as declaration annotations. + // The normal declaration annotation checks make sure that the use is valid. + break; + case 1: + log.error(typetree.pos(), "cant.type.annotate.scoping.1", + onlyTypeAnnotations); + break; + default: + log.error(typetree.pos(), "cant.type.annotate.scoping", + onlyTypeAnnotations); } return type; } @@ -539,15 +518,62 @@ public class TypeAnnotations { } } - private JCArrayTypeTree arrayTypeTree(JCTree typetree) { - if (typetree.getKind() == JCTree.Kind.ARRAY_TYPE) { - return (JCArrayTypeTree) typetree; - } else if (typetree.getKind() == JCTree.Kind.ANNOTATED_TYPE) { - return (JCArrayTypeTree) ((JCAnnotatedType)typetree).underlyingType; - } else { - Assert.error("Could not determine array type from type tree: " + typetree); - return null; + /** + * Create a copy of the {@code Type type} with the help of the Tree for a type + * {@code JCTree typetree} inserting all type annotations in {@code annotations} to the + * innermost array component type. + * + * SIDE EFFECT: Update position for the annotations to be {@code pos}. + */ + private Type rewriteArrayType(ArrayType type, List annotations, TypeAnnotationPosition pos) { + ArrayType tomodify = new ArrayType(type); + ArrayType res = tomodify; + + List loc = List.nil(); + + // peel one and update loc + Type tmpType = type.elemtype; + loc = loc.prepend(TypePathEntry.ARRAY); + + while (tmpType.hasTag(TypeTag.ARRAY)) { + ArrayType arr = (ArrayType)tmpType; + + // Update last type with new element type + ArrayType tmp = new ArrayType(arr); + tomodify.elemtype = tmp; + tomodify = tmp; + + tmpType = arr.elemtype; + loc = loc.prepend(TypePathEntry.ARRAY); } + + // Fix innermost element type + Type elemType; + if (tmpType.getMetadata() != null) { + List tcs; + if (tmpType.getAnnotationMirrors().isEmpty()) { + tcs = annotations; + } else { + // Special case, lets prepend + tcs = annotations.appendList(tmpType.getAnnotationMirrors()); + } + elemType = tmpType.cloneWithMetadata(tmpType + .getMetadata() + .without(Kind.ANNOTATIONS) + .combine(new TypeMetadata.Annotations(tcs))); + } else { + elemType = tmpType.cloneWithMetadata(new TypeMetadata(new TypeMetadata.Annotations(annotations))); + } + tomodify.elemtype = elemType; + + // Update positions + for (TypeCompound tc : annotations) { + if (tc.position == null) + tc.position = pos; + tc.position.location = loc; + } + + return res; } /** Return a copy of the first type that only differs by @@ -569,7 +595,6 @@ public class TypeAnnotations { private Type typeWithAnnotations(final Type type, final Type stopAt, final List annotations) { - //System.err.println("typeWithAnnotations " + type + " " + annotations + " stopAt " + stopAt); Visitor> visitor = new Type.Visitor>() { @Override @@ -660,20 +685,14 @@ public class TypeAnnotations { /* This is the beginning of the second part of organizing * type annotations: determine the type annotation positions. */ - - // This method is considered deprecated, and will be removed - // in the near future. Don't use it for anything new. private TypeAnnotationPosition resolveFrame(JCTree tree, JCTree frame, List path, JCLambda currentLambda, int outer_type_index, - ListBuffer location) { - /* - System.out.println("Resolving tree: " + tree + " kind: " + tree.getKind()); - System.out.println(" Framing tree: " + frame + " kind: " + frame.getKind()); - */ + ListBuffer location) + { // Note that p.offset is set in // com.sun.tools.javac.jvm.Gen.setTypeAnnotationPositions(int) @@ -695,20 +714,17 @@ public class TypeAnnotations { if (frameNewClass.def != null) { // Special handling for anonymous class instantiations final JCClassDecl frameClassDecl = frameNewClass.def; - if (frameClassDecl.extending == tree) { - return TypeAnnotationPosition - .classExtends(location.toList(), currentLambda, - frame.pos); - } else if (frameClassDecl.implementing.contains(tree)) { + if (frameClassDecl.implementing.contains(tree)) { final int type_index = frameClassDecl.implementing.indexOf(tree); return TypeAnnotationPosition .classExtends(location.toList(), currentLambda, type_index, frame.pos); } else { - // In contrast to CLASS below, typarams cannot occur here. - throw new AssertionError("Could not determine position of tree " + tree + - " within frame " + frame); + //for encl.new @TA Clazz(), tree may be different from frameClassDecl.extending + return TypeAnnotationPosition + .classExtends(location.toList(), currentLambda, + frame.pos); } } else if (frameNewClass.typeargs.contains(tree)) { final int type_index = @@ -1120,29 +1136,31 @@ public class TypeAnnotations { // Nothing to do for separateAnnotationsKinds if // there are no annotations of either kind. // TODO: make sure there are no declaration annotations. - final TypeAnnotationPosition pos = - TypeAnnotationPosition.methodReceiver(tree.recvparam.vartype.pos); - separateAnnotationsKinds(tree.recvparam.vartype, - tree.recvparam.sym.type, - tree.recvparam.sym, pos); + final TypeAnnotationPosition pos = TypeAnnotationPosition.methodReceiver(tree.recvparam.vartype.pos); + push(tree.recvparam); + try { + separateAnnotationsKinds(tree.recvparam.vartype, tree.recvparam.sym.type, tree.recvparam.sym, pos); + } finally { + pop(); + } } int i = 0; for (JCVariableDecl param : tree.params) { if (!param.mods.annotations.isEmpty()) { // Nothing to do for separateAnnotationsKinds if // there are no annotations of either kind. - final TypeAnnotationPosition pos = - TypeAnnotationPosition.methodParameter(i, param.vartype.pos); - separateAnnotationsKinds(param.vartype, - param.sym.type, - param.sym, pos); + final TypeAnnotationPosition pos = TypeAnnotationPosition.methodParameter(i, param.vartype.pos); + push(param); + try { + separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos); + } finally { + pop(); + } } ++i; } } - push(tree); - // super.visitMethodDef(tree); if (sigOnly) { scan(tree.mods); scan(tree.restype); @@ -1154,7 +1172,6 @@ public class TypeAnnotations { scan(tree.defaultValue); scan(tree.body); } - pop(); } /* Store a reference to the current lambda expression, to @@ -1172,18 +1189,20 @@ public class TypeAnnotations { if (!param.mods.annotations.isEmpty()) { // Nothing to do for separateAnnotationsKinds if // there are no annotations of either kind. - final TypeAnnotationPosition pos = - TypeAnnotationPosition.methodParameter(tree, i, - param.vartype.pos); - separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos); + final TypeAnnotationPosition pos = TypeAnnotationPosition + .methodParameter(tree, i, param.vartype.pos); + push(param); + try { + separateAnnotationsKinds(param.vartype, param.sym.type, param.sym, pos); + } finally { + pop(); + } } ++i; } - push(tree); scan(tree.body); scan(tree.params); - pop(); } finally { currentLambda = prevLambda; } @@ -1227,17 +1246,14 @@ public class TypeAnnotations { // No type annotations can occur here. } else { // There is nothing else in a variable declaration that needs separation. - Assert.error("Unhandled variable kind: " + tree + " of kind: " + tree.sym.getKind()); + Assert.error("Unhandled variable kind"); } - push(tree); - // super.visitVarDef(tree); scan(tree.mods); scan(tree.vartype); if (!sigOnly) { scan(tree.init); } - pop(); } @Override @@ -1363,31 +1379,37 @@ public class TypeAnnotations { scan(tree.elems); } - private void findPosition(JCTree tree, JCTree frame, List annotations) { + + private void findTypeCompoundPosition(JCTree tree, JCTree frame, List annotations) { if (!annotations.isEmpty()) { - /* - System.err.println("Finding pos for: " + annotations); - System.err.println(" tree: " + tree + " kind: " + tree.getKind()); - System.err.println(" frame: " + frame + " kind: " + frame.getKind()); - */ final TypeAnnotationPosition p = - resolveFrame(tree, frame, frames.toList(), currentLambda, 0, - new ListBuffer()); + resolveFrame(tree, frame, frames, currentLambda, 0, new ListBuffer<>()); + for (TypeCompound tc : annotations) + tc.position = p; + } + } + + private void findPosition(JCTree tree, JCTree frame, List annotations) { + if (!annotations.isEmpty()) + { + final TypeAnnotationPosition p = + resolveFrame(tree, frame, frames, currentLambda, 0, new ListBuffer<>()); + setTypeAnnotationPos(annotations, p); } } - private void setTypeAnnotationPos(List annotations, - TypeAnnotationPosition position) { + private void setTypeAnnotationPos(List annotations, TypeAnnotationPosition position) + { + // attribute might be null during DeferredAttr; + // we will be back later. for (JCAnnotation anno : annotations) { - // attribute might be null during DeferredAttr; - // we will be back later. - if (anno.attribute != null) { + if (anno.attribute != null) ((Attribute.TypeCompound) anno.attribute).position = position; - } } } + @Override public String toString() { return super.toString() + ": sigOnly: " + sigOnly; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeMetadata.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeMetadata.java index 22e821e5ee9..71aefc3a697 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeMetadata.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeMetadata.java @@ -30,46 +30,63 @@ import com.sun.tools.javac.util.Assert; import com.sun.tools.javac.util.List; import java.util.EnumMap; import java.util.HashSet; -import java.util.Map; import java.util.Set; /** - * A super-interface for all type metadata elements. Metadata classes - * can be created for any metadata on types with the following - * properties: + * TypeMetadata is essentially an immutable {@code EnumMap>} * - *

    - *
  • They have a default value (preferably empty)
  • - *
  • The field is usually the default value
  • - *
  • Different values of the field are visible, and denote distinct - * types
  • - *
+ * A metadata class represented by a subtype of Entry can express a property on a Type instance. + * Thers should be at most one instance of an Entry per Entry.Kind on any given Type instance. + * + * Metadata classes of a specific kind are responsible for how they combine themselvs. + * + * @implNote {@code Entry:combine} need not be commutative. */ public class TypeMetadata { + public static final TypeMetadata EMPTY = new TypeMetadata(); - public static final TypeMetadata empty = new TypeMetadata(); - private final EnumMap contents; + private final EnumMap contents; + /** + * Create a new empty TypeMetadata map. + */ private TypeMetadata() { - contents = new EnumMap(Element.Kind.class); + contents = new EnumMap<>(Entry.Kind.class); } - public TypeMetadata(final Element elem) { + /** + * Create a new TypeMetadata map containing the Entry {@code elem}. + * + * @param elem the sole contents of this map + */ + public TypeMetadata(Entry elem) { this(); + Assert.checkNonNull(elem); contents.put(elem.kind(), elem); } - public TypeMetadata(final TypeMetadata other) { + /** + * Creates a copy of TypeMetadata {@code other} with a shallow copy the other's metadata contents. + * + * @param other the TypeMetadata to copy contents from. + */ + public TypeMetadata(TypeMetadata other) { + Assert.checkNonNull(other); contents = other.contents.clone(); } - public TypeMetadata copy() { - return new TypeMetadata(this); - } + /** + * Return a copy of this TypeMetadata with the metadata entry for {@code elem.kind()} combined + * with {@code elem}. + * + * @param elem the new value + * @return a new TypeMetadata updated with {@code Entry elem} + */ + public TypeMetadata combine(Entry elem) { + Assert.checkNonNull(elem); - public TypeMetadata combine(final Element elem) { - final TypeMetadata out = new TypeMetadata(this); - final Element.Kind key = elem.kind(); + TypeMetadata out = new TypeMetadata(this); + Entry.Kind key = elem.kind(); if (contents.containsKey(key)) { out.add(key, this.contents.get(key).combine(elem)); } else { @@ -78,17 +95,26 @@ public class TypeMetadata { return out; } - public TypeMetadata combine(final TypeMetadata other) { - final TypeMetadata out = new TypeMetadata(); - final Set keys = new HashSet<>(this.contents.keySet()); + /** + * Return a copy of this TypeMetadata with the metadata entry for all kinds from {@code other} + * combined with the same kind from this. + * + * @param other the TypeMetadata to combine with this + * @return a new TypeMetadata updated with all entries from {@code other} + */ + public TypeMetadata combineAll(TypeMetadata other) { + Assert.checkNonNull(other); + + TypeMetadata out = new TypeMetadata(); + Set keys = new HashSet<>(contents.keySet()); keys.addAll(other.contents.keySet()); - for(final Element.Kind key : keys) { - if (this.contents.containsKey(key)) { + for(Entry.Kind key : keys) { + if (contents.containsKey(key)) { if (other.contents.containsKey(key)) { - out.add(key, this.contents.get(key).combine(other.contents.get(key))); + out.add(key, contents.get(key).combine(other.contents.get(key))); } else { - out.add(key, this.contents.get(key)); + out.add(key, contents.get(key)); } } else if (other.contents.containsKey(key)) { out.add(key, other.contents.get(key)); @@ -97,26 +123,35 @@ public class TypeMetadata { return out; } - public Element get(final Element.Kind kind) { + /** + * Return a TypeMetadata with the metadata entry for {@code kind} removed. + * + * This may be the same instance or a new TypeMetadata. + * + * @param kind the {@code Kind} to remove metadata for + * @return a new TypeMetadata without {@code Kind kind} + */ + public TypeMetadata without(Entry.Kind kind) { + if (this == EMPTY || contents.get(kind) == null) + return this; + + TypeMetadata out = new TypeMetadata(this); + out.contents.remove(kind); + return out.contents.isEmpty() ? EMPTY : out; + } + + public Entry get(Entry.Kind kind) { return contents.get(kind); } - public boolean isEmpty() { - return contents.isEmpty(); - } - - private void add(final Element.Kind kind, final Element elem) { + private void add(Entry.Kind kind, Entry elem) { contents.put(kind, elem); } - private void addAll(final Map m) { - contents.putAll(m); - } - - public interface Element { + public interface Entry { public enum Kind { - ANNOTATIONS; + ANNOTATIONS } /** @@ -131,16 +166,18 @@ public class TypeMetadata { * @param other The metadata with which to combine this one. * @return The combined metadata. */ - public Element combine(Element other); + public Entry combine(Entry other); } /** * A type metadata object holding type annotations. */ - public static class Annotations implements Element { - private final List annos; + public static class Annotations implements Entry { + private List annos; - public Annotations(final List annos) { + public static final List TO_BE_SET = List.nil(); + + public Annotations(List annos) { this.annos = annos; } @@ -154,18 +191,16 @@ public class TypeMetadata { } @Override - public Annotations combine(final Element other) { - // Temporary: we should append the lists, but that won't - // work with type annotations today. Instead, we replace - // the list. - return new Annotations(((Annotations) other).annos); + public Annotations combine(Entry other) { + Assert.check(annos == TO_BE_SET); + annos = ((Annotations)other).annos; + return this; } @Override public Kind kind() { return Kind.ANNOTATIONS; } @Override - public String toString() { return "ANNOTATIONS { " + annos + " }"; } + public String toString() { return "ANNOTATIONS [ " + annos + " ]"; } } - } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java index 70ce0435abb..94c3d210e33 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java @@ -40,6 +40,7 @@ import javax.tools.JavaFileObject; import com.sun.tools.javac.code.Attribute.RetentionPolicy; import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.code.Type.UndetVar.InferenceBound; +import com.sun.tools.javac.code.TypeMetadata.Entry.Kind; import com.sun.tools.javac.comp.AttrContext; import com.sun.tools.javac.comp.Check; import com.sun.tools.javac.comp.Enter; @@ -809,7 +810,7 @@ public class Types { return isSubtype(t, s, false); } public boolean isSubtype(Type t, Type s, boolean capture) { - if (t == s) + if (t.equalsIgnoreMetadata(s)) return true; if (s.isPartial()) return isSuperType(s, t); @@ -1081,14 +1082,11 @@ public class Types { isSameTypeStrict.visit(t, s) : isSameTypeLoose.visit(t, s); } - public boolean isSameAnnotatedType(Type t, Type s) { - return isSameAnnotatedType.visit(t, s); - } // where abstract class SameTypeVisitor extends TypeRelation { public Boolean visitType(Type t, Type s) { - if (t == s) + if (t.equalsIgnoreMetadata(s)) return true; if (s.isPartial()) @@ -1281,39 +1279,6 @@ public class Types { // - TypeRelation isSameAnnotatedType = new LooseSameTypeVisitor() { - private Boolean compareAnnotations(Type t1, Type t2) { - List annos1 = t1.getAnnotationMirrors(); - List annos2 = t2.getAnnotationMirrors(); - return annos1.containsAll(annos2) && annos2.containsAll(annos1); - } - - @Override - public Boolean visitType(Type t, Type s) { - return compareAnnotations(t, s) && super.visitType(t, s); - } - - @Override - public Boolean visitWildcardType(WildcardType t, Type s) { - return compareAnnotations(t, s) && super.visitWildcardType(t, s); - } - - @Override - public Boolean visitClassType(ClassType t, Type s) { - return compareAnnotations(t, s) && super.visitClassType(t, s); - } - - @Override - public Boolean visitArrayType(ArrayType t, Type s) { - return compareAnnotations(t, s) && super.visitArrayType(t, s); - } - - @Override - public Boolean visitForAll(ForAll t, Type s) { - return compareAnnotations(t, s) && super.visitForAll(t, s); - } - }; - // public boolean containedBy(Type t, Type s) { switch (t.getTag()) { @@ -2167,7 +2132,7 @@ public class Types { * type parameters in t are deleted. */ public Type erasure(Type t) { - return eraseNotNeeded(t)? t : erasure(t, false); + return eraseNotNeeded(t) ? t : erasure(t, false); } //where private boolean eraseNotNeeded(Type t) { @@ -2187,23 +2152,23 @@ public class Types { } // where private TypeMapping erasure = new TypeMapping() { - private Type combineMetadata(final Type ty, - final TypeMetadata md) { - if (!md.isEmpty()) { - switch (ty.getKind()) { - default: return ty.clone(ty.metadata.combine(md)); - case OTHER: - case UNION: - case INTERSECTION: - case PACKAGE: - case EXECUTABLE: - case NONE: - case VOID: - case ERROR: - return ty; + private Type combineMetadata(final Type s, + final Type t) { + if (t.getMetadata() != TypeMetadata.EMPTY) { + switch (s.getKind()) { + case OTHER: + case UNION: + case INTERSECTION: + case PACKAGE: + case EXECUTABLE: + case NONE: + case VOID: + case ERROR: + return s; + default: return s.cloneWithMetadata(s.getMetadata().without(Kind.ANNOTATIONS)); } } else { - return ty; + return s; } } @@ -2212,7 +2177,7 @@ public class Types { return t; /*fast special case*/ else { //other cases already handled - return combineMetadata(t, t.getMetadata()); + return combineMetadata(t, t); } } @@ -2220,17 +2185,18 @@ public class Types { public Type visitClassType(ClassType t, Boolean recurse) { Type erased = t.tsym.erasure(Types.this); if (recurse) { - erased = new ErasedClassType(erased.getEnclosingType(),erased.tsym, t.getMetadata()); + erased = new ErasedClassType(erased.getEnclosingType(),erased.tsym, + t.getMetadata().without(Kind.ANNOTATIONS)); return erased; } else { - return combineMetadata(erased, t.getMetadata()); + return combineMetadata(erased, t); } } @Override public Type visitTypeVar(TypeVar t, Boolean recurse) { Type erased = erasure(t.bound, recurse); - return combineMetadata(erased, t.getMetadata()); + return combineMetadata(erased, t); } }; @@ -2932,7 +2898,7 @@ public class Types { public List subst(List ts, List from, List to) { - return new Subst(from, to).subst(ts); + return ts.map(new Subst(from, to)); } /** @@ -2942,10 +2908,10 @@ public class Types { * elements of the longer list. */ public Type subst(Type t, List from, List to) { - return new Subst(from, to).subst(t); + return t.map(new Subst(from, to)); } - private class Subst extends UnaryVisitor { + private class Subst extends TypeMapping { List from; List to; @@ -2964,76 +2930,25 @@ public class Types { this.to = to; } - Type subst(Type t) { - if (from.tail == null) - return t; - else - return visit(t); - } - - List subst(List ts) { - if (from.tail == null) - return ts; - boolean wild = false; - if (ts.nonEmpty() && from.nonEmpty()) { - Type head1 = subst(ts.head); - List tail1 = subst(ts.tail); - if (head1 != ts.head || tail1 != ts.tail) - return tail1.prepend(head1); - } - return ts; - } - - public Type visitType(Type t, Void ignored) { - return t; - } - - @Override - public Type visitMethodType(MethodType t, Void ignored) { - List argtypes = subst(t.argtypes); - Type restype = subst(t.restype); - List thrown = subst(t.thrown); - if (argtypes == t.argtypes && - restype == t.restype && - thrown == t.thrown) - return t; - else - return new MethodType(argtypes, restype, thrown, t.tsym); - } - @Override public Type visitTypeVar(TypeVar t, Void ignored) { for (List from = this.from, to = this.to; from.nonEmpty(); from = from.tail, to = to.tail) { - if (t == from.head) { + if (t.equalsIgnoreMetadata(from.head)) { return to.head.withTypeVar(t); } } return t; } - @Override - public Type visitUndetVar(UndetVar t, Void ignored) { - //do nothing - we should not replace inside undet variables - return t; - } - @Override public Type visitClassType(ClassType t, Void ignored) { if (!t.isCompound()) { - List typarams = t.getTypeArguments(); - List typarams1 = subst(typarams); - Type outer = t.getEnclosingType(); - Type outer1 = subst(outer); - if (typarams1 == typarams && outer1 == outer) - return t; - else - return new ClassType(outer1, typarams1, t.tsym, - t.getMetadata()); + return super.visitClassType(t, ignored); } else { - Type st = subst(supertype(t)); - List is = subst(interfaces(t)); + Type st = visit(supertype(t)); + List is = visit(interfaces(t), ignored); if (st == supertype(t) && is == interfaces(t)) return t; else @@ -3043,26 +2958,11 @@ public class Types { @Override public Type visitWildcardType(WildcardType t, Void ignored) { - Type bound = t.type; - if (t.kind != BoundKind.UNBOUND) - bound = subst(bound); - if (bound == t.type) { - return t; - } else { - if (t.isExtendsBound() && bound.isExtendsBound()) - bound = wildUpperBound(bound); - return new WildcardType(bound, t.kind, syms.boundClass, - t.bound, t.getMetadata()); + WildcardType t2 = (WildcardType)super.visitWildcardType(t, ignored); + if (t2 != t && t.isExtendsBound() && t2.type.isExtendsBound()) { + t2.type = wildUpperBound(t2.type); } - } - - @Override - public Type visitArrayType(ArrayType t, Void ignored) { - Type elemtype = subst(t.elemtype); - if (elemtype == t.elemtype) - return t; - else - return new ArrayType(elemtype, t.tsym, t.getMetadata()); + return t2; } @Override @@ -3075,21 +2975,25 @@ public class Types { Types.this.subst(t.qtype, t.tvars, freevars)); } List tvars1 = substBounds(t.tvars, from, to); - Type qtype1 = subst(t.qtype); + Type qtype1 = visit(t.qtype); if (tvars1 == t.tvars && qtype1 == t.qtype) { return t; } else if (tvars1 == t.tvars) { - return new ForAll(tvars1, qtype1); + return new ForAll(tvars1, qtype1) { + @Override + public boolean needsStripping() { + return true; + } + }; } else { - return new ForAll(tvars1, - Types.this.subst(qtype1, t.tvars, tvars1)); + return new ForAll(tvars1, Types.this.subst(qtype1, t.tvars, tvars1)) { + @Override + public boolean needsStripping() { + return true; + } + }; } } - - @Override - public Type visitErrorType(ErrorType t, Void ignored) { - return t; - } } public List substBounds(List tvars, @@ -4232,8 +4136,7 @@ public class Types { } private boolean containsTypeEquivalent(Type t, Type s) { - return - isSameType(t, s) || // shortcut + return isSameType(t, s) || // shortcut containsType(t, s) && containsType(s, t); } @@ -4675,7 +4578,7 @@ public class Types { return getRetention(a.type.tsym); } - public RetentionPolicy getRetention(Symbol sym) { + public RetentionPolicy getRetention(TypeSymbol sym) { RetentionPolicy vis = RetentionPolicy.CLASS; // the default Attribute.Compound c = sym.attribute(syms.retentionType.tsym); if (c != null) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java index feadce3ad42..35fe5bb2b47 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,28 +25,39 @@ package com.sun.tools.javac.comp; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; +import com.sun.tools.javac.code.*; +import com.sun.tools.javac.code.Attribute.Compound; +import com.sun.tools.javac.code.Attribute.TypeCompound; +import com.sun.tools.javac.code.Scope.WriteableScope; +import com.sun.tools.javac.code.Symbol.*; +import com.sun.tools.javac.code.TypeMetadata.Entry.Kind; +import com.sun.tools.javac.tree.JCTree; +import com.sun.tools.javac.tree.JCTree.*; +import com.sun.tools.javac.tree.TreeInfo; +import com.sun.tools.javac.tree.TreeMaker; +import com.sun.tools.javac.tree.TreeScanner; +import com.sun.tools.javac.util.*; +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; +import com.sun.tools.javac.util.List; import javax.tools.JavaFileObject; +import java.util.*; -import com.sun.tools.javac.util.*; -import com.sun.tools.javac.util.DefinedBy.Api; -import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; -import com.sun.tools.javac.code.*; -import com.sun.tools.javac.code.Symbol.*; -import com.sun.tools.javac.tree.*; -import com.sun.tools.javac.tree.JCTree.*; - -import static com.sun.tools.javac.code.Kinds.Kind.*; +import static com.sun.tools.javac.code.Flags.SYNTHETIC; +import static com.sun.tools.javac.code.Kinds.Kind.MTH; +import static com.sun.tools.javac.code.Kinds.Kind.VAR; +import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE; import static com.sun.tools.javac.code.TypeTag.ARRAY; import static com.sun.tools.javac.code.TypeTag.CLASS; -import static com.sun.tools.javac.tree.JCTree.Tag.*; +import static com.sun.tools.javac.tree.JCTree.Tag.ANNOTATION; +import static com.sun.tools.javac.tree.JCTree.Tag.ASSIGN; +import static com.sun.tools.javac.tree.JCTree.Tag.IDENT; +import static com.sun.tools.javac.tree.JCTree.Tag.NEWARRAY; -/** Enter annotations on symbols. Annotations accumulate in a queue, - * which is processed at the top level of any set of recursive calls - * requesting it be processed. +/** Enter annotations onto symbols and types (and trees). + * + * This is also a pseudo stage in the compiler taking care of scheduling when annotations are + * entered. * *

This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. @@ -64,95 +75,98 @@ public class Annotate { } private final Attr attr; - private final TreeMaker make; - private final Log log; - private final Symtab syms; - private final Names names; - private final Resolve rs; - private final Types types; - private final ConstFold cfolder; private final Check chk; - private final Lint lint; + private final ConstFold cfolder; private final DeferredLintHandler deferredLintHandler; - private final Source source; + private final Enter enter; + private final Lint lint; + private final Log log; + private final Names names; + private final Resolve resolve; + private final TreeMaker make; + private final Symtab syms; + private final TypeEnvs typeEnvs; + private final Types types; - private boolean allowTypeAnnos; - private boolean allowRepeatedAnnos; + private final Attribute theUnfinishedDefaultValue; + private final boolean allowRepeatedAnnos; protected Annotate(Context context) { context.put(annotateKey, this); + attr = Attr.instance(context); - make = TreeMaker.instance(context); - log = Log.instance(context); - syms = Symtab.instance(context); - names = Names.instance(context); - rs = Resolve.instance(context); - types = Types.instance(context); - cfolder = ConstFold.instance(context); chk = Check.instance(context); - source = Source.instance(context); - lint = Lint.instance(context); + cfolder = ConstFold.instance(context); deferredLintHandler = DeferredLintHandler.instance(context); + enter = Enter.instance(context); + log = Log.instance(context); + lint = Lint.instance(context); + make = TreeMaker.instance(context); + names = Names.instance(context); + resolve = Resolve.instance(context); + syms = Symtab.instance(context); + typeEnvs = TypeEnvs.instance(context); + types = Types.instance(context); + + theUnfinishedDefaultValue = new Attribute.Error(syms.errType); + + Source source = Source.instance(context); allowRepeatedAnnos = source.allowRepeatedAnnotations(); - allowTypeAnnos = source.allowTypeAnnotations(); } -/* ******************************************************************** - * Queue maintenance - *********************************************************************/ + /** Semaphore to delay annotation processing */ + private int blockCount = 0; - private int enterCount = 0; - - ListBuffer q = new ListBuffer<>(); - ListBuffer typesQ = new ListBuffer<>(); - ListBuffer repeatedQ = new ListBuffer<>(); - ListBuffer afterRepeatedQ = new ListBuffer<>(); - ListBuffer validateQ = new ListBuffer<>(); - - public void earlier(Worker a) { - q.prepend(a); + /** Called when annotations processing needs to be postponed. */ + public void blockAnnotations() { + blockCount++; } - public void normal(Worker a) { - q.append(a); - } - - public void typeAnnotation(Worker a) { - typesQ.append(a); - } - - public void repeated(Worker a) { - repeatedQ.append(a); - } - - public void afterRepeated(Worker a) { - afterRepeatedQ.append(a); - } - - public void validate(Worker a) { - validateQ.append(a); - } - - /** Called when the Enter phase starts. */ - public void enterStart() { - enterCount++; - } - - /** Called after the Enter phase completes. */ - public void enterDone() { - enterCount--; - flush(); + /** Called when annotation processing can be resumed. */ + public void unblockAnnotations() { + blockCount--; + if (blockCount == 0) + flush(); } /** Variant which allows for a delayed flush of annotations. * Needed by ClassReader */ - public void enterDoneWithoutFlush() { - enterCount--; + public void unblockAnnotationsNoFlush() { + blockCount--; } + /** are we blocking annotation processing? */ + public boolean annotationsBlocked() {return blockCount > 0; } + + public List fromAnnotations(List annotations) { + if (annotations.isEmpty()) { + return List.nil(); + } + + ListBuffer buf = new ListBuffer<>(); + for (JCAnnotation anno : annotations) { + Assert.checkNonNull(anno.attribute); + buf.append((TypeCompound) anno.attribute); + } + return buf.toList(); + } + + /** Annotate (used for everything else) */ + public void normal(Runnable r) { + q.append(r); + } + + /** Validate, triggers after 'normal' */ + public void validate(Runnable a) { + validateQ.append(a); + } + + /** Flush all annotation queues */ public void flush() { - if (enterCount != 0) return; - enterCount++; + if (annotationsBlocked()) return; + if (isFlushing()) return; + + startFlushing(); try { while (q.nonEmpty()) { q.next().run(); @@ -160,35 +174,502 @@ public class Annotate { while (typesQ.nonEmpty()) { typesQ.next().run(); } - while (repeatedQ.nonEmpty()) { - repeatedQ.next().run(); - } - while (afterRepeatedQ.nonEmpty()) { - afterRepeatedQ.next().run(); + while (afterTypesQ.nonEmpty()) { + afterTypesQ.next().run(); } while (validateQ.nonEmpty()) { validateQ.next().run(); } } finally { - enterCount--; + doneFlushing(); } } - /** A client that needs to run during {@link #flush()} registers an worker - * into one of the queues defined in this class. The queues are: {@link #earlier(Worker)}, - * {@link #normal(Worker)}, {@link #typeAnnotation(Worker)}, {@link #repeated(Worker)}, - * {@link #afterRepeated(Worker)}, {@link #validate(Worker)}. - * The {@link Worker#run()} method will called inside the {@link #flush()} - * call. Queues are empties in the abovementioned order. - */ - public interface Worker { - void run(); - String toString(); + private ListBuffer q = new ListBuffer<>(); + private ListBuffer validateQ = new ListBuffer<>(); + + private int flushCount = 0; + private boolean isFlushing() { return flushCount > 0; } + private void startFlushing() { flushCount++; } + private void doneFlushing() { flushCount--; } + + ListBuffer typesQ = new ListBuffer<>(); + ListBuffer afterTypesQ = new ListBuffer<>(); + + + public void typeAnnotation(Runnable a) { + typesQ.append(a); + } + + public void afterTypes(Runnable a) { + afterTypesQ.append(a); } + /** + * Queue annotations for later attribution and entering. This is probably the method you are looking for. + * + * @param annotations the list of JCAnnotations to attribute and enter + * @param localEnv the enclosing env + * @param s ths Symbol on which to enter the annotations + * @param deferPos report errors here + */ + public void annotateLater(List annotations, Env localEnv, + Symbol s, DiagnosticPosition deferPos) + { + if (annotations.isEmpty()) { + return; + } + + s.resetAnnotations(); // mark Annotations as incomplete for now + + normal(new Runnable() { + @Override + public String toString() { + return "Annotate " + annotations + " onto " + s + " in " + s.owner; + } + + @Override + public void run() { + Assert.check(s.annotationsPendingCompletion()); + JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); + DiagnosticPosition prevLintPos = + deferPos != null + ? deferredLintHandler.setPos(deferPos) + : deferredLintHandler.immediate(); + Lint prevLint = deferPos != null ? null : chk.setLint(lint); + try { + if (s.hasAnnotations() && annotations.nonEmpty()) + log.error(annotations.head.pos, "already.annotated", Kinds.kindName(s), s); + + Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null"); + annotateNow(s, annotations, localEnv, false); + } finally { + if (prevLint != null) + chk.setLint(prevLint); + deferredLintHandler.setPos(prevLintPos); + log.useSource(prev); + } + } + }); + + validate(new Runnable() { //validate annotations + @Override + public void run() { + JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); + try { + chk.validateAnnotations(annotations, s); + } finally { + log.useSource(prev); + } + } + + @Override + public String toString() { + return "validate annotations: " + annotations + " on " + s; + } + }); + } + + + /** Queue processing of an attribute default value. */ + public void annotateDefaultValueLater(JCExpression defaultValue, Env localEnv, + MethodSymbol m, DiagnosticPosition deferPos) + { + normal(new Runnable() { + @Override + public void run() { + JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); + DiagnosticPosition prevLintPos = deferredLintHandler.setPos(deferPos); + try { + enterDefaultValue(defaultValue, localEnv, m); + } finally { + deferredLintHandler.setPos(prevLintPos); + log.useSource(prev); + } + } + + @Override + public String toString() { + return "Annotate " + m.owner + "." + + m + " default " + defaultValue; + } + }); + + validate(new Runnable() { //validate annotations + @Override + public void run() { + JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); + try { + // if default value is an annotation, check it is a well-formed + // annotation value (e.g. no duplicate values, no missing values, etc.) + chk.validateAnnotationTree(defaultValue); + } finally { + log.useSource(prev); + } + } + + @Override + public String toString() { + return "Validate default value " + m.owner + "." + m + " default " + defaultValue; + } + }); + } + + /** Enter a default value for an annotation element. */ + private void enterDefaultValue(JCExpression defaultValue, + Env localEnv, MethodSymbol m) { + m.defaultValue = attributeAnnotationValue(m.type.getReturnType(), defaultValue, localEnv); + } + + /** + * Gather up annotations into a map from type symbols to lists of Compound attributes, + * then continue on with repeating annotations processing. + */ + private void annotateNow(Symbol toAnnotate, + List withAnnotations, Env env, boolean typeAnnotations) + { + Map> annotated = new LinkedHashMap<>(); + Map pos = new HashMap<>(); + boolean allowRepeatedAnnos = this.allowRepeatedAnnos; + + for (List al = withAnnotations; !al.isEmpty(); al = al.tail) { + JCAnnotation a = al.head; + + T c; + if (typeAnnotations) { + @SuppressWarnings("unchecked") + T tmp = (T)attributeTypeAnnotation(a, syms.annotationType, env); + c = tmp; + } else { + @SuppressWarnings("unchecked") + T tmp = (T)attributeAnnotation(a, syms.annotationType, env); + c = tmp; + } + + Assert.checkNonNull(c, "Failed to create annotation"); + + if (annotated.containsKey(a.type.tsym)) { + if (!allowRepeatedAnnos) { + log.error(a.pos(), "repeatable.annotations.not.supported.in.source"); + allowRepeatedAnnos = true; + } + ListBuffer l = annotated.get(a.type.tsym); + l = l.append(c); + annotated.put(a.type.tsym, l); + pos.put(c, a.pos()); + } else { + annotated.put(a.type.tsym, ListBuffer.of(c)); + pos.put(c, a.pos()); + } + + // Note: @Deprecated has no effect on local variables and parameters + if (!c.type.isErroneous() + && toAnnotate.owner.kind != MTH + && types.isSameType(c.type, syms.deprecatedType)) { + toAnnotate.flags_field |= Flags.DEPRECATED; + } + } + + List buf = List.nil(); + for (ListBuffer lb : annotated.values()) { + if (lb.size() == 1) { + buf = buf.prepend(lb.first()); + } else { + AnnotationContext ctx = new AnnotationContext<>(env, annotated, pos, typeAnnotations); + T res = makeContainerAnnotation(lb.toList(), ctx, toAnnotate); + if (res != null) + buf = buf.prepend(res); + } + } + + if (typeAnnotations) { + @SuppressWarnings("unchecked") + List attrs = (List)buf.reverse(); + toAnnotate.appendUniqueTypeAttributes(attrs); + } else { + @SuppressWarnings("unchecked") + List attrs = (List)buf.reverse(); + toAnnotate.resetAnnotations(); + toAnnotate.setDeclarationAttributes(attrs); + } + } + + /** + * Attribute and store a semantic representation of the annotation tree {@code tree} into the + * tree.attribute field. + * + * @param tree the tree representing an annotation + * @param expectedAnnotationType the expected (super)type of the annotation + * @param env the current env in where the annotation instance is found + */ + public Attribute.Compound attributeAnnotation(JCAnnotation tree, Type expectedAnnotationType, + Env env) + { + // The attribute might have been entered if it is Target or Repetable + // Because TreeCopier does not copy type, redo this if type is null + if (tree.attribute != null && tree.type != null) + return tree.attribute; + + List> elems = attributeAnnotationValues(tree, expectedAnnotationType, env); + Attribute.Compound ac = new Attribute.Compound(tree.type, elems); + + return tree.attribute = ac; + } + + /** Attribute and store a semantic representation of the type annotation tree {@code tree} into + * the tree.attribute field. + * + * @param a the tree representing an annotation + * @param expectedAnnotationType the expected (super)type of the annotation + * @param env the the current env in where the annotation instance is found + */ + public Attribute.TypeCompound attributeTypeAnnotation(JCAnnotation a, Type expectedAnnotationType, + Env env) + { + // The attribute might have been entered if it is Target or Repetable + // Because TreeCopier does not copy type, redo this if type is null + if (a.attribute == null || a.type == null || !(a.attribute instanceof Attribute.TypeCompound)) { + // Create a new TypeCompound + List> elems = + attributeAnnotationValues(a, expectedAnnotationType, env); + + Attribute.TypeCompound tc = + new Attribute.TypeCompound(a.type, elems, TypeAnnotationPosition.unknown); + a.attribute = tc; + return tc; + } else { + // Use an existing TypeCompound + return (Attribute.TypeCompound)a.attribute; + } + } + + /** + * Attribute annotation elements creating a list of pairs of the Symbol representing that + * element and the value of that element as an Attribute. */ + private List> attributeAnnotationValues(JCAnnotation a, + Type expected, Env env) + { + // The annotation might have had its type attributed (but not + // checked) by attr.attribAnnotationTypes during MemberEnter, + // in which case we do not need to do it again. + Type at = (a.annotationType.type != null ? + a.annotationType.type : attr.attribType(a.annotationType, env)); + a.type = chk.checkType(a.annotationType.pos(), at, expected); + + boolean isError = a.type.isErroneous(); + if (!a.type.tsym.isAnnotationType() && !isError) { + log.error(a.annotationType.pos(), + "not.annotation.type", a.type.toString()); + isError = true; + } + + // List of name=value pairs (or implicit "value=" if size 1) + List args = a.args; + + boolean elidedValue = false; + // special case: elided "value=" assumed + if (args.length() == 1 && !args.head.hasTag(ASSIGN)) { + args.head = make.at(args.head.pos). + Assign(make.Ident(names.value), args.head); + elidedValue = true; + } + + ListBuffer> buf = new ListBuffer<>(); + for (List tl = args; tl.nonEmpty(); tl = tl.tail) { + Pair p = attributeAnnotationNameValuePair(tl.head, a.type, isError, env, elidedValue); + if (p != null && !p.fst.type.isErroneous()) + buf.append(p); + } + return buf.toList(); + } + + // where + private Pair attributeAnnotationNameValuePair(JCExpression nameValuePair, + Type thisAnnotationType, boolean badAnnotation, Env env, boolean elidedValue) + { + if (!nameValuePair.hasTag(ASSIGN)) { + log.error(nameValuePair.pos(), "annotation.value.must.be.name.value"); + attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env); + return null; + } + JCAssign assign = (JCAssign)nameValuePair; + if (!assign.lhs.hasTag(IDENT)) { + log.error(nameValuePair.pos(), "annotation.value.must.be.name.value"); + attributeAnnotationValue(nameValuePair.type = syms.errType, nameValuePair, env); + return null; + } + + // Resolve element to MethodSym + JCIdent left = (JCIdent)assign.lhs; + Symbol method = resolve.resolveQualifiedMethod(elidedValue ? assign.rhs.pos() : left.pos(), + env, thisAnnotationType, + left.name, List.nil(), null); + left.sym = method; + left.type = method.type; + if (method.owner != thisAnnotationType.tsym && !badAnnotation) + log.error(left.pos(), "no.annotation.member", left.name, thisAnnotationType); + Type resultType = method.type.getReturnType(); + + // Compute value part + Attribute value = attributeAnnotationValue(resultType, assign.rhs, env); + nameValuePair.type = resultType; + + return method.type.isErroneous() ? null : new Pair<>((MethodSymbol)method, value); + + } + + /** Attribute an annotation element value */ + private Attribute attributeAnnotationValue(Type expectedElementType, JCExpression tree, + Env env) + { + //first, try completing the symbol for the annotation value - if acompletion + //error is thrown, we should recover gracefully, and display an + //ordinary resolution diagnostic. + try { + expectedElementType.tsym.complete(); + } catch(CompletionFailure e) { + log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym); + expectedElementType = syms.errType; + } + + if (expectedElementType.hasTag(ARRAY)) { + return getAnnotationArrayValue(expectedElementType, tree, env); + + } + + //error recovery + if (tree.hasTag(NEWARRAY)) { + if (!expectedElementType.isErroneous()) + log.error(tree.pos(), "annotation.value.not.allowable.type"); + JCNewArray na = (JCNewArray)tree; + if (na.elemtype != null) { + log.error(na.elemtype.pos(), "new.not.allowed.in.annotation"); + } + for (List l = na.elems; l.nonEmpty(); l=l.tail) { + attributeAnnotationValue(syms.errType, + l.head, + env); + } + return new Attribute.Error(syms.errType); + } + + if (expectedElementType.tsym.isAnnotationType()) { + if (tree.hasTag(ANNOTATION)) { + return attributeAnnotation((JCAnnotation)tree, expectedElementType, env); + } else { + log.error(tree.pos(), "annotation.value.must.be.annotation"); + expectedElementType = syms.errType; + } + } + + //error recovery + if (tree.hasTag(ANNOTATION)) { + if (!expectedElementType.isErroneous()) + log.error(tree.pos(), "annotation.not.valid.for.type", expectedElementType); + attributeAnnotation((JCAnnotation)tree, syms.errType, env); + return new Attribute.Error(((JCAnnotation)tree).annotationType.type); + } + + if (expectedElementType.isPrimitive() || + (types.isSameType(expectedElementType, syms.stringType) && !expectedElementType.hasTag(TypeTag.ERROR))) { + return getAnnotationPrimitiveValue(expectedElementType, tree, env); + } + + if (expectedElementType.tsym == syms.classType.tsym) { + return getAnnotationClassValue(expectedElementType, tree, env); + } + + if (expectedElementType.hasTag(CLASS) && + (expectedElementType.tsym.flags() & Flags.ENUM) != 0) { + return getAnnotationEnumValue(expectedElementType, tree, env); + } + + //error recovery: + if (!expectedElementType.isErroneous()) + log.error(tree.pos(), "annotation.value.not.allowable.type"); + return new Attribute.Error(attr.attribExpr(tree, env, expectedElementType)); + } + + private Attribute getAnnotationEnumValue(Type expectedElementType, JCExpression tree, Env env) { + Type result = attr.attribExpr(tree, env, expectedElementType); + Symbol sym = TreeInfo.symbol(tree); + if (sym == null || + TreeInfo.nonstaticSelect(tree) || + sym.kind != VAR || + (sym.flags() & Flags.ENUM) == 0) { + log.error(tree.pos(), "enum.annotation.must.be.enum.constant"); + return new Attribute.Error(result.getOriginalType()); + } + VarSymbol enumerator = (VarSymbol) sym; + return new Attribute.Enum(expectedElementType, enumerator); + } + + private Attribute getAnnotationClassValue(Type expectedElementType, JCExpression tree, Env env) { + Type result = attr.attribExpr(tree, env, expectedElementType); + if (result.isErroneous()) { + // Does it look like an unresolved class literal? + if (TreeInfo.name(tree) == names._class && + ((JCFieldAccess) tree).selected.type.isErroneous()) { + Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName(); + return new Attribute.UnresolvedClass(expectedElementType, + types.createErrorType(n, + syms.unknownSymbol, syms.classType)); + } else { + return new Attribute.Error(result.getOriginalType()); + } + } + + // Class literals look like field accesses of a field named class + // at the tree level + if (TreeInfo.name(tree) != names._class) { + log.error(tree.pos(), "annotation.value.must.be.class.literal"); + return new Attribute.Error(syms.errType); + } + return new Attribute.Class(types, + (((JCFieldAccess) tree).selected).type); + } + + private Attribute getAnnotationPrimitiveValue(Type expectedElementType, JCExpression tree, Env env) { + Type result = attr.attribExpr(tree, env, expectedElementType); + if (result.isErroneous()) + return new Attribute.Error(result.getOriginalType()); + if (result.constValue() == null) { + log.error(tree.pos(), "attribute.value.must.be.constant"); + return new Attribute.Error(expectedElementType); + } + result = cfolder.coerce(result, expectedElementType); + return new Attribute.Constant(expectedElementType, result.constValue()); + } + + private Attribute getAnnotationArrayValue(Type expectedElementType, JCExpression tree, Env env) { + // Special case, implicit array + if (!tree.hasTag(NEWARRAY)) { + tree = make.at(tree.pos). + NewArray(null, List.nil(), List.of(tree)); + } + + JCNewArray na = (JCNewArray)tree; + if (na.elemtype != null) { + log.error(na.elemtype.pos(), "new.not.allowed.in.annotation"); + } + ListBuffer buf = new ListBuffer<>(); + for (List l = na.elems; l.nonEmpty(); l=l.tail) { + buf.append(attributeAnnotationValue(types.elemtype(expectedElementType), + l.head, + env)); + } + na.type = expectedElementType; + return new Attribute. + Array(expectedElementType, buf.toArray(new Attribute[buf.length()])); + } + + /* ********************************* + * Support for repeating annotations + ***********************************/ + /** * This context contains all the information needed to synthesize new - * annotations trees by the completer for repeating annotations. + * annotations trees for repeating annotations. */ private class AnnotationContext { public final Env env; @@ -209,280 +690,15 @@ public class Annotate { this.pos = pos; this.isTypeCompound = isTypeCompound; } - - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("RepeatedContext["); - for (Map.Entry> entry : - annotated.entrySet()) { - sb.append(" "); - sb.append(entry.getKey()); - sb.append(" = { "); - sb.append(entry.getValue()); - sb.append(" }"); - } - sb.append(" ]"); - return sb.toString(); - } } - private static class Placeholder extends Attribute.Compound { - - private final Annotate.AnnotationContext ctx; - private final List placeholderFor; - private final Symbol on; - - public Placeholder(Annotate.AnnotationContext ctx, - List placeholderFor, Symbol on) { - super(on.type, List.>nil(), - placeholderFor.head.position); - this.ctx = ctx; - this.placeholderFor = placeholderFor; - this.on = on; - } - - @Override @DefinedBy(Api.LANGUAGE_MODEL) - public String toString() { - return ""; - } - - public List getPlaceholderFor() { - return placeholderFor; - } - - public Annotate.AnnotationContext getRepeatedContext() { - return ctx; - } - } - - -/* ******************************************************************** - * Compute an attribute from its annotation. - *********************************************************************/ - - /** Process a single compound annotation, returning its - * Attribute. Used from MemberEnter for attaching the attributes - * to the annotated symbol. - */ - Attribute.Compound enterAnnotation(JCAnnotation a, - Type expected, - Env env) { - List> elems = - enterAttributeValues(a, expected, env); - Attribute.Compound ac = new Attribute.Compound(a.type, elems); - a.attribute = ac; - - return ac; - } - - Attribute.TypeCompound enterTypeAnnotation(JCAnnotation a, - Type expected, - Env env) { - List> elems = - enterAttributeValues(a, expected, env); - - if (a.attribute == null || !(a.attribute instanceof Attribute.TypeCompound)) { - // Create a new TypeCompound - - Attribute.TypeCompound tc = - new Attribute.TypeCompound(a.type, elems, - // TODO: Eventually, we will get rid of this use of - // unknown, because we'll get a position from - // MemberEnter (task 8027262). - TypeAnnotationPosition.unknown); - a.attribute = tc; - return tc; - } else { - // Use an existing TypeCompound - return (Attribute.TypeCompound)a.attribute; - } - } - - private List> - enterAttributeValues(JCAnnotation a, - Type expected, - Env env) { - // The annotation might have had its type attributed (but not - // checked) by attr.attribAnnotationTypes during MemberEnter, - // in which case we do not need to do it again. - Type at = (a.annotationType.type != null ? a.annotationType.type - : attr.attribType(a.annotationType, env)); - a.type = chk.checkType(a.annotationType.pos(), at, expected); - boolean isError = a.type.isErroneous(); - if ((a.type.tsym.flags() & Flags.ANNOTATION) == 0 && !isError) { - log.error(a.annotationType.pos(), - "not.annotation.type", a.type.toString()); - isError = true; - } - List args = a.args; - boolean elidedValue = false; - if (args.length() == 1 && !args.head.hasTag(ASSIGN)) { - // special case: elided "value=" assumed - elidedValue = true; - args.head = make.at(args.head.pos). - Assign(make.Ident(names.value), args.head); - } - ListBuffer> buf = - new ListBuffer<>(); - for (List tl = args; tl.nonEmpty(); tl = tl.tail) { - JCExpression t = tl.head; - if (!t.hasTag(ASSIGN)) { - log.error(t.pos(), "annotation.value.must.be.name.value"); - enterAttributeValue(t.type = syms.errType, t, env); - continue; - } - JCAssign assign = (JCAssign)t; - if (!assign.lhs.hasTag(IDENT)) { - log.error(t.pos(), "annotation.value.must.be.name.value"); - enterAttributeValue(t.type = syms.errType, t, env); - continue; - } - JCIdent left = (JCIdent)assign.lhs; - Symbol method = rs.resolveQualifiedMethod(elidedValue ? assign.rhs.pos() : left.pos(), - env, - a.type, - left.name, - List.nil(), - null); - left.sym = method; - left.type = method.type; - if (method.owner != a.type.tsym && !isError) - log.error(left.pos(), "no.annotation.member", left.name, a.type); - Type result = method.type.getReturnType(); - Attribute value = enterAttributeValue(result, assign.rhs, env); - if (!method.type.isErroneous()) - buf.append(new Pair<>((MethodSymbol)method, value)); - t.type = result; - } - return buf.toList(); - } - - Attribute enterAttributeValue(Type expected, - JCExpression tree, - Env env) { - //first, try completing the attribution value sym - if a completion - //error is thrown, we should recover gracefully, and display an - //ordinary resolution diagnostic. - try { - expected.tsym.complete(); - } catch(CompletionFailure e) { - log.error(tree.pos(), "cant.resolve", Kinds.kindName(e.sym), e.sym); - expected = syms.errType; - } - if (expected.hasTag(ARRAY)) { - if (!tree.hasTag(NEWARRAY)) { - tree = make.at(tree.pos). - NewArray(null, List.nil(), List.of(tree)); - } - JCNewArray na = (JCNewArray)tree; - if (na.elemtype != null) { - log.error(na.elemtype.pos(), "new.not.allowed.in.annotation"); - } - ListBuffer buf = new ListBuffer<>(); - for (List l = na.elems; l.nonEmpty(); l=l.tail) { - buf.append(enterAttributeValue(types.elemtype(expected), - l.head, - env)); - } - na.type = expected; - return new Attribute. - Array(expected, buf.toArray(new Attribute[buf.length()])); - } - if (tree.hasTag(NEWARRAY)) { //error recovery - if (!expected.isErroneous()) - log.error(tree.pos(), "annotation.value.not.allowable.type"); - JCNewArray na = (JCNewArray)tree; - if (na.elemtype != null) { - log.error(na.elemtype.pos(), "new.not.allowed.in.annotation"); - } - for (List l = na.elems; l.nonEmpty(); l=l.tail) { - enterAttributeValue(syms.errType, - l.head, - env); - } - return new Attribute.Error(syms.errType); - } - if ((expected.tsym.flags() & Flags.ANNOTATION) != 0) { - if (tree.hasTag(ANNOTATION)) { - return enterAnnotation((JCAnnotation)tree, expected, env); - } else { - log.error(tree.pos(), "annotation.value.must.be.annotation"); - expected = syms.errType; - } - } - if (tree.hasTag(ANNOTATION)) { //error recovery - if (!expected.isErroneous()) - log.error(tree.pos(), "annotation.not.valid.for.type", expected); - enterAnnotation((JCAnnotation)tree, syms.errType, env); - return new Attribute.Error(((JCAnnotation)tree).annotationType.type); - } - if (expected.isPrimitive() || - (types.isSameType(expected, syms.stringType) && !expected.hasTag(TypeTag.ERROR))) { - Type result = attr.attribExpr(tree, env, expected); - if (result.isErroneous()) - return new Attribute.Error(result.getOriginalType()); - if (result.constValue() == null) { - log.error(tree.pos(), "attribute.value.must.be.constant"); - return new Attribute.Error(expected); - } - result = cfolder.coerce(result, expected); - return new Attribute.Constant(expected, result.constValue()); - } - if (expected.tsym == syms.classType.tsym) { - Type result = attr.attribExpr(tree, env, expected); - if (result.isErroneous()) { - // Does it look like an unresolved class literal? - if (TreeInfo.name(tree) == names._class && - ((JCFieldAccess) tree).selected.type.isErroneous()) { - Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName(); - return new Attribute.UnresolvedClass(expected, - types.createErrorType(n, - syms.unknownSymbol, syms.classType)); - } else { - return new Attribute.Error(result.getOriginalType()); - } - } - - // Class literals look like field accesses of a field named class - // at the tree level - if (TreeInfo.name(tree) != names._class) { - log.error(tree.pos(), "annotation.value.must.be.class.literal"); - return new Attribute.Error(syms.errType); - } - return new Attribute.Class(types, - (((JCFieldAccess) tree).selected).type); - } - if (expected.hasTag(CLASS) && - (expected.tsym.flags() & Flags.ENUM) != 0) { - Type result = attr.attribExpr(tree, env, expected); - Symbol sym = TreeInfo.symbol(tree); - if (sym == null || - TreeInfo.nonstaticSelect(tree) || - sym.kind != VAR || - (sym.flags() & Flags.ENUM) == 0) { - log.error(tree.pos(), "enum.annotation.must.be.enum.constant"); - return new Attribute.Error(result.getOriginalType()); - } - VarSymbol enumerator = (VarSymbol) sym; - return new Attribute.Enum(expected, enumerator); - } - //error recovery: - if (!expected.isErroneous()) - log.error(tree.pos(), "annotation.value.not.allowable.type"); - return new Attribute.Error(attr.attribExpr(tree, env, expected)); - } - - /* ********************************* - * Support for repeating annotations - ***********************************/ - /* Process repeated annotations. This method returns the * synthesized container annotation or null IFF all repeating * annotation are invalid. This method reports errors/warnings. */ private T processRepeatedAnnotations(List annotations, - AnnotationContext ctx, - Symbol on) { + AnnotationContext ctx, Symbol on) + { T firstOccurrence = annotations.head; List repeated = List.nil(); Type origAnnoType = null; @@ -490,14 +706,10 @@ public class Annotate { Type targetContainerType = null; MethodSymbol containerValueSymbol = null; - Assert.check(!annotations.isEmpty() && - !annotations.tail.isEmpty()); // i.e. size() > 1 + Assert.check(!annotations.isEmpty() && !annotations.tail.isEmpty()); // i.e. size() > 1 int count = 0; - for (List al = annotations; - !al.isEmpty(); - al = al.tail) - { + for (List al = annotations; !al.isEmpty(); al = al.tail) { count++; // There must be more than a single anno in the annotation list @@ -532,18 +744,23 @@ public class Annotate { repeated = repeated.prepend(currentAnno); } + if (!repeated.isEmpty() && targetContainerType == null) { + log.error(ctx.pos.get(annotations.head), "duplicate.annotation.invalid.repeated", origAnnoType); + return null; + } + if (!repeated.isEmpty()) { repeated = repeated.reverse(); TreeMaker m = make.at(ctx.pos.get(firstOccurrence)); Pair p = new Pair(containerValueSymbol, - new Attribute.Array(arrayOfOrigAnnoType, repeated)); + new Attribute.Array(arrayOfOrigAnnoType, repeated)); if (ctx.isTypeCompound) { /* TODO: the following code would be cleaner: Attribute.TypeCompound at = new Attribute.TypeCompound(targetContainerType, List.of(p), ((Attribute.TypeCompound)annotations.head).position); JCTypeAnnotation annoTree = m.TypeAnnotation(at); - at = enterTypeAnnotation(annoTree, targetContainerType, ctx.env); + at = attributeTypeAnnotation(annoTree, targetContainerType, ctx.env); */ // However, we directly construct the TypeCompound to keep the // direct relation to the contained TypeCompounds. @@ -562,12 +779,13 @@ public class Annotate { JCAnnotation annoTree = m.Annotation(c); if (!chk.annotationApplicable(annoTree, on)) - log.error(annoTree.pos(), "invalid.repeatable.annotation.incompatible.target", targetContainerType, origAnnoType); + log.error(annoTree.pos(), "invalid.repeatable.annotation.incompatible.target", + targetContainerType, origAnnoType); if (!chk.validateAnnotationDeferErrors(annoTree)) log.error(annoTree.pos(), "duplicate.annotation.invalid.repeated", origAnnoType); - c = enterAnnotation(annoTree, targetContainerType, ctx.env); + c = attributeAnnotation(annoTree, targetContainerType, ctx.env); c.setSynthesized(true); @SuppressWarnings("unchecked") @@ -579,17 +797,19 @@ public class Annotate { } } - /** Fetches the actual Type that should be the containing annotation. */ + /** + * Fetches the actual Type that should be the containing annotation. + */ private Type getContainingType(Attribute.Compound currentAnno, - DiagnosticPosition pos, - boolean reportError) + DiagnosticPosition pos, + boolean reportError) { Type origAnnoType = currentAnno.type; TypeSymbol origAnnoDecl = origAnnoType.tsym; // Fetch the Repeatable annotation from the current // annotation's declaration, or null if it has none - Attribute.Compound ca = origAnnoDecl.attribute(syms.repeatableType.tsym); + Attribute.Compound ca = origAnnoDecl.getAnnotationTypeMetadata().getRepeatable(); if (ca == null) { // has no Repeatable annotation if (reportError) log.error(pos, "duplicate.annotation.missing.container", origAnnoType, syms.repeatableType); @@ -597,7 +817,7 @@ public class Annotate { } return filterSame(extractContainingType(ca, pos, origAnnoDecl), - origAnnoType); + origAnnoType); } // returns null if t is same as 's', returns 't' otherwise @@ -611,8 +831,8 @@ public class Annotate { /** Extract the actual Type to be used for a containing annotation. */ private Type extractContainingType(Attribute.Compound ca, - DiagnosticPosition pos, - TypeSymbol annoDecl) + DiagnosticPosition pos, + TypeSymbol annoDecl) { // The next three checks check that the Repeatable annotation // on the declaration of the annotation type that is repeating is @@ -657,7 +877,7 @@ public class Annotate { nr_value_elems++; if (nr_value_elems == 1 && - elm.kind == MTH) { + elm.kind == MTH) { containerValueSymbol = (MethodSymbol)elm; } else { error = true; @@ -665,14 +885,14 @@ public class Annotate { } if (error) { log.error(pos, - "invalid.repeatable.annotation.multiple.values", - targetContainerType, - nr_value_elems); + "invalid.repeatable.annotation.multiple.values", + targetContainerType, + nr_value_elems); return null; } else if (nr_value_elems == 0) { log.error(pos, - "invalid.repeatable.annotation.no.value", - targetContainerType); + "invalid.repeatable.annotation.no.value", + targetContainerType); return null; } @@ -680,8 +900,8 @@ public class Annotate { // probably "impossible" to fail this if (containerValueSymbol.kind != MTH) { log.error(pos, - "invalid.repeatable.annotation.invalid.value", - targetContainerType); + "invalid.repeatable.annotation.invalid.value", + targetContainerType); fatalError = true; } @@ -690,174 +910,24 @@ public class Annotate { Type valueRetType = containerValueSymbol.type.getReturnType(); Type expectedType = types.makeArrayType(originalAnnoType); if (!(types.isArray(valueRetType) && - types.isSameType(expectedType, valueRetType))) { + types.isSameType(expectedType, valueRetType))) { log.error(pos, - "invalid.repeatable.annotation.value.return", - targetContainerType, - valueRetType, - expectedType); + "invalid.repeatable.annotation.value.return", + targetContainerType, + valueRetType, + expectedType); fatalError = true; } - if (error) { - fatalError = true; - } - - // The conditions for a valid containing annotation are made - // in Check.validateRepeatedAnnotaton(); return fatalError ? null : containerValueSymbol; } - private AnnotationContext - prepareEnterAnnotations(List annotations, - Env env, - Symbol sym, - AttributeCreator creator, - boolean isTypeCompound) { - Map> annotated = new LinkedHashMap<>(); - Map pos = new HashMap<>(); - - for (List al = annotations; !al.isEmpty(); al = al.tail) { - JCAnnotation a = al.head; - T c = creator.create(a, syms.annotationType, env); - - Assert.checkNonNull(c, "Failed to create annotation"); - - if (annotated.containsKey(a.type.tsym)) { - if (!allowRepeatedAnnos) { - log.error(a.pos(), "repeatable.annotations.not.supported.in.source"); - allowRepeatedAnnos = true; - } - ListBuffer l = annotated.get(a.type.tsym); - l = l.append(c); - annotated.put(a.type.tsym, l); - pos.put(c, a.pos()); - } else { - annotated.put(a.type.tsym, ListBuffer.of(c)); - pos.put(c, a.pos()); - } - - // Note: @Deprecated has no effect on local variables and parameters - if (!c.type.isErroneous() - && sym.owner.kind != MTH - && types.isSameType(c.type, syms.deprecatedType)) { - sym.flags_field |= Flags.DEPRECATED; - } - } - - return new AnnotationContext<>(env, annotated, pos, - isTypeCompound); - } - - // Gather up annotations into a map from type symbols to lists of - // Compound attributes, then continue on with repeating - // annotations processing - private - void attachAttributesLater(final List annotations, - final Env env, - final Symbol sym, - final boolean isTypeCompound, - final AttributeCreator creator, - final AttributeAttacher attacher) { - final AnnotationContext ctx = - prepareEnterAnnotations(annotations, env, sym, creator, isTypeCompound); - final Map> annotated = - ctx.annotated; - boolean hasRepeated = false; - - List buf = List.nil(); - for (ListBuffer lb : annotated.values()) { - if (lb.size() == 1) { - buf = buf.prepend(lb.first()); - } else { - @SuppressWarnings("unchecked") - T res = (T) new Placeholder<>(ctx, lb.toList(), sym); - buf = buf.prepend(res); - hasRepeated = true; - } - } - - final List attrs = buf.reverse(); - - if (!isTypeCompound) { - // Attach declaration attributes early, so - // that @Repeatable and other annotations get attached. - // Since the attacher uses setDeclarationAttributes, this - // will be overwritten later. - attacher.attach(sym, attrs); - } - if (hasRepeated) { - repeated(new Annotate.Worker() { - @Override - public String toString() { - return "repeated annotation pass of: " + sym + " in: " + sym.owner; - } - - @Override - public void run() { - JavaFileObject oldSource = - log.useSource(env.toplevel.sourcefile); - try { - attacher.attach(sym, replacePlaceholders(attrs, ctx, sym)); - } finally { - log.useSource(oldSource); - } - } - }); - } else { - attacher.attach(sym, attrs); - } - } - - private interface AttributeAttacher { - public void attach(Symbol sym, List attrs); - } - - private final AttributeAttacher declAnnotationsAttacher = - new AttributeAttacher() { - @Override - public void attach(Symbol sym, List attrs) { - sym.resetAnnotations(); - sym.setDeclarationAttributes(attrs); - } - }; - - private final AttributeAttacher typeAnnotationsAttacher = - new AttributeAttacher() { - @Override - public void attach(Symbol sym, List attrs) { - sym.appendUniqueTypeAttributes(attrs); - } - }; - - private List - replacePlaceholders(List buf, - Annotate.AnnotationContext ctx, - Symbol sym) { - List result = List.nil(); - for (T a : buf) { - if (a instanceof Placeholder) { - @SuppressWarnings("unchecked") - T replacement = replaceOne((Placeholder) a, ctx, sym); - - if (null != replacement) { - result = result.prepend(replacement); - } - } else { - result = result.prepend(a); - } - } - - return result.reverse(); - } - - private T replaceOne(Placeholder placeholder, - Annotate.AnnotationContext ctx, - Symbol sym) { + private T makeContainerAnnotation(List toBeReplaced, + AnnotationContext ctx, Symbol sym) + { // Process repeated annotations T validRepeated = - processRepeatedAnnotations(placeholder.getPlaceholderFor(), - ctx, sym); + processRepeatedAnnotations(toBeReplaced, ctx, sym); if (validRepeated != null) { // Check that the container isn't manually @@ -865,7 +935,8 @@ public class Annotate { // its contained annotation. ListBuffer manualContainer = ctx.annotated.get(validRepeated.type.tsym); if (manualContainer != null) { - log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present", + log.error(ctx.pos.get(manualContainer.first()), + "invalid.repeatable.annotation.repeated.and.container.present", manualContainer.first().type.tsym); } } @@ -874,107 +945,16 @@ public class Annotate { return validRepeated; } -/* ******************************************************************** - * Annotation processing - *********************************************************************/ + /******************** + * Type annotations * + ********************/ - /** Queue annotations for later processing. */ - void annotateLater(final List annotations, - final Env localEnv, - final Symbol s, - final DiagnosticPosition deferPos) { - if (annotations.isEmpty()) { - return; - } - if (s.kind != PCK) { - s.resetAnnotations(); // mark Annotations as incomplete for now - } - normal(new Annotate.Worker() { - @Override - public String toString() { - return "annotate " + annotations + " onto " + s + " in " + s.owner; - } - - @Override - public void run() { - Assert.check(s.kind == PCK || s.annotationsPendingCompletion()); - JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); - DiagnosticPosition prevLintPos = - deferPos != null - ? deferredLintHandler.setPos(deferPos) - : deferredLintHandler.immediate(); - Lint prevLint = deferPos != null ? null : chk.setLint(lint); - try { - if (s.hasAnnotations() && - annotations.nonEmpty()) - log.error(annotations.head.pos, - "already.annotated", - Kinds.kindName(s), s); - actualEnterAnnotations(annotations, localEnv, s); - } finally { - if (prevLint != null) - chk.setLint(prevLint); - deferredLintHandler.setPos(prevLintPos); - log.useSource(prev); - } - } - }); - - validate(new Annotate.Worker() { //validate annotations - @Override - public void run() { - JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); - try { - chk.validateAnnotations(annotations, s); - } finally { - log.useSource(prev); - } - } - }); - } - - private interface AttributeCreator { - public T create(JCAnnotation a, Type expected, Env env); - } - - // TODO: When SE8 features can be used, these can go away and be - // replaced by method refs. - private final AttributeCreator enterAnnotationsCreator = - new AttributeCreator() { - @Override - public Attribute.Compound create(JCAnnotation a, - Type expected, - Env env) { - return enterAnnotation(a, syms.annotationType, env); - } - }; - private final AttributeCreator enterTypeAnnotationsCreator = - new AttributeCreator() { - @Override - public Attribute.TypeCompound create(JCAnnotation a, - Type expected, - Env env) { - return enterTypeAnnotation(a, syms.annotationType, env); - } - }; - - /** Enter a set of annotations. */ - private void actualEnterAnnotations(List annotations, - Env env, - Symbol s) { - Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null"); - attachAttributesLater(annotations, env, s, false, - enterAnnotationsCreator, - declAnnotationsAttacher); - } - - /* - * If the symbol is non-null, attach the type annotation to it. + /** + * Attribute the list of annotations and enter them onto s. */ - private void actualEnterTypeAnnotations(final List annotations, - final Env env, - final Symbol s, - final DiagnosticPosition deferPos) { + public void enterTypeAnnotations(List annotations, Env env, + Symbol s, DiagnosticPosition deferPos) + { Assert.checkNonNull(s, "Symbol argument to actualEnterTypeAnnotations is nul/"); JavaFileObject prev = log.useSource(env.toplevel.sourcefile); DiagnosticPosition prevLintPos = null; @@ -983,9 +963,7 @@ public class Annotate { prevLintPos = deferredLintHandler.setPos(deferPos); } try { - attachAttributesLater(annotations, env, s, true, - enterTypeAnnotationsCreator, - typeAnnotationsAttacher); + annotateNow(s, annotations, env, true); } finally { if (prevLintPos != null) deferredLintHandler.setPos(prevLintPos); @@ -993,21 +971,61 @@ public class Annotate { } } - public void annotateTypeLater(final JCTree tree, - final Env env, - final Symbol sym, - final DiagnosticPosition deferPos) { + /** + * Enqueue tree for scanning of type annotations, attaching to the Symbol sym. + */ + public void queueScanTreeAndTypeAnnotate(JCTree tree, Env env, Symbol sym, + DiagnosticPosition deferPos) + { Assert.checkNonNull(sym); - normal(new Annotate.Worker() { - @Override - public String toString() { - return "type annotate " + tree + " onto " + sym + " in " + sym.owner; - } - @Override - public void run() { - tree.accept(new TypeAnnotate(env, sym, deferPos)); - } - }); + normal(new Runnable() { + @Override + public String toString() { + return "type annotate " + tree + " onto " + sym + " in " + sym.owner; + } + + @Override + public void run() { + tree.accept(new TypeAnnotate(env, sym, deferPos)); + } + }); + } + + /** + * Apply the annotations to the particular type. + */ + public void annotateTypeSecondStage(JCTree tree, List annotations, Type storeAt) { + typeAnnotation(new Runnable() { + @Override + public String toString() { + return "Type annotate 2:nd stage " + annotations + " onto " + tree; + } + + @Override + public void run() { + List compounds = fromAnnotations(annotations); + Assert.check(annotations.size() == compounds.size()); + storeAt.getMetadataOfKind(Kind.ANNOTATIONS).combine(new TypeMetadata.Annotations(compounds)); + } + }); + } + + /** + * Apply the annotations to the particular type. + */ + public void annotateTypeParameterSecondStage(JCTree tree, List annotations) { + typeAnnotation(new Runnable() { + @Override + public String toString() { + return "Type annotate 2:nd stage " + annotations + " onto " + tree; + } + + @Override + public void run() { + List compounds = fromAnnotations(annotations); + Assert.check(annotations.size() == compounds.size()); + } + }); } /** @@ -1019,9 +1037,7 @@ public class Annotate { private final Symbol sym; private DiagnosticPosition deferPos; - public TypeAnnotate(final Env env, - final Symbol sym, - final DiagnosticPosition deferPos) { + public TypeAnnotate(Env env, Symbol sym, DiagnosticPosition deferPos) { this.env = env; this.sym = sym; @@ -1029,27 +1045,28 @@ public class Annotate { } @Override - public void visitAnnotatedType(final JCAnnotatedType tree) { - actualEnterTypeAnnotations(tree.annotations, env, sym, deferPos); - super.visitAnnotatedType(tree); + public void visitAnnotatedType(JCAnnotatedType tree) { + enterTypeAnnotations(tree.annotations, env, sym, deferPos); + scan(tree.underlyingType); } @Override - public void visitTypeParameter(final JCTypeParameter tree) { - actualEnterTypeAnnotations(tree.annotations, env, sym, deferPos); - super.visitTypeParameter(tree); + public void visitTypeParameter(JCTypeParameter tree) { + enterTypeAnnotations(tree.annotations, env, sym, deferPos); + scan(tree.bounds); } @Override - public void visitNewArray(final JCNewArray tree) { - actualEnterTypeAnnotations(tree.annotations, env, sym, deferPos); + public void visitNewArray(JCNewArray tree) { + enterTypeAnnotations(tree.annotations, env, sym, deferPos); for (List dimAnnos : tree.dimAnnotations) - actualEnterTypeAnnotations(dimAnnos, env, sym, deferPos); - super.visitNewArray(tree); + enterTypeAnnotations(dimAnnos, env, sym, deferPos); + scan(tree.elemtype); + scan(tree.elems); } @Override - public void visitMethodDef(final JCMethodDecl tree) { + public void visitMethodDef(JCMethodDecl tree) { scan(tree.mods); scan(tree.restype); scan(tree.typarams); @@ -1058,11 +1075,10 @@ public class Annotate { scan(tree.thrown); scan(tree.defaultValue); // Do not annotate the body, just the signature. - // scan(tree.body); } @Override - public void visitVarDef(final JCVariableDecl tree) { + public void visitVarDef(JCVariableDecl tree) { DiagnosticPosition prevPos = deferPos; deferPos = tree.pos(); try { @@ -1094,4 +1110,238 @@ public class Annotate { } } } + + /********************* + * Completer support * + *********************/ + + private AnnotationTypeCompleter theSourceCompleter = new AnnotationTypeCompleter() { + @Override + public void complete(ClassSymbol sym) throws CompletionFailure { + Env context = typeEnvs.get(sym); + Annotate.this.attributeAnnotationType(context); + } + }; + + /* Last stage completer to enter just enough annotations to have a prototype annotation type. + * This currently means entering @Target and @Repetable. + */ + public AnnotationTypeCompleter annotationTypeSourceCompleter() { + return theSourceCompleter; + } + + private void attributeAnnotationType(Env env) { + Assert.check(((JCClassDecl)env.tree).sym.isAnnotationType(), + "Trying to annotation type complete a non-annotation type"); + + JavaFileObject prev = log.useSource(env.toplevel.sourcefile); + try { + JCClassDecl tree = (JCClassDecl)env.tree; + AnnotationTypeVisitor v = new AnnotationTypeVisitor(attr, chk, syms, typeEnvs); + v.scanAnnotationType(tree); + tree.sym.getAnnotationTypeMetadata().setRepeatable(v.repeatable); + tree.sym.getAnnotationTypeMetadata().setTarget(v.target); + } finally { + log.useSource(prev); + } + } + + public Attribute unfinishedDefaultValue() { + return theUnfinishedDefaultValue; + } + + public static interface AnnotationTypeCompleter { + void complete(ClassSymbol sym) throws CompletionFailure; + } + + /** Visitor to determine a prototype annotation type for a class declaring an annotation type. + * + *

This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own risk. + * This code and its internal interfaces are subject to change or + * deletion without notice. + */ + public class AnnotationTypeVisitor extends TreeScanner { + private Env env; + + private final Attr attr; + private final Check check; + private final Symtab tab; + private final TypeEnvs typeEnvs; + + private Compound target; + private Compound repeatable; + + public AnnotationTypeVisitor(Attr attr, Check check, Symtab tab, TypeEnvs typeEnvs) { + this.attr = attr; + this.check = check; + this.tab = tab; + this.typeEnvs = typeEnvs; + } + + public Compound getRepeatable() { + return repeatable; + } + + public Compound getTarget() { + return target; + } + + public void scanAnnotationType(JCClassDecl decl) { + visitClassDef(decl); + } + + @Override + public void visitClassDef(JCClassDecl tree) { + Env prevEnv = env; + env = typeEnvs.get(tree.sym); + try { + scan(tree.mods); // look for repeatable and target + // don't descend into body + } finally { + env = prevEnv; + } + } + + @Override + public void visitAnnotation(JCAnnotation tree) { + Type t = tree.annotationType.type; + if (t == null) { + t = attr.attribType(tree.annotationType, env); + tree.annotationType.type = t = check.checkType(tree.annotationType.pos(), t, tab.annotationType); + } + + if (t == tab.annotationTargetType) { + target = Annotate.this.attributeAnnotation(tree, tab.annotationTargetType, env); + } else if (t == tab.repeatableType) { + repeatable = Annotate.this.attributeAnnotation(tree, tab.repeatableType, env); + } + } + } + + /** Represents the semantics of an Annotation Type. + * + *

This is NOT part of any supported API. + * If you write code that depends on this, you do so at your own risk. + * This code and its internal interfaces are subject to change or + * deletion without notice. + */ + public static class AnnotationTypeMetadata { + final ClassSymbol metaDataFor; + private Compound target; + private Compound repeatable; + private AnnotationTypeCompleter annotationTypeCompleter; + + public AnnotationTypeMetadata(ClassSymbol metaDataFor, AnnotationTypeCompleter annotationTypeCompleter) { + this.metaDataFor = metaDataFor; + this.annotationTypeCompleter = annotationTypeCompleter; + } + + private void init() { + // Make sure metaDataFor is member entered + while (metaDataFor.completer != null) + metaDataFor.complete(); + + if (annotationTypeCompleter != null) { + AnnotationTypeCompleter c = annotationTypeCompleter; + annotationTypeCompleter = null; + c.complete(metaDataFor); + } + } + + public void complete() { + init(); + } + + public Compound getRepeatable() { + init(); + return repeatable; + } + + public void setRepeatable(Compound repeatable) { + Assert.checkNull(this.repeatable); + this.repeatable = repeatable; + } + + public Compound getTarget() { + init(); + return target; + } + + public void setTarget(Compound target) { + Assert.checkNull(this.target); + this.target = target; + } + + public Set getAnnotationElements() { + init(); + Set members = new LinkedHashSet<>(); + WriteableScope s = metaDataFor.members(); + Iterable ss = s.getSymbols(NON_RECURSIVE); + for (Symbol sym : ss) + if (sym.kind == MTH && + sym.name != sym.name.table.names.clinit && + (sym.flags() & SYNTHETIC) == 0) + members.add((MethodSymbol)sym); + return members; + } + + public Set getAnnotationElementsWithDefault() { + init(); + Set members = getAnnotationElements(); + Set res = new LinkedHashSet<>(); + for (MethodSymbol m : members) + if (m.defaultValue != null) + res.add(m); + return res; + } + + @Override + public String toString() { + return "Annotation type for: " + metaDataFor; + } + + public boolean isMetadataForAnnotationType() { return true; } + + public static AnnotationTypeMetadata notAnAnnotationType() { + return NOT_AN_ANNOTATION_TYPE; + } + + private static final AnnotationTypeMetadata NOT_AN_ANNOTATION_TYPE = + new AnnotationTypeMetadata(null, null) { + @Override + public void complete() { + } // do nothing + + @Override + public String toString() { + return "Not an annotation type"; + } + + @Override + public Set getAnnotationElements() { + return new LinkedHashSet<>(0); + } + + @Override + public Set getAnnotationElementsWithDefault() { + return new LinkedHashSet<>(0); + } + + @Override + public boolean isMetadataForAnnotationType() { + return false; + } + + @Override + public Compound getTarget() { + return null; + } + + @Override + public Compound getRepeatable() { + return null; + } + }; + } } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index 36a9c6bc9ce..02340511e52 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -40,6 +40,7 @@ import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.code.Scope.WriteableScope; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Type.*; +import com.sun.tools.javac.code.TypeMetadata.Annotations; import com.sun.tools.javac.code.Types.FunctionDescriptorLookupError; import com.sun.tools.javac.comp.Check.CheckContext; import com.sun.tools.javac.comp.DeferredAttr.AttrMode; @@ -103,11 +104,11 @@ public class Attr extends JCTree.Visitor { final Target target; final Types types; final JCDiagnostic.Factory diags; - final Annotate annotate; final TypeAnnotations typeAnnotations; final DeferredLintHandler deferredLintHandler; final TypeEnvs typeEnvs; final Dependencies dependencies; + final Annotate annotate; public static Attr instance(Context context) { Attr instance = context.get(attrKey); @@ -997,7 +998,7 @@ public class Attr extends JCTree.Visitor { } // Attribute all type annotations in the body - annotate.annotateTypeLater(tree.body, localEnv, m, null); + annotate.queueScanTreeAndTypeAnnotate(tree.body, localEnv, m, null); annotate.flush(); // Attribute method body. @@ -1020,16 +1021,16 @@ public class Attr extends JCTree.Visitor { env.info.scope.enter(tree.sym); } else { try { - annotate.enterStart(); + annotate.blockAnnotations(); memberEnter.memberEnter(tree, env); } finally { - annotate.enterDone(); + annotate.unblockAnnotations(); } } } else { if (tree.init != null) { // Field initializer expression need to be entered. - annotate.annotateTypeLater(tree.init, env, tree.sym, tree.pos()); + annotate.queueScanTreeAndTypeAnnotate(tree.init, env, tree.sym, tree.pos()); annotate.flush(); } } @@ -1090,7 +1091,7 @@ public class Attr extends JCTree.Visitor { if ((tree.flags & STATIC) != 0) localEnv.info.staticLevel++; // Attribute all type annotations in the block - annotate.annotateTypeLater(tree, localEnv, localEnv.info.scope.owner, null); + annotate.queueScanTreeAndTypeAnnotate(tree, localEnv, localEnv.info.scope.owner, null); annotate.flush(); attribStats(tree.stats, localEnv); @@ -1953,9 +1954,16 @@ public class Attr extends JCTree.Visitor { // Attribute clazz expression and store // symbol + type back into the attributed tree. - Type clazztype = TreeInfo.isEnumInit(env.tree) ? - attribIdentAsEnumType(env, (JCIdent)clazz) : - attribType(clazz, env); + Type clazztype; + + try { + env.info.isNewClass = true; + clazztype = TreeInfo.isEnumInit(env.tree) ? + attribIdentAsEnumType(env, (JCIdent)clazz) : + attribType(clazz, env); + } finally { + env.info.isNewClass = false; + } clazztype = chk.checkDiamond(tree, clazztype); chk.validate(clazz, localEnv); @@ -4002,7 +4010,7 @@ public class Attr extends JCTree.Visitor { TypeVar typeVar = (TypeVar) tree.type; if (tree.annotations != null && tree.annotations.nonEmpty()) { - annotateType(tree, tree.annotations); + annotate.annotateTypeParameterSecondStage(tree, tree.annotations); } if (!typeVar.bound.isErroneous()) { @@ -4092,45 +4100,17 @@ public class Attr extends JCTree.Visitor { } public void visitAnnotation(JCAnnotation tree) { - Assert.error("should be handled in Annotate"); + Assert.error("should be handled in annotate"); } public void visitAnnotatedType(JCAnnotatedType tree) { - Type underlyingType = attribType(tree.getUnderlyingType(), env); - this.attribAnnotationTypes(tree.annotations, env); - annotateType(tree, tree.annotations); - result = tree.type = underlyingType; - } + attribAnnotationTypes(tree.annotations, env); + Type underlyingType = attribType(tree.underlyingType, env); + Type annotatedType = underlyingType.annotatedType(Annotations.TO_BE_SET); - /** - * Apply the annotations to the particular type. - */ - public void annotateType(final JCTree tree, final List annotations) { - annotate.typeAnnotation(new Annotate.Worker() { - @Override - public String toString() { - return "annotate " + annotations + " onto " + tree; - } - @Override - public void run() { - List compounds = fromAnnotations(annotations); - Assert.check(annotations.size() == compounds.size()); - tree.type = tree.type.annotatedType(compounds); - } - }); - } - - private static List fromAnnotations(List annotations) { - if (annotations.isEmpty()) { - return List.nil(); - } - - ListBuffer buf = new ListBuffer<>(); - for (JCAnnotation anno : annotations) { - Assert.checkNonNull(anno.attribute); - buf.append((Attribute.TypeCompound) anno.attribute); - } - return buf.toList(); + if (!env.info.isNewClass) + annotate.annotateTypeSecondStage(tree, tree.annotations, annotatedType); + result = tree.type = annotatedType; } public void visitErroneous(JCErroneous tree) { @@ -4298,8 +4278,9 @@ public class Attr extends JCTree.Visitor { log.error(tree.typarams.head.pos(), "intf.annotation.cant.have.type.params"); - // If this annotation has a @Repeatable, validate - Attribute.Compound repeatable = c.attribute(syms.repeatableType.tsym); + // If this annotation type has a @Repeatable, validate + Attribute.Compound repeatable = c.getAnnotationTypeMetadata().getRepeatable(); + // If this annotation type has a @Repeatable, validate if (repeatable != null) { // get diagnostic position for error reporting DiagnosticPosition cbPos = getDiagnosticPosition(tree, repeatable.type); @@ -4675,7 +4656,7 @@ public class Attr extends JCTree.Visitor { // This method will raise an error for such a type. for (JCAnnotation ai : annotations) { if (!ai.type.isErroneous() && - typeAnnotations.annotationType(ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) { + typeAnnotations.annotationTargetType(ai.attribute, sym) == TypeAnnotations.AnnotationType.DECLARATION) { log.error(ai.pos(), "annotation.type.not.applicable"); } } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java index 84d4a5318a6..dd1436ed1c6 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java @@ -68,6 +68,11 @@ public class AttrContext { */ boolean isAnonymousDiamond = false; + /** + * Is this an attribution environment for an instance creation expression? + */ + boolean isNewClass = false; + /** Are arguments to current function applications boxed into an array for varargs? */ Resolve.MethodResolutionPhase pendingResolutionPhase = null; @@ -106,6 +111,7 @@ public class AttrContext { info.isSerializable = isSerializable; info.isSpeculative = isSpeculative; info.isAnonymousDiamond = isAnonymousDiamond; + info.isNewClass = isNewClass; return info; } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index 2f74ea42998..3a31e365da9 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -31,6 +31,7 @@ import javax.tools.JavaFileManager; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Attribute.Compound; +import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata; import com.sun.tools.javac.jvm.*; import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.Fragments; @@ -81,6 +82,7 @@ public class Check { private final DeferredAttr deferredAttr; private final Infer infer; private final Types types; + private final TypeAnnotations typeAnnotations; private final JCDiagnostic.Factory diags; private boolean warnOnSyntheticConflicts; private boolean suppressAbortOnBadClassFile; @@ -120,6 +122,7 @@ public class Check { deferredAttr = DeferredAttr.instance(context); infer = Infer.instance(context); types = Types.instance(context); + typeAnnotations = TypeAnnotations.instance(context); diags = JCDiagnostic.Factory.instance(context); Options options = Options.instance(context); lint = Lint.instance(context); @@ -526,7 +529,7 @@ public class Check { * @param found The type that was found. * @param req The type that was required. */ - Type checkType(DiagnosticPosition pos, Type found, Type req) { + public Type checkType(DiagnosticPosition pos, Type found, Type req) { return checkType(pos, found, req, basicHandler); } @@ -587,7 +590,7 @@ public class Check { public void report() { if (lint.isEnabled(Lint.LintCategory.CAST)) log.warning(Lint.LintCategory.CAST, - tree.pos(), "redundant.cast", tree.expr.type); + tree.pos(), "redundant.cast", tree.clazz.type); } }); } @@ -2830,7 +2833,7 @@ public class Check { } } - private void validateRetention(Symbol container, Symbol contained, DiagnosticPosition pos) { + private void validateRetention(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) { Attribute.RetentionPolicy containerRetention = types.getRetention(container); Attribute.RetentionPolicy containedRetention = types.getRetention(contained); @@ -2869,7 +2872,7 @@ public class Check { } } - private void validateTarget(Symbol container, Symbol contained, DiagnosticPosition pos) { + private void validateTarget(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) { // The set of targets the container is applicable to must be a subset // (with respect to annotation target semantics) of the set of targets // the contained is applicable to. The target sets may be implicit or @@ -2996,32 +2999,18 @@ public class Check { /** Is the annotation applicable to types? */ protected boolean isTypeAnnotation(JCAnnotation a, boolean isTypeParameter) { - Attribute.Compound atTarget = - a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym); - if (atTarget == null) { - // An annotation without @Target is not a type annotation. - return false; - } - - Attribute atValue = atTarget.member(names.value); - if (!(atValue instanceof Attribute.Array)) { - return false; // error recovery - } - - Attribute.Array arr = (Attribute.Array) atValue; - for (Attribute app : arr.values) { - if (!(app instanceof Attribute.Enum)) { - return false; // recovery - } - Attribute.Enum e = (Attribute.Enum) app; - - if (e.value.name == names.TYPE_USE) - return true; - else if (isTypeParameter && e.value.name == names.TYPE_PARAMETER) - return true; - } - return false; + List targets = typeAnnotations.annotationTargets(a.attribute); + return (targets == null) ? + false : + targets.stream() + .anyMatch(attr -> isTypeAnnotation(attr, isTypeParameter)); } + //where + boolean isTypeAnnotation(Attribute a, boolean isTypeParameter) { + Attribute.Enum e = (Attribute.Enum)a; + return (e.value.name == names.TYPE_USE || + (isTypeParameter && e.value.name == names.TYPE_PARAMETER)); + } /** Is the annotation applicable to the symbol? */ boolean annotationApplicable(JCAnnotation a, Symbol s) { @@ -3043,51 +3032,55 @@ public class Check { } } for (Name target : targets) { - if (target == names.TYPE) - { if (s.kind == TYP) return true; } - else if (target == names.FIELD) - { if (s.kind == VAR && s.owner.kind != MTH) return true; } - else if (target == names.METHOD) - { if (s.kind == MTH && !s.isConstructor()) return true; } - else if (target == names.PARAMETER) - { if (s.kind == VAR && s.owner.kind == MTH && - (s.flags() & PARAMETER) != 0) + if (target == names.TYPE) { + if (s.kind == TYP) + return true; + } else if (target == names.FIELD) { + if (s.kind == VAR && s.owner.kind != MTH) + return true; + } else if (target == names.METHOD) { + if (s.kind == MTH && !s.isConstructor()) + return true; + } else if (target == names.PARAMETER) { + if (s.kind == VAR && s.owner.kind == MTH && + (s.flags() & PARAMETER) != 0) { return true; } - else if (target == names.CONSTRUCTOR) - { if (s.kind == MTH && s.isConstructor()) return true; } - else if (target == names.LOCAL_VARIABLE) - { if (s.kind == VAR && s.owner.kind == MTH && - (s.flags() & PARAMETER) == 0) + } else if (target == names.CONSTRUCTOR) { + if (s.kind == MTH && s.isConstructor()) + return true; + } else if (target == names.LOCAL_VARIABLE) { + if (s.kind == VAR && s.owner.kind == MTH && + (s.flags() & PARAMETER) == 0) { return true; } - else if (target == names.ANNOTATION_TYPE) - { if (s.kind == TYP && (s.flags() & ANNOTATION) != 0) + } else if (target == names.ANNOTATION_TYPE) { + if (s.kind == TYP && (s.flags() & ANNOTATION) != 0) { return true; } - else if (target == names.PACKAGE) - { if (s.kind == PCK) return true; } - else if (target == names.TYPE_USE) - { if (s.kind == TYP || s.kind == VAR || - (s.kind == MTH && !s.isConstructor() && - !s.type.getReturnType().hasTag(VOID)) || - (s.kind == MTH && s.isConstructor())) + } else if (target == names.PACKAGE) { + if (s.kind == PCK) + return true; + } else if (target == names.TYPE_USE) { + if (s.kind == TYP || s.kind == VAR || + (s.kind == MTH && !s.isConstructor() && + !s.type.getReturnType().hasTag(VOID)) || + (s.kind == MTH && s.isConstructor())) { return true; } - else if (target == names.TYPE_PARAMETER) - { if (s.kind == TYP && s.type.hasTag(TYPEVAR)) + } else if (target == names.TYPE_PARAMETER) { + if (s.kind == TYP && s.type.hasTag(TYPEVAR)) return true; - } - else - return true; // recovery + } else + return true; // Unknown ElementType. This should be an error at declaration site, + // assume applicable. } return false; } - Attribute.Array getAttributeTargetAttribute(Symbol s) { - Attribute.Compound atTarget = - s.attribute(syms.annotationTargetType.tsym); + Attribute.Array getAttributeTargetAttribute(TypeSymbol s) { + Attribute.Compound atTarget = s.getAnnotationTypeMetadata().getTarget(); if (atTarget == null) return null; // ok, is applicable Attribute atValue = atTarget.member(names.value); if (!(atValue instanceof Attribute.Array)) return null; // error recovery @@ -3117,32 +3110,33 @@ public class Check { private boolean validateAnnotation(JCAnnotation a) { boolean isValid = true; + AnnotationTypeMetadata metadata = a.annotationType.type.tsym.getAnnotationTypeMetadata(); + // collect an inventory of the annotation elements - Set members = new LinkedHashSet<>(); - for (Symbol sym : a.annotationType.type.tsym.members().getSymbols(NON_RECURSIVE)) - if (sym.kind == MTH && sym.name != names.clinit && - (sym.flags() & SYNTHETIC) == 0) - members.add((MethodSymbol) sym); + Set elements = metadata.getAnnotationElements(); // remove the ones that are assigned values for (JCTree arg : a.args) { if (!arg.hasTag(ASSIGN)) continue; // recovery - JCAssign assign = (JCAssign) arg; + JCAssign assign = (JCAssign)arg; Symbol m = TreeInfo.symbol(assign.lhs); if (m == null || m.type.isErroneous()) continue; - if (!members.remove(m)) { + if (!elements.remove(m)) { isValid = false; log.error(assign.lhs.pos(), "duplicate.annotation.member.value", - m.name, a.type); + m.name, a.type); } } // all the remaining ones better have default values List missingDefaults = List.nil(); - for (MethodSymbol m : members) { - if (m.defaultValue == null && !m.type.isErroneous()) { + Set membersWithDefault = metadata.getAnnotationElementsWithDefault(); + for (MethodSymbol m : elements) { + if (m.type.isErroneous()) + continue; + + if (!membersWithDefault.contains(m)) missingDefaults = missingDefaults.append(m.name); - } } missingDefaults = missingDefaults.reverse(); if (missingDefaults.nonEmpty()) { @@ -3153,12 +3147,18 @@ public class Check { log.error(a.pos(), key, a.type, missingDefaults); } + return isValid && validateTargetAnnotationValue(a); + } + + /* Validate the special java.lang.annotation.Target annotation */ + boolean validateTargetAnnotationValue(JCAnnotation a) { // special case: java.lang.annotation.Target must not have // repeated values in its value member if (a.annotationType.type.tsym != syms.annotationTargetType.tsym || - a.args.tail == null) - return isValid; + a.args.tail == null) + return true; + boolean isValid = true; if (!a.args.head.hasTag(ASSIGN)) return false; // error recovery JCAssign assign = (JCAssign) a.args.head; Symbol m = TreeInfo.symbol(assign.lhs); diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java index 9cb73b3a545..385cc9828d8 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java @@ -176,14 +176,14 @@ public class DeferredAttr extends JCTree.Visitor { SpeculativeCache speculativeCache; DeferredType(JCExpression tree, Env env) { - super(null, TypeMetadata.empty); + super(null, TypeMetadata.EMPTY); this.tree = tree; this.env = attr.copyEnv(env); this.speculativeCache = new SpeculativeCache(); } @Override - public DeferredType clone(TypeMetadata md) { + public DeferredType cloneWithMetadata(TypeMetadata md) { throw new AssertionError("Cannot add metadata to a deferred type"); } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java index 177dbf8df2f..7ab179305ef 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java @@ -25,7 +25,6 @@ package com.sun.tools.javac.comp; -import java.util.*; import javax.tools.JavaFileObject; import javax.tools.JavaFileManager; @@ -34,7 +33,6 @@ import com.sun.tools.javac.code.Kinds.KindSelector; import com.sun.tools.javac.code.Scope.*; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Type.*; -import com.sun.tools.javac.jvm.*; import com.sun.tools.javac.main.Option.PkgInfo; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.tree.JCTree.*; @@ -87,11 +85,11 @@ import static com.sun.tools.javac.code.Kinds.Kind.*; public class Enter extends JCTree.Visitor { protected static final Context.Key enterKey = new Context.Key<>(); + Annotate annotate; Log log; Symtab syms; Check chk; TreeMaker make; - Annotate annotate; TypeEnter typeEnter; Types types; Lint lint; @@ -253,11 +251,13 @@ public class Enter extends JCTree.Visitor { Env prevEnv = this.env; try { this.env = env; + annotate.blockAnnotations(); tree.accept(this); return result; } catch (CompletionFailure ex) { return chk.completionError(tree.pos(), ex); } finally { + annotate.unblockAnnotations(); this.env = prevEnv; } } @@ -474,7 +474,7 @@ public class Enter extends JCTree.Visitor { * @param c The class symbol to be processed or null to process all. */ public void complete(List trees, ClassSymbol c) { - annotate.enterStart(); + annotate.blockAnnotations(); ListBuffer prevUncompleted = uncompleted; if (typeEnter.completionEnabled) uncompleted = new ListBuffer<>(); @@ -497,7 +497,7 @@ public class Enter extends JCTree.Visitor { } } finally { uncompleted = prevUncompleted; - annotate.enterDone(); + annotate.unblockAnnotations(); } } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java index 4558aeb9350..72a432676ff 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java @@ -2766,20 +2766,6 @@ public class Lower extends TreeTranslator { return translationMap; } - public void visitAnnotatedType(JCAnnotatedType tree) { - // No need to retain type annotations in the tree - // tree.annotations = translate(tree.annotations); - tree.annotations = List.nil(); - tree.underlyingType = translate(tree.underlyingType); - // but maintain type annotations in the type. - if (tree.type.isAnnotated()) { - tree.type = tree.underlyingType.type.annotatedType(tree.type.getAnnotationMirrors()); - } else if (tree.underlyingType.type.isAnnotated()) { - tree.type = tree.underlyingType.type; - } - result = tree; - } - public void visitTypeCast(JCTypeCast tree) { tree.clazz = translate(tree.clazz); if (tree.type.isPrimitive() != tree.expr.type.isPrimitive()) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java index 92072680708..46b65e5be4d 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ package com.sun.tools.javac.comp; -import javax.tools.JavaFileObject; - import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Scope.WriteableScope; import com.sun.tools.javac.tree.*; @@ -224,10 +222,12 @@ public class MemberEnter extends JCTree.Visitor { annotate.annotateLater(tree.mods.annotations, localEnv, m, tree.pos()); // Visit the signature of the method. Note that // TypeAnnotate doesn't descend into the body. - annotate.annotateTypeLater(tree, localEnv, m, tree.pos()); + annotate.queueScanTreeAndTypeAnnotate(tree, localEnv, m, tree.pos()); - if (tree.defaultValue != null) - annotateDefaultValueLater(tree.defaultValue, localEnv, m, tree.pos()); + if (tree.defaultValue != null) { + m.defaultValue = annotate.unfinishedDefaultValue(); // set it to temporary sentinel for now + annotate.annotateDefaultValueLater(tree.defaultValue, localEnv, m, tree.pos()); + } } /** Create a fresh environment for method bodies. @@ -255,6 +255,7 @@ public class MemberEnter extends JCTree.Visitor { localEnv.info.staticLevel++; } DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos()); + try { if (TreeInfo.isEnumInit(tree)) { attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype); @@ -297,7 +298,7 @@ public class MemberEnter extends JCTree.Visitor { } annotate.annotateLater(tree.mods.annotations, localEnv, v, tree.pos()); - annotate.annotateTypeLater(tree.vartype, localEnv, v, tree.pos()); + annotate.queueScanTreeAndTypeAnnotate(tree.vartype, localEnv, v, tree.pos()); v.pos = tree.pos; } @@ -434,53 +435,4 @@ public class MemberEnter extends JCTree.Visitor { Env iEnv = initEnv(tree, env); return iEnv; } - - /** Queue processing of an attribute default value. */ - void annotateDefaultValueLater(final JCExpression defaultValue, - final Env localEnv, - final MethodSymbol m, - final DiagnosticPosition deferPos) { - annotate.normal(new Annotate.Worker() { - @Override - public String toString() { - return "annotate " + m.owner + "." + - m + " default " + defaultValue; - } - - @Override - public void run() { - JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); - DiagnosticPosition prevLintPos = deferredLintHandler.setPos(deferPos); - try { - enterDefaultValue(defaultValue, localEnv, m); - } finally { - deferredLintHandler.setPos(prevLintPos); - log.useSource(prev); - } - } - }); - annotate.validate(new Annotate.Worker() { //validate annotations - @Override - public void run() { - JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile); - try { - // if default value is an annotation, check it is a well-formed - // annotation value (e.g. no duplicate values, no missing values, etc.) - chk.validateAnnotationTree(defaultValue); - } finally { - log.useSource(prev); - } - } - }); - } - - /** Enter a default value for an attribute method. */ - private void enterDefaultValue(final JCExpression defaultValue, - final Env localEnv, - final MethodSymbol m) { - m.defaultValue = annotate.enterAttributeValue(m.type.getReturnType(), - defaultValue, - localEnv); - } - } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java index 90521531f54..f3dbb34b4b7 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java @@ -28,6 +28,7 @@ package com.sun.tools.javac.comp; import java.util.*; import com.sun.tools.javac.code.*; +import com.sun.tools.javac.code.Attribute.TypeCompound; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.tree.JCTree.*; @@ -68,6 +69,7 @@ public class TransTypes extends TreeTranslator { private TreeMaker make; private Enter enter; private Types types; + private Annotate annotate; private final Resolve resolve; private final CompileStates compileStates; @@ -91,6 +93,7 @@ public class TransTypes extends TreeTranslator { Source source = Source.instance(context); allowInterfaceBridges = source.allowDefaultMethods(); allowGraphInference = source.allowGraphInference(); + annotate = Annotate.instance(context); } /** A hashtable mapping bridge methods to the methods they override after @@ -751,6 +754,15 @@ public class TransTypes extends TreeTranslator { result = tree; } + public void visitAnnotatedType(JCAnnotatedType tree) { + // For now, we need to keep the annotations in the tree because of the current + // MultiCatch implementation wrt type annotations + List mirrors = annotate.fromAnnotations(tree.annotations); + tree.underlyingType = translate(tree.underlyingType); + tree.type = tree.underlyingType.type.annotatedType(mirrors); + result = tree; + } + public void visitTypeCast(JCTypeCast tree) { tree.clazz = translate(tree.clazz, null); Type originalTarget = tree.type; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java index a27378c6034..c54cfd6db65 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ import com.sun.tools.javac.code.Scope.ImportFilter; import com.sun.tools.javac.code.Scope.NamedImportScope; import com.sun.tools.javac.code.Scope.StarImportScope; import com.sun.tools.javac.code.Scope.WriteableScope; +import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.DefinedBy.Api; @@ -135,6 +136,7 @@ public class TypeEnter implements Completer { lint = Lint.instance(context); typeEnvs = TypeEnvs.instance(context); dependencies = Dependencies.instance(context); + Source source = Source.instance(context); allowTypeAnnos = source.allowTypeAnnotations(); allowDeprecationOnImport = source.allowDeprecationOnImport(); } @@ -164,7 +166,7 @@ public class TypeEnter implements Completer { Env topEnv = enter.topLevelEnv(tree); finishImports(tree, () -> { completeClass.resolveImports(tree, topEnv); }); } - } + } } /* ******************************************************************** @@ -184,7 +186,7 @@ public class TypeEnter implements Completer { } try { - annotate.enterStart(); + annotate.blockAnnotations(); sym.flags_field |= UNATTRIBUTED; List> queue; @@ -206,7 +208,7 @@ public class TypeEnter implements Completer { } } } finally { - annotate.enterDone(); + annotate.unblockAnnotations(); } } @@ -780,9 +782,9 @@ public class TypeEnter implements Completer { Env baseEnv = baseEnv(tree, env); if (tree.extending != null) - annotate.annotateTypeLater(tree.extending, baseEnv, sym, tree.pos()); + annotate.queueScanTreeAndTypeAnnotate(tree.extending, baseEnv, sym, tree.pos()); for (JCExpression impl : tree.implementing) - annotate.annotateTypeLater(impl, baseEnv, sym, tree.pos()); + annotate.queueScanTreeAndTypeAnnotate(impl, baseEnv, sym, tree.pos()); annotate.flush(); attribSuperTypes(env, baseEnv); @@ -800,7 +802,7 @@ public class TypeEnter implements Completer { attr.attribTypeVariables(tree.typarams, baseEnv); for (JCTypeParameter tp : tree.typarams) - annotate.annotateTypeLater(tp, baseEnv, sym, tree.pos()); + annotate.queueScanTreeAndTypeAnnotate(tp, baseEnv, sym, tree.pos()); // check that no package exists with same fully qualified name, // but admit classes in the unnamed package which have the same @@ -899,6 +901,11 @@ public class TypeEnter implements Completer { addEnumMembers(tree, env); } memberEnter.memberEnter(tree.defs, env); + + if (tree.sym.isAnnotationType()) { + Assert.checkNull(tree.sym.completer); + tree.sym.setAnnotationTypeMetadata(new AnnotationTypeMetadata(tree.sym, annotate.annotationTypeSourceCompleter())); + } } /** Add the implicit members for an enum type diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java index 641098642ae..abcf45da00f 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -36,17 +36,17 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; - import javax.tools.JavaFileManager; import javax.tools.JavaFileObject; - +import com.sun.tools.javac.comp.Annotate; +import com.sun.tools.javac.comp.Annotate.AnnotationTypeCompleter; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.code.Scope.WriteableScope; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Symtab; import com.sun.tools.javac.code.Type.*; -import com.sun.tools.javac.comp.Annotate; +import com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata; import com.sun.tools.javac.file.BaseFileObject; import com.sun.tools.javac.jvm.ClassFile.NameAndType; import com.sun.tools.javac.jvm.ClassFile.Version; @@ -81,7 +81,7 @@ public class ClassReader { public static final int INITIAL_BUFFER_SIZE = 0x0fff0; - Annotate annotate; + private final Annotate annotate; /** Switch: verbose output. */ @@ -190,6 +190,18 @@ public class ClassReader { */ Set warnedAttrs = new HashSet<>(); + /** + * The prototype @Target Attribute.Compound if this class is an annotation annotated with + * @Target + */ + CompoundAnnotationProxy target; + + /** + * The prototype @Repetable Attribute.Compound if this class is an annotation annotated with + * @Repeatable + */ + CompoundAnnotationProxy repeatable; + /** Get the ClassReader instance for this invocation. */ public static ClassReader instance(Context context) { ClassReader instance = context.get(classReaderKey); @@ -201,6 +213,7 @@ public class ClassReader { /** Construct a new class reader. */ protected ClassReader(Context context) { context.put(classReaderKey, this); + annotate = Annotate.instance(context); names = Names.instance(context); syms = Symtab.instance(context); types = Types.instance(context); @@ -212,9 +225,8 @@ public class ClassReader { log = Log.instance(context); Options options = Options.instance(context); - annotate = Annotate.instance(context); - verbose = options.isSet(VERBOSE); - checkClassFile = options.isSet("-checkclassfile"); + verbose = options.isSet(VERBOSE); + checkClassFile = options.isSet("-checkclassfile"); Source source = Source.instance(context); allowSimplifiedVarargs = source.allowSimplifiedVarargs(); @@ -1304,6 +1316,13 @@ public class ClassReader { ListBuffer proxies = new ListBuffer<>(); for (int i = 0; i deproxyCompoundList(List pl) { // also must fill in types!!!! @@ -1855,19 +1877,19 @@ public class ClassReader { } } - class AnnotationDefaultCompleter extends AnnotationDeproxy implements Annotate.Worker { + class AnnotationDefaultCompleter extends AnnotationDeproxy implements Runnable { final MethodSymbol sym; final Attribute value; final JavaFileObject classFile = currentClassFile; - @Override - public String toString() { - return " ClassReader store default for " + sym.owner + "." + sym + " is " + value; - } + AnnotationDefaultCompleter(MethodSymbol sym, Attribute value) { + super(currentOwner.kind == MTH + ? currentOwner.enclClass() : (ClassSymbol)currentOwner); this.sym = sym; this.value = value; } - // implement Annotate.Worker.run() + + @Override public void run() { JavaFileObject previousClassFile = currentClassFile; try { @@ -1880,22 +1902,27 @@ public class ClassReader { currentClassFile = previousClassFile; } } + + @Override + public String toString() { + return " ClassReader store default for " + sym.owner + "." + sym + " is " + value; + } } - class AnnotationCompleter extends AnnotationDeproxy implements Annotate.Worker { + class AnnotationCompleter extends AnnotationDeproxy implements Runnable { final Symbol sym; final List l; final JavaFileObject classFile; - @Override - public String toString() { - return " ClassReader annotate " + sym.owner + "." + sym + " with " + l; - } + AnnotationCompleter(Symbol sym, List l) { + super(currentOwner.kind == MTH + ? currentOwner.enclClass() : (ClassSymbol)currentOwner); this.sym = sym; this.l = l; this.classFile = currentClassFile; } - // implement Annotate.Worker.run() + + @Override public void run() { JavaFileObject previousClassFile = currentClassFile; try { @@ -1910,6 +1937,11 @@ public class ClassReader { currentClassFile = previousClassFile; } } + + @Override + public String toString() { + return " ClassReader annotate " + sym.owner + "." + sym + " with " + l; + } } class TypeAnnotationCompleter extends AnnotationCompleter { @@ -2298,6 +2330,8 @@ public class ClassReader { currentClassFile = c.classfile; warnedAttrs.clear(); filling = true; + target = null; + repeatable = null; try { bp = 0; buf = readInputStream(buf, c.classfile.openInputStream()); @@ -2318,6 +2352,12 @@ public class ClassReader { Name name = missingTypeVariables.head.tsym.name; throw badClassFile("undecl.type.var", name); } + + if ((c.flags_field & Flags.ANNOTATION) != 0) { + c.setAnnotationTypeMetadata(new AnnotationTypeMetadata(c, new CompleterDeproxy(c, target, repeatable))); + } else { + c.setAnnotationTypeMetadata(AnnotationTypeMetadata.notAnAnnotationType()); + } } catch (IOException ex) { throw badClassFile("unable.to.access.file", ex.getMessage()); } catch (ArrayIndexOutOfBoundsException ex) { @@ -2515,4 +2555,42 @@ public class ClassReader { return name.hashCode(); } } + + private class CompleterDeproxy implements AnnotationTypeCompleter { + ClassSymbol proxyOn; + CompoundAnnotationProxy target; + CompoundAnnotationProxy repeatable; + + public CompleterDeproxy(ClassSymbol c, CompoundAnnotationProxy target, + CompoundAnnotationProxy repeatable) + { + this.proxyOn = c; + this.target = target; + this.repeatable = repeatable; + } + + @Override + public void complete(ClassSymbol sym) { + Assert.check(proxyOn == sym); + Attribute.Compound theTarget = null, theRepeatable = null; + AnnotationDeproxy deproxy; + + try { + if (target != null) { + deproxy = new AnnotationDeproxy(proxyOn); + theTarget = deproxy.deproxyCompound(target); + } + + if (repeatable != null) { + deproxy = new AnnotationDeproxy(proxyOn); + theRepeatable = deproxy.deproxyCompound(repeatable); + } + } catch (Exception e) { + throw new CompletionFailure(sym, e.getMessage()); + } + + sym.getAnnotationTypeMetadata().setTarget(theTarget); + sym.getAnnotationTypeMetadata().setRepeatable(theRepeatable); + } + } } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java index 402ae13470b..32adf0723a0 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java @@ -75,6 +75,7 @@ public class Gen extends JCTree.Visitor { private final Types types; private final Lower lower; private final Flow flow; + private final Annotate annotate; /** Format of stackmap tables to be generated. */ private final Code.StackMapFormat stackMap; @@ -142,6 +143,7 @@ public class Gen extends JCTree.Visitor { } this.jsrlimit = setjsrlimit; this.useJsrLocally = false; // reset in visitTry + annotate = Annotate.instance(context); } /** Switches @@ -1468,21 +1470,18 @@ public class Gen extends JCTree.Visitor { int startpc, int endpc, List gaps) { if (startpc != endpc) { - List subClauses = TreeInfo.isMultiCatch(tree) ? - ((JCTypeUnion)tree.param.vartype).alternatives : - List.of(tree.param.vartype); + List, JCExpression>> catchTypeExprs + = catchTypesWithAnnotations(tree); while (gaps.nonEmpty()) { - for (JCExpression subCatch : subClauses) { + for (Pair, JCExpression> subCatch1 : catchTypeExprs) { + JCExpression subCatch = subCatch1.snd; int catchType = makeRef(tree.pos(), subCatch.type); int end = gaps.head.intValue(); registerCatch(tree.pos(), startpc, end, code.curCP(), catchType); - if (subCatch.type.isAnnotated()) { - for (Attribute.TypeCompound tc : - subCatch.type.getAnnotationMirrors()) { + for (Attribute.TypeCompound tc : subCatch1.fst) { tc.position.setCatchInfo(catchType, startpc); - } } } gaps = gaps.tail; @@ -1490,16 +1489,14 @@ public class Gen extends JCTree.Visitor { gaps = gaps.tail; } if (startpc < endpc) { - for (JCExpression subCatch : subClauses) { + for (Pair, JCExpression> subCatch1 : catchTypeExprs) { + JCExpression subCatch = subCatch1.snd; int catchType = makeRef(tree.pos(), subCatch.type); registerCatch(tree.pos(), startpc, endpc, code.curCP(), catchType); - if (subCatch.type.isAnnotated()) { - for (Attribute.TypeCompound tc : - subCatch.type.getAnnotationMirrors()) { - tc.position.setCatchInfo(catchType, startpc); - } + for (Attribute.TypeCompound tc : subCatch1.fst) { + tc.position.setCatchInfo(catchType, startpc); } } } @@ -1507,7 +1504,7 @@ public class Gen extends JCTree.Visitor { code.statBegin(tree.pos); code.markStatBegin(); int limit = code.nextreg; - int exlocal = code.newLocal(exparam); + code.newLocal(exparam); items.makeLocalItem(exparam).store(); code.statBegin(TreeInfo.firstStatPos(tree.body)); genStat(tree.body, env, CRT_BLOCK); @@ -1515,6 +1512,30 @@ public class Gen extends JCTree.Visitor { code.statBegin(TreeInfo.endPos(tree.body)); } } + // where + List, JCExpression>> catchTypesWithAnnotations(JCCatch tree) { + return TreeInfo.isMultiCatch(tree) ? + catchTypesWithAnnotationsFromMulticatch((JCTypeUnion)tree.param.vartype, tree.param.sym.getRawTypeAttributes()) : + List.of(new Pair<>(tree.param.sym.getRawTypeAttributes(), tree.param.vartype)); + } + // where + List, JCExpression>> catchTypesWithAnnotationsFromMulticatch(JCTypeUnion tree, List first) { + List alts = tree.alternatives; + List, JCExpression>> res = List.of(new Pair<>(first, alts.head)); + alts = alts.tail; + + while(alts != null && alts.head != null) { + JCExpression alt = alts.head; + if (alt instanceof JCAnnotatedType) { + JCAnnotatedType a = (JCAnnotatedType)alt; + res = res.prepend(new Pair<>(annotate.fromAnnotations(a.annotations), alt)); + } else { + res = res.prepend(new Pair<>(List.nil(), alt)); + } + alts = alts.tail; + } + return res.reverse(); + } /** Register a catch clause in the "Exceptions" code-attribute. */ @@ -2052,7 +2073,7 @@ public class Gen extends JCTree.Visitor { code.emitop2(new_, makeRef(pos, stringBufferType)); code.emitop0(dup); callMethod( - pos, stringBufferType, names.init, List.nil(), false); + pos, stringBufferType, names.init, List.nil(), false); } /** Append value (on tos) to string buffer (on tos - 1). @@ -2100,11 +2121,11 @@ public class Gen extends JCTree.Visitor { */ void bufferToString(DiagnosticPosition pos) { callMethod( - pos, - stringBufferType, - names.toString, - List.nil(), - false); + pos, + stringBufferType, + names.toString, + List.nil(), + false); } /** Complete generating code for operation, with left operand diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/UninitializedType.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/UninitializedType.java index d1dacc35369..5b40f6419fa 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/UninitializedType.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/UninitializedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ class UninitializedType extends Type.DelegatedType { } @Override - public UninitializedType clone(final TypeMetadata md) { + public UninitializedType cloneWithMetadata(final TypeMetadata md) { return new UninitializedType(tag, qtype, offset, md); } diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java index 9849f2d0c47..ed6642857ae 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,13 @@ package com.sun.tools.javac.model; +import java.util.Collection; import java.util.Collections; import java.util.EnumSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; import javax.lang.model.element.*; import javax.lang.model.type.*; @@ -115,14 +117,17 @@ public class JavacTypes implements javax.lang.model.util.Types { @DefinedBy(Api.LANGUAGE_MODEL) public List directSupertypes(TypeMirror t) { validateTypeNotIn(t, EXEC_OR_PKG); - return types.directSupertypes((Type) t); + Type ty = (Type)t; + return types.directSupertypes(ty).stream() + .map(Type::stripMetadataIfNeeded) + .collect(Collectors.toList()); } @DefinedBy(Api.LANGUAGE_MODEL) public TypeMirror erasure(TypeMirror t) { if (t.getKind() == TypeKind.PACKAGE) throw new IllegalArgumentException(t.toString()); - return types.erasure((Type) t); + return types.erasure((Type)t).stripMetadataIfNeeded(); } @DefinedBy(Api.LANGUAGE_MODEL) @@ -143,7 +148,7 @@ public class JavacTypes implements javax.lang.model.util.Types { @DefinedBy(Api.LANGUAGE_MODEL) public TypeMirror capture(TypeMirror t) { validateTypeNotIn(t, EXEC_OR_PKG); - return types.capture((Type) t); + return types.capture((Type)t).stripMetadataIfNeeded(); } @DefinedBy(Api.LANGUAGE_MODEL) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java index 656079aa763..a1efba6612f 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,8 +34,6 @@ import javax.lang.model.type.TypeKind; import javax.tools.JavaFileObject; import com.sun.source.tree.*; -import com.sun.source.tree.LambdaExpressionTree.BodyKind; -import com.sun.source.tree.MemberReferenceTree.ReferenceMode; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Scope.*; import com.sun.tools.javac.code.Symbol.*; @@ -2502,12 +2500,6 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition { public JCTree annotationType; public List args; - - // Attribute.Compound if tag is ANNOTATION - // Attribute.TypeCompound if tag is TYPE_ANNOTATION - // - // NOTE: This field is slated for removal in the future. Do - // not use it for anything new. public Attribute.Compound attribute; protected JCAnnotation(Tag tag, JCTree annotationType, List args) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java index c543782b888..0925fd1b815 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -234,6 +234,8 @@ public class RichDiagnosticFormatter extends } private boolean unique(TypeVar typevar) { + typevar = (TypeVar)typevar.stripMetadataIfNeeded(); + int found = 0; for (Type t : whereClauses.get(WhereClauseKind.TYPEVAR).keySet()) { if (t.toString().equals(typevar.toString())) { @@ -542,6 +544,7 @@ public class RichDiagnosticFormatter extends @Override public Void visitTypeVar(TypeVar t, Void ignored) { + t = (TypeVar)t.stripMetadataIfNeeded(); if (indexOf(t, WhereClauseKind.TYPEVAR) == -1) { //access the bound type and skip error types Type bound = t.bound; diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java b/langtools/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java index 2c7ac550764..4e457f7832f 100644 --- a/langtools/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java +++ b/langtools/test/tools/javac/annotations/typeAnnotations/api/AnnotatedArrayOrder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ /* * @test + * @bug 8031744 * @summary Checks the annotation types targeting array types */ @@ -34,7 +35,6 @@ import java.util.List; import java.util.Map; import java.util.HashMap; import java.lang.annotation.*; -import javax.tools.JavaFileManager; import javax.tools.JavaFileObject; import com.sun.source.tree.*; import com.sun.source.util.JavacTask; diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java index dac16370cff..71bab2f32ee 100644 --- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java +++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 6843077 8006775 + * @bug 6843077 8006775 8031744 * @summary random tests for new locations * @author Matt Papi * @compile BasicTest.java @@ -41,12 +41,16 @@ import java.io.*; @interface C {} @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface D {} +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@interface E {} +@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@interface F {} /** * Tests basic JSR 308 parser functionality. We don't really care about what * the parse tree looks like, just that these annotations can be parsed. */ -class BasicTest extends @B LinkedList implements @C List { +class BasicTest<@D T extends @A Object> extends @B LinkedList<@E T> implements @C List<@F T> { void test() { diff --git a/langtools/test/tools/javac/lib/DPrinter.java b/langtools/test/tools/javac/lib/DPrinter.java index da9f62da6a2..d5907fd7a4a 100644 --- a/langtools/test/tools/javac/lib/DPrinter.java +++ b/langtools/test/tools/javac/lib/DPrinter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -477,7 +477,7 @@ public class DPrinter { out.print(label); out.println(": " + info(sym.getClass(), - String.format("0x%x--%s", sym.kind, Kinds.kindName(sym)), + String.format("0x%x--%s", sym.kind.ordinal(), Kinds.kindName(sym)), sym.getKind()) + " " + sym.name + " " + hashString(sym)); diff --git a/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java b/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java index aafe60a4dd3..c2e4e86161b 100644 --- a/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java +++ b/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,21 +23,27 @@ /* * @test - * @bug 8013852 + * @bug 8013852 8031744 * @summary Annotations on types * @library /tools/javac/lib - * @ignore 8057688 type annotations in type argument position are lost - * @ignore 8031744 Annotations on many Language Model elements are not returned * @build JavacTestingAbstractProcessor DPrinter BasicAnnoTests * @compile/process -processor BasicAnnoTests -proc:only BasicAnnoTests.java */ import java.io.PrintWriter; +import java.io.Serializable; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; +import java.lang.annotation.Repeatable; import java.lang.annotation.Target; +import java.util.ArrayList; + +import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.NavigableMap; import java.util.Set; +import java.util.TreeMap; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; @@ -48,15 +54,23 @@ import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.ArrayType; +import javax.lang.model.type.DeclaredType; import javax.lang.model.type.ExecutableType; +import javax.lang.model.type.IntersectionType; import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeVariable; import javax.lang.model.type.WildcardType; +import javax.lang.model.util.Types; import javax.tools.Diagnostic.Kind; +import com.sun.tools.javac.code.Attribute; import com.sun.tools.javac.code.Symbol; -import com.sun.tools.javac.code.Type; import com.sun.tools.javac.processing.JavacProcessingEnvironment; +import com.sun.tools.javac.util.Name; + +import static com.sun.tools.javac.code.Attribute.Array; +import static com.sun.tools.javac.code.Attribute.Constant; +import static com.sun.tools.javac.code.Attribute.Compound; /** * The test scans this file looking for test cases annotated with @Test. @@ -77,7 +91,7 @@ public class BasicAnnoTests extends JavacTestingAbstractProcessor { public boolean process(Set annotations, RoundEnvironment roundEnv) { TestElementScanner s = new TestElementScanner(); for (Element e: roundEnv.getRootElements()) { - s.scan(e); + s.scan(e, null); } return true; } @@ -95,17 +109,17 @@ public class BasicAnnoTests extends JavacTestingAbstractProcessor { */ class TestElementScanner extends ElementScanner { public Void scan(Element elem, Void ignore) { + List tests = new ArrayList<>(); AnnotationMirror test = getAnnotation(elem, Test.class.getName().replace('$', '.')); if (test != null) { + tests.add(test); + } + tests.addAll(getAnnotations(elem, Tests.class.getName().replace('$', '.'))); + + if (tests.size() > 0) { out.println("Test: " + elem + " " + test); - TestTypeScanner s = new TestTypeScanner(elem, test); - s.scan(elem.asType(), null); - if (getPosn(test) >= s.count) - error(elem, "position " + getPosn(test) + " not found"); - if (!s.found) { - dprinter.printSymbol("element", (Symbol) elem); - dprinter.printType("type", (Type) elem.asType()); - } + TestTypeScanner s = new TestTypeScanner(elem, tests, types); + s.test(elem.asType()); out.println(); } return super.scan(elem, ignore); @@ -118,45 +132,110 @@ public class BasicAnnoTests extends JavacTestingAbstractProcessor { */ class TestTypeScanner extends TypeScanner { Element elem; - AnnotationMirror test; + NavigableMap toBeFound; int count = 0; - boolean found = false; + Set seen = new HashSet<>(); - TestTypeScanner(Element elem, AnnotationMirror test) { + TestTypeScanner(Element elem, List tests, Types types) { + super(types); this.elem = elem; - this.test = test; + + NavigableMap testByPos = new TreeMap<>(); + for (AnnotationMirror test : tests) { + for (int pos : getPosn(test)) { + testByPos.put(pos, test); + } + } + this.toBeFound = testByPos; + } + + public void test(TypeMirror t) { + scan(t, null); } @Override Void scan(TypeMirror t, Void ignore) { if (t == null) return DEFAULT_VALUE; - if (verbose) - out.println("scan " + count + ": " + t); - if (count == getPosn(test)) { - String annoType = getAnnoType(test); - AnnotationMirror anno = getAnnotation(t, annoType); - if (anno == null) { - error(elem, "annotation not found on " + count + ": " + t); - } else { - String v = getValue(anno, "value").toString(); - if (v.equals(getExpect(test))) { - out.println("found " + anno + " as expected"); - found = true; + + if (!seen.contains(t)) { + try { + seen.add(t); + if (verbose) + out.println("scan " + count + ": " + t); + if (toBeFound.size() > 0) { + if (toBeFound.firstKey().equals(count)) { + AnnotationMirror test = toBeFound.pollFirstEntry().getValue(); + String annoType = getAnnoType(test); + AnnotationMirror anno = getAnnotation(t, annoType); + if (anno == null) { + error(elem, "annotation not found on " + count + ": " + t); + } else { + String v = getValue(anno, "value").toString(); + if (v.equals(getExpect(test))) { + out.println("found " + anno + " as expected"); + } else { + error(elem, "Unexpected value: " + v + ", expected: " + getExpect(test)); + } + } + } else if (count > toBeFound.firstKey()) { + rescue(); + } else { + List annos = t.getAnnotationMirrors(); + if (annos.size() > 0) { + for (AnnotationMirror a : annos) + error(elem, "annotation " + a + " found on " + count + ": " + t); + } + } } else { - error(elem, "Unexpected value: " + v + ", expected: " + getExpect(test)); + List annos = t.getAnnotationMirrors(); + if (annos.size() > 0) { + for (AnnotationMirror a : annos) + error(elem, "annotation " + a + " found on " + count + ": " + t); + } } + count++; + return super.scan(t, ignore); + + } finally { + seen.remove(t); } } - count++; - return super.scan(t, ignore); + + return DEFAULT_VALUE; + + } + + private void rescue() { + while (toBeFound.size() > 0 && toBeFound.firstKey() >= count) + toBeFound.pollFirstEntry(); } } - /** Get the position value from an @Test annotation mirror. */ - static int getPosn(AnnotationMirror test) { + /** Get the position value from an element annotated with a @Test annotation mirror. */ + static int[] getPosn(Element elem) { + return elem.getAnnotation(Test.class).posn(); + } + + /** Get the position value from a @Test annotation mirror. */ + static Integer[] getPosn(AnnotationMirror test) { AnnotationValue v = getValue(test, "posn"); - return (Integer) v.getValue(); + Object value = v.getValue(); + Integer i = 0; + if (value instanceof Constant) { + i = (Integer)((Constant)value).getValue(); + Integer[] res = new Integer[1]; + res[0] = i; + return res; + } else if (value instanceof List) { + List l = (List)value; + Integer[] res = new Integer[l.size()]; + for (int c = 0; c < l.size(); c++) { + res[c] = (Integer)l.get(c).getValue(); + } + return res; + } + return null; } /** Get the expect value from an @Test annotation mirror. */ @@ -185,6 +264,25 @@ public class BasicAnnoTests extends JavacTestingAbstractProcessor { return null; } + static List getAnnotations(Element e, String name) { + Name valueName = ((Symbol)e).getSimpleName().table.names.value; + List res = new ArrayList<>(); + + for (AnnotationMirror m : e.getAnnotationMirrors()) { + TypeElement te = (TypeElement) m.getAnnotationType().asElement(); + if (te.getQualifiedName().contentEquals(name)) { + Compound theAnno = (Compound)m; + Array valueArray = (Array)theAnno.member(valueName); + for (Attribute a : valueArray.getValue()) { + AnnotationMirror theMirror = (AnnotationMirror) a; + + res.add(theMirror); + } + } + } + return res; + } + /** * Get a specific value from an annotation mirror. */ @@ -203,6 +301,13 @@ public class BasicAnnoTests extends JavacTestingAbstractProcessor { * one sufficient for our needs. */ static class TypeScanner extends SimpleTypeVisitor { + private Types types; + + public TypeScanner(Types types) { + super(); + this.types = types; + } + @Override public R visitArray(ArrayType t, P p) { scan(t.getComponentType(), p); @@ -211,16 +316,33 @@ public class BasicAnnoTests extends JavacTestingAbstractProcessor { @Override public R visitExecutable(ExecutableType t, P p) { + //out.println(" type parameters: " + t.getTypeVariables()); + scan(t.getTypeVariables(), p); + //out.println(" return: " + t.getReturnType()); + scan(t.getReturnType(), p); + //out.println(" receiver: " + t.getReceiverTypes()); scan(t.getReceiverType()); //out.println(" params: " + t.getParameterTypes()); scan(t.getParameterTypes(), p); - //out.println(" return: " + t.getReturnType()); - scan(t.getReturnType(), p); //out.println(" throws: " + t.getThrownTypes()); scan(t.getThrownTypes(), p); return super.visitExecutable(t, p); } + @Override + public R visitDeclared(DeclaredType t, P p) { + scan(t.getTypeArguments(), p); + // don't scan enclosing + scan(types.directSupertypes(t), p); + return super.visitDeclared(t, p); + } + + @Override + public R visitIntersection(IntersectionType t, P p) { + scan(t.getBounds(), p); + return super.visitIntersection(t, p); + } + @Override public R visitTypeVariable(TypeVariable t, P p) { scan(t.getLowerBound(), p); @@ -254,36 +376,194 @@ public class BasicAnnoTests extends JavacTestingAbstractProcessor { } /** Annotation to identify test cases. */ + @Repeatable(Tests.class) @interface Test { /** Where to look for the annotation, expressed as a scan index. */ - int posn(); + int[] posn(); /** The annotation to look for. */ Class annoType(); /** The string representation of the annotation's value. */ String expect(); } + @interface Tests { + Test[] value(); + } + /** Type annotation to use in test cases. */ @Target(ElementType.TYPE_USE) public @interface TA { int value(); } + @Target(ElementType.TYPE_USE) + public @interface TB { + int value(); + } + + // Test cases + + // TODO: add more cases for arrays + // all annotated + // all but one annotated + // vary position of one not annotated + // only one annotated + // vary position of one annotated + // the three above with the corner case of the ambiguos decl + type anno added @Test(posn=0, annoType=TA.class, expect="1") public @TA(1) int f1; + @Test(posn=0, annoType=TA.class, expect="11") + @TA(11) public int f11; + + @Test(posn=1, annoType=TA.class, expect="111") + @TA(111) public int [] f111; + + @Test(posn=1, annoType=TA.class, expect="1120") + @Test(posn=0, annoType=TB.class, expect="1121") + @TA(1120) public int @TB(1121) [] f112; + + @Test(posn=0, annoType=TB.class, expect="11211") + @Test(posn=1, annoType=TA.class, expect="11200") + public @TA(11200) int @TB(11211) [] f112b; + + @Test(posn=1, annoType=TB.class, expect="1131") + @Test(posn=2, annoType=TA.class, expect="1130") + @TA(1130) public int [] @TB(1131) [] f113; + + @Test(posn=5, annoType=TA.class, expect="12") + public @TA(12) int [] [] [] [] [] f12; + + @Test(posn=6, annoType=TA.class, expect="13") + public @TA(13) int [] [] [] [] [] [] f13; + + @Test(posn=7, annoType=TA.class, expect="14") + @TA(14) public int [] [] [] [] [] [] [] f14; + + @Test(posn=6, annoType=TA.class, expect="150") + @Test(posn=7, annoType=TB.class, expect="151") + @TB(151) public int [] [] [] [] [] [] @TA(150) [] f15; + + @Test(posn=0, annoType=TB.class, expect="1511") + @Test(posn=3, annoType=TA.class, expect="1512") + @Test(posn=6, annoType=TA.class, expect="150") + @Test(posn=7, annoType=TB.class, expect="151") + @TB(151) public int @TB(1511) [] [] [] @TA(1512) [] [] [] @TA(150) [] f15b; + + @Test(posn=0, annoType=TB.class, expect="1521") + @Test(posn=3, annoType=TA.class, expect="1522") + @Test(posn=6, annoType=TA.class, expect="152") + public int @TB(1521) [] [] [] @TA(1522) [] [] [] @TA(152) [] f15c; + + @Test(posn=5, annoType=TA.class, expect="160") + @Test(posn=6, annoType=TB.class, expect="161") + public int [] [] [] [] [] @TA(160) [] @TB(161) [] f16; + @Test(posn=0, annoType=TA.class, expect="2") public int @TA(2) [] f2; + @Test(posn=0, annoType=TB.class, expect="33") @Test(posn=1, annoType=TA.class, expect="3") - public @TA(3) int [] f3; + public @TA(3) int @TB(33) [] f3; - @Test(posn=1, annoType=TA.class, expect="4") + @Test(posn=2, annoType=TA.class, expect="4") public int m1(@TA(4) float a) throws Exception { return 0; } - @Test(posn=2, annoType=TA.class, expect="5") + @Test(posn=1, annoType=TA.class, expect="5") public @TA(5) int m2(float a) throws Exception { return 0; } @Test(posn=3, annoType=TA.class, expect="6") public int m3(float a) throws @TA(6) Exception { return 0; } + + // Also tests that a decl anno on a typevar doesn't show up on the Type + @Test(posn=7, annoType=TA.class, expect="8") + public <@TA(7) M> M m4(@TA(8) float a) throws Exception { return null; } + + // Also tests that a decl anno on a typevar doesn't show up on the Type + @Test(posn=4, annoType=TA.class, expect="10") + public class Inner1<@TA(9) S> extends @TA(10) Object implements Cloneable {} + + // Also tests that a decl anno on a typevar doesn't show up on the Type + @Test(posn=5, annoType=TA.class, expect="12") + public class Inner2<@TA(11) S> extends Object implements @TA(12) Cloneable {} + + @Test(posn={3,6}, annoType=TA.class, expect="13") + public M m5(float a) { return null; } + + @Test(posn=3, annoType=TA.class, expect="14") + public class Inner3 {} + + @Test(posn=4, annoType=TA.class, expect="15") + public class Inner4 {} + + @Test(posn=5, annoType=TA.class, expect="16") + public class Inner5 {} + + @Test(posn=7, annoType=TA.class, expect="17") + public class Inner6 {} + + // Test annotated bounds + + @Test(posn=1, annoType=TA.class, expect="18") + public Set<@TA(18) ? extends Object> f4; + + @Test(posn=2, annoType=TA.class, expect="19") + public Set f5; + + @Test(posn=3, annoType=TA.class, expect="20") + public Set> f6; + + @Test(posn=4, annoType=TA.class, expect="21") + public Set> f7; + + @Test(posn=1, annoType=TA.class, expect="22") + public Set<@TA(22) ?> f8; + + @Test(posn=1, annoType=TA.class, expect="23") + public Set<@TA(23) ? super Object> f9; + + // Test type use annotations on uses of type variables + @Test(posn=5, annoType = TA.class, expect = "25") + @Test(posn=5, annoType = TB.class, expect = "26") + void m6(@TA(25) @TB(26) T t) { } + + class Inner7 { + @Test(posn=0, annoType = TA.class, expect = "30") + @Test(posn=0, annoType = TB.class, expect = "31") + @TA(30) @TB(31) T f; + } + + // Test type use annotations on uses of type variables + @Test(posn=5, annoType = TB.class, expect = "41") + <@TA(40) T> void m7(@TB(41) T t) { } + + class Inner8<@TA(50) T> { + @Test(posn=0, annoType = TB.class, expect = "51") + @TB(51) T f; + } + + // Test type use annotations on uses of Class types + @Test(posn=5, annoType = TA.class, expect = "60") + @Test(posn=5, annoType = TB.class, expect = "61") + void m60(@TA(60) @TB(61) String t) { } + + class Inner70 { + @Test(posn=0, annoType = TA.class, expect = "70") + @Test(posn=0, annoType = TB.class, expect = "71") + @TA(70) @TB(71) String f; + } + + // Test type use annotations on uses of type variables + @Test(posn=5, annoType = TB.class, expect = "81") + <@TA(80) T> void m80(@TB(81) String t) { } + + class Inner90<@TA(90) T> { + @Test(posn=0, annoType = TB.class, expect = "91") + @TB(91) String f; + } + + // Recursive bound + @Test(posn=4, annoType = TB.class, expect = "100") + class Inner100> { + } } diff --git a/langtools/test/tools/javac/warnings/6747671/T6747671.out b/langtools/test/tools/javac/warnings/6747671/T6747671.out index 518804d68b5..1176234cd39 100644 --- a/langtools/test/tools/javac/warnings/6747671/T6747671.out +++ b/langtools/test/tools/javac/warnings/6747671/T6747671.out @@ -7,6 +7,6 @@ T6747671.java:29:28: compiler.warn.raw.class.use: T6747671.B, T6747671.B T6747671.java:32:9: compiler.warn.raw.class.use: T6747671.A, T6747671.A T6747671.java:32:20: compiler.warn.raw.class.use: T6747671.A, T6747671.A T6747671.java:33:16: compiler.warn.raw.class.use: T6747671.A.Z, T6747671.A.Z -T6747671.java:36:9: compiler.warn.raw.class.use: @T6747671.TA T6747671.B, T6747671.B +T6747671.java:36:9: compiler.warn.raw.class.use: T6747671.B, T6747671.B T6747671.java:36:27: compiler.warn.raw.class.use: T6747671.B, T6747671.B 11 warnings From fc3275e49310e1aaee2cbd5ba378efdd51abc270 Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Wed, 8 Apr 2015 10:37:54 +0200 Subject: [PATCH 068/101] 8076557: The specified procedure could not be found in management.dll Reviewed-by: tbell, ihse, sla --- jdk/make/lib/Lib-java.management.gmk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jdk/make/lib/Lib-java.management.gmk b/jdk/make/lib/Lib-java.management.gmk index 9f4435d7707..e0e6f1d9476 100644 --- a/jdk/make/lib/Lib-java.management.gmk +++ b/jdk/make/lib/Lib-java.management.gmk @@ -38,6 +38,11 @@ BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/i $(LIBJAVA_HEADER_FLAGS) \ # +# In (at least) VS2013 and later, -DPSAPI_VERSION=1 is needed to generate +# a binary that is compatible with windows versions older than 7/2008R2. +# See MSDN documentation for GetProcessMemoryInfo for more information. +BUILD_LIBMANAGEMENT_CFLAGS += -DPSAPI_VERSION=1 + BUILD_LIBMANAGEMENT_EXCLUDES := ifneq ($(OPENJDK_TARGET_OS), solaris) From c2aa4833c370258e138f140fd6c6c20a758d31ef Mon Sep 17 00:00:00 2001 From: Alexander Stepanov Date: Wed, 8 Apr 2015 16:01:26 +0400 Subject: [PATCH 069/101] 8039440: Tidy warnings cleanup for org/omg Some HTML markup fixes for CORBA Reviewed-by: yan, rriggs, lancea --- .../share/classes/javax/activity/package.html | 4 +- .../share/classes/javax/rmi/CORBA/Util.java | 4 +- .../share/classes/org/omg/CORBA/Any.java | 8 +- .../org/omg/CORBA/CompletionStatus.java | 6 +- .../org/omg/CORBA/DataInputStream.java | 66 ++--- .../classes/org/omg/CORBA/LocalObject.java | 61 +++-- .../share/classes/org/omg/CORBA/NVList.java | 3 +- .../share/classes/org/omg/CORBA/ORB.java | 22 +- .../share/classes/org/omg/CORBA/Object.java | 4 +- .../classes/org/omg/CORBA/Principal.java | 4 +- .../classes/org/omg/CORBA/ServerRequest.java | 4 +- .../classes/org/omg/CORBA/ShortHolder.java | 6 +- .../share/classes/org/omg/CORBA/TCKind.java | 4 +- .../share/classes/org/omg/CORBA/TypeCode.java | 101 ++++---- .../org/omg/CORBA/doc-files/compliance.html | 128 ++++------ .../omg/CORBA/doc-files/generatedfiles.html | 118 ++++++--- .../share/classes/org/omg/CORBA/package.html | 54 ++-- .../org/omg/CORBA/portable/InvokeHandler.java | 4 +- .../org/omg/CORBA/portable/package.html | 64 +++-- .../classes/org/omg/CORBA_2_3/package.html | 22 +- .../org/omg/CORBA_2_3/portable/package.html | 5 +- .../NamingContextExtPackage/package.html | 11 +- .../NamingContextPackage/package.html | 6 +- .../classes/org/omg/CosNaming/nameservice.idl | 234 +++++++++--------- .../classes/org/omg/CosNaming/package.html | 76 +++--- .../classes/org/omg/Dynamic/package.html | 4 +- .../DynAnyFactoryPackage/package.html | 4 +- .../omg/DynamicAny/DynAnyPackage/package.html | 4 +- .../classes/org/omg/DynamicAny/package.html | 14 +- .../omg/IOP/CodecFactoryPackage/package.html | 4 +- .../org/omg/IOP/CodecPackage/package.html | 4 +- .../share/classes/org/omg/IOP/package.html | 4 +- .../classes/org/omg/Messaging/package.html | 4 +- .../org/omg/PortableInterceptor/IOP.idl | 14 +- .../omg/PortableInterceptor/Interceptors.idl | 18 +- .../ORBInitInfoPackage/package.html | 4 +- .../org/omg/PortableInterceptor/package.html | 28 +-- .../CurrentPackage/package.html | 4 +- .../POAManagerPackage/package.html | 4 +- .../PortableServer/POAPackage/package.html | 5 +- .../ServantLocatorPackage/package.html | 9 +- .../org/omg/PortableServer/package.html | 63 +++-- .../org/omg/SendingContext/package.html | 4 +- .../org/omg/stub/java/rmi/package.html | 4 +- 44 files changed, 591 insertions(+), 627 deletions(-) diff --git a/corba/src/java.corba/share/classes/javax/activity/package.html b/corba/src/java.corba/share/classes/javax/activity/package.html index bceb353231a..d9696cc090a 100644 --- a/corba/src/java.corba/share/classes/javax/activity/package.html +++ b/corba/src/java.corba/share/classes/javax/activity/package.html @@ -2,7 +2,7 @@ @@ -34,7 +33,7 @@ Provides methods for the input and output of value types, and contains other updates to the org/omg/CORBA/portable package. -

+ @since 1.3 @serial exclude diff --git a/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html b/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html index 1d5e960eafa..4f4284cff2d 100644 --- a/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html +++ b/corba/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html @@ -3,7 +3,7 @@ + * + * + * + * + * * ... - * </xs:sequence> - * </xs:complexType> - * </xs:element> - * </xs:schema> + * + * + * + * * * JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" ); * Unmarshaller u = jc.createUnmarshaller(); @@ -308,8 +308,8 @@ import java.io.Reader; * // local element declaration in schema. * * // FooType is the JAXB mapping of the type of local element declaration foo. - * JAXBElement<FooType> foo = u.unmarshal( fooSubtree, FooType.class); - * + * JAXBElement foo = u.unmarshal( fooSubtree, FooType.class); + * } * * *

diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyElement.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyElement.java index 0fcd2dc372f..ce76369549a 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyElement.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyElement.java @@ -94,15 +94,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; *

Schema To Java example

* * The following schema would produce the following Java class: - *
- * <xs:complexType name="foo">
- *   <xs:sequence>
- *     <xs:element name="a" type="xs:int" />
- *     <xs:element name="b" type="xs:int" />
- *     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- *   </xs:sequence>
- * </xs:complexType>
- * 
+ *
{@code
+ * 
+ *   
+ *     
+ *     
+ *     
+ *   
+ * 
+ * }
* *
  * class Foo {
@@ -115,30 +115,30 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  *
  * It can unmarshal instances like
  *
- * 
- * <foo xmlns:e="extra">
- *   <a>1</a>
- *   <e:other />  // this will be bound to DOM, because unmarshalling is orderless
- *   <b>3</b>
- *   <e:other />
- *   <c>5</c>     // this will be bound to DOM, because the annotation doesn't remember namespaces.
- * </foo>
- * 
+ *
{@code
+ * 
+ *   1
+ *     // this will be bound to DOM, because unmarshalling is orderless
+ *   3
+ *   
+ *   5     // this will be bound to DOM, because the annotation doesn't remember namespaces.
+ * 
+ * }
* * * * The following schema would produce the following Java class: - *
- * <xs:complexType name="bar">
- *   <xs:complexContent>
- *   <xs:extension base="foo">
- *     <xs:sequence>
- *       <xs:element name="c" type="xs:int" />
- *       <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
- *     </xs:sequence>
- *   </xs:extension>
- * </xs:complexType>
- * 
+ *
{@code
+ * 
+ *   
+ *   
+ *     
+ *       
+ *       
+ *     
+ *   
+ * 
+ * }
* *
  * class Bar extends Foo {
@@ -150,16 +150,16 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  *
  * It can unmarshal instances like
  *
- * 
- * <bar xmlns:e="extra">
- *   <a>1</a>
- *   <e:other />  // this will be bound to DOM, because unmarshalling is orderless
- *   <b>3</b>
- *   <e:other />
- *   <c>5</c>     // this now goes to Bar.c
- *   <e:other />  // this will go to Foo.any
- * </bar>
- * 
+ *
{@code
+ * 
+ *   1
+ *     // this will be bound to DOM, because unmarshalling is orderless
+ *   3
+ *   
+ *   5     // this now goes to Bar.c
+ *     // this will go to Foo.any
+ * 
+ * }
* * * @@ -171,15 +171,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * *

* The following schema would produce the following Java class: - *

- * <xs:complexType name="foo">
- *   <xs:choice maxOccurs="unbounded" minOccurs="0">
- *     <xs:element name="a" type="xs:int" />
- *     <xs:element name="b" type="xs:int" />
- *     <xs:any namespace="##other" processContents="lax" />
- *   </xs:choice>
- * </xs:complexType>
- * 
+ *
{@code
+ * 
+ *   
+ *     
+ *     
+ *     
+ *   
+ * 
+ * }
* *
  * class Foo {
@@ -204,11 +204,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  * It can unmarshal instances like
  *
  * 
- * <foo xmlns:e="extra">
- *   <a>1</a>     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
- *   <e:other />  // this will unmarshal to a DOM {@link Element}.
- *   <b>3</b>     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
- * </foo>
+ *{@code }
+ *{@code   1}     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
+ *{@code   }  // this will unmarshal to a DOM {@link Element}.
+ *{@code   3}     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
+ *{@code }
  * 
* * @@ -225,11 +225,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * } *
* then the following document will unmarshal like this: - *
- * <foo>
- *   <unknown />
- *   <foo />
- * </foo>
+ * 
{@code
+ * 
+ *   
+ *   
+ * 
  *
  * Foo foo = unmarshal();
  * // 1 for 'unknown', another for 'foo'
@@ -239,7 +239,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
  * // because of lax=true, the 'foo' element eagerly
  * // unmarshals to a Foo object.
  * assert foo.others[1] instanceof Foo;
- * 
+ * }
* * @author Kohsuke Kawaguchi * @since 1.6, JAXB 2.0 diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttachmentRef.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttachmentRef.java index 92d8e91eb3a..a658a0801cb 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttachmentRef.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttachmentRef.java @@ -51,16 +51,16 @@ import java.lang.annotation.Target; * } *
* The above code maps to the following XML: - *
- * <xs:element name="foo" xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd">
- *   <xs:complexType>
- *     <xs:sequence>
- *       <xs:element name="body" type="ref:swaRef" minOccurs="0" />
- *     </xs:sequence>
- *     <xs:attribute name="data" type="ref:swaRef" use="optional" />
- *   </xs:complexType>
- * </xs:element>
- * 
+ *
{@code
+ * 
+ *   
+ *     
+ *       
+ *     
+ *     
+ *   
+ * 
+ * }
* *

* The above binding supports WS-I AP 1.0 WS-I Attachments Profile Version 1.0. diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java index 8e367582ca3..713c5c0f5c0 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java @@ -89,14 +89,15 @@ import static java.lang.annotation.RetentionPolicy.*; * public java.math.BigDecimal getPrice() {...} ; * public void setPrice(java.math.BigDecimal ) {...}; * } + * {@code * - * <!-- Example: XML Schema fragment --> - * <xs:complexType name="USPrice"> - * <xs:sequence> - * </xs:sequence> - * <xs:attribute name="price" type="xs:decimal"/> - * </xs:complexType> - *

+ * + * + * + * + * + * + * } * *

Example 2: Map a JavaBean property to an XML attribute with anonymous type.

* See Example 7 in @{@link XmlType}. @@ -108,17 +109,18 @@ import static java.lang.annotation.RetentionPolicy.*; * ... * @XmlAttribute List<Integer> items; * } + * {@code * - * <!-- Example: XML Schema fragment --> - * <xs:complexType name="foo"> + * + * * ... - * <xs:attribute name="items"> - * <xs:simpleType> - * <xs:list itemType="xs:int"/> - * </xs:simpleType> - * </xs:complexType> + * + * + * + * + * * - * + * } * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlType * @since 1.6, JAXB 2.0 diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElement.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElement.java index 3d7c89dc836..8f2d881236b 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElement.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElement.java @@ -82,14 +82,15 @@ import static java.lang.annotation.RetentionPolicy.*; * @XmlElement(name="itemprice") * public java.math.BigDecimal price; * } + * {@code * - * <!-- Example: Local XML Schema element --> - * <xs:complexType name="USPrice"/> - * <xs:sequence> - * <xs:element name="itemprice" type="xs:decimal" minOccurs="0"/> - * </sequence> - * </xs:complexType> - * + * + * + * + * + * + * + * } *

* * Example 2: Map a field to a nillable element. @@ -100,14 +101,15 @@ import static java.lang.annotation.RetentionPolicy.*; * @XmlElement(nillable=true) * public java.math.BigDecimal price; * } + * {@code * - * <!-- Example: Local XML Schema element --> - * <xs:complexType name="USPrice"> - * <xs:sequence> - * <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="0"/> - * </sequence> - * </xs:complexType> - * + * + * + * + * + * + * + * } *

* Example 3: Map a field to a nillable, required element. *

@@ -117,14 +119,15 @@ import static java.lang.annotation.RetentionPolicy.*;
  *         @XmlElement(nillable=true, required=true)
  *         public java.math.BigDecimal price;
  *     }
+ * {@code
  *
- *     <!-- Example: Local XML Schema element -->
- *     <xs:complexType name="USPrice">
- *       <xs:sequence>
- *         <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="1"/>
- *       </sequence>
- *     </xs:complexType>
- *   
+ * + * + * + * + * + * + * } * *

Example 4: Map a JavaBean property to an XML element * with anonymous type.

@@ -179,7 +182,7 @@ public @interface XmlElement { * the enclosing class. * *
  • - * Otherwise '' (which produces unqualified element in the default + * Otherwise {@literal ''} (which produces unqualified element in the default * namespace. * */ diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java index 6920957a5e6..6d791e95c05 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java @@ -65,21 +65,22 @@ import static java.lang.annotation.ElementType.METHOD; * JAXBElement<String> createFoo(String s) { ... } * } * - *
    - *     <!-- XML input -->
    - *       <foo>string</foo>
    + * 
     {@code
    + *
    + *     
    + *     string
      *
      *     // Example: code fragment corresponding to XML input
    - *     JAXBElement<String> o =
    - *     (JAXBElement<String>)unmarshaller.unmarshal(aboveDocument);
    + *     JAXBElement o =
    + *     (JAXBElement)unmarshaller.unmarshal(aboveDocument);
      *     // print JAXBElement instance to show values
      *     System.out.println(o.getName());   // prints  "{}foo"
      *     System.out.println(o.getValue());  // prints  "string"
      *     System.out.println(o.getValue().getClass()); // prints "java.lang.String"
      *
    - *     <!-- Example: XML schema definition -->
    - *     <xs:element name="foo" type="xs:string"/>
    - * 
    + * + * + * }
    * *

    Example 2: Element declaration with non local scope *

    @@ -90,18 +91,18 @@ import static java.lang.annotation.ElementType.METHOD; * The following example may be replaced in a future revision of * this javadoc. * - *

    - *     <!-- Example: XML schema definition -->
    - *     <xs:schema>
    - *       <xs:complexType name="pea">
    - *         <xs:choice maxOccurs="unbounded">
    - *           <xs:element name="foo" type="xs:string"/>
    - *           <xs:element name="bar" type="xs:string"/>
    - *         </xs:choice>
    - *       </xs:complexType>
    - *       <xs:element name="foo" type="xs:int"/>
    - *     </xs:schema>
    - * 
    + *
    {@code
    + *     
    + *     
    + *       
    + *         
    + *           
    + *           
    + *         
    + *       
    + *       
    + *     
    + * }
    *
      *     // Example: expected default binding
      *     class Pea {
    diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRef.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRef.java
    index 9f99ca3d80b..b420d7b1414 100644
    --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRef.java
    +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRef.java
    @@ -56,10 +56,10 @@ import static java.lang.annotation.ElementType.METHOD;
      * support for substitution groups using an element property,
      * (section 5.5.5, "Element Property" of JAXB 2.0 specification). An
      * element property method signature is of the form:
    - * 
    - *     public void setTerm(JAXBElement<? extends Operator>);
    - *     public JAXBElement<? extends Operator> getTerm();
    - * 
    + *
    {@code
    + *     public void setTerm(JAXBElement);
    + *     public JAXBElement getTerm();
    + * }
    *

    * An element factory method annotated with {@link XmlElementDecl} is * used to create a JAXBElement instance, containing an XML @@ -121,19 +121,20 @@ import static java.lang.annotation.ElementType.METHOD; * class JavacTask extends Task { * ... * } + * {@code * - * <!-- XML Schema fragment --> - * <xs:element name="target" type="Target"> - * <xs:complexType name="Target"> - * <xs:sequence> - * <xs:choice maxOccurs="unbounded"> - * <xs:element ref="jar"> - * <xs:element ref="javac"> - * </xs:choice> - * </xs:sequence> - * </xs:complexType> + * + * + * + * + * + * + * + * + * + * * - *

    + * } *

    * Thus the following code fragment: *

    @@ -143,16 +144,16 @@ import static java.lang.annotation.ElementType.METHOD;
      *     marshal(target);
      * 
    * will produce the following XML output: - *
    - *     <target>
    - *       <jar>
    + * 
    {@code
    + *     
    + *       
      *         ....
    - *       </jar>
    - *       <javac>
    + *       
    + *       
      *         ....
    - *       </javac>
    - *     </target>
    - * 
    + * + * + * }
    *

    * It is not an error to have a class that extends Task * that doesn't have {@link XmlRootElement}. But they can't show up in an @@ -207,11 +208,11 @@ import static java.lang.annotation.ElementType.METHOD; * marshal(m); * * will produce the following XML output: - *

    - *     <math>
    - *       <add>...</add>
    - *     </math>
    - * 
    + *
    {@code
    + *     
    + *       ...
    + *     
    + * }
    * * * @author
    • Kohsuke Kawaguchi, Sun Microsystems,Inc.
    • Sekhar Vajjhala, Sun Microsystems, Inc.
    diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementWrapper.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementWrapper.java index fc7d09c05e8..69f50411fdc 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementWrapper.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementWrapper.java @@ -39,21 +39,21 @@ import java.lang.annotation.Target; * XML element around collections. The annotation therefore supports * two forms of serialization shown below. * - *
    + * 
    {@code
      *    //Example: code fragment
      *      int[] names;
      *
      *    // XML Serialization Form 1 (Unwrapped collection)
    - *    <names> ... </names>
    - *    <names> ... </names>
    + *     ... 
    + *     ... 
      *
      *    // XML Serialization Form 2 ( Wrapped collection )
    - *    <wrapperElement>
    - *       <names> value-of-item </names>
    - *       <names> value-of-item </names>
    + *    
    + *        value-of-item 
    + *        value-of-item 
      *       ....
    - *    </wrapperElement>
    - * 
    + * + * }
    * *

    The two serialized XML forms allow a null collection to be * represented either by absence or presence of an element with a diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java index e15bb1e4146..fb64513d697 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java @@ -44,7 +44,7 @@ import java.lang.annotation.Target; * @XmlElements({ @XmlElement(...),@XmlElement(...) }) * * - *

    The @XmlElements annnotation can be used with the + *

    The @XmlElements annotation can be used with the * following program elements:

    *
      *
    • a JavaBean property
    • @@ -78,28 +78,29 @@ import java.lang.annotation.Target; * @XmlElements( * @XmlElement(name="A", type=Integer.class), * @XmlElement(name="B", type=Float.class) - * } + * ) * public List items; * } + * {@code * - * <!-- XML Representation for a List of {1,2.5} - * XML output is not wrapped using another element --> + * * ... - * <A> 1 </A> - * <B> 2.5 </B> + * 1 + * 2.5 * ... * - * <!-- XML Schema fragment --> - * <xs:complexType name="Foo"> - * <xs:sequence> - * <xs:choice minOccurs="0" maxOccurs="unbounded"> - * <xs:element name="A" type="xs:int"/> - * <xs:element name="B" type="xs:float"/> - * <xs:choice> - * </xs:sequence> - * </xs:complexType> + * + * + * + * + * + * + * + * + * * - * + * } * *

      Example 2: Map to a list of elements wrapped with another element *

      @@ -114,21 +115,22 @@ import java.lang.annotation.Target; * } * public List items; * } + * {@code * - * <!-- XML Schema fragment --> - * <xs:complexType name="Foo"> - * <xs:sequence> - * <xs:element name="bar"> - * <xs:complexType> - * <xs:choice minOccurs="0" maxOccurs="unbounded"> - * <xs:element name="A" type="xs:int"/> - * <xs:element name="B" type="xs:float"/> - * </xs:choice> - * </xs:complexType> - * </xs:element> - * </xs:sequence> - * </xs:complexType> - * + * + * + * + * + * + * + * + * + * + * + * + * + * + * } * *

      Example 3: Change element name based on type using an adapter. *

      @@ -145,21 +147,22 @@ import java.lang.annotation.Target; * @XmlType abstract class P {...} * @XmlType(name="PX") class PX extends P {...} * @XmlType(name="PY") class PY extends P {...} + * {@code * - * <!-- XML Schema fragment --> - * <xs:complexType name="Foo"> - * <xs:sequence> - * <xs:element name="bar"> - * <xs:complexType> - * <xs:choice minOccurs="0" maxOccurs="unbounded"> - * <xs:element name="A" type="PX"/> - * <xs:element name="B" type="PY"/> - * </xs:choice> - * </xs:complexType> - * </xs:element> - * </xs:sequence> - * </xs:complexType> - * + * + * + * + * + * + * + * + * + * + * + * + * + * + * } * * @author
      • Kohsuke Kawaguchi, Sun Microsystems, Inc.
      • Sekhar Vajjhala, Sun Microsystems, Inc.
      * @see XmlElement diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnumValue.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnumValue.java index bcdebcb1a5f..fc29ac0786b 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnumValue.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnumValue.java @@ -56,23 +56,24 @@ import static java.lang.annotation.ElementType.FIELD; *

      In the absence of this annotation, {@link Enum#name()} is used * as the XML representation. * - *

      Example 1: Map enum constant name -> enumeration facet

      + *

      Example 1: Map enum constant name {@literal ->} enumeration facet

      *
        *     //Example: Code fragment
        *     @XmlEnum(String.class)
        *     public enum Card { CLUBS, DIAMONDS, HEARTS, SPADES }
      + * {@code
        *
      - *     <!-- Example: XML Schema fragment -->
      - *     <xs:simpleType name="Card">
      - *       <xs:restriction base="xs:string"/>
      - *         <xs:enumeration value="CLUBS"/>
      - *         <xs:enumeration value="DIAMONDS"/>
      - *         <xs:enumeration value="HEARTS"/>
      - *         <xs:enumeration value="SPADES"/>
      - *     </xs:simpleType>
      - * 
      + * + * + * + * + * + * + * + * + * } * - *

      Example 2: Map enum constant name(value) -> enumeration facet

      + *

      Example 2: Map enum constant name(value) {@literal ->} enumeration facet

      *
        *     //Example: code fragment
        *     @XmlType
      @@ -82,19 +83,20 @@ import static java.lang.annotation.ElementType.FIELD;
        *         @XmlEnumValue("5") NICKEL(5),
        *         @XmlEnumValue("10") DIME(10),
        *         @XmlEnumValue("25") QUARTER(25) }
      + * {@code
        *
      - *     <!-- Example: XML Schema fragment -->
      - *     <xs:simpleType name="Coin">
      - *       <xs:restriction base="xs:int">
      - *         <xs:enumeration value="1"/>
      - *         <xs:enumeration value="5"/>
      - *         <xs:enumeration value="10"/>
      - *         <xs:enumeration value="25"/>
      - *       </xs:restriction>
      - *     </xs:simpleType>
      - * 
      + * + * + * + * + * + * + * + * + * + * } * - *

      Example 3: Map enum constant name -> enumeration facet

      + *

      Example 3: Map enum constant name {@literal ->} enumeration facet

      * *
        *     //Code fragment
      @@ -104,15 +106,16 @@ import static java.lang.annotation.ElementType.FIELD;
        *         @XmlEnumValue("1") ONE,
        *         @XmlEnumValue("2") TWO;
        *     }
      + * {@code
        *
      - *     <!-- Example: XML Schema fragment -->
      - *     <xs:simpleType name="Code">
      - *       <xs:restriction base="xs:int">
      - *         <xs:enumeration value="1"/>
      - *         <xs:enumeration value="2"/>
      - *       </xs:restriction>
      - *     </xs:simpleType>
      - * 
      + * + * + * + * + * + * + * + * } * * @since 1.6, JAXB 2.0 */ diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlID.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlID.java index 441dc5d101b..52d03609f02 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlID.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlID.java @@ -73,17 +73,18 @@ import static java.lang.annotation.RetentionPolicy.*; * public void setCustomerID(String id); * .... other properties not shown * } + * {@code * - * <!-- Example: XML Schema fragment --> - * <xs:complexType name="Customer"> - * <xs:complexContent> - * <xs:sequence> + * + * + * + * * .... - * </xs:sequence> - * <xs:attribute name="customerID" type="xs:ID"/> - * </xs:complexContent> - * </xs:complexType> - * + * + * + * + * + * } * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlIDREF diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlIDREF.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlIDREF.java index 2ad68419da9..503f936d03e 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlIDREF.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlIDREF.java @@ -37,7 +37,7 @@ import static java.lang.annotation.RetentionPolicy.*; *

      * To preserve referential integrity of an object graph across XML * serialization followed by a XML deserialization, requires an object - * reference to be marshalled by reference or containment + * reference to be marshaled by reference or containment * appropriately. Annotations @XmlID and @XmlIDREF * together allow a customized mapping of a JavaBean property's * type by containment or reference. @@ -82,18 +82,19 @@ import static java.lang.annotation.RetentionPolicy.*; * public void setCustomer(Customer customer); * .... * } + * {@code * - * <!-- Example: XML Schema fragment --> - * <xs:complexType name="Shipping"> - * <xs:complexContent> - * <xs:sequence> - * <xs:element name="customer" type="xs:IDREF"/> + * + * + * + * + * * .... - * </xs:sequence> - * </xs:complexContent> - * </xs:complexType> + * + * + * * - * + * } * * *

      Example 2: The following is a complete example of @@ -142,64 +143,65 @@ import static java.lang.annotation.RetentionPolicy.*; * // maps reference to Invoice by containment by default. * public Invoice getInvoice(); * } + * {@code * - * <!-- XML Schema mapping for above code frament --> + * * - * <xs:complexType name="Invoice"> - * <xs:complexContent> - * <xs:sequence> - * <xs:element name="customer" type="xs:IDREF"/> + * + * + * + * * .... - * </xs:sequence> - * </xs:complexContent> - * </xs:complexType> + * + * + * * - * <xs:complexType name="Shipping"> - * <xs:complexContent> - * <xs:sequence> - * <xs:element name="customer" type="xs:IDREF"/> + * + * + * + * * .... - * </xs:sequence> - * </xs:complexContent> - * </xs:complexType> + * + * + * * - * <xs:complexType name="Customer"> - * <xs:complexContent> - * <xs:sequence> + * + * + * * .... - * </xs:sequence> - * <xs:attribute name="CustomerID" type="xs:ID"/> - * </xs:complexContent> - * </xs:complexType> + * + * + * + * * - * <xs:complexType name="CustomerData"> - * <xs:complexContent> - * <xs:sequence> - * <xs:element name="customer" type="xs:Customer"/> - * <xs:element name="shipping" type="xs:Shipping"/> - * <xs:element name="invoice" type="xs:Invoice"/> - * </xs:sequence> - * </xs:complexContent> - * </xs:complexType> + * + * + * + * + * + * + * + * + * * - * <xs:element name"customerData" type="xs:CustomerData"/> + * * - * <!-- Instance document conforming to the above XML Schema --> - * <customerData> - * <customer customerID="Alice"> + * + * + * * .... - * </customer> + * * - * <shipping customer="Alice"> + * * .... - * </shipping> + * * - * <invoice customer="Alice"> + * * .... - * </invoice> - * </customerData> + * + * * - * + * } * *

      Example 3: Mapping List to repeating element of type IDREF *

      @@ -209,16 +211,17 @@ import static java.lang.annotation.RetentionPolicy.*;
        *         @XmlElement(name="Alice")
        *             public List customers;
        *     }
      + * {@code
        *
      - *     <!-- XML schema fragment -->
      - *     <xs:complexType name="Shipping">
      - *       <xs:sequence>
      - *         <xs:choice minOccurs="0" maxOccurs="unbounded">
      - *           <xs:element name="Alice" type="xs:IDREF"/>
      - *         </xs:choice>
      - *       </xs:sequence>
      - *     </xs:complexType>
      - * 
      + * + * + * + * + * + * + * + * + * } * *

      Example 4: Mapping a List to a list of elements of type IDREF. *

      @@ -230,17 +233,18 @@ import static java.lang.annotation.RetentionPolicy.*;
        *              @XmlElement(name="John", type="InternationalCustomer.class")
        *         public List customers;
        *     }
      + * {@code
        *
      - *     <!-- XML Schema fragment -->
      - *     <xs:complexType name="Shipping">
      - *       <xs:sequence>
      - *         <xs:choice minOccurs="0" maxOccurs="unbounded">
      - *           <xs:element name="Alice" type="xs:IDREF"/>
      - *           <xs:element name="John" type="xs:IDREF"/>
      - *         </xs:choice>
      - *       </xs:sequence>
      - *     </xs:complexType>
      - * 
      + * + * + * + * + * + * + * + * + * + * } * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlID * @since 1.6, JAXB 2.0 diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlList.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlList.java index 9bd81d03355..675fbb4b7f2 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlList.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlList.java @@ -59,12 +59,12 @@ import static java.lang.annotation.ElementType.PARAMETER; * * would produce XML like this: * - *
      - * <foo>
      - *   <data>abc</data>
      - *   <data>def</data>
      - * </foo>
      - * 
      + *
      {@code
      + * 
      + *   abc
      + *   def
      + * 
      + * }
      * * @XmlList annotation, on the other hand, allows multiple values to be * represented as whitespace-separated tokens in a single element. For example, @@ -80,11 +80,11 @@ import static java.lang.annotation.ElementType.PARAMETER; * * the above code will produce XML like this: * - *
      - * <foo>
      - *   <data>abc def</data>
      - * </foo>
      - * 
      + *
      {@code
      + * 
      + *   abc def
      + * 
      + * }
      * *

      This annotation can be used with the following annotations: * {@link XmlElement}, diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java index 83c5da66d12..87d160d54d6 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java @@ -56,32 +56,33 @@ import javax.xml.bind.JAXBElement; *

    * * Below is an example of binding and creation of mixed content. - *
    - *  <!-- schema fragment having  mixed content -->
    - *  <xs:complexType name="letterBody" mixed="true">
    - *    <xs:sequence>
    - *      <xs:element name="name" type="xs:string"/>
    - *      <xs:element name="quantity" type="xs:positiveInteger"/>
    - *      <xs:element name="productName" type="xs:string"/>
    - *      <!-- etc. -->
    - *    </xs:sequence>
    - *  </xs:complexType>
    - *  <xs:element name="letterBody" type="letterBody"/>
    + * 
    {@code
    + *
    + *  
    + *  
    + *    
    + *      
    + *      
    + *      
    + *      
    + *    
    + *  
    + *  
      *
      * // Schema-derived Java code:
      * // (Only annotations relevant to mixed content are shown below,
    - * //  others are ommitted.)
    + * //  others are omitted.)
      * import java.math.BigInteger;
      * public class ObjectFactory {
      *      // element instance factories
    - *      JAXBElement<LetterBody> createLetterBody(LetterBody value);
    - *      JAXBElement<String>     createLetterBodyName(String value);
    - *      JAXBElement<BigInteger> createLetterBodyQuantity(BigInteger value);
    - *      JAXBElement<String>     createLetterBodyProductName(String value);
    + *      JAXBElement createLetterBody(LetterBody value);
    + *      JAXBElement     createLetterBodyName(String value);
    + *      JAXBElement createLetterBodyQuantity(BigInteger value);
    + *      JAXBElement     createLetterBodyProductName(String value);
      *      // type instance factory
      *      LetterBody createLetterBody();
      * }
    - * 
    + * }
    *
      * public class LetterBody {
      *      // Mixed content can contain instances of Element classes
    @@ -96,17 +97,17 @@ import javax.xml.bind.JAXBElement;
      * }
      * 
    * The following is an XML instance document with mixed content - *
    - * <letterBody>
    - * Dear Mr.<name>Robert Smith</name>
    - * Your order of <quantity>1</quantity> <productName>Baby
    - * Monitor</productName> shipped from our warehouse. ....
    - * </letterBody>
    - * 
    + *
    {@code
    + * 
    + * Dear Mr.Robert Smith
    + * Your order of 1 Baby
    + * Monitor shipped from our warehouse. ....
    + * 
    + * }
    * that can be constructed using following JAXB API calls. - *
    + * 
    {@code
      * LetterBody lb = ObjectFactory.createLetterBody();
    - * JAXBElement<LetterBody> lbe = ObjectFactory.createLetterBody(lb);
    + * JAXBElement lbe = ObjectFactory.createLetterBody(lb);
      * List gcl = lb.getContent();  //add mixed content to general content property.
      * gcl.add("Dear Mr.");  // add text information item as a String.
      *
    @@ -119,7 +120,7 @@ import javax.xml.bind.JAXBElement;
      *                      createLetterBodyQuantity(new BigInteger("1")));
      * gcl.add(ObjectFactory.createLetterBodyProductName("Baby Monitor"));
      * gcl.add("shipped from our warehouse");  // add text information item
    - * 
    + * }
    * *

    See "Package Specification" in javax.xml.bind.package javadoc for * additional common information.

    diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java index b84e71beca2..fbbf2f69dc9 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java @@ -73,28 +73,30 @@ import static java.lang.annotation.ElementType.TYPE; * marshal( new Point(3,5), System.out); * * - *
    - *     <!-- Example: XML output -->
    - *     <point>
    - *       <x> 3 </x>
    - *       <y> 5 </y>
    - *     </point>
    - * 
    + *
    {@code
    + *
    + *     
    + *     
    + *        3 
    + *        5 
    + *     
    + * }
    * * The annotation causes an global element declaration to be produced * in the schema. The global element declaration is associated with * the XML schema type to which the class is mapped. * - *
    - *     <!-- Example: XML schema definition -->
    - *     <xs:element name="point" type="point"/>
    - *     <xs:complexType name="point">
    - *       <xs:sequence>
    - *         <xs:element name="x" type="xs:int"/>
    - *         <xs:element name="y" type="xs:int"/>
    - *       </xs:sequence>
    - *     </xs:complexType>
    - * 
    + *
    {@code
    + *
    + *     
    + *     
    + *     
    + *       
    + *         
    + *         
    + *       
    + *     
    + * }
    * *

    * @@ -113,27 +115,28 @@ import static java.lang.annotation.ElementType.TYPE; * * //Example: Code fragment corresponding to XML output * * marshal( new Point3D(3,5,0), System.out ); + * {@code * - * <!-- Example: XML output --> - * <!-- The element name is point3D not point --> - * <point3D> - * <x>3</x> - * <y>5</y> - * <z>0</z> - * </point3D> + * + * + * + * 3 + * 5 + * 0 + * * - * <!-- Example: XML schema definition --> - * <xs:element name="point3D" type="point3D"/> - * <xs:complexType name="point3D"> - * <xs:complexContent> - * <xs:extension base="point"> - * <xs:sequence> - * <xs:element name="z" type="xs:int"/> - * </xs:sequence> - * </xs:extension> - * </xs:complexContent> - * </xs:complexType> - * + * + * + * + * + * + * + * + * + * + * + * + * } * * Example 3: Associate a global element with XML Schema type * to which the class is mapped. @@ -144,15 +147,16 @@ import static java.lang.annotation.ElementType.TYPE; * @XmlElement * public java.math.BigDecimal price; * } + * {@code * - * <!-- Example: XML schema definition --> - * <xs:element name="PriceElement" type="USPrice"/> - * <xs:complexType name="USPrice"> - * <xs:sequence> - * <xs:element name="price" type="xs:decimal"/> - * </sequence> - * </xs:complexType> - * + * + * + * + * + * + * + * + * } * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @since 1.6, JAXB 2.0 diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchema.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchema.java index 6d25d57a266..db25ef00765 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchema.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchema.java @@ -63,16 +63,17 @@ import static java.lang.annotation.RetentionPolicy.*; * @javax.xml.bind.annotation.XmlSchema ( * namespace = "http://www.example.com/MYPO1" * ) + * {@code * - * <!-- XML Schema fragment --> - * <schema + * + * + * > + * + * } * *

    Example 2: Customize namespace prefix, namespace URI * mapping

    @@ -86,16 +87,17 @@ import static java.lang.annotation.RetentionPolicy.*; * * @javax.xml.bind.annotation.XmlNs(prefix="xs", * namespaceURI="http://www.w3.org/2001/XMLSchema") - * ) + * } * ) + * {@code * - * <!-- XML Schema fragment --> - * <schema + * + * * - * + * } * *

    Example 3: Customize elementFormDefault

    *
    @@ -103,14 +105,15 @@ import static java.lang.annotation.RetentionPolicy.*;
      *      elementFormDefault=XmlNsForm.UNQUALIFIED
      *      ...
      *    )
    + * {@code
      *
    - *    <!-- XML Schema fragment -->
    - *    <schema
    + *    
    + *    
      *
    - * 
    + * } * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @since 1.6, JAXB 2.0 diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaType.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaType.java index a25b291df06..a1d2859eceb 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaType.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaType.java @@ -65,14 +65,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * @XmlSchemaType(name="date") * public XMLGregorianCalendar date; * } + * {@code * - * <!-- Example: Local XML Schema element --> - * <xs:complexType name="USPrice"/> - * <xs:sequence> - * <xs:element name="date" type="xs:date"/> - * </sequence> - * </xs:complexType> - * + * + * + * + * + * + * + * } * *

    Example 2: Customize mapping of XMLGregorianCalendar at package * level

    diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlTransient.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlTransient.java index 055e90e3ca0..b3394d5465f 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlTransient.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlTransient.java @@ -78,14 +78,15 @@ import static java.lang.annotation.RetentionPolicy.*; * String setName() {..}; * } * + * {@code * - * <!-- Example: XML Schema fragment --> - * <xs:complexType name="USAddress"> - * <xs:sequence> - * <xs:element name="name" type="xs:string"/> - * </xs:sequence> - * </xs:complexType> - * + * + * + * + * + * + * + * } * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @since 1.6, JAXB 2.0 diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java index 42e71396338..f20d4055860 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java @@ -112,7 +112,7 @@ import java.lang.annotation.Target; * The following table shows the mapping of the class to a XML Schema * complex type or simple type. The notational symbols used in the table are: *
      - *
    • -> : represents a mapping
    • + *
    • {@literal ->} : represents a mapping
    • *
    • [x]+ : one or more occurances of x
    • *
    • [ @XmlValue property ]: JavaBean property annotated with * @XmlValue
    • @@ -132,7 +132,7 @@ import java.lang.annotation.Target; * * Class * {} - * [property]+ -> elements + * [property]+ {@literal ->} elements * complexcontent
      xs:all * * @@ -140,7 +140,7 @@ import java.lang.annotation.Target; * * Class * non empty - * [property]+ -> elements + * [property]+ {@literal ->} elements * complexcontent
      xs:sequence * * @@ -148,7 +148,7 @@ import java.lang.annotation.Target; * * Class * X - * no property -> element + * no property {@literal ->} element * complexcontent
      empty sequence * * @@ -156,7 +156,7 @@ import java.lang.annotation.Target; * * Class * X - * 1 [@XmlValue property] {@literal &&}
      [property]+ -> attributes + * 1 [@XmlValue property] {@literal &&}
      [property]+ {@literal ->} attributes * simplecontent * * @@ -164,7 +164,7 @@ import java.lang.annotation.Target; * * Class * X - * 1 [@XmlValue property] {@literal &&}
      no properties -> attribute + * 1 [@XmlValue property] {@literal &&}
      no properties {@literal ->} attribute * * simpletype * @@ -208,35 +208,37 @@ import java.lang.annotation.Target; * java.math.BigDecimal getZip() {..}; * void setZip(java.math.BigDecimal) {..}; * } + * {@code * - * <!-- XML Schema mapping for USAddress --> - * <xs:complexType name="USAddress"> - * <xs:sequence> - * <xs:element name="street" type="xs:string"/> - * <xs:element name="city" type="xs:string"/> - * <xs:element name="state" type="xs:string"/> - * <xs:element name="zip" type="xs:decimal"/> - * <xs:element name="name" type="xs:string"/> - * </xs:all> - * </xs:complexType> - * + * + * + * + * + * + * + * + * + * + * + * } *

      Example 2: Map a class to a complex type with * xs:all

      *
        * @XmlType(propOrder={})
        * public class USAddress { ...}
      + * {@code
        *
      - * <!-- XML Schema mapping for USAddress -->
      - * <xs:complexType name="USAddress">
      - *   <xs:all>
      - *     <xs:element name="name" type="xs:string"/>
      - *     <xs:element name="street" type="xs:string"/>
      - *     <xs:element name="city" type="xs:string"/>
      - *     <xs:element name="state" type="xs:string"/>
      - *     <xs:element name="zip" type="xs:decimal"/>
      - *   </xs:sequence>
      - * </xs:complexType>
      - *
      + * + * + * + * + * + * + * + * + * + * + *} *

      Example 3: Map a class to a global element with an * anonymous type. *

      @@ -244,20 +246,21 @@ import java.lang.annotation.Target; * @XmlRootElement * @XmlType(name="") * public class USAddress { ...} + * {@code * - * <!-- XML Schema mapping for USAddress --> - * <xs:element name="USAddress"> - * <xs:complexType> - * <xs:sequence> - * <xs:element name="name" type="xs:string"/> - * <xs:element name="street" type="xs:string"/> - * <xs:element name="city" type="xs:string"/> - * <xs:element name="state" type="xs:string"/> - * <xs:element name="zip" type="xs:decimal"/> - * </xs:sequence> - * </xs:complexType> - * </xs:element> - * + * + * + * + * + * + * + * + * + * + * + * + * + * } * *

      Example 4: Map a property to a local element with * anonymous type. @@ -271,22 +274,23 @@ import java.lang.annotation.Target; * @XmlType(name="") * public class USAddress { ... } * } + * {@code * - * <!-- XML Schema mapping for USAddress --> - * <xs:complexType name="Invoice"> - * <xs:sequence> - * <xs:element name="addr"> - * <xs:complexType> - * <xs:element name="name", type="xs:string"/> - * <xs:element name="city", type="xs:string"/> - * <xs:element name="city" type="xs:string"/> - * <xs:element name="state" type="xs:string"/> - * <xs:element name="zip" type="xs:decimal"/> - * </xs:complexType> + * + * + * + * + * + * + * + * + * + * + * * ... - * </xs:sequence> - * </xs:complexType> - * + * + * + * } * *

      Example 5: Map a property to an attribute with * anonymous type. @@ -306,19 +310,20 @@ import java.lang.annotation.Target; * @XmlValue * public java.math.BigDecimal price; * } + * {@code * - * <!-- Example: XML Schema fragment --> - * <xs:complexType name="Item"> - * <xs:sequence> - * <xs:element name="name" type="xs:string"/> - * <xs:attribute name="price"> - * <xs:simpleType> - * <xs:restriction base="xs:decimal"/> - * </xs:simpleType> - * </xs:attribute> - * </xs:sequence> - * </xs:complexType> - * + * + * + * + * + * + * + * + * + * + * + * + * } * *

      Example 6: Define a factoryClass and factoryMethod * diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlValue.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlValue.java index 1ab10854a4f..675305b5821 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlValue.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlValue.java @@ -87,13 +87,14 @@ import static java.lang.annotation.RetentionPolicy.*; * @XmlValue * public java.math.BigDecimal price; * } + * {@code * - * <!-- Example 1: XML Schema fragment --> - * <xs:simpleType name="USPrice"> - * <xs:restriction base="xs:decimal"/> - * </xs:simpleType> + * + * + * + * * - * + * } * *

      Example 2: Map a class to XML Schema complexType with * with simpleContent.

      @@ -108,17 +109,18 @@ import static java.lang.annotation.RetentionPolicy.*; * @XmlAttribute * public String currency; * } + * {@code * - * <!-- Example 2: XML Schema fragment --> - * <xs:complexType name="InternationalPrice"> - * <xs:simpleContent> - * <xs:extension base="xs:decimal"> - * <xs:attribute name="currency" type="xs:string"/> - * </xs:extension> - * </xs:simpleContent> - * </xs:complexType> + * + * + * + * + * + * + * + * * - * + * } * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlType diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java index 9a589653c12..38865a0c32f 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ package javax.xml.bind.annotation.adapters; * *

      * This adapter removes leading and trailing whitespaces, then truncate any - * sequnce of tab, CR, LF, and SP by a single whitespace character ' '. + * sequence of tab, CR, LF, and SP by a single whitespace character ' '. * * @author Kohsuke Kawaguchi * @since 1.6, JAXB 2.0 @@ -41,7 +41,7 @@ public class CollapsedStringAdapter extends XmlAdapter { /** * Removes leading and trailing whitespaces of the string * given as the parameter, then truncate any - * sequnce of tab, CR, LF, and SP by a single whitespace character ' '. + * sequence of tab, CR, LF, and SP by a single whitespace character ' '. */ public String unmarshal(String text) { if(text==null) return null; // be defensive diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlAdapter.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlAdapter.java index 4a500814f02..3c5bd422512 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlAdapter.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlAdapter.java @@ -75,35 +75,35 @@ package javax.xml.bind.annotation.adapters; * *

      Step 1: Determine the desired XML representation for HashMap. * - *

      - *     <hashmap>
      - *         <entry key="id123">this is a value</entry>
      - *         <entry key="id312">this is another value</entry>
      + * 
      {@code
      + *     
      + *         this is a value
      + *         this is another value
        *         ...
      - *       </hashmap>
      - * 
      + * + * }
      * *

      Step 2: Determine the schema definition that the * desired XML representation shown above should follow. * - *

      + * 
      {@code
        *
      - *     <xs:complexType name="myHashMapType">
      - *       <xs:sequence>
      - *         <xs:element name="entry" type="myHashMapEntryType"
      - *                        minOccurs = "0" maxOccurs="unbounded"/>
      - *       </xs:sequence>
      - *     </xs:complexType>
      + *     
      + *       
      + *         
      + *       
      + *     
        *
      - *     <xs:complexType name="myHashMapEntryType">
      - *       <xs:simpleContent>
      - *         <xs:extension base="xs:string">
      - *           <xs:attribute name="key" type="xs:int"/>
      - *         </xs:extension>
      - *       </xs:simpleContent>
      - *     </xs:complexType>
      + *     
      + *       
      + *         
      + *           
      + *         
      + *       
      + *     
        *
      - * 
      + * }
      * *

      Step 3: Write value types that can generate the above * schema definition. @@ -125,11 +125,11 @@ package javax.xml.bind.annotation.adapters; *

      Step 4: Write the adapter that adapts the value type, * MyHashMapType to a bound type, HashMap, used by the application. * - *

      + * 
      {@code
        *     public final class MyHashMapAdapter extends
      - *                        XmlAdapter<MyHashMapType,HashMap> { ... }
      + *                        XmlAdapter { ... }
        *
      - * 
      + * }
      * *

      Step 5: Use the adapter. * @@ -143,13 +143,13 @@ package javax.xml.bind.annotation.adapters; * * The above code fragment will map to the following schema: * - *

      - *     <xs:complexType name="Foo">
      - *       <xs:sequence>
      - *         <xs:element name="hashmap" type="myHashMapType">
      - *       </xs:sequence>
      - *     </xs:complexType>
      - * 
      + *
      {@code
      + *     
      + *       
      + *         
      + *       
      + *     
      + * }
      * * @param * The type that JAXB doesn't know how to handle. An adapter is written diff --git a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java index 6cebcf89dc9..2f1ee037750 100644 --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import java.lang.annotation.Target; * @XmlJavaTypeAdapters ({ @XmlJavaTypeAdapter(...),@XmlJavaTypeAdapter(...) }) * * - *

      The @XmlJavaTypeAdapters annnotation is useful for + *

      The @XmlJavaTypeAdapters annotation is useful for * defining {@link XmlJavaTypeAdapter} annotations for different types * at the package level. * diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/addressing/EPRHeader.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/addressing/EPRHeader.java index 3c73af04610..642dee10f70 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/addressing/EPRHeader.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/addressing/EPRHeader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -119,7 +119,7 @@ final class EPRHeader extends AbstractHeaderImpl { epr.writeTo(localName, w); w.flush(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance(); + DocumentBuilderFactory fac = XmlUtil.newDocumentBuilderFactory(false); fac.setNamespaceAware(true); Node eprNode = fac.newDocumentBuilder().parse(bais).getDocumentElement(); Node eprNodeToAdd = header.getOwnerDocument().importNode(eprNode, true); diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/message/stream/StreamHeader.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/message/stream/StreamHeader.java index 6415f1319bb..ae268e2f86f 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/message/stream/StreamHeader.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/message/stream/StreamHeader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -194,7 +194,7 @@ public abstract class StreamHeader extends AbstractHeaderImpl { // TODO what about in-scope namespaces // Not very efficient consider implementing a stream buffer // processor that produces a DOM node from the buffer. - TransformerFactory tf = XmlUtil.newTransformerFactory(); + TransformerFactory tf = XmlUtil.newTransformerFactory(true); Transformer t = tf.newTransformer(); XMLStreamBufferSource source = new XMLStreamBufferSource(_mark); DOMResult result = new DOMResult(); diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java index 86d36466e45..84047b67d24 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,9 @@ import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; //TODO DOMHeader DOMMessage SAAJMessage StatefulInstanceResolver import com.sun.xml.internal.bind.unmarshaller.DOMScanner; +//TODO MtomCodec +import com.sun.xml.internal.bind.v2.runtime.output.Encoded; + //TODO ExceptionBean import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper; diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/DOMUtil.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/DOMUtil.java index e5f8cb7c0ad..47fb059f2c5 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/DOMUtil.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/DOMUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,7 +56,7 @@ public class DOMUtil { synchronized (DOMUtil.class) { if (db == null) { try { - DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(); + DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(true); dbf.setNamespaceAware(true); db = dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java index 6241299d41a..9a8641035bd 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,7 +92,7 @@ public abstract class AbstractSchemaValidationTube extends AbstractFilterTubeImp super(next); this.binding = binding; feature = binding.getFeature(SchemaValidationFeature.class); - sf = allowExternalAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), "file", false); + sf = allowExternalAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), "all", false); } protected AbstractSchemaValidationTube(AbstractSchemaValidationTube that, TubeCloner cloner) { diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties index b18bbc710b0..8cc250fb181 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ # questions. # -build-id=2.2.11-b150127.1410 -build-version=JAX-WS RI 2.2.11-b150127.1410 +build-id=2.2.11-b150402.1412 +build-version=JAX-WS RI 2.2.11-b150402.1412 major-version=2.2.11 -svn-revision=28121d09ed8ac02b76788709ccb4cdb66e03bbfa +svn-revision=f923291dedcf386c5f408263984a99d7cedf0012 diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java index 14ad9743353..d30bb8aba62 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XMLStreamReaderToXMLStreamWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -187,14 +187,11 @@ public class XMLStreamReaderToXMLStreamWriter { protected void handleStartElement() throws XMLStreamException { String nsUri = in.getNamespaceURI(); - if(nsUri==null) - out.writeStartElement(in.getLocalName()); - else - out.writeStartElement( - fixNull(in.getPrefix()), - in.getLocalName(), - nsUri - ); + out.writeStartElement( + fixNull(in.getPrefix()), + in.getLocalName(), + fixNull(nsUri) + ); // start namespace bindings int nsCount = in.getNamespaceCount(); diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java index 10ad6086112..18d7fcd55ed 100644 --- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java +++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -231,7 +231,7 @@ public class XmlUtil { static final ContextClassloaderLocal saxParserFactory = new ContextClassloaderLocal() { @Override protected SAXParserFactory initialValue() throws Exception { - SAXParserFactory factory = SAXParserFactory.newInstance(); + SAXParserFactory factory = newSAXParserFactory(true); factory.setNamespaceAware(true); return factory; } @@ -371,57 +371,49 @@ public class XmlUtil { } }; - public static DocumentBuilderFactory newDocumentBuilderFactory() { - return newDocumentBuilderFactory(true); - } - - public static DocumentBuilderFactory newDocumentBuilderFactory(boolean secureXmlProcessing) { + public static DocumentBuilderFactory newDocumentBuilderFactory(boolean disableSecurity) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessing)); + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity)); } catch (ParserConfigurationException e) { LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } ); } return factory; } - public static TransformerFactory newTransformerFactory(boolean secureXmlProcessingEnabled) { + public static TransformerFactory newTransformerFactory(boolean disableSecurity) { TransformerFactory factory = TransformerFactory.newInstance(); try { - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled)); + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity)); } catch (TransformerConfigurationException e) { LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()}); } return factory; } - public static TransformerFactory newTransformerFactory() { - return newTransformerFactory(true); - } - - public static SAXParserFactory newSAXParserFactory(boolean secureXmlProcessingEnabled) { + public static SAXParserFactory newSAXParserFactory(boolean disableSecurity) { SAXParserFactory factory = SAXParserFactory.newInstance(); try { - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled)); + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity)); } catch (Exception e) { LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()}); } return factory; } - public static XPathFactory newXPathFactory(boolean secureXmlProcessingEnabled) { + public static XPathFactory newXPathFactory(boolean disableSecurity) { XPathFactory factory = XPathFactory.newInstance(); try { - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled)); + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity)); } catch (XPathFactoryConfigurationException e) { LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } ); } return factory; } - public static XMLInputFactory newXMLInputFactory(boolean secureXmlProcessingEnabled) { + public static XMLInputFactory newXMLInputFactory(boolean disableSecurity) { XMLInputFactory factory = XMLInputFactory.newInstance(); - if (isXMLSecurityDisabled(secureXmlProcessingEnabled)) { + if (xmlSecurityDisabled(disableSecurity)) { // TODO-Miran: are those apppropriate defaults? factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); @@ -429,14 +421,14 @@ public class XmlUtil { return factory; } - private static boolean isXMLSecurityDisabled(boolean runtimeDisabled) { + private static boolean xmlSecurityDisabled(boolean runtimeDisabled) { return XML_SECURITY_DISABLED || runtimeDisabled; } - public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { + public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecurity) { // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied - if (isXMLSecurityDisabled(disableSecureProcessing)) { + if (xmlSecurityDisabled(disableSecurity)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary."); } diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties index 427db1f466e..19f062ab0b0 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -30,10 +30,10 @@ BASEDIR_DOESNT_EXIST = \ Non-existent directory: {0} VERSION = \ - schemagen 2.2.12-b150126.1924 + schemagen 2.2.12-b150331.1824 FULLVERSION = \ - schemagen full version "2.2.12-b150126.1924" + schemagen full version "2.2.12-b150331.1824" USAGE = \ Usage: schemagen [-options ...] \n\ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties index 435ed7150a6..1de04cc98b7 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Nicht erkanntes {0} in Zeile {1} Spalte {2} BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0} -VERSION = schemagen 2.2.12-b150126.1924 +VERSION = schemagen 2.2.12-b150331.1824 -FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.12-b150126.1924" +FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.12-b150331.1824" USAGE = Verwendung: schemagen [-options ...] \nOptionen: \n\\ \\ \\ \\ -d : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help : Zeigt diese Verwendungsmeldung an diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties index c6d5aad27fa..015e45a1be0 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Aparece un {0} inesperado en la l\u00EDnea {1} y la colu BASEDIR_DOESNT_EXIST = Directorio no existente: {0} -VERSION = schemagen 2.2.12-b150126.1924 +VERSION = schemagen 2.2.12-b150331.1824 -FULLVERSION = versi\u00F3n completa de schemagen "2.2.12-b150126.1924" +FULLVERSION = versi\u00F3n completa de schemagen "2.2.12-b150331.1824" USAGE = Sintaxis: schemagen [-options ...] \nOpciones: \n\\ \\ \\ \\ -d : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help : muestra este mensaje de sintaxis diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties index 756a94788fa..a006426db90 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Un \u00E9l\u00E9ment {0} inattendu appara\u00EEt \u00E0 BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant -VERSION = schemagen 2.2.12-b150126.1924 +VERSION = schemagen 2.2.12-b150331.1824 -FULLVERSION = version compl\u00E8te de schemagen "2.2.12-b150126.1924" +FULLVERSION = version compl\u00E8te de schemagen "2.2.12-b150331.1824" USAGE = Syntaxe : schemagen [-options ...] \nOptions : \n\ \ \ \ -d : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties index 992b68e2c77..ca32febc263 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} imprevisto visualizzato sulla riga {1} colonna {2} BASEDIR_DOESNT_EXIST = Directory non esistente: {0} -VERSION = schemagen 2.2.12-b150126.1924 +VERSION = schemagen 2.2.12-b150331.1824 -FULLVERSION = versione completa schemagen "2.2.12-b150126.1924" +FULLVERSION = versione completa schemagen "2.2.12-b150331.1824" USAGE = Uso: schemagen [-options ...] \nOpzioni: \n\ \ \ \ -d : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode : genera il file di episodio per la compilazione separata\n\ \ \ \ -version : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion : visualizza le informazioni sulla versione completa\n\ \ \ \ -help : visualizza questo messaggio sull'uso diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties index bf3e933ce1c..28f152ffcbd 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u4E88\u671F\u3057\u306A\u3044{0}\u304C\u884C{1}\u3001\u BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0} -VERSION = schemagen 2.2.12-b150126.1924 +VERSION = schemagen 2.2.12-b150331.1824 -FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150126.1924" +FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150331.1824" USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059 diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties index 31ba0ab9637..1f7cd2ef605 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \uC608\uC0C1\uCE58 \uC54A\uC740 {0}\uC774(\uAC00) {1}\uD BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0} -VERSION = schemagen 2.2.12-b150126.1924 +VERSION = schemagen 2.2.12-b150331.1824 -FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.12-b150126.1924" +FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.12-b150331.1824" USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] \n\uC635\uC158: \n\ \ \ \ -d : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4. diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties index c2f4155d874..0596527faad 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} inesperado aparece na linha {1} coluna {2} BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0} -VERSION = gera\u00E7\u00E3o do esquema 2.2.12-b150126.1924 +VERSION = gera\u00E7\u00E3o do esquema 2.2.12-b150331.1824 -FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.12-b150126.1924" +FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.12-b150331.1824" USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help : exibir esta mensagem de uso diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties index cec06517656..3d780676808 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u5728\u7B2C {1} \u884C, \u7B2C {2} \u5217\u51FA\u73B0\u BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0} -VERSION = schemagen 2.2.12-b150126.1924 +VERSION = schemagen 2.2.12-b150331.1824 -FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924" +FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824" USAGE = \u7528\u6CD5: schemagen [-options ...] \n\u9009\u9879: \n\ \ \ \ -d : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties index 938aef76528..1ded7446a25 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u672A\u9810\u671F\u7684 {0} \u986F\u793A\u65BC\u884C {1 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0} -VERSION = schemagen 2.2.12-b150126.1924 +VERSION = schemagen 2.2.12-b150331.1824 -FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924" +FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824" USAGE = \u7528\u6CD5: schemagen [-options ...] \n\u9078\u9805: \n\\ \\ \\ \\ -d : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java index 47d62d8e713..6a3eec71d50 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -158,7 +158,12 @@ public class SchemaGenerator { while (cl != null) { if (cl instanceof URLClassLoader) { for (URL url : ((URLClassLoader) cl).getURLs()) { - appendPath(cp, url.getPath()); + try { + appendPath(cp,new File(url.toURI()).getPath()); + } catch(URISyntaxException ex) { + /*If the URL is not properly formated - skip it*/ + LOGGER.log(Level.SEVERE, ex.getMessage(), ex); + } } } cl = cl.getParent(); diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/SchemaGenerator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/SchemaGenerator.java index a15b1453e9f..2a8b59894fe 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/SchemaGenerator.java +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/SchemaGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,8 +23,6 @@ * questions. */ - - package com.sun.tools.internal.jxc.ap; import com.sun.tools.internal.jxc.api.JXC; @@ -89,12 +87,12 @@ public class SchemaGenerator extends AbstractProcessor { public boolean process(Set annotations, RoundEnvironment roundEnv) { final ErrorReceiverImpl errorListener = new ErrorReceiverImpl(processingEnv); - List classes = new ArrayList(); + List classesToBeBound = new ArrayList(); // simply ignore all the interface definitions, // so that users won't have to manually exclude interfaces, which is silly. - filterClass(classes, roundEnv.getRootElements()); + filterClass(classesToBeBound, roundEnv.getRootElements()); - J2SJAXBModel model = JXC.createJavaCompiler().bind(classes, Collections.emptyMap(), null, processingEnv); + J2SJAXBModel model = JXC.createJavaCompiler().bind(classesToBeBound, Collections.emptyMap(), null, processingEnv); if (model == null) return false; // error @@ -133,11 +131,17 @@ public class SchemaGenerator extends AbstractProcessor { return false; } - private void filterClass(List classes, Collection elements) { + /** + * Filter classes (note that enum is kind of class) from elements tree + * @param result list of found classes + * @param elements tree to be filtered + */ + private void filterClass(List result, Collection elements) { for (Element element : elements) { - if (element.getKind().equals(ElementKind.CLASS) || element.getKind().equals(ElementKind.ENUM)) { - classes.add(new Reference((TypeElement) element, processingEnv)); - filterClass(classes, ElementFilter.typesIn(element.getEnclosedElements())); + final ElementKind kind = element.getKind(); + if (ElementKind.CLASS.equals(kind) || ElementKind.ENUM.equals(kind)) { + result.add(new Reference((TypeElement) element, processingEnv)); + filterClass(result, ElementFilter.typesIn(element.getEnclosedElements())); } } } diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java index 803d32973a9..359bfc4cec0 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/model/nav/ApNavigator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,12 @@ import com.sun.source.util.TreePath; import com.sun.source.util.Trees; import com.sun.xml.internal.bind.v2.model.nav.Navigator; import com.sun.xml.internal.bind.v2.runtime.Location; - +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; @@ -52,12 +57,6 @@ import javax.lang.model.util.ElementFilter; import javax.lang.model.util.Elements; import javax.lang.model.util.SimpleTypeVisitor6; import javax.lang.model.util.Types; -import java.lang.annotation.Annotation; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; /** * {@link Navigator} implementation for annotation processing. @@ -241,7 +240,7 @@ public final class ApNavigator implements Navigator elements = env.getElementUtils().getAllMembers(clazz); - Collection constants = new HashSet(); + Collection constants = new ArrayList(); for (Element element : elements) { if (element.getKind().equals(ElementKind.ENUM_CONSTANT)) { constants.add((VariableElement) element); diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties index fd88f7f2d7f..de2930362f8 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -171,20 +171,20 @@ Driver.CompilingSchema = \ Driver.FailedToGenerateCode = \ Failed to produce code. -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn Driver.FilePrologComment = \ - This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 \n\ + This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 \n\ See http://java.sun.com/xml/jaxb \n\ Any modifications to this file will be lost upon recompilation of the source schema. \n\ Generated on: {0} \n Driver.Version = \ - xjc 2.2.12-b150126.1924 + xjc 2.2.12-b150331.1824 Driver.FullVersion = \ - xjc full version "2.2.12-b150126.1924" + xjc full version "2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties index 97271e9de79..6c30fbf39cc 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,14 +96,14 @@ Driver.CompilingSchema = Ein Schema wird kompiliert ... Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden. -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn -Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 generiert \nSiehe http://java.sun.com/xml/jaxb \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn +Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 generiert \nSiehe http://java.sun.com/xml/jaxb \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n -Driver.Version = xjc 2.2.12-b150126.1924 +Driver.Version = xjc 2.2.12-b150331.1824 -Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.12-b150126.1924" +Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties index eadb52fac88..0ad71a458d2 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,14 +96,14 @@ Driver.CompilingSchema = Compilando un esquema... Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo. -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn -Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.12-b150126.1924 \nVisite http://java.sun.com/xml/jaxb \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn +Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.12-b150331.1824 \nVisite http://java.sun.com/xml/jaxb \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n -Driver.Version = xjc 2.2.12-b150126.1924 +Driver.Version = xjc 2.2.12-b150331.1824 -Driver.FullVersion = versi\u00F3n completa de xjc "2.2.12-b150126.1924" +Driver.FullVersion = versi\u00F3n completa de xjc "2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties index dd19a1687df..dab13109b69 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,14 +96,14 @@ Driver.CompilingSchema = compilation d'un sch\u00e9ma... Driver.FailedToGenerateCode = Echec de la production du code. -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn -Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.12-b150126.1924 \nVoir http://java.sun.com/xml/jaxb \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn +Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.12-b150331.1824 \nVoir http://java.sun.com/xml/jaxb \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n -Driver.Version = xjc 2.2.12-b150126.1924 +Driver.Version = xjc 2.2.12-b150331.1824 -Driver.FullVersion = version compl\u00E8te xjc "2.2.12-b150126.1924" +Driver.FullVersion = version compl\u00E8te xjc "2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties index f259cb3d291..32b7221ef35 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,14 +96,14 @@ Driver.CompilingSchema = compilazione di uno schema in corso... Driver.FailedToGenerateCode = Produzione del codice non riuscita. -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn -Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b150126.1924 \nVedere http://java.sun.com/xml/jaxb \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn +Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b150331.1824 \nVedere http://java.sun.com/xml/jaxb \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n -Driver.Version = xjc 2.2.12-b150126.1924 +Driver.Version = xjc 2.2.12-b150331.1824 -Driver.FullVersion = versione completa xjc "2.2.12-b150126.1924" +Driver.FullVersion = versione completa xjc "2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties index 9674081427e..366edb4becc 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,14 +96,14 @@ Driver.CompilingSchema = \u30b9\u30ad\u30fc\u30de\u306e\u30b3\u30f3\u30d1\u30a4\ Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002 -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn -Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.12-b150126.1924\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \nhttp://java.sun.com/xml/jaxb\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn +Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.12-b150331.1824\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \nhttp://java.sun.com/xml/jaxb\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n -Driver.Version = xjc 2.2.12-b150126.1924 +Driver.Version = xjc 2.2.12-b150331.1824 -Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150126.1924" +Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties index 3715185d805..ffb08b6952e 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,14 +96,14 @@ Driver.CompilingSchema = \uc2a4\ud0a4\ub9c8\ub97c \ucef4\ud30c\uc77c\ud558\ub294 Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4. -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn -Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.12-b150126.1924 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \nhttp://java.sun.com/xml/jaxb\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn +Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.12-b150331.1824 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \nhttp://java.sun.com/xml/jaxb\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n -Driver.Version = XJC 2.2.12-b150126.1924 +Driver.Version = XJC 2.2.12-b150331.1824 -Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.12-b150126.1924" +Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties index 9f44278b4eb..5712ddafe10 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,14 +96,14 @@ Driver.CompilingSchema = compilando um esquema... Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo. -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn -Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.12-b150126.1924 \nConsulte http://java.sun.com/xml/jaxb \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn +Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.12-b150331.1824 \nConsulte http://java.sun.com/xml/jaxb \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n -Driver.Version = xjc 2.2.12-b150126.1924 +Driver.Version = xjc 2.2.12-b150331.1824 -Driver.FullVersion = vers\u00E3o completa de xjc "2.2.12-b150126.1924" +Driver.FullVersion = vers\u00E3o completa de xjc "2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties index 11276a8352a..b5f2d8a505a 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7f16\u8bd1\u6a21\u5f0f... Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002 -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn -Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.12-b150126.1924 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee http://java.sun.com/xml/jaxb \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn +Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.12-b150331.1824 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee http://java.sun.com/xml/jaxb \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n -Driver.Version = xjc 2.2.12-b150126.1924 +Driver.Version = xjc 2.2.12-b150331.1824 -Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924" +Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties index 27227f5b5c5..d722fc105cc 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7de8\u8b6f\u7db1\u8981... Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc. -# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn -Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 http://java.sun.com/xml/jaxb \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n +# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn +Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 http://java.sun.com/xml/jaxb \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n -Driver.Version = xjc 2.2.12-b150126.1924 +Driver.Version = xjc 2.2.12-b150331.1824 -Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924" +Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824" -Driver.BuildID = 2.2.12-b150126.1924 +Driver.BuildID = 2.2.12-b150331.1824 # for JDK integration - include version in source zip jaxb.jdk.version=@@JAXB_JDK_VERSION@@ diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/code_injector/PluginImpl.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/code_injector/PluginImpl.java index 626e97232f5..2d82bab915f 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/code_injector/PluginImpl.java +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/code_injector/PluginImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,15 @@ package com.sun.tools.internal.xjc.addon.code_injector; +import java.util.Collection; import java.util.Collections; import java.util.List; +import com.sun.istack.internal.NotNull; import com.sun.tools.internal.xjc.Options; import com.sun.tools.internal.xjc.Plugin; import com.sun.tools.internal.xjc.model.CPluginCustomization; -import com.sun.tools.internal.xjc.outline.ClassOutline; +import com.sun.tools.internal.xjc.outline.CustomizableOutline; import com.sun.tools.internal.xjc.outline.Outline; import com.sun.tools.internal.xjc.util.DOMUtils; @@ -54,7 +56,7 @@ public class PluginImpl extends Plugin { } public boolean isCustomizationTagName(String nsUri, String localName) { - return nsUri.equals(Const.NS) && localName.equals("code"); + return Const.NS.equals(nsUri) && "code".equals(localName); } public String getUsage() { @@ -62,9 +64,15 @@ public class PluginImpl extends Plugin { } // meat of the processing - public boolean run(Outline model, Options opt, ErrorHandler errorHandler) { - for( ClassOutline co : model.getClasses() ) { - CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code"); + public boolean run(@NotNull Outline model, Options opt, ErrorHandler errorHandler) { + checkAndInject(model.getClasses()); + checkAndInject(model.getEnums()); + return true; + } + + private static void checkAndInject(Collection outlines) { + for (CustomizableOutline co : outlines) { + CPluginCustomization c = co.getTarget().getCustomizations().find(Const.NS, "code"); if(c==null) continue; // no customization --- nothing to inject here @@ -74,9 +82,7 @@ public class PluginImpl extends Plugin { String codeFragment = DOMUtils.getElementText(c.element); // inject the specified code fragment into the implementation class. - co.implClass.direct(codeFragment); + co.getImplClass().direct(codeFragment); } - - return true; } } diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ClassOutline.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ClassOutline.java index 1b6e1b664d9..dde38ae363c 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ClassOutline.java +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ClassOutline.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import java.util.List; import com.sun.codemodel.internal.JClass; import com.sun.codemodel.internal.JDefinedClass; import com.sun.tools.internal.xjc.model.CClassInfo; +import com.sun.tools.internal.xjc.model.CCustomizable; import com.sun.tools.internal.xjc.model.CPropertyInfo; import com.sun.istack.internal.NotNull; @@ -44,7 +45,7 @@ import com.sun.istack.internal.NotNull; * * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) */ -public abstract class ClassOutline { +public abstract class ClassOutline implements CustomizableOutline { /** * A {@link Outline} that encloses all the class outlines. @@ -122,4 +123,14 @@ public abstract class ClassOutline { if(s==null) return null; return parent().getClazz(s); } + + @Override + public JDefinedClass getImplClass() { + return implClass; + } + + @Override + public CCustomizable getTarget() { + return target; + } } diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/CustomizableOutline.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/CustomizableOutline.java new file mode 100644 index 00000000000..79c223d5c57 --- /dev/null +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/CustomizableOutline.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.tools.internal.xjc.outline; + +import com.sun.codemodel.internal.JDefinedClass; +import com.sun.istack.internal.NotNull; +import com.sun.tools.internal.xjc.model.CCustomizable; + +/** + * This interface describes that outline class could be customized. + * It provides the bound info from {@link CCustomizable} target. And + * customization output - implementation class. + * + * @author yaroska + * @since 2.2.12 + */ +public interface CustomizableOutline { + + /** + * Provides bound information about customizable target. + * @return customizable target + */ + @NotNull CCustomizable getTarget(); + + /** + * Provides customization output. + * @return Implementation class + */ + @NotNull JDefinedClass getImplClass(); +} diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ElementOutline.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ElementOutline.java index 34609aa8fec..72d768719ba 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ElementOutline.java +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/ElementOutline.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ package com.sun.tools.internal.xjc.outline; import com.sun.codemodel.internal.JDefinedClass; +import com.sun.tools.internal.xjc.model.CCustomizable; import com.sun.tools.internal.xjc.model.CElementInfo; /** @@ -39,7 +40,7 @@ import com.sun.tools.internal.xjc.model.CElementInfo; * * @author Kohsuke Kawaguchi */ -public abstract class ElementOutline { +public abstract class ElementOutline implements CustomizableOutline { /** * A {@link Outline} that encloses all the class outlines. @@ -69,4 +70,14 @@ public abstract class ElementOutline { this.target = target; this.implClass = implClass; } + + @Override + public CCustomizable getTarget() { + return target; + } + + @Override + public JDefinedClass getImplClass() { + return implClass; + } } diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/EnumOutline.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/EnumOutline.java index 9ac6b7a97d3..ae48a7212e2 100644 --- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/EnumOutline.java +++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/EnumOutline.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.List; import com.sun.codemodel.internal.JDefinedClass; +import com.sun.tools.internal.xjc.model.CCustomizable; import com.sun.tools.internal.xjc.model.CEnumLeafInfo; import com.sun.istack.internal.NotNull; @@ -40,7 +41,7 @@ import com.sun.istack.internal.NotNull; * * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) */ -public abstract class EnumOutline { +public abstract class EnumOutline implements CustomizableOutline { /** * This {@link EnumOutline} holds information about this {@link CEnumLeafInfo}. @@ -74,4 +75,14 @@ public abstract class EnumOutline { this.target = target; this.clazz = clazz; } + + @Override + public JDefinedClass getImplClass() { + return clazz; + } + + @Override + public CCustomizable getTarget() { + return target; + } } diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties index b18bbc710b0..8cc250fb181 100644 --- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties +++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ # questions. # -build-id=2.2.11-b150127.1410 -build-version=JAX-WS RI 2.2.11-b150127.1410 +build-id=2.2.11-b150402.1412 +build-version=JAX-WS RI 2.2.11-b150402.1412 major-version=2.2.11 -svn-revision=28121d09ed8ac02b76788709ccb4cdb66e03bbfa +svn-revision=f923291dedcf386c5f408263984a99d7cedf0012 diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java index aabf2579a43..ee1582ed285 100644 --- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java +++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ package com.sun.tools.internal.ws.wsdl.document.soap; +import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants; + import javax.xml.namespace.QName; /** @@ -35,9 +37,7 @@ import javax.xml.namespace.QName; public interface SOAPConstants { // namespace URIs - public static final String URI_ENVELOPE = - "http://schemas.xmlsoap.org/soap/envelope/"; - + public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE; public static final String NS_WSDL_SOAP = "http://schemas.xmlsoap.org/wsdl/soap/"; public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java index c153cce7f68..d216e6f3608 100644 --- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java +++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/Internalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,7 +78,7 @@ public class Internalizer { private static final ContextClassloaderLocal xpf = new ContextClassloaderLocal() { @Override protected XPathFactory initialValue() throws Exception { - return XPathFactory.newInstance(); + return XmlUtil.newXPathFactory(true); } }; /** diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java index 0f12222220c..6801dd9f474 100644 --- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java +++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser/JAXWSBindingExtensionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,10 +25,10 @@ package com.sun.tools.internal.ws.wsdl.parser; +import com.sun.tools.internal.ws.util.xml.XmlUtil; import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; -import com.sun.tools.internal.ws.util.xml.XmlUtil; import com.sun.tools.internal.ws.wsdl.document.*; import com.sun.tools.internal.ws.wsdl.document.jaxws.CustomName; import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding; @@ -57,7 +57,7 @@ public class JAXWSBindingExtensionHandler extends AbstractExtensionHandler { private static final ContextClassloaderLocal xpf = new ContextClassloaderLocal() { @Override protected XPathFactory initialValue() throws Exception { - return XPathFactory.newInstance(); + return XmlUtil.newXPathFactory(false); } }; From 2cbce413a0661708df47af47b1ad14f58a601665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Fri, 10 Apr 2015 14:18:31 +0200 Subject: [PATCH 093/101] 8067215: Disable dual fields when not using optimistic types Reviewed-by: attila, lagergren --- .../tools/nasgen/PrototypeGenerator.java | 2 - nashorn/docs/DEVELOPER_README | 19 ++-- .../internal/codegen/CodeGenerator.java | 15 ++- .../internal/codegen/CompilerConstants.java | 7 +- .../internal/codegen/FieldObjectCreator.java | 8 +- .../internal/codegen/FindScopeDepths.java | 2 +- .../nashorn/internal/codegen/MapCreator.java | 18 +-- .../nashorn/internal/codegen/MapTuple.java | 6 +- .../codegen/ObjectClassGenerator.java | 102 ++++++++--------- .../internal/codegen/ObjectCreator.java | 2 +- .../internal/codegen/SpillObjectCreator.java | 53 +++++---- .../jdk/nashorn/internal/objects/Global.java | 14 ++- .../internal/objects/NativeJSAdapter.java | 2 +- .../nashorn/internal/parser/JSONParser.java | 32 ++++-- .../internal/runtime/AccessorProperty.java | 37 +++---- .../internal/runtime/AllocationStrategy.java | 9 +- .../jdk/nashorn/internal/runtime/Context.java | 35 +++++- .../internal/runtime/JSONFunctions.java | 3 +- .../jdk/nashorn/internal/runtime/JSType.java | 5 - .../nashorn/internal/runtime/Property.java | 43 +++----- .../nashorn/internal/runtime/PropertyMap.java | 11 +- .../internal/runtime/ScriptObject.java | 80 ++++++-------- .../internal/runtime/SetMethodCreator.java | 8 +- .../internal/runtime/SpillProperty.java | 18 ++- .../internal/runtime/StructureLoader.java | 41 +++++-- .../internal/runtime/linker/Bootstrap.java | 13 +-- .../runtime/linker/NashornGuards.java | 3 +- .../jdk/nashorn/internal/scripts/JD.java | 88 +++++++++++++++ .../jdk/nashorn/internal/scripts/JO.java | 14 +-- nashorn/test/script/nosecurity/JDK-8067215.js | 104 ++++++++++++++++++ 30 files changed, 532 insertions(+), 262 deletions(-) create mode 100644 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JD.java create mode 100644 nashorn/test/script/nosecurity/JDK-8067215.js diff --git a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java index 8eb19b7d112..115e4b19f4e 100644 --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java @@ -124,8 +124,6 @@ public class PrototypeGenerator extends ClassGenerator { if (memberCount > 0) { // call "super(map$)" mi.getStatic(className, PROPERTYMAP_FIELD_NAME, PROPERTYMAP_DESC); - // make sure we use duplicated PropertyMap so that original map - // stays intact and so can be used for many global. mi.invokeSpecial(PROTOTYPEOBJECT_TYPE, INIT, SCRIPTOBJECT_INIT_DESC); // initialize Function type fields initFunctionFields(mi); diff --git a/nashorn/docs/DEVELOPER_README b/nashorn/docs/DEVELOPER_README index 5550b903b1d..faff28c0bac 100644 --- a/nashorn/docs/DEVELOPER_README +++ b/nashorn/docs/DEVELOPER_README @@ -63,16 +63,19 @@ SYSTEM PROPERTY: -Dnashorn.codegen.debug.trace= See the description of the codegen logger below. -SYSTEM PROPERTY: -Dnashorn.fields.objects +SYSTEM PROPERTY: -Dnashorn.fields.objects, -Dnashorn.fields.dual -When this property is true, Nashorn will only use object fields for -AccessorProperties. This means that primitive values must be boxed -when stored in a field, which is significantly slower than using -primitive fields. +When the nashorn.fields.objects property is true, Nashorn will always +use object fields for AccessorProperties, requiring boxing for all +primitive property values. When nashorn.fields.dual is set, Nashorn +will always use dual long/object fields, which allows primitives to be +stored without boxing. When neither system property is set, Nashorn +chooses a setting depending on the optimistic types setting (dual +fields when optimistic types are enabled, object-only fields otherwise). -By default, Nashorn uses dual object and long fields. Ints are -represented as the 32 low bits of the long fields. Doubles are -represented as the doubleToLongBits of their value. This way a +With dual fields, Nashorn uses long fields to store primitive values. +Ints are represented as the 32 low bits of the long fields. Doubles +are represented as the doubleToLongBits of their value. This way a single field can be used for all primitive types. Packing and unpacking doubles to their bit representation is intrinsified by the JVM and extremely fast. diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java index fd627a6f1fb..81daa4f228f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java @@ -43,7 +43,6 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.methodDescriptor; import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup; import static jdk.nashorn.internal.codegen.CompilerConstants.typeDescriptor; import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup; -import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY; import static jdk.nashorn.internal.ir.Symbol.HAS_SLOT; import static jdk.nashorn.internal.ir.Symbol.IS_INTERNAL; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; @@ -305,6 +304,14 @@ final class CodeGenerator extends NodeOperatorVisitor getValueType() { - if (OBJECT_FIELDS_ONLY || value == null || paramType == null) { + if (!useDualFields() || value == null || paramType == null || paramType.isBoolean()) { return Object.class; } - return paramType.isBoolean() ? Object.class : paramType.getTypeClass(); + return paramType.getTypeClass(); } }); } @@ -2555,7 +2562,7 @@ final class CodeGenerator extends NodeOperatorVisitor valueType = (OBJECT_FIELDS_ONLY || value == null || value.getType().isBoolean()) ? Object.class : value.getType().getTypeClass(); + final Class valueType = (!useDualFields() || value == null || value.getType().isBoolean()) ? Object.class : value.getType().getTypeClass(); tuples.add(new MapTuple(key, symbol, Type.typeFor(valueType), value) { @Override public Class getValueType() { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java index e84c9f0477d..a7f31d50406 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java @@ -149,8 +149,11 @@ public enum CompilerConstants { /** Arguments parameter in scope object constructors; in slot 3 when present */ INIT_ARGUMENTS(null, 3), - /** prefix for all ScriptObject subclasses with fields, @see ObjectGenerator */ - JS_OBJECT_PREFIX("JO"), + /** prefix for all ScriptObject subclasses with dual object/primitive fields, see {@link ObjectClassGenerator} */ + JS_OBJECT_DUAL_FIELD_PREFIX("JD"), + + /** prefix for all ScriptObject subclasses with object fields only, see {@link ObjectClassGenerator} */ + JS_OBJECT_SINGLE_FIELD_PREFIX("JO"), /** name for allocate method in JO objects */ ALLOCATE("allocate"), diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java index 491af86f63f..25baea0ce28 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java @@ -151,7 +151,7 @@ public abstract class FieldObjectCreator extends ObjectCreator { @Override protected PropertyMap makeMap() { assert propertyMap == null : "property map already initialized"; - propertyMap = newMapCreator(fieldObjectClass).makeFieldMap(hasArguments(), fieldCount, paddedFieldCount, evalCode); + propertyMap = newMapCreator(fieldObjectClass).makeFieldMap(hasArguments(), codegen.useDualFields(), fieldCount, paddedFieldCount, evalCode); return propertyMap; } @@ -166,7 +166,7 @@ public abstract class FieldObjectCreator extends ObjectCreator { private void putField(final MethodEmitter method, final String key, final int fieldIndex, final MapTuple tuple) { method.dup(); - final Type fieldType = tuple.isPrimitive() ? PRIMITIVE_FIELD_TYPE : Type.OBJECT; + final Type fieldType = codegen.useDualFields() && tuple.isPrimitive() ? PRIMITIVE_FIELD_TYPE : Type.OBJECT; final String fieldClass = getClassName(); final String fieldName = getFieldName(fieldIndex, fieldType); final String fieldDesc = typeDescriptor(fieldType.getTypeClass()); @@ -202,8 +202,8 @@ public abstract class FieldObjectCreator extends ObjectCreator { */ private void findClass() { fieldObjectClassName = isScope() ? - ObjectClassGenerator.getClassName(fieldCount, paramCount) : - ObjectClassGenerator.getClassName(paddedFieldCount); + ObjectClassGenerator.getClassName(fieldCount, paramCount, codegen.useDualFields()) : + ObjectClassGenerator.getClassName(paddedFieldCount, codegen.useDualFields()); try { this.fieldObjectClass = Context.forStructureClass(Compiler.binaryName(fieldObjectClassName)); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java index b45b9867116..9f9abf9c0c9 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java @@ -207,7 +207,7 @@ final class FindScopeDepths extends NodeVisitor implements Logga final RecompilableScriptFunctionData data = new RecompilableScriptFunctionData( newFunctionNode, compiler.getCodeInstaller(), - ObjectClassGenerator.createAllocationStrategy(newFunctionNode.getThisProperties()), + ObjectClassGenerator.createAllocationStrategy(newFunctionNode.getThisProperties(), compiler.getContext().useDualFields()), nestedFunctions, externalSymbolDepths.get(fnId), internalSymbols.get(fnId), diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java index ae96dc46607..be99db99c7f 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java @@ -68,17 +68,17 @@ public class MapCreator { * @param evalCode is this property map created for 'eval' code? * @return New map populated with accessor properties. */ - PropertyMap makeFieldMap(final boolean hasArguments, final int fieldCount, final int fieldMaximum, final boolean evalCode) { + PropertyMap makeFieldMap(final boolean hasArguments, final boolean dualFields, final int fieldCount, final int fieldMaximum, final boolean evalCode) { final List properties = new ArrayList<>(); assert tuples != null; for (final MapTuple tuple : tuples) { final String key = tuple.key; final Symbol symbol = tuple.symbol; - final Class initialType = tuple.getValueType(); + final Class initialType = dualFields ? tuple.getValueType() : Object.class; if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) { - final int flags = getPropertyFlags(symbol, hasArguments, evalCode); + final int flags = getPropertyFlags(symbol, hasArguments, evalCode, dualFields); final Property property = new AccessorProperty( key, flags, @@ -92,7 +92,7 @@ public class MapCreator { return PropertyMap.newMap(properties, structure.getName(), fieldCount, fieldMaximum, 0); } - PropertyMap makeSpillMap(final boolean hasArguments) { + PropertyMap makeSpillMap(final boolean hasArguments, final boolean dualFields) { final List properties = new ArrayList<>(); int spillIndex = 0; assert tuples != null; @@ -100,10 +100,10 @@ public class MapCreator { for (final MapTuple tuple : tuples) { final String key = tuple.key; final Symbol symbol = tuple.symbol; - final Class initialType = tuple.getValueType(); + final Class initialType = dualFields ? tuple.getValueType() : Object.class; if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) { - final int flags = getPropertyFlags(symbol, hasArguments, false); + final int flags = getPropertyFlags(symbol, hasArguments, false, dualFields); properties.add( new SpillProperty( key, @@ -124,7 +124,7 @@ public class MapCreator { * * @return flags to use for fields */ - static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode) { + static int getPropertyFlags(final Symbol symbol, final boolean hasArguments, final boolean evalCode, final boolean dualFields) { int flags = 0; if (symbol.isParam()) { @@ -162,6 +162,10 @@ public class MapCreator { flags |= Property.NEEDS_DECLARATION; } + if (dualFields) { + flags |= Property.DUAL_FIELDS; + } + return flags; } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapTuple.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapTuple.java index 024c3d6745e..44cdc8b2c88 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapTuple.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapTuple.java @@ -25,8 +25,6 @@ package jdk.nashorn.internal.codegen; -import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY; - import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.ir.Symbol; @@ -52,11 +50,11 @@ class MapTuple { } public Class getValueType() { - return OBJECT_FIELDS_ONLY ? Object.class : null; //until proven otherwise we are undefined, see NASHORN-592 int.class; + return null; //until proven otherwise we are undefined, see NASHORN-592 int.class; } boolean isPrimitive() { - return !OBJECT_FIELDS_ONLY && getValueType().isPrimitive() && getValueType() != boolean.class; + return getValueType() != null && getValueType().isPrimitive() && getValueType() != boolean.class; } @Override diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java index 2205044c9e5..383d2f130d4 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java @@ -31,7 +31,8 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_ARGUMENTS; import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_MAP; import static jdk.nashorn.internal.codegen.CompilerConstants.INIT_SCOPE; import static jdk.nashorn.internal.codegen.CompilerConstants.JAVA_THIS; -import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_PREFIX; +import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_DUAL_FIELD_PREFIX; +import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_SINGLE_FIELD_PREFIX; import static jdk.nashorn.internal.codegen.CompilerConstants.className; import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup; import static jdk.nashorn.internal.lookup.Lookup.MH; @@ -99,18 +100,10 @@ public final class ObjectClassGenerator implements Loggable { */ private final DebugLogger log; - /** - * Should the runtime only use java.lang.Object slots for fields? If this is false, the representation - * will be a primitive 64-bit long value used for all primitives and a java.lang.Object for references. - * This introduces a larger number of method handles in the system, as we need to have different getters - * and setters for the different fields. - * - * This is engineered to plug into the TaggedArray implementation, when it's done. - */ - public static final boolean OBJECT_FIELDS_ONLY = Options.getBooleanProperty("nashorn.fields.objects"); - - /** The field types in the system */ - private static final List FIELD_TYPES = new LinkedList<>(); + /** Field types for object-only fields */ + private static final Type[] FIELD_TYPES_OBJECT = new Type[] { Type.OBJECT }; + /** Field types for dual primitive/object fields */ + private static final Type[] FIELD_TYPES_DUAL = new Type[] { Type.LONG, Type.OBJECT }; /** What type is the primitive type in dual representation */ public static final Type PRIMITIVE_FIELD_TYPE = Type.LONG; @@ -118,33 +111,27 @@ public final class ObjectClassGenerator implements Loggable { private static final MethodHandle GET_DIFFERENT = findOwnMH("getDifferent", Object.class, Object.class, Class.class, MethodHandle.class, MethodHandle.class, int.class); private static final MethodHandle GET_DIFFERENT_UNDEFINED = findOwnMH("getDifferentUndefined", Object.class, int.class); - /** - * The list of field types that we support - one type creates one field. This is currently either - * LONG + OBJECT or just OBJECT for classic mode. - */ - static { - if (!OBJECT_FIELDS_ONLY) { - FIELD_TYPES.add(PRIMITIVE_FIELD_TYPE); - } - FIELD_TYPES.add(Type.OBJECT); - } private static boolean initialized = false; /** The context */ private final Context context; + private final boolean dualFields; + /** * Constructor * * @param context a context + * @param dualFields whether to use dual fields representation */ - public ObjectClassGenerator(final Context context) { + public ObjectClassGenerator(final Context context, final boolean dualFields) { this.context = context; + this.dualFields = dualFields; assert context != null; this.log = initLogger(context); if (!initialized) { initialized = true; - if (OBJECT_FIELDS_ONLY) { + if (!dualFields) { log.warning("Running with object fields only - this is a deprecated configuration."); } } @@ -176,16 +163,30 @@ public final class ObjectClassGenerator implements Loggable { throw new AssertionError("cannot pack" + n); } + private static String getPrefixName(final boolean dualFields) { + return dualFields ? JS_OBJECT_DUAL_FIELD_PREFIX.symbolName() : JS_OBJECT_SINGLE_FIELD_PREFIX.symbolName(); + } + + private static String getPrefixName(final String className) { + if (className.startsWith(JS_OBJECT_DUAL_FIELD_PREFIX.symbolName())) { + return getPrefixName(true); + } else if (className.startsWith(JS_OBJECT_SINGLE_FIELD_PREFIX.symbolName())) { + return getPrefixName(false); + } + throw new AssertionError("Not a structure class: " + className); + } + /** * Returns the class name for JavaScript objects with fieldCount fields. * * @param fieldCount Number of fields to allocate. - * + * @param dualFields whether to use dual fields representation * @return The class name. */ - public static String getClassName(final int fieldCount) { - return fieldCount != 0 ? SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.symbolName() + fieldCount : - SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.symbolName(); + public static String getClassName(final int fieldCount, final boolean dualFields) { + final String prefix = getPrefixName(dualFields); + return fieldCount != 0 ? SCRIPTS_PACKAGE + '/' + prefix + fieldCount : + SCRIPTS_PACKAGE + '/' + prefix; } /** @@ -194,22 +195,23 @@ public final class ObjectClassGenerator implements Loggable { * * @param fieldCount Number of fields to allocate. * @param paramCount Number of parameters to allocate - * + * @param dualFields whether to use dual fields representation * @return The class name. */ - public static String getClassName(final int fieldCount, final int paramCount) { - return SCRIPTS_PACKAGE + '/' + JS_OBJECT_PREFIX.symbolName() + fieldCount + SCOPE_MARKER + paramCount; + public static String getClassName(final int fieldCount, final int paramCount, final boolean dualFields) { + return SCRIPTS_PACKAGE + '/' + getPrefixName(dualFields) + fieldCount + SCOPE_MARKER + paramCount; } /** * Returns the number of fields in the JavaScript scope class. Its name had to be generated using either - * {@link #getClassName(int)} or {@link #getClassName(int, int)}. + * {@link #getClassName(int, boolean)} or {@link #getClassName(int, int, boolean)}. * @param clazz the JavaScript scope class. * @return the number of fields in the scope class. */ public static int getFieldCount(final Class clazz) { final String name = clazz.getSimpleName(); - final String prefix = JS_OBJECT_PREFIX.symbolName(); + final String prefix = getPrefixName(name); + if (prefix.equals(name)) { return 0; } @@ -238,8 +240,8 @@ public final class ObjectClassGenerator implements Loggable { * @param className name of class * @param fieldNames fields to initialize to undefined, where applicable */ - private static void initializeToUndefined(final MethodEmitter init, final String className, final List fieldNames) { - if (!OBJECT_FIELDS_ONLY) { + private void initializeToUndefined(final MethodEmitter init, final String className, final List fieldNames) { + if (dualFields) { // no need to initialize anything to undefined in the dual field world // - then we have a constant getter for undefined for any unknown type return; @@ -292,7 +294,7 @@ public final class ObjectClassGenerator implements Loggable { * @return Byte codes for generated class. */ public byte[] generate(final int fieldCount) { - final String className = getClassName(fieldCount); + final String className = getClassName(fieldCount, dualFields); final String superName = className(ScriptObject.class); final ClassEmitter classEmitter = newClassEmitter(className, superName); @@ -322,7 +324,7 @@ public final class ObjectClassGenerator implements Loggable { * @return Byte codes for generated class. */ public byte[] generate(final int fieldCount, final int paramCount) { - final String className = getClassName(fieldCount, paramCount); + final String className = getClassName(fieldCount, paramCount, dualFields); final String superName = className(FunctionScope.class); final ClassEmitter classEmitter = newClassEmitter(className, superName); final List initFields = addFields(classEmitter, fieldCount); @@ -353,11 +355,11 @@ public final class ObjectClassGenerator implements Loggable { * * @return List fields that need to be initialized. */ - private static List addFields(final ClassEmitter classEmitter, final int fieldCount) { + private List addFields(final ClassEmitter classEmitter, final int fieldCount) { final List initFields = new LinkedList<>(); - + final Type[] fieldTypes = dualFields ? FIELD_TYPES_DUAL : FIELD_TYPES_OBJECT; for (int i = 0; i < fieldCount; i++) { - for (final Type type : FIELD_TYPES) { + for (final Type type : fieldTypes) { final String fieldName = getFieldName(i, type); classEmitter.field(fieldName, type.getTypeClass()); @@ -533,13 +535,10 @@ public final class ObjectClassGenerator implements Loggable { private static MethodHandle getterForType(final Class forType, final MethodHandle primitiveGetter, final MethodHandle objectGetter) { switch (getAccessorTypeIndex(forType)) { case TYPE_INT_INDEX: - assert !OBJECT_FIELDS_ONLY : "this can only happen with dual fields"; return MH.explicitCastArguments(primitiveGetter, primitiveGetter.type().changeReturnType(int.class)); case TYPE_LONG_INDEX: - assert !OBJECT_FIELDS_ONLY : "this can only happen with dual fields"; return primitiveGetter; case TYPE_DOUBLE_INDEX: - assert !OBJECT_FIELDS_ONLY : "this can only happen with dual fields"; return MH.filterReturnValue(primitiveGetter, UNPACK_DOUBLE); case TYPE_OBJECT_INDEX: return objectGetter; @@ -557,7 +556,7 @@ public final class ObjectClassGenerator implements Loggable { final boolean isPrimitiveStorage = forType != null && forType.isPrimitive(); //which is the primordial getter - final MethodHandle getter = OBJECT_FIELDS_ONLY ? objectGetter : isPrimitiveStorage ? primitiveGetter : objectGetter; + final MethodHandle getter = primitiveGetter == null ? objectGetter : isPrimitiveStorage ? primitiveGetter : objectGetter; if (forType == null) { if (isOptimistic) { @@ -580,8 +579,7 @@ public final class ObjectClassGenerator implements Loggable { return MH.dropArguments(GET_UNDEFINED.get(ti), 0, Object.class); } - assert forType != null; - assert !OBJECT_FIELDS_ONLY || forType == Object.class : forType; + assert primitiveGetter != null || forType == Object.class : forType; if (isOptimistic) { if (fti < ti) { @@ -635,8 +633,6 @@ public final class ObjectClassGenerator implements Loggable { return tgetter; } - assert !OBJECT_FIELDS_ONLY; - //final MethodType pmt = primitiveGetter.type(); assert primitiveGetter != null; final MethodType tgetterType = tgetter.type(); switch (fti) { @@ -727,7 +723,7 @@ public final class ObjectClassGenerator implements Loggable { final int fti = getAccessorTypeIndex(forType); final int ti = getAccessorTypeIndex(type); - if (fti == TYPE_OBJECT_INDEX || OBJECT_FIELDS_ONLY) { + if (fti == TYPE_OBJECT_INDEX || primitiveSetter == null) { if (ti == TYPE_OBJECT_INDEX) { return objectSetter; } @@ -735,8 +731,6 @@ public final class ObjectClassGenerator implements Loggable { return MH.asType(objectSetter, objectSetter.type().changeParameterType(1, type)); } - assert !OBJECT_FIELDS_ONLY; - final MethodType pmt = primitiveSetter.type(); switch (fti) { @@ -832,8 +826,8 @@ public final class ObjectClassGenerator implements Loggable { * @param thisProperties number of properties assigned to "this" * @return the allocation strategy */ - static AllocationStrategy createAllocationStrategy(final int thisProperties) { + static AllocationStrategy createAllocationStrategy(final int thisProperties, final boolean dualFields) { final int paddedFieldCount = getPaddedFieldCount(thisProperties); - return new AllocationStrategy(paddedFieldCount); + return new AllocationStrategy(paddedFieldCount, dualFields); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java index 1a09ca62df7..782e3d27464 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java @@ -134,7 +134,7 @@ public abstract class ObjectCreator { MethodEmitter loadTuple(final MethodEmitter method, final MapTuple tuple, final boolean pack) { loadValue(tuple.value, tuple.type); - if (pack && tuple.isPrimitive()) { + if (pack && codegen.useDualFields() && tuple.isPrimitive()) { method.pack(); } else { method.convert(Type.OBJECT); diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java index 40d12dfbdc2..567edba405b 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java @@ -27,7 +27,6 @@ package jdk.nashorn.internal.codegen; import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup; import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup; -import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY; import java.util.LinkedHashSet; import java.util.List; @@ -42,6 +41,7 @@ import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.ScriptRuntime; import jdk.nashorn.internal.runtime.arrays.ArrayData; import jdk.nashorn.internal.runtime.arrays.ArrayIndex; +import jdk.nashorn.internal.scripts.JD; import jdk.nashorn.internal.scripts.JO; /** @@ -65,10 +65,13 @@ public final class SpillObjectCreator extends ObjectCreator { assert !isScope() : "spill scope objects are not currently supported"; final int length = tuples.size(); - final long[] jpresetValues = new long[ScriptObject.spillAllocationLength(length)]; - final Object[] opresetValues = new Object[ScriptObject.spillAllocationLength(length)]; + final boolean dualFields = codegen.useDualFields(); + final int spillLength = ScriptObject.spillAllocationLength(length); + final long[] jpresetValues = dualFields ? new long[spillLength] : null; + final Object[] opresetValues = new Object[spillLength]; final Set postsetValues = new LinkedHashSet<>(); final int callSiteFlags = codegen.getCallSiteFlags(); + final Class objectClass = dualFields ? JD.class : JO.class; ArrayData arrayData = ArrayData.allocate(ScriptRuntime.EMPTY_ARRAY); // Compute constant property values @@ -88,9 +91,9 @@ public final class SpillObjectCreator extends ObjectCreator { final Property property = propertyMap.findProperty(key); if (property != null) { // normal property key - property.setType(JSType.unboxedFieldType(constantValue)); + property.setType(dualFields ? JSType.unboxedFieldType(constantValue) : Object.class); final int slot = property.getSlot(); - if (!OBJECT_FIELDS_ONLY && constantValue instanceof Number) { + if (dualFields && constantValue instanceof Number) { jpresetValues[slot] = ObjectClassGenerator.pack((Number)constantValue); } else { opresetValues[slot] = constantValue; @@ -130,28 +133,32 @@ public final class SpillObjectCreator extends ObjectCreator { //assert postsetValues.isEmpty() : "test me " + postsetValues; // create object and invoke constructor - method._new(JO.class).dup(); + method._new(objectClass).dup(); codegen.loadConstant(propertyMap); //load primitive values to j spill array - codegen.loadConstant(jpresetValues); - for (final int i : postsetValues) { - final MapTuple tuple = tuples.get(i); - final Property property = propertyMap.findProperty(tuple.key); - if (property != null && tuple.isPrimitive()) { - method.dup(); - method.load(property.getSlot()); - loadTuple(method, tuple); - method.arraystore(); + if (dualFields) { + codegen.loadConstant(jpresetValues); + for (final int i : postsetValues) { + final MapTuple tuple = tuples.get(i); + final Property property = propertyMap.findProperty(tuple.key); + if (property != null && tuple.isPrimitive()) { + method.dup(); + method.load(property.getSlot()); + loadTuple(method, tuple); + method.arraystore(); + } } + } else { + method.loadNull(); } //load object values to o spill array codegen.loadConstant(opresetValues); for (final int i : postsetValues) { - final MapTuple tuple = tuples.get(i); - final Property property = propertyMap.findProperty(tuple.key); - if (property != null && !tuple.isPrimitive()) { + final MapTuple tuple = tuples.get(i); + final Property property = propertyMap.findProperty(tuple.key); + if (property != null && (!dualFields || !tuple.isPrimitive())) { method.dup(); method.load(property.getSlot()); loadTuple(method, tuple); @@ -160,7 +167,7 @@ public final class SpillObjectCreator extends ObjectCreator { } //instantiate the script object with spill objects - method.invoke(constructorNoLookup(JO.class, PropertyMap.class, long[].class, Object[].class)); + method.invoke(constructorNoLookup(objectClass, PropertyMap.class, long[].class, Object[].class)); // Set prefix array data if any if (arrayData.length() > 0) { @@ -171,8 +178,8 @@ public final class SpillObjectCreator extends ObjectCreator { // set postfix for (final int i : postsetValues) { - final MapTuple tuple = tuples.get(i); - final Property property = propertyMap.findProperty(tuple.key); + final MapTuple tuple = tuples.get(i); + final Property property = propertyMap.findProperty(tuple.key); if (property == null) { final int index = ArrayIndex.getArrayIndex(tuple.key); assert ArrayIndex.isValidArrayIndex(index); @@ -188,7 +195,9 @@ public final class SpillObjectCreator extends ObjectCreator { @Override protected PropertyMap makeMap() { assert propertyMap == null : "property map already initialized"; - propertyMap = new MapCreator<>(JO.class, tuples).makeSpillMap(false); + final boolean dualFields = codegen.useDualFields(); + final Class clazz = dualFields ? JD.class : JO.class; + propertyMap = new MapCreator<>(clazz, tuples).makeSpillMap(false, codegen.useDualFields()); return propertyMap; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java index e6eba091c40..16ec29e1dca 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java @@ -79,6 +79,7 @@ import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.InvokeByName; import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; import jdk.nashorn.internal.runtime.regexp.RegExpResult; +import jdk.nashorn.internal.scripts.JD; import jdk.nashorn.internal.scripts.JO; import jdk.nashorn.tools.ShellFunctions; @@ -718,7 +719,7 @@ public final class Global extends ScriptObject implements Scope { private static final MethodHandle LOAD = findOwnMH_S("load", Object.class, Object.class, Object.class); private static final MethodHandle LOAD_WITH_NEW_GLOBAL = findOwnMH_S("loadWithNewGlobal", Object.class, Object.class, Object[].class); private static final MethodHandle EXIT = findOwnMH_S("exit", Object.class, Object.class, Object.class); - private static final MethodHandle LEXICAL_SCOPE_FILTER = findOwnMH_S("lexicalScopeFilter", Object.class, Object.class); + private static final MethodHandle LEXICAL_SCOPE_FILTER = findOwnMH_S("lexicalScopeFilter", Object.class, Object.class); // initialized by nasgen private static PropertyMap $nasgenmap$; @@ -750,6 +751,11 @@ public final class Global extends ScriptObject implements Scope { return context; } + @Override + protected boolean useDualFields() { + return context.useDualFields(); + } + // performs initialization checks for Global constructor and returns the // PropertyMap, if everything is fine. private static PropertyMap checkAndGetMap(final Context context) { @@ -933,7 +939,7 @@ public final class Global extends ScriptObject implements Scope { * @return the new ScriptObject */ public ScriptObject newObject() { - return new JO(getObjectPrototype(), JO.getInitialMap()); + return useDualFields() ? new JD(getObjectPrototype()) : new JO(getObjectPrototype()); } /** @@ -2744,8 +2750,8 @@ public final class Global extends ScriptObject implements Scope { */ private static class LexicalScope extends ScriptObject { - LexicalScope(final ScriptObject proto) { - super(proto, PropertyMap.newMap()); + LexicalScope(final Global global) { + super(global, PropertyMap.newMap()); } @Override diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java index c5ca91010fa..c5ece8cd007 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java @@ -160,7 +160,7 @@ public final class NativeJSAdapter extends ScriptObject { } private static ScriptObject wrapAdaptee(final ScriptObject adaptee) { - return new JO(adaptee, JO.getInitialMap()); + return new JO(adaptee); } @Override diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java index 524381873fb..5360226a39a 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java @@ -41,6 +41,7 @@ import jdk.nashorn.internal.runtime.Source; import jdk.nashorn.internal.runtime.SpillProperty; import jdk.nashorn.internal.runtime.arrays.ArrayData; import jdk.nashorn.internal.runtime.arrays.ArrayIndex; +import jdk.nashorn.internal.scripts.JD; import jdk.nashorn.internal.scripts.JO; import static jdk.nashorn.internal.parser.TokenType.STRING; @@ -54,11 +55,10 @@ public class JSONParser { final private String source; final private Global global; + final private boolean dualFields; final int length; int pos = 0; - private static PropertyMap EMPTY_MAP = PropertyMap.newMap(); - private static final int EOF = -1; private static final String TRUE = "true"; @@ -74,10 +74,11 @@ public class JSONParser { * @param source the source * @param global the global object */ - public JSONParser(final String source, final Global global ) { + public JSONParser(final String source, final Global global, final boolean dualFields) { this.source = source; this.global = global; this.length = source.length(); + this.dualFields = dualFields; } /** @@ -180,7 +181,7 @@ public class JSONParser { } private Object parseObject() { - PropertyMap propertyMap = EMPTY_MAP; + PropertyMap propertyMap = dualFields ? JD.getInitialMap() : JO.getInitialMap(); ArrayData arrayData = ArrayData.EMPTY_ARRAY; final ArrayList values = new ArrayList<>(); int state = STATE_EMPTY; @@ -241,36 +242,45 @@ public class JSONParser { return newArrayData.set(index, value, false); } - private static PropertyMap addObjectProperty(final PropertyMap propertyMap, final List values, + private PropertyMap addObjectProperty(final PropertyMap propertyMap, final List values, final String id, final Object value) { final Property oldProperty = propertyMap.findProperty(id); final PropertyMap newMap; - final Class type = ObjectClassGenerator.OBJECT_FIELDS_ONLY ? Object.class : getType(value); + final Class type; + final int flags; + if (dualFields) { + type = getType(value); + flags = Property.DUAL_FIELDS; + } else { + type = Object.class; + flags = 0; + } if (oldProperty != null) { values.set(oldProperty.getSlot(), value); - newMap = propertyMap.replaceProperty(oldProperty, new SpillProperty(id, 0, oldProperty.getSlot(), type));; + newMap = propertyMap.replaceProperty(oldProperty, new SpillProperty(id, flags, oldProperty.getSlot(), type));; } else { values.add(value); - newMap = propertyMap.addProperty(new SpillProperty(id, 0, propertyMap.size(), type)); + newMap = propertyMap.addProperty(new SpillProperty(id, flags, propertyMap.size(), type)); } return newMap; } private Object createObject(final PropertyMap propertyMap, final List values, final ArrayData arrayData) { - final long[] primitiveSpill = new long[values.size()]; + final long[] primitiveSpill = dualFields ? new long[values.size()] : null; final Object[] objectSpill = new Object[values.size()]; for (final Property property : propertyMap.getProperties()) { - if (property.getType() == Object.class) { + if (!dualFields || property.getType() == Object.class) { objectSpill[property.getSlot()] = values.get(property.getSlot()); } else { primitiveSpill[property.getSlot()] = ObjectClassGenerator.pack((Number) values.get(property.getSlot())); } } - final ScriptObject object = new JO(propertyMap, primitiveSpill, objectSpill); + final ScriptObject object = dualFields ? + new JD(propertyMap, primitiveSpill, objectSpill) : new JO(propertyMap, null, objectSpill); object.setInitialProto(global.getObjectPrototype()); object.setArray(arrayData); return object; diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java index a9afeb93abf..6fde66b45f2 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java @@ -25,7 +25,6 @@ package jdk.nashorn.internal.runtime; -import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY; import static jdk.nashorn.internal.codegen.ObjectClassGenerator.PRIMITIVE_FIELD_TYPE; import static jdk.nashorn.internal.codegen.ObjectClassGenerator.createGetter; import static jdk.nashorn.internal.codegen.ObjectClassGenerator.createSetter; @@ -98,7 +97,7 @@ public class AccessorProperty extends Property { objectSetters[i] = MH.asType(MH.setter(LOOKUP, structure, fieldName, typeClass), Lookup.SET_OBJECT_TYPE); } - if (!OBJECT_FIELDS_ONLY) { + if (!StructureLoader.isSingleFieldStructure(structure.getName())) { for (int i = 0; i < fieldCount; i++) { final String fieldNamePrimitive = getFieldName(i, PRIMITIVE_FIELD_TYPE); final Class typeClass = PRIMITIVE_FIELD_TYPE.getTypeClass(); @@ -211,7 +210,7 @@ public class AccessorProperty extends Property { * @param setter the property setter or null if non writable, non configurable */ private AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) { - super(key, flags | IS_BUILTIN | (getter.type().returnType().isPrimitive() ? IS_NASGEN_PRIMITIVE : 0), slot); + super(key, flags | IS_BUILTIN | DUAL_FIELDS | (getter.type().returnType().isPrimitive() ? IS_NASGEN_PRIMITIVE : 0), slot); assert !isSpill(); // we don't need to prep the setters these will never be invalidated as this is a nasgen @@ -221,18 +220,15 @@ public class AccessorProperty extends Property { final Class setterType = setter == null ? null : setter.type().parameterType(1); assert setterType == null || setterType == getterType; - if (OBJECT_FIELDS_ONLY) { - primitiveGetter = primitiveSetter = null; + + if (getterType == int.class || getterType == long.class) { + primitiveGetter = MH.asType(getter, Lookup.GET_PRIMITIVE_TYPE); + primitiveSetter = setter == null ? null : MH.asType(setter, Lookup.SET_PRIMITIVE_TYPE); + } else if (getterType == double.class) { + primitiveGetter = MH.asType(MH.filterReturnValue(getter, ObjectClassGenerator.PACK_DOUBLE), Lookup.GET_PRIMITIVE_TYPE); + primitiveSetter = setter == null ? null : MH.asType(MH.filterArguments(setter, 1, ObjectClassGenerator.UNPACK_DOUBLE), Lookup.SET_PRIMITIVE_TYPE); } else { - if (getterType == int.class || getterType == long.class) { - primitiveGetter = MH.asType(getter, Lookup.GET_PRIMITIVE_TYPE); - primitiveSetter = setter == null ? null : MH.asType(setter, Lookup.SET_PRIMITIVE_TYPE); - } else if (getterType == double.class) { - primitiveGetter = MH.asType(MH.filterReturnValue(getter, ObjectClassGenerator.PACK_DOUBLE), Lookup.GET_PRIMITIVE_TYPE); - primitiveSetter = setter == null ? null : MH.asType(MH.filterArguments(setter, 1, ObjectClassGenerator.UNPACK_DOUBLE), Lookup.SET_PRIMITIVE_TYPE); - } else { - primitiveGetter = primitiveSetter = null; - } + primitiveGetter = primitiveSetter = null; } assert primitiveGetter == null || primitiveGetter.type() == Lookup.GET_PRIMITIVE_TYPE : primitiveGetter + "!=" + Lookup.GET_PRIMITIVE_TYPE; @@ -241,7 +237,7 @@ public class AccessorProperty extends Property { objectGetter = getter.type() != Lookup.GET_OBJECT_TYPE ? MH.asType(getter, Lookup.GET_OBJECT_TYPE) : getter; objectSetter = setter != null && setter.type() != Lookup.SET_OBJECT_TYPE ? MH.asType(setter, Lookup.SET_OBJECT_TYPE) : setter; - setType(OBJECT_FIELDS_ONLY ? Object.class : getterType); + setType(getterType); } /** @@ -282,6 +278,9 @@ public class AccessorProperty extends Property { objectSetter = gs.objectSetters[slot]; primitiveSetter = gs.primitiveSetters[slot]; } + + // Always use dual fields except for single field structures + assert hasDualFields() != StructureLoader.isSingleFieldStructure(structure.getName()); } /** @@ -310,7 +309,7 @@ public class AccessorProperty extends Property { */ public AccessorProperty(final String key, final int flags, final Class structure, final int slot, final Class initialType) { this(key, flags, structure, slot); - setType(OBJECT_FIELDS_ONLY ? Object.class : initialType); + setType(hasDualFields() ? initialType : Object.class); } /** @@ -347,7 +346,7 @@ public class AccessorProperty extends Property { * @param initialValue initial value */ protected final void setInitialValue(final ScriptObject owner, final Object initialValue) { - setType(JSType.unboxedFieldType(initialValue)); + setType(hasDualFields() ? JSType.unboxedFieldType(initialValue) : Object.class); if (initialValue instanceof Integer) { invokeSetter(owner, ((Integer)initialValue).intValue()); } else if (initialValue instanceof Long) { @@ -363,7 +362,7 @@ public class AccessorProperty extends Property { * Initialize the type of a property */ protected final void initializeType() { - setType(OBJECT_FIELDS_ONLY ? Object.class : null); + setType(!hasDualFields() ? Object.class : null); } private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException { @@ -670,7 +669,7 @@ public class AccessorProperty extends Property { @Override public final boolean canChangeType() { - if (OBJECT_FIELDS_ONLY) { + if (!hasDualFields()) { return false; } // Return true for currently undefined even if non-writable/configurable to allow initialization of ES6 CONST. diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java index 395aee5ce4a..f25b588448a 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AllocationStrategy.java @@ -44,6 +44,9 @@ final public class AllocationStrategy implements Serializable { /** Number of fields in the allocated object */ private final int fieldCount; + /** Whether to use dual field representation */ + private final boolean dualFields; + /** Name of class where allocator function resides */ private transient String allocatorClassName; @@ -53,15 +56,17 @@ final public class AllocationStrategy implements Serializable { /** * Construct an allocation strategy with the given map and class name. * @param fieldCount number of fields in the allocated object + * @param dualFields whether to use dual field representation */ - public AllocationStrategy(final int fieldCount) { + public AllocationStrategy(final int fieldCount, final boolean dualFields) { this.fieldCount = fieldCount; + this.dualFields = dualFields; } private String getAllocatorClassName() { if (allocatorClassName == null) { // These classes get loaded, so an interned variant of their name is most likely around anyway. - allocatorClassName = Compiler.binaryName(ObjectClassGenerator.getClassName(fieldCount)).intern(); + allocatorClassName = Compiler.binaryName(ObjectClassGenerator.getClassName(fieldCount, dualFields)).intern(); } return allocatorClassName; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java index 8c265c8a7ff..5c4bbd662f5 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java @@ -130,6 +130,23 @@ public final class Context { private static MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); private static MethodType CREATE_PROGRAM_FUNCTION_TYPE = MethodType.methodType(ScriptFunction.class, ScriptObject.class); + /** + * Should scripts use only object slots for fields, or dual long/object slots? The default + * behaviour is to couple this to optimistic types, using dual representation if optimistic types are enabled + * and single field representation otherwise. This can be overridden by setting either the "nashorn.fields.objects" + * or "nashorn.fields.dual" system property. + */ + private final FieldMode fieldMode; + + private static enum FieldMode { + /** Value for automatic field representation depending on optimistic types setting */ + AUTO, + /** Value for object field representation regardless of optimistic types setting */ + OBJECTS, + /** Value for dual primitive/object field representation regardless of optimistic types setting */ + DUAL + } + /** * Keeps track of which builtin prototypes and properties have been relinked * Currently we are conservative and associate the name of a builtin class with all @@ -434,7 +451,7 @@ public final class Context { * @param appLoader application class loader */ public Context(final Options options, final ErrorManager errors, final ClassLoader appLoader) { - this(options, errors, appLoader, (ClassFilter)null); + this(options, errors, appLoader, null); } /** @@ -522,6 +539,14 @@ public final class Context { getErr().println("nashorn full version " + Version.fullVersion()); } + if (Options.getBooleanProperty("nashorn.fields.dual")) { + fieldMode = FieldMode.DUAL; + } else if (Options.getBooleanProperty("nashorn.fields.objects")) { + fieldMode = FieldMode.OBJECTS; + } else { + fieldMode = FieldMode.AUTO; + } + initLoggers(); } @@ -575,6 +600,14 @@ public final class Context { return env.getErr(); } + /** + * Should scripts compiled by this context use dual field representation? + * @return true if using dual fields, false for object-only fields + */ + public boolean useDualFields() { + return fieldMode == FieldMode.DUAL || (fieldMode == FieldMode.AUTO && env._optimistic_types); + } + /** * Get the PropertyMap of the current global scope * @return the property map of the current global scope diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java index 9622b59a17c..d5f3af77e09 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java @@ -72,7 +72,8 @@ public final class JSONFunctions { public static Object parse(final Object text, final Object reviver) { final String str = JSType.toString(text); final Global global = Context.getGlobal(); - final JSONParser parser = new JSONParser(str, global); + final boolean dualFields = ((ScriptObject) global).useDualFields(); + final JSONParser parser = new JSONParser(str, global, dualFields); final Object value; try { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java index c7eae4f5c30..31be7d28b91 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java @@ -26,7 +26,6 @@ package jdk.nashorn.internal.runtime; import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall; -import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; @@ -1972,10 +1971,6 @@ public enum JSType { * @return primive type or Object.class if not primitive */ public static Class unboxedFieldType(final Object o) { - if (OBJECT_FIELDS_ONLY) { - return Object.class; - } - if (o == null) { return Object.class; } else if (o.getClass() == Integer.class) { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java index 4225c251246..7d5442088cb 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java @@ -96,6 +96,9 @@ public abstract class Property implements Serializable { /** Is this property an ES6 lexical binding? */ public static final int IS_LEXICAL_BINDING = 1 << 10; + /** Does this property support dual field representation? */ + public static final int DUAL_FIELDS = 1 << 11; + /** Property key. */ private final String key; @@ -286,7 +289,7 @@ public abstract class Property implements Serializable { * @return true if parameter */ public boolean isParameter() { - return (flags & IS_PARAMETER) == IS_PARAMETER; + return (flags & IS_PARAMETER) != 0; } /** @@ -294,7 +297,7 @@ public abstract class Property implements Serializable { * @return true if has arguments */ public boolean hasArguments() { - return (flags & HAS_ARGUMENTS) == HAS_ARGUMENTS; + return (flags & HAS_ARGUMENTS) != 0; } /** @@ -316,7 +319,7 @@ public abstract class Property implements Serializable { * @return true if this is a bound property */ public boolean isBound() { - return (flags & IS_BOUND) == IS_BOUND; + return (flags & IS_BOUND) != 0; } /** @@ -325,7 +328,7 @@ public abstract class Property implements Serializable { * @return true if this is a block-scoped variable */ public boolean needsDeclaration() { - return (flags & NEEDS_DECLARATION) == NEEDS_DECLARATION; + return (flags & NEEDS_DECLARATION) != 0; } /** @@ -345,16 +348,6 @@ public abstract class Property implements Serializable { return this; } - /** - * Check if a flag is set for a property - * @param property property - * @param flag flag to check - * @return true if flag is set - */ - public static boolean checkFlag(final Property property, final int flag) { - return (property.getFlags() & flag) == flag; - } - /** * Get the flags for this property * @return property flags @@ -363,16 +356,6 @@ public abstract class Property implements Serializable { return flags; } - /** - * Get the modify flags for this property. The modify flags are the ECMA 8.6.1 - * flags that decide if the Property is writable, configurable and/or enumerable. - * - * @return modify flags for property - */ - public int getModifyFlags() { - return flags & MODIFY_MASK; - } - /** * Remove property flags from the property. Properties are immutable here, * so any property change that results in a smaller flag set results in the @@ -715,7 +698,7 @@ public abstract class Property implements Serializable { * @return whether this property is a function declaration or not. */ public boolean isFunctionDeclaration() { - return (flags & IS_FUNCTION_DECLARATION) == IS_FUNCTION_DECLARATION; + return (flags & IS_FUNCTION_DECLARATION) != 0; } /** @@ -723,6 +706,14 @@ public abstract class Property implements Serializable { * @return true if this property represents a lexical binding. */ public boolean isLexicalBinding() { - return (flags & IS_LEXICAL_BINDING) == IS_LEXICAL_BINDING; + return (flags & IS_LEXICAL_BINDING) != 0; + } + + /** + * Does this property support dual fields for both primitive and object values? + * @return true if supports dual fields + */ + public boolean hasDualFields() { + return (flags & DUAL_FIELDS) != 0; } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java index db7c5c992ce..fbc0dbbf47d 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java @@ -198,13 +198,22 @@ public final class PropertyMap implements Iterable, Serializable { return properties == null || properties.isEmpty()? newMap() : newMap(properties, JO.class.getName(), 0, 0, 0); } + /** + * Return a sharable empty map for the given object class. + * @param clazz the base object class + * @return New empty {@link PropertyMap}. + */ + public static PropertyMap newMap(final Class clazz) { + return new PropertyMap(EMPTY_HASHMAP, clazz.getName(), 0, 0, 0, false); + } + /** * Return a sharable empty map. * * @return New empty {@link PropertyMap}. */ public static PropertyMap newMap() { - return new PropertyMap(EMPTY_HASHMAP, JO.class.getName(), 0, 0, 0, false); + return newMap(JO.class); } /** diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java index 284505a9baf..daf65c23647 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java @@ -28,7 +28,6 @@ package jdk.nashorn.internal.runtime; import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup; import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCall; import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup; -import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; @@ -146,12 +145,6 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { /** Area for reference properties added to object after instantiation, see {@link AccessorProperty} */ protected Object[] objectSpill; - /** - * Number of elements in the spill. This may be less than the spill array lengths, if not all of - * the allocated memory is in use - */ - private int spillLength; - /** Indexed array data. */ private ArrayData arrayData; @@ -171,12 +164,6 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { /** Method handle for getting the array data */ public static final Call GET_ARRAY = virtualCall(MethodHandles.lookup(), ScriptObject.class, "getArray", ArrayData.class); - /** Method handle for getting the property map - debugging purposes */ - public static final Call GET_MAP = virtualCall(MethodHandles.lookup(), ScriptObject.class, "getMap", PropertyMap.class); - - /** Method handle for setting the array data */ - public static final Call SET_ARRAY = virtualCall(MethodHandles.lookup(), ScriptObject.class, "setArray", void.class, ArrayData.class); - /** Method handle for getting a function argument at a given index. Used from MapCreator */ public static final Call GET_ARGUMENT = virtualCall(MethodHandles.lookup(), ScriptObject.class, "getArgument", Object.class, int.class); @@ -259,8 +246,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { this(map); this.primitiveSpill = primitiveSpill; this.objectSpill = objectSpill; - assert primitiveSpill.length == objectSpill.length : " primitive spill pool size is not the same length as object spill pool size"; - this.spillLength = spillAllocationLength(primitiveSpill.length); + assert primitiveSpill == null || primitiveSpill.length == objectSpill.length : " primitive spill pool size is not the same length as object spill pool size"; } /** @@ -727,7 +713,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { setArray(getArray().ensure(longIndex)); doesNotHaveEnsureDelete(longIndex, oldLength, false); } - setArray(getArray().set(index,value, false)); + setArray(getArray().set(index, value, false)); } private void checkIntegerKey(final String key) { @@ -976,10 +962,10 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { * @param setter setter for {@link UserAccessorProperty}, null if not present or N/A */ protected final void initUserAccessors(final String key, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) { - final int slot = spillLength; - ensureSpillSize(spillLength); //arguments=slot0, caller=slot0 - objectSpill[slot] = new UserAccessorProperty.Accessors(getter, setter); final PropertyMap oldMap = getMap(); + final int slot = oldMap.getFreeSpillSlot(); + ensureSpillSize(slot); + objectSpill[slot] = new UserAccessorProperty.Accessors(getter, setter); Property newProperty; PropertyMap newMap; do { @@ -1006,19 +992,12 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { final int slot = uc.getSlot(); assert uc.getLocalType() == Object.class; - if (slot >= spillLength) { - uc.setAccessors(this, getMap(), new UserAccessorProperty.Accessors(getter, setter)); - } else { - final UserAccessorProperty.Accessors gs = uc.getAccessors(this); //this crashes - if (gs == null) { - uc.setAccessors(this, getMap(), new UserAccessorProperty.Accessors(getter, setter)); - } else { - //reuse existing getter setter for speed - gs.set(getter, setter); - if (uc.getFlags() == propertyFlags) { - return oldProperty; - } - } + final UserAccessorProperty.Accessors gs = uc.getAccessors(this); //this crashes + assert gs != null; + //reuse existing getter setter for speed + gs.set(getter, setter); + if (uc.getFlags() == propertyFlags) { + return oldProperty; } newProperty = new UserAccessorProperty(uc.getKey(), propertyFlags, slot); } else { @@ -2053,8 +2032,6 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { protoSwitchPoint = null; } - assert OBJECT_FIELDS_ONLY || guard != null : "we always need a map guard here"; - final GuardedInvocation inv = new GuardedInvocation(mh, guard, protoSwitchPoint, exception); return inv.addSwitchPoint(findBuiltinSwitchPoint(name)); } @@ -2531,13 +2508,14 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { /** * Add a spill property for the given key. - * @param key Property key. - * @param propertyFlags Property flags. + * @param key Property key. + * @param flags Property flags. * @return Added property. */ - private Property addSpillProperty(final String key, final int propertyFlags, final Object value, final boolean hasInitialValue) { + private Property addSpillProperty(final String key, final int flags, final Object value, final boolean hasInitialValue) { final PropertyMap propertyMap = getMap(); final int fieldSlot = propertyMap.getFreeFieldSlot(); + final int propertyFlags = flags | (useDualFields() ? Property.DUAL_FIELDS : 0); Property property; if (fieldSlot > -1) { @@ -2562,7 +2540,7 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { * @return Setter method handle. */ MethodHandle addSpill(final Class type, final String key) { - return addSpillProperty(key, 0, null, false).getSetter(OBJECT_FIELDS_ONLY ? Object.class : type, getMap()); + return addSpillProperty(key, 0, null, false).getSetter(type, getMap()); } /** @@ -2649,9 +2627,9 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { final int spreadArgs = mh.type().parameterCount() - callSiteParamCount + 1; return MH.filterArguments( MH.asSpreader( - mh, - Object[].class, - spreadArgs), + mh, + Object[].class, + spreadArgs), callSiteParamCount - 1, MH.insertArguments( TRUNCATINGFILTER, @@ -3739,24 +3717,32 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable { return uc; } + /** + * Returns {@code true} if properties for this object should use dual field mode, {@code false} otherwise. + * @return {@code true} if dual fields should be used. + */ + protected boolean useDualFields() { + return !StructureLoader.isSingleFieldStructure(getClass().getName()); + } + Object ensureSpillSize(final int slot) { - if (slot < spillLength) { + final int oldLength = objectSpill == null ? 0 : objectSpill.length; + if (slot < oldLength) { return this; } final int newLength = alignUp(slot + 1, SPILL_RATE); final Object[] newObjectSpill = new Object[newLength]; - final long[] newPrimitiveSpill = OBJECT_FIELDS_ONLY ? null : new long[newLength]; + final long[] newPrimitiveSpill = useDualFields() ? new long[newLength] : null; if (objectSpill != null) { - System.arraycopy(objectSpill, 0, newObjectSpill, 0, spillLength); - if (!OBJECT_FIELDS_ONLY) { - System.arraycopy(primitiveSpill, 0, newPrimitiveSpill, 0, spillLength); + System.arraycopy(objectSpill, 0, newObjectSpill, 0, oldLength); + if (primitiveSpill != null && newPrimitiveSpill != null) { + System.arraycopy(primitiveSpill, 0, newPrimitiveSpill, 0, oldLength); } } this.primitiveSpill = newPrimitiveSpill; this.objectSpill = newObjectSpill; - this.spillLength = newLength; return this; } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java index 90bbf43c8a6..4fe1b4f5485 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java @@ -232,14 +232,18 @@ final class SetMethodCreator { } private SetMethod createNewFieldSetter(final SwitchPoint builtinSwitchPoint) { - return createNewSetter(new AccessorProperty(getName(), 0, sobj.getClass(), getMap().getFreeFieldSlot(), type), builtinSwitchPoint); + return createNewSetter(new AccessorProperty(getName(), getFlags(sobj), sobj.getClass(), getMap().getFreeFieldSlot(), type), builtinSwitchPoint); } private SetMethod createNewSpillPropertySetter(final SwitchPoint builtinSwitchPoint) { - return createNewSetter(new SpillProperty(getName(), 0, getMap().getFreeSpillSlot(), type), builtinSwitchPoint); + return createNewSetter(new SpillProperty(getName(), getFlags(sobj), getMap().getFreeSpillSlot(), type), builtinSwitchPoint); } private PropertyMap getNewMap(final Property property) { return getMap().addProperty(property); } + + private static int getFlags(final ScriptObject scriptObject) { + return scriptObject.useDualFields() ? Property.DUAL_FIELDS : 0; + } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java index 856504a3b0d..9019b5609f1 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java @@ -25,7 +25,6 @@ package jdk.nashorn.internal.runtime; -import static jdk.nashorn.internal.codegen.ObjectClassGenerator.OBJECT_FIELDS_ONLY; import static jdk.nashorn.internal.lookup.Lookup.MH; import java.lang.invoke.MethodHandle; @@ -139,11 +138,11 @@ public class SpillProperty extends AccessorProperty { } } - private static MethodHandle primitiveGetter(final int slot) { - return OBJECT_FIELDS_ONLY ? null : Accessors.getCached(slot, true, true); + private static MethodHandle primitiveGetter(final int slot, final int flags) { + return (flags & DUAL_FIELDS) == DUAL_FIELDS ? Accessors.getCached(slot, true, true) : null; } - private static MethodHandle primitiveSetter(final int slot) { - return OBJECT_FIELDS_ONLY ? null : Accessors.getCached(slot, true, false); + private static MethodHandle primitiveSetter(final int slot, final int flags) { + return (flags & DUAL_FIELDS) == DUAL_FIELDS ? Accessors.getCached(slot, true, false) : null; } private static MethodHandle objectGetter(final int slot) { return Accessors.getCached(slot, false, true); @@ -160,8 +159,7 @@ public class SpillProperty extends AccessorProperty { * @param slot spill slot */ public SpillProperty(final String key, final int flags, final int slot) { - super(key, flags, slot, primitiveGetter(slot), primitiveSetter(slot), objectGetter(slot), objectSetter(slot)); - assert !OBJECT_FIELDS_ONLY || getLocalType() == Object.class; + super(key, flags, slot, primitiveGetter(slot, flags), primitiveSetter(slot, flags), objectGetter(slot), objectSetter(slot)); } /** @@ -173,7 +171,7 @@ public class SpillProperty extends AccessorProperty { */ public SpillProperty(final String key, final int flags, final int slot, final Class initialType) { this(key, flags, slot); - setType(OBJECT_FIELDS_ONLY ? Object.class : initialType); + setType(hasDualFields() ? initialType : Object.class); } SpillProperty(final String key, final int flags, final int slot, final ScriptObject owner, final Object initialValue) { @@ -216,8 +214,8 @@ public class SpillProperty extends AccessorProperty { @Override void initMethodHandles(final Class structure) { final int slot = getSlot(); - primitiveGetter = primitiveGetter(slot); - primitiveSetter = primitiveSetter(slot); + primitiveGetter = primitiveGetter(slot, getFlags()); + primitiveSetter = primitiveSetter(slot, getFlags()); objectGetter = objectGetter(slot); objectSetter = objectSetter(slot); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java index 41201cde847..8324730a264 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java @@ -27,7 +27,8 @@ package jdk.nashorn.internal.runtime; import static jdk.nashorn.internal.codegen.Compiler.SCRIPTS_PACKAGE; import static jdk.nashorn.internal.codegen.Compiler.binaryName; -import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_PREFIX; +import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_DUAL_FIELD_PREFIX; +import static jdk.nashorn.internal.codegen.CompilerConstants.JS_OBJECT_SINGLE_FIELD_PREFIX; import java.security.ProtectionDomain; import jdk.nashorn.internal.codegen.ObjectClassGenerator; @@ -36,7 +37,8 @@ import jdk.nashorn.internal.codegen.ObjectClassGenerator; * Responsible for on the fly construction of structure classes. */ final class StructureLoader extends NashornLoader { - private static final String JS_OBJECT_PREFIX_EXTERNAL = binaryName(SCRIPTS_PACKAGE) + '.' + JS_OBJECT_PREFIX.symbolName(); + private static final String SINGLE_FIELD_PREFIX = binaryName(SCRIPTS_PACKAGE) + '.' + JS_OBJECT_SINGLE_FIELD_PREFIX.symbolName(); + private static final String DUAL_FIELD_PREFIX = binaryName(SCRIPTS_PACKAGE) + '.' + JS_OBJECT_DUAL_FIELD_PREFIX.symbolName(); /** * Constructor. @@ -45,14 +47,39 @@ final class StructureLoader extends NashornLoader { super(parent); } + /** + * Returns true if the class name represents a structure object with dual primitive/object fields. + * @param name a class name + * @return true if a dual field structure class + */ + private static boolean isDualFieldStructure(final String name) { + return name.startsWith(DUAL_FIELD_PREFIX); + } + + /** + * Returns true if the class name represents a structure object with single object-only fields. + * @param name a class name + * @return true if a single field structure class + */ + static boolean isSingleFieldStructure(final String name) { + return name.startsWith(SINGLE_FIELD_PREFIX); + } + + /** + * Returns true if the class name represents a Nashorn structure object. + * @param name a class name + * @return true if a structure class + */ static boolean isStructureClass(final String name) { - return name.startsWith(JS_OBJECT_PREFIX_EXTERNAL); + return isDualFieldStructure(name) || isSingleFieldStructure(name); } @Override protected Class findClass(final String name) throws ClassNotFoundException { - if (isStructureClass(name)) { - return generateClass(name, name.substring(JS_OBJECT_PREFIX_EXTERNAL.length())); + if (isDualFieldStructure(name)) { + return generateClass(name, name.substring(DUAL_FIELD_PREFIX.length()), true); + } else if (isSingleFieldStructure(name)) { + return generateClass(name, name.substring(SINGLE_FIELD_PREFIX.length()), false); } return super.findClass(name); } @@ -63,10 +90,10 @@ final class StructureLoader extends NashornLoader { * @param descriptor Layout descriptor. * @return Generated class. */ - private Class generateClass(final String name, final String descriptor) { + private Class generateClass(final String name, final String descriptor, final boolean dualFields) { final Context context = Context.getContextTrusted(); - final byte[] code = new ObjectClassGenerator(context).generate(descriptor); + final byte[] code = new ObjectClassGenerator(context, dualFields).generate(descriptor); return defineClass(name, code, 0, code.length, new ProtectionDomain(null, getPermissions(null))); } } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java index b00d3ec1f87..9cdf6d5c352 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java @@ -74,17 +74,16 @@ public final class Bootstrap { * of object fields only, it is fine. However, with dual fields, in order to get * performance on benchmarks with a lot of object instantiation and then field * reassignment, it can take slightly more relinks to become stable with type - * changes swapping out an entire proprety map and making a map guard fail. - * Therefore the relink threshold is set to 16 for dual fields (now the default). - * This doesn't seem to have any other negative performance implication. + * changes swapping out an entire property map and making a map guard fail. + * Since we need to set this value statically it must work with possibly changing + * optimistic types and dual fields settings. A higher value does not seem to have + * any other negative performance implication when running with object-only fields, + * so we choose a higher value here. * * See for example octane.gbemu, run with --log=fields:warning to study * megamorphic behavior */ - private static final int NASHORN_DEFAULT_UNSTABLE_RELINK_THRESHOLD = - ObjectClassGenerator.OBJECT_FIELDS_ONLY ? - 8 : - 16; + private static final int NASHORN_DEFAULT_UNSTABLE_RELINK_THRESHOLD = 16; // do not create me!! private Bootstrap() { diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java index dac36d4afb7..ca7034d139c 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java @@ -33,7 +33,6 @@ import java.lang.ref.WeakReference; import jdk.internal.dynalink.CallSiteDescriptor; import jdk.internal.dynalink.linker.LinkRequest; import jdk.nashorn.api.scripting.JSObject; -import jdk.nashorn.internal.codegen.ObjectClassGenerator; import jdk.nashorn.internal.objects.Global; import jdk.nashorn.internal.runtime.Property; import jdk.nashorn.internal.runtime.PropertyMap; @@ -123,7 +122,7 @@ public final class NashornGuards { */ static boolean needsGuard(final Property property, final CallSiteDescriptor desc) { return property == null || property.isConfigurable() - || property.isBound() || !ObjectClassGenerator.OBJECT_FIELDS_ONLY + || property.isBound() || property.hasDualFields() || !NashornCallSiteDescriptor.isFastScope(desc) || property.canChangeType(); } diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JD.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JD.java new file mode 100644 index 00000000000..11d6cacc4bc --- /dev/null +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JD.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.nashorn.internal.scripts; + +import jdk.nashorn.internal.runtime.PropertyMap; +import jdk.nashorn.internal.runtime.ScriptObject; + +/** + * Empty object class for dual primitive-object fields. + */ +public class JD extends ScriptObject { + + private static final PropertyMap map$ = PropertyMap.newMap(JD.class); + + /** + * Returns the initial property map to be used. + * @return the initial property map. + */ + public static PropertyMap getInitialMap() { + return map$; + } + + /** + * Constructor given an initial property map + * + * @param map the property map + */ + public JD(final PropertyMap map) { + super(map); + } + + /** + * Constructor given an initial prototype and the default initial property map. + * + * @param proto the prototype object + */ + public JD(final ScriptObject proto) { + super(proto, getInitialMap()); + } + + /** + * Constructor that takes a pre-initialized spill pool. Used by + * {@link jdk.nashorn.internal.codegen.SpillObjectCreator} and + * {@link jdk.nashorn.internal.parser.JSONParser} for initializing object literals + * + * @param map property map + * @param primitiveSpill primitive spill pool + * @param objectSpill reference spill pool + */ + public JD(final PropertyMap map, final long[] primitiveSpill, final Object[] objectSpill) { + super(map, primitiveSpill, objectSpill); + } + + /** + * A method handle of this method is passed to the ScriptFunction constructor. + * + * @param map the property map to use for allocatorMap + * + * @return newly allocated ScriptObject + */ + public static ScriptObject allocate(final PropertyMap map) { + return new JD(map); + } +} + diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JO.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JO.java index 2388a9781bd..1f9aa7ca127 100644 --- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JO.java +++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,11 +29,11 @@ import jdk.nashorn.internal.runtime.PropertyMap; import jdk.nashorn.internal.runtime.ScriptObject; /** - * Empty object class. + * Empty object class for object-only fields. */ public class JO extends ScriptObject { - private static final PropertyMap map$ = PropertyMap.newMap(); + private static final PropertyMap map$ = PropertyMap.newMap(JO.class); /** * Returns the initial property map to be used. @@ -53,13 +53,12 @@ public class JO extends ScriptObject { } /** - * Constructor given an initial prototype and an initial property map. + * Constructor given an initial prototype and the default initial property map. * * @param proto the prototype object - * @param map the property map */ - public JO(final ScriptObject proto, final PropertyMap map) { - super(proto, map); + public JO(final ScriptObject proto) { + super(proto, getInitialMap()); } /** @@ -86,3 +85,4 @@ public class JO extends ScriptObject { return new JO(map); } } + diff --git a/nashorn/test/script/nosecurity/JDK-8067215.js b/nashorn/test/script/nosecurity/JDK-8067215.js new file mode 100644 index 00000000000..12877acbf43 --- /dev/null +++ b/nashorn/test/script/nosecurity/JDK-8067215.js @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * JDK-8067215: Disable dual fields when not using optimistic types + * + * @test + * @run + * @option -Dnashorn.debug=true + * @fork + */ + +var intType = Java.type("int"); +var doubleType = Java.type("double"); +var longType = Java.type("long"); +var objectType = Java.type("java.lang.Object"); + +var Context = Java.type("jdk.nashorn.internal.runtime.Context"); +var JSType = Java.type("jdk.nashorn.internal.runtime.JSType"); + +var context = Context.getContext(); +var dualFields = context.useDualFields(); +var optimisticTypes = context.getEnv()._optimistic_types; + +if (dualFields != optimisticTypes) { + throw new Error("Wrong dual fields setting"); +} + +function testMap(obj) { + obj.x = "foo"; + obj["y"] = 0; + Object.defineProperty(obj, "z", {value: 0.5}); + var map = Debug.map(obj); + for (var key in obj) { + var prop = map.findProperty(key); + if (prop.hasDualFields() !== dualFields) { + throw new Error("Wrong property flags: " + prop); + } + if (prop.getType() != getExpectedType(obj[key])) { + throw new Error("Wrong property type: " + prop.getType() + " // " + getExpectedType(obj[key])); + + } + } +} + +function getExpectedType(value) { + if (!dualFields) { + return objectType.class; + } + if (JSType.isRepresentableAsInt(value)) { + return intType.class; + } + if (JSType.isRepresentableAsLong(value)) { + return longType.class; + } + if (JSType.isNumber(value)) { + return doubleType.class; + } + return objectType.class; +} + +var o = { + a: 1, + b: 2.5, + c: 0x10000000000, + d: true +}; + +function C() { + this.a = 1; + this.b = 2.5; + this.c = 0x10000000000; + this.d = true; +} + +var a = 1; +var b = 2.5; +var c = 0x10000000000; +var d = true; + +testMap(o); +testMap(new C()); +testMap(JSON.parse('{ "a": 1, "b": 2.5, "c": 1099511627776, "d": true }')); +testMap(this); From 671367fd2a6fcf141956b34afab2e862435aec5f Mon Sep 17 00:00:00 2001 From: Erik Joelsson Date: Fri, 10 Apr 2015 16:32:00 +0200 Subject: [PATCH 094/101] 8073634: Improve clean targets Reviewed-by: ihse --- common/autoconf/basics.m4 | 3 + common/autoconf/basics_windows.m4 | 43 +++++++------- common/autoconf/build-performance.m4 | 7 --- common/autoconf/configure.ac | 4 +- common/autoconf/generated-configure.sh | 81 +++++++++++++++----------- common/autoconf/spec.gmk.in | 4 +- common/autoconf/toolchain_windows.m4 | 2 +- make/Main.gmk | 14 ++--- make/MainSupport.gmk | 44 +++++++++----- 9 files changed, 114 insertions(+), 88 deletions(-) diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index d9df0877703..02a096ed8c1 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -658,6 +658,8 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], fi OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}" $MKDIR -p "$OUTPUT_ROOT" + CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support" + $MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR" if test ! -d "$OUTPUT_ROOT"; then AC_MSG_ERROR([Could not create build directory $OUTPUT_ROOT]) fi @@ -703,6 +705,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk) AC_SUBST(CONF_NAME, $CONF_NAME) AC_SUBST(OUTPUT_ROOT, $OUTPUT_ROOT) + AC_SUBST(CONFIGURESUPPORT_OUTPUTDIR) # The spec.gmk file contains all variables for the make system. AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in]) diff --git a/common/autoconf/basics_windows.m4 b/common/autoconf/basics_windows.m4 index 1bcb6151486..7ce14a82d8b 100644 --- a/common/autoconf/basics_windows.m4 +++ b/common/autoconf/basics_windows.m4 @@ -383,45 +383,46 @@ AC_DEFUN_ONCE([BASIC_COMPILE_FIXPATH], if test "x$OPENJDK_BUILD_OS" = xwindows; then AC_MSG_CHECKING([if fixpath can be created]) FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c" - FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe" + FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe" + FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath" if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then - FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC` - FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN` # Important to keep the .exe suffix on Cygwin for Hotspot makefiles - FIXPATH="$OUTPUT_ROOT/fixpath.exe -c" + FIXPATH="$FIXPATH_BIN -c" elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then - FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC` - FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN` - # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line # @ was chosen as separator to minimize risk of other tools messing around with it - all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" | tr ' ' '\n' | grep '^/./' | sort | uniq` + all_unique_prefixes=`echo "${all_fixpath_prefixes@<:@@@:>@}" \ + | tr ' ' '\n' | grep '^/./' | sort | uniq` fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'` - - FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list" + FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list" fi - rm -f $OUTPUT_ROOT/fixpath* - cd $OUTPUT_ROOT - $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1 + FIXPATH_SRC_W="$FIXPATH_SRC" + FIXPATH_BIN_W="$FIXPATH_BIN" + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_SRC_W]) + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([FIXPATH_BIN_W]) + $RM -rf $FIXPATH_BIN $FIXPATH_DIR + $MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin + cd $FIXPATH_DIR + $CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1 cd $CURDIR - if test ! -x $OUTPUT_ROOT/fixpath.exe; then + if test ! -x $FIXPATH_BIN; then AC_MSG_RESULT([no]) - cat $OUTPUT_ROOT/fixpath1.log - AC_MSG_ERROR([Could not create $OUTPUT_ROOT/fixpath.exe]) + cat $FIXPATH_DIR/fixpath1.log + AC_MSG_ERROR([Could not create $FIXPATH_BIN]) fi AC_MSG_RESULT([yes]) AC_MSG_CHECKING([if fixpath.exe works]) - cd $OUTPUT_ROOT - $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1 + cd $FIXPATH_DIR + $FIXPATH $CC $FIXPATH_SRC -Fe$FIXPATH_DIR/fixpath2.exe \ + > $FIXPATH_DIR/fixpath2.log 2>&1 cd $CURDIR - if test ! -x $OUTPUT_ROOT/fixpath2.exe; then + if test ! -x $FIXPATH_DIR/fixpath2.exe; then AC_MSG_RESULT([no]) - cat $OUTPUT_ROOT/fixpath2.log + cat $FIXPATH_DIR/fixpath2.log AC_MSG_ERROR([fixpath did not work!]) fi AC_MSG_RESULT([yes]) - rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj fi AC_SUBST(FIXPATH) diff --git a/common/autoconf/build-performance.m4 b/common/autoconf/build-performance.m4 index 5b3dbdd1fe4..b5911b789a7 100644 --- a/common/autoconf/build-performance.m4 +++ b/common/autoconf/build-performance.m4 @@ -336,11 +336,4 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC], AC_MSG_CHECKING([whether to use sjavac]) AC_MSG_RESULT([$ENABLE_SJAVAC]) AC_SUBST(ENABLE_SJAVAC) - - if test "x$ENABLE_SJAVAC" = xyes; then - SJAVAC_SERVER_DIR="$OUTPUT_ROOT/javacservers" - else - SJAVAC_SERVER_DIR= - fi - AC_SUBST(SJAVAC_SERVER_DIR) ]) diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac index 29dd14662ca..560f4525b6a 100644 --- a/common/autoconf/configure.ac +++ b/common/autoconf/configure.ac @@ -261,7 +261,7 @@ CUSTOM_LATE_HOOK # We're messing a bit with internal autoconf variables to put the config.status # in the output directory instead of the current directory. -CONFIG_STATUS="$OUTPUT_ROOT/config.status" +CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status" # Create the actual output files. Now the main work of configure is done. AC_OUTPUT @@ -269,7 +269,7 @@ CUSTOM_CONFIG_OUTPUT_GENERATED_HOOK # Try to move the config.log file to the output directory. if test -e ./config.log; then - $MV -f ./config.log "$OUTPUT_ROOT/config.log" 2> /dev/null + $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null fi # Make the compare script executable diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 137ccd58d93..a7fc898624c 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -632,7 +632,6 @@ LIBOBJS CFLAGS_CCACHE CCACHE USE_PRECOMPILED_HEADER -SJAVAC_SERVER_DIR ENABLE_SJAVAC SJAVAC_SERVER_JAVA_FLAGS SJAVAC_SERVER_JAVA @@ -884,6 +883,7 @@ CHECK_TOOLSDIR_GMAKE CHECK_MAKE CHECK_GMAKE PKGHANDLER +CONFIGURESUPPORT_OUTPUTDIR OUTPUT_ROOT CONF_NAME SPEC @@ -4365,7 +4365,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1428017006 +DATE_WHEN_GENERATED=1428676283 ############################################################################### # @@ -15266,6 +15266,8 @@ $as_echo "in build directory with custom name" >&6; } fi OUTPUT_ROOT="$SRC_ROOT/build/${CONF_NAME}" $MKDIR -p "$OUTPUT_ROOT" + CONFIGURESUPPORT_OUTPUTDIR="$OUTPUT_ROOT/configure-support" + $MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR" if test ! -d "$OUTPUT_ROOT"; then as_fn_error $? "Could not create build directory $OUTPUT_ROOT" "$LINENO" 5 fi @@ -15450,6 +15452,7 @@ $as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is inval OUTPUT_ROOT=$OUTPUT_ROOT + # The spec.gmk file contains all variables for the make system. ac_config_files="$ac_config_files $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" @@ -27622,7 +27625,7 @@ $as_echo "$as_me: Rewriting VS_ENV_CMD to \"$new_complete\"" >&6;} $as_echo "$as_me: Trying to extract Visual Studio environment variables" >&6;} # We need to create a couple of temporary files. - VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env" + VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env" $MKDIR -p $VS_ENV_TMP_DIR # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). @@ -43136,50 +43139,69 @@ $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath can be created" >&5 $as_echo_n "checking if fixpath can be created... " >&6; } FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c" - FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe" + FIXPATH_BIN="$CONFIGURESUPPORT_OUTPUTDIR/bin/fixpath.exe" + FIXPATH_DIR="$CONFIGURESUPPORT_OUTPUTDIR/fixpath" if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then - FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC` - FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN` # Important to keep the .exe suffix on Cygwin for Hotspot makefiles - FIXPATH="$OUTPUT_ROOT/fixpath.exe -c" + FIXPATH="$FIXPATH_BIN -c" elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then - FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC` - FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN` - # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line # @ was chosen as separator to minimize risk of other tools messing around with it - all_unique_prefixes=`echo "${all_fixpath_prefixes[@]}" | tr ' ' '\n' | grep '^/./' | sort | uniq` + all_unique_prefixes=`echo "${all_fixpath_prefixes[@]}" \ + | tr ' ' '\n' | grep '^/./' | sort | uniq` fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'` - - FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list" + FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list" fi - rm -f $OUTPUT_ROOT/fixpath* - cd $OUTPUT_ROOT - $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1 + FIXPATH_SRC_W="$FIXPATH_SRC" + FIXPATH_BIN_W="$FIXPATH_BIN" + + unix_path="$FIXPATH_SRC_W" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + windows_path=`$CYGPATH -m "$unix_path"` + FIXPATH_SRC_W="$windows_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + windows_path=`cmd //c echo $unix_path` + FIXPATH_SRC_W="$windows_path" + fi + + + unix_path="$FIXPATH_BIN_W" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + windows_path=`$CYGPATH -m "$unix_path"` + FIXPATH_BIN_W="$windows_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + windows_path=`cmd //c echo $unix_path` + FIXPATH_BIN_W="$windows_path" + fi + + $RM -rf $FIXPATH_BIN $FIXPATH_DIR + $MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin + cd $FIXPATH_DIR + $CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1 cd $CURDIR - if test ! -x $OUTPUT_ROOT/fixpath.exe; then + if test ! -x $FIXPATH_BIN; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - cat $OUTPUT_ROOT/fixpath1.log - as_fn_error $? "Could not create $OUTPUT_ROOT/fixpath.exe" "$LINENO" 5 + cat $FIXPATH_DIR/fixpath1.log + as_fn_error $? "Could not create $FIXPATH_BIN" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath.exe works" >&5 $as_echo_n "checking if fixpath.exe works... " >&6; } - cd $OUTPUT_ROOT - $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1 + cd $FIXPATH_DIR + $FIXPATH $CC $FIXPATH_SRC -Fe$FIXPATH_DIR/fixpath2.exe \ + > $FIXPATH_DIR/fixpath2.log 2>&1 cd $CURDIR - if test ! -x $OUTPUT_ROOT/fixpath2.exe; then + if test ! -x $FIXPATH_DIR/fixpath2.exe; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - cat $OUTPUT_ROOT/fixpath2.log + cat $FIXPATH_DIR/fixpath2.log as_fn_error $? "fixpath did not work!" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj fi @@ -51415,13 +51437,6 @@ $as_echo_n "checking whether to use sjavac... " >&6; } $as_echo "$ENABLE_SJAVAC" >&6; } - if test "x$ENABLE_SJAVAC" = xyes; then - SJAVAC_SERVER_DIR="$OUTPUT_ROOT/javacservers" - else - SJAVAC_SERVER_DIR= - fi - - # Can the C/C++ compiler use precompiled headers? @@ -51849,7 +51864,7 @@ $as_echo "$OUTPUT_DIR_IS_LOCAL" >&6; } # We're messing a bit with internal autoconf variables to put the config.status # in the output directory instead of the current directory. -CONFIG_STATUS="$OUTPUT_ROOT/config.status" +CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status" # Create the actual output files. Now the main work of configure is done. cat >confcache <<\_ACEOF @@ -53017,7 +53032,7 @@ fi # Try to move the config.log file to the output directory. if test -e ./config.log; then - $MV -f ./config.log "$OUTPUT_ROOT/config.log" 2> /dev/null + $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null fi # Make the compare script executable diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index a29e90b60d2..8ae516585e0 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -237,6 +237,8 @@ JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support +# This does not get overridden in a bootcycle build +CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@ HOTSPOT_DIST=@HOTSPOT_DIST@ @@ -258,7 +260,7 @@ MEMORY_SIZE:=@MEMORY_SIZE@ ENABLE_SJAVAC:=@ENABLE_SJAVAC@ # Store sjavac server synchronization files here, and # the sjavac server log files. -SJAVAC_SERVER_DIR:=@SJAVAC_SERVER_DIR@ +SJAVAC_SERVER_DIR=$(MAKESUPPORT_OUTPUTDIR)/javacservers # Number of parallel jobs to use for compilation JOBS?=@JOBS@ diff --git a/common/autoconf/toolchain_windows.m4 b/common/autoconf/toolchain_windows.m4 index dc1a24875c2..87850a25b2f 100644 --- a/common/autoconf/toolchain_windows.m4 +++ b/common/autoconf/toolchain_windows.m4 @@ -270,7 +270,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV], AC_MSG_NOTICE([Trying to extract Visual Studio environment variables]) # We need to create a couple of temporary files. - VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env" + VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env" $MKDIR -p $VS_ENV_TMP_DIR # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). diff --git a/make/Main.gmk b/make/Main.gmk index 9d7bed14277..221a0ca37bc 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -541,7 +541,7 @@ CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \ CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS)) CLEAN_TESTS += hotspot-jtreg-native jdk-jtreg-native CLEAN_TEST_TARGETS += $(addprefix clean-test-, $(CLEAN_TESTS)) -CLEAN_PHASES := gensrc java native include +CLEAN_PHASES := gensrc java native include docs CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES)) CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES)) # Construct targets of the form clean-$module-$phase @@ -550,7 +550,7 @@ CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \ # Remove everything, except the output from configure. clean: $(CLEAN_DIR_TARGETS) - ($(CD) $(OUTPUT_ROOT) && $(RM) -r source_tips build.log* build-trace*.log*) + ($(CD) $(OUTPUT_ROOT) && $(RM) -r build*.log*) $(ECHO) Cleaned all build artifacts. $(CLEAN_DIR_TARGETS): @@ -574,13 +574,11 @@ $(CLEAN_MODULE_PHASE_TARGETS): # while classes and touch files end up in jdk. clean-support: clean-jdk -clean-docs: clean-docstemp - -# Remove everything, including configure configuration. -# If the output directory was created by configure and now becomes empty, remove it as well. +# Remove everything, including configure configuration. If the output +# directory was created by configure and now becomes empty, remove it as well. dist-clean: clean - ($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments \ - Makefile compare.sh tmp javacservers) + ($(CD) $(OUTPUT_ROOT) && \ + $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide) $(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \ if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \ $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \ diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk index aded13eef23..bbd7b817df8 100644 --- a/make/MainSupport.gmk +++ b/make/MainSupport.gmk @@ -41,46 +41,60 @@ endef # Cleans the dir given as $1 define CleanDir @$(PRINTF) "Cleaning $(strip $1) build artifacts ..." - @($(CD) $(OUTPUT_ROOT) && $(RM) -r $1) + @$(PRINTF) "\n" $(LOG_DEBUG) + ($(CD) $(OUTPUT_ROOT) && $(RM) -r $1) @$(PRINTF) " done\n" endef define CleanTest @$(PRINTF) "Cleaning test $(strip $1) ..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) + @$(PRINTF) "\n" $(LOG_DEBUG) + $(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1)) @$(PRINTF) " done\n" endef define Clean-gensrc @$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1) + @$(PRINTF) "\n" $(LOG_DEBUG) + $(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1) + $(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1) @$(PRINTF) " done\n" endef define Clean-java @$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..." - @$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1) - @$(PRINTF) " done\n" - @$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) + @$(PRINTF) "\n" $(LOG_DEBUG) + $(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1) + $(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1) + $(PRINTF) " done\n" + $(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..." + $(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1) @$(PRINTF) " done\n" endef define Clean-native @$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1) + @$(PRINTF) "\n" $(LOG_DEBUG) + $(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1) + $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1) + $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1) + $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1) + $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1) @$(PRINTF) " done\n" endef define Clean-include @$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..." - @$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1) + @$(PRINTF) "\n" $(LOG_DEBUG) + $(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1) + @$(PRINTF) " done\n" +endef + +define Clean-docs + @$(PRINTF) "Cleaning docs ..." + @$(PRINTF) "\n" $(LOG_DEBUG) + $(RM) -r $(SUPPORT_OUTPUTDIR)/docs + $(RM) -r $(IMAGES_OUTPUTDIR)/docs @$(PRINTF) " done\n" endef From 060b684a5627901d2058d2bfbbc5cd129223064a Mon Sep 17 00:00:00 2001 From: James Laskey Date: Fri, 10 Apr 2015 14:21:24 -0300 Subject: [PATCH 095/101] 8077506: Simplify test JImageTest Reviewed-by: alanb --- jdk/test/jdk/internal/jimage/JImageTest.java | 121 ++++--------------- 1 file changed, 21 insertions(+), 100 deletions(-) diff --git a/jdk/test/jdk/internal/jimage/JImageTest.java b/jdk/test/jdk/internal/jimage/JImageTest.java index 9d4817e4b85..51c0bfdbf57 100644 --- a/jdk/test/jdk/internal/jimage/JImageTest.java +++ b/jdk/test/jdk/internal/jimage/JImageTest.java @@ -22,121 +22,41 @@ */ /* * @test + * @library /lib/testlibrary + * @build jdk.testlibrary.* * @summary Test to see if jimage tool extracts and recreates correctly. * @run main/timeout=360 JImageTest */ -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; + +import jdk.testlibrary.ProcessTools; + /** * Basic test for jimage tool. */ public class JImageTest { - private static Runtime runtime = Runtime.getRuntime(); - private static int errors = 0; + private static void jimage(String... jimageArgs) throws Exception { + ArrayList args = new ArrayList<>(); + args.add("-ms8m"); + args.add("jdk.tools.jimage.Main"); + args.addAll(Arrays.asList(jimageArgs)); - static class Tool { - private int exit = 0; - private String out = ""; - private String err = ""; + ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(args.toArray(new String[args.size()])); + int res = builder.inheritIO().start().waitFor(); - private void feedInputStream(String in, OutputStream out) { - try (OutputStreamWriter outputStream = new OutputStreamWriter(out)) { - if (in != null) { - outputStream.write(in, 0, in.length()); - } - } catch (final IOException ex) { - // Process was not expecting input. May be normal state of affairs. - } - } - - private Thread getOutputStreamThread(InputStream in, StringBuilder out) { - return new Thread(() -> { - final char buffer[] = new char[1024]; - - try (final InputStreamReader inputStream = new InputStreamReader(in)) { - for (int length; (length = inputStream.read(buffer, 0, buffer.length)) != -1; ) { - out.append(buffer, 0, length); - } - } catch (final IOException ex) { - out.append(ex.toString()); - } - }); - } - - Tool(String[] args) { - this(null, args); - } - - Tool(String in, String[] args) { - ProcessBuilder processBuilder = new ProcessBuilder(args); - exec(processBuilder, in); - } - - private void exec(ProcessBuilder processBuilder, String in) { - StringBuilder outBuilder = new StringBuilder(); - StringBuilder errBuilder = new StringBuilder(); - - try { - Process process = processBuilder.start(); - - Thread outThread = getOutputStreamThread(process.getInputStream(), outBuilder); - Thread errThread = getOutputStreamThread(process.getErrorStream(), errBuilder); - - outThread.start(); - errThread.start(); - - feedInputStream(in, process.getOutputStream()); - - exit = process.waitFor(); - outThread.join(); - errThread.join(); - } catch (IOException | InterruptedException ex) { - ex.printStackTrace(); - exit = -1; - } - - out = outBuilder.toString(); - err = errBuilder.toString(); - } - - int getExit() { - return exit; - } - - String getOut() { - return out; - } - - String getErr() { - return err; + if (res != 0) { + throw new RuntimeException("JImageTest tool FAILED"); } } - private static void exec(String... args) { - Tool tool = new Tool(args); - int exit = tool.getExit(); - - if (exit != 0) { - errors++; - System.err.println("----------Tool.out----------"); - System.err.append(tool.getOut()); - System.err.println("----------Tool.err----------"); - System.err.append(tool.getErr()); - System.err.println("----------Tool.exit----------"); - System.err.println("Error code = " + exit); - throw new RuntimeException("JImageTest FAIL"); - } - } - - public static void main(String[] args) { + public static void main(String[] args) throws Exception { final String JAVA_HOME = System.getProperty("java.home"); Path jimagePath = Paths.get(JAVA_HOME, "bin", "jimage"); Path bootimagePath = Paths.get(JAVA_HOME, "lib", "modules", "bootmodules.jimage"); @@ -147,12 +67,13 @@ public class JImageTest { String extractDir = Paths.get(".", "extract").toAbsolutePath().toString(); String recreateImage = Paths.get(".", "recreate.jimage").toAbsolutePath().toString(); - exec(new String[] {jimage, "extract", "--dir", extractDir, bootimage}); - exec(new String[] {jimage, "recreate", "--dir", extractDir, recreateImage}); + jimage("extract", "--dir", extractDir, bootimage); + jimage("recreate", "--dir", extractDir, recreateImage); System.out.println("Test successful"); } else { System.out.println("Test skipped, no module image"); } + } } From 6032f62b0e87abe2794ad6c8d5d63c8921f349d6 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 20:26:31 +0200 Subject: [PATCH 096/101] Added tag jdk9-b58 for changeset f40752db7773 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index eae140588de..aabab1874df 100644 --- a/.hgtags +++ b/.hgtags @@ -300,3 +300,4 @@ d6224d6021459ac8b3832e822f5acc849fa944af jdk9-b52 c97e2d1bad9708d379793ba2a4c848eda14c741e jdk9-b55 47544495db2d3d2edf0f85862d8715592fdb919f jdk9-b56 ddb95d8f169b09544cc17e72a6baaff2400092f5 jdk9-b57 +f40752db7773ca0c737f2ad88371e35c57fdfed7 jdk9-b58 From 6a9e4d3c8fe9a65c6888f6b43607d2d1789140c7 Mon Sep 17 00:00:00 2001 From: "J. Duke" Date: Wed, 5 Jul 2017 20:27:32 +0200 Subject: [PATCH 097/101] Added tag jdk9-b59 for changeset da950f343762 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index aabab1874df..18f00fc6ce6 100644 --- a/.hgtags +++ b/.hgtags @@ -301,3 +301,4 @@ c97e2d1bad9708d379793ba2a4c848eda14c741e jdk9-b55 47544495db2d3d2edf0f85862d8715592fdb919f jdk9-b56 ddb95d8f169b09544cc17e72a6baaff2400092f5 jdk9-b57 f40752db7773ca0c737f2ad88371e35c57fdfed7 jdk9-b58 +da950f343762a856d69751570a4c07cfa68a415b jdk9-b59 From 5a24e90bdd52969ef65feba5b7dea93da82d7f05 Mon Sep 17 00:00:00 2001 From: Mark Sheppard Date: Mon, 13 Apr 2015 14:58:47 +0100 Subject: [PATCH 098/101] 8068721: RMI-IIOP communication fails when ConcurrentHashMap is passed to remote method Reviewed-by: chegar, alanb --- jdk/test/TEST.ROOT | 2 +- jdk/test/TEST.groups | 2 +- .../ConcurrentHashMapTest.java | 143 +++++++++ .../rmi/PortableRemoteObject/HelloClient.java | 98 +++++++ .../rmi/PortableRemoteObject/HelloImpl.java | 60 ++++ .../PortableRemoteObject/HelloInterface.java | 14 + .../rmi/PortableRemoteObject/HelloServer.java | 36 +++ .../javax/rmi/PortableRemoteObject/Test.java | 6 + .../PortableRemoteObject/_HelloImpl_Tie.java | 128 +++++++++ .../_HelloInterface_Stub.java | 272 ++++++++++++++++++ 10 files changed, 759 insertions(+), 2 deletions(-) create mode 100644 jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java create mode 100644 jdk/test/javax/rmi/PortableRemoteObject/HelloClient.java create mode 100644 jdk/test/javax/rmi/PortableRemoteObject/HelloImpl.java create mode 100644 jdk/test/javax/rmi/PortableRemoteObject/HelloInterface.java create mode 100644 jdk/test/javax/rmi/PortableRemoteObject/HelloServer.java create mode 100644 jdk/test/javax/rmi/PortableRemoteObject/Test.java create mode 100644 jdk/test/javax/rmi/PortableRemoteObject/_HelloImpl_Tie.java create mode 100644 jdk/test/javax/rmi/PortableRemoteObject/_HelloInterface_Stub.java diff --git a/jdk/test/TEST.ROOT b/jdk/test/TEST.ROOT index 0e6fa003234..cf9bdb246ff 100644 --- a/jdk/test/TEST.ROOT +++ b/jdk/test/TEST.ROOT @@ -8,7 +8,7 @@ keys=2d dnd i18n intermittent othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation # Tests that cannot run concurrently -exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream +exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream javax/rmi # Group definitions groups=TEST.groups [closed/TEST.groups] diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups index 94103f534b8..73ac408f90e 100644 --- a/jdk/test/TEST.groups +++ b/jdk/test/TEST.groups @@ -138,7 +138,6 @@ jdk_time = \ jdk_rmi = \ java/rmi \ - javax/rmi/ssl \ sun/rmi jdk_security1 = \ @@ -237,6 +236,7 @@ jdk_tools = \ jdk_other = \ java/sql \ javax/sql \ + javax/rmi \ javax/naming \ javax/script \ javax/smartcardio \ diff --git a/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java b/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java new file mode 100644 index 00000000000..382f201efaf --- /dev/null +++ b/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8068721 + * @summary test RMI-IIOP call with ConcurrentHashMap as an argument + * @library /lib/testlibrary + * @build jdk.testlibrary.* + * @build Test HelloInterface HelloServer HelloClient HelloImpl _HelloImpl_Tie _HelloInterface_Stub ConcurrentHashMapTest + * @run main/othervm -Djava.naming.provider.url=iiop://localhost:1050 -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest + */ + + +import java.io.DataInputStream; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.CountDownLatch; +import jdk.testlibrary.JDKToolFinder; +import jdk.testlibrary.JDKToolLauncher; + +public class ConcurrentHashMapTest { + + static final String ORBD = JDKToolFinder.getTestJDKTool("orbd"); + static final String JAVA = JDKToolFinder.getTestJDKTool("java"); + static final JDKToolLauncher orbdLauncher = JDKToolLauncher.createUsingTestJDK("orbd"); + static final String CLASSPATH = System.getProperty("java.class.path"); + static final int FIVE_SECONDS = 5000; + + private static Exception clientException; + private static boolean exceptionInClient; + private static Process orbdProcess; + private static Process rmiServerProcess; + + public static void main(String[] args) throws Exception { + startTestComponents(); + stopTestComponents(); + System.err.println("Test completed OK "); + } + + static void startTestComponents () throws Exception { + startOrbd(); + Thread.sleep(FIVE_SECONDS); + startRmiIiopServer(); + Thread.sleep(FIVE_SECONDS); + executeRmiIiopClient(); + } + + private static void stopTestComponents() throws Exception { + stopRmiIiopServer(); + stopOrbd(); + if (exceptionInClient) { + throw new RuntimeException(clientException); + } else if (!isResponseReceived()) { + throw new RuntimeException("Expected Response not received"); + } + } + + static void startOrbd() throws Exception { + System.out.println("\nStarting orbd on port 1050 "); + + //orbd -ORBInitialHost localhost -ORBInitialPort 1050 + orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost") + .addToolArg("-ORBInitialPort").addToolArg("1050"); + + System.out.println("ConcurrentHashMapTest: Executing: " + Arrays.asList(orbdLauncher.getCommand())); + ProcessBuilder pb = new ProcessBuilder(orbdLauncher.getCommand()); + pb.redirectError(ProcessBuilder.Redirect.INHERIT); + orbdProcess = pb.start(); + } + + + static void startRmiIiopServer() throws Exception { + System.out.println("\nStarting RmiServer"); + // java -cp . + // -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory + // -Djava.naming.provider.url=iiop://localhost:1050 HelloServer + List commands = new ArrayList<>(); + commands.add(ConcurrentHashMapTest.JAVA); + commands.add("-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory"); + commands.add("-Djava.naming.provider.url=iiop://localhost:1050"); + commands.add("-cp"); + commands.add(ConcurrentHashMapTest.CLASSPATH); + commands.add("HelloServer"); + + System.out.println("ConcurrentHashMapTest: Executing: " + commands); + ProcessBuilder pb = new ProcessBuilder(commands); + pb.redirectError(ProcessBuilder.Redirect.INHERIT); + rmiServerProcess = pb.start(); + } + + static boolean isResponseReceived() { + return HelloClient.isResponseReceived(); + } + + static void stopRmiIiopServer() throws Exception { + rmiServerProcess.destroy(); + rmiServerProcess.waitFor(); + //rmiServerProcess.waitFor(30, TimeUnit.SECONDS); + System.out.println("serverProcess exitCode:" + + rmiServerProcess.exitValue()); + } + + static void stopOrbd() throws Exception { + orbdProcess.destroy(); + orbdProcess.waitFor(); + //orbdProcess.waitFor(30, TimeUnit.SECONDS); + System.out.println("orbd exitCode:" + + orbdProcess.exitValue()); + } + + static void executeRmiIiopClient() throws Exception { + try { + HelloClient.executeRmiClientCall(); + } catch (Exception ex) { + clientException = ex; + exceptionInClient = true; + } + } +} diff --git a/jdk/test/javax/rmi/PortableRemoteObject/HelloClient.java b/jdk/test/javax/rmi/PortableRemoteObject/HelloClient.java new file mode 100644 index 00000000000..d3baa64e56b --- /dev/null +++ b/jdk/test/javax/rmi/PortableRemoteObject/HelloClient.java @@ -0,0 +1,98 @@ +import java.rmi.RemoteException; +import java.net.InetAddress; +import java.net.MalformedURLException; +import java.rmi.NotBoundException; +import java.util.HashMap; +import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.ReentrantLock; + +import javax.naming.NamingException; +import javax.naming.InitialContext; +import javax.naming.Context; +import javax.naming.NameNotFoundException; +import javax.naming.NamingException; +import javax.rmi.PortableRemoteObject; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; + +public class HelloClient implements Runnable { + static final int MAX_RETRY = 10; + static final int ONE_SECOND = 1000; + private static boolean responseReceived; + + public static void main(String args[]) throws Exception { + executeRmiClientCall(); + } + + @Override + public void run() { + try { + executeRmiClientCall(); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + + public static boolean isResponseReceived () { + return responseReceived; + } + + public static void executeRmiClientCall() throws Exception { + Context ic; + Object objref; + HelloInterface helloSvc; + String response; + int retryCount = 0; + + Test test = new Test(); + System.out.println("HelloClient.main: enter ..."); + while (retryCount < MAX_RETRY) { + try { + ic = new InitialContext(); + System.out.println("HelloClient.main: HelloService lookup ..."); + // STEP 1: Get the Object reference from the Name Service + // using JNDI call. + objref = ic.lookup("HelloService"); + System.out.println("HelloClient: Obtained a ref. to Hello server."); + + // STEP 2: Narrow the object reference to the concrete type and + // invoke the method. + helloSvc = (HelloInterface) PortableRemoteObject.narrow(objref, + HelloInterface.class); + System.out.println("HelloClient: Invoking on remote server with ConcurrentHashMap parameter"); + ConcurrentHashMap testConcurrentHashMap = new ConcurrentHashMap(); + response = helloSvc.sayHelloWithHashMap(testConcurrentHashMap); + System.out.println("HelloClient: Server says: " + response); + if (!response.contains("Hello with hashMapSize ==")) { + System.out.println("HelloClient: expected response not received"); + throw new RuntimeException("Expected Response Hello with hashMapSize == 0 not received"); + } + responseReceived = true; + break; + } catch (NameNotFoundException nnfEx) { + System.err.println("NameNotFoundException Caught .... try again"); + retryCount++; + try { + Thread.sleep(ONE_SECOND); + } catch (InterruptedException e) { + e.printStackTrace(); + } + continue; + } catch (Exception e) { + System.err.println("Exception " + e + "Caught"); + e.printStackTrace(); + throw new RuntimeException(e); + } + } + System.err.println("HelloClient terminating "); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } +} diff --git a/jdk/test/javax/rmi/PortableRemoteObject/HelloImpl.java b/jdk/test/javax/rmi/PortableRemoteObject/HelloImpl.java new file mode 100644 index 00000000000..e6b24948852 --- /dev/null +++ b/jdk/test/javax/rmi/PortableRemoteObject/HelloImpl.java @@ -0,0 +1,60 @@ +import java.net.InetAddress; +import java.rmi.RemoteException; +import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.ReentrantLock; + +import javax.rmi.PortableRemoteObject; + +public class HelloImpl extends PortableRemoteObject implements HelloInterface { + public HelloImpl() throws java.rmi.RemoteException { + super(); // invoke rmi linking and remote object initialization + } + + public String sayHello(String from) throws java.rmi.RemoteException { + System.out.println("Hello from " + from + "!!"); + System.out.flush(); + String reply = "Hello from us to you " + from; + return reply; + } + + @Override + public String sayHelloToTest(Test test) throws RemoteException { + return "Test says Hello"; + } + + @Override + public String sayHelloWithInetAddress(InetAddress ipAddr) + throws RemoteException { + String response = "Hello with InetAddress " + ipAddr.toString(); + return response; + } + + @Override + public String sayHelloWithHashMap(ConcurrentHashMap receivedHashMap) + throws RemoteException { + int hashMapSize = 0; + + hashMapSize = receivedHashMap.size(); + String response = "Hello with hashMapSize == " + hashMapSize; + return response; + } + + @Override + public String sayHelloWithHashMap2(HashMap receivedHashMap) + throws RemoteException { + int hashMapSize = 0; + + hashMapSize = receivedHashMap.size(); + String response = "Hello with hashMapSize == " + hashMapSize; + return response; + } + + @Override + public String sayHelloWithReentrantLock(ReentrantLock receivedLock) + throws RemoteException { + + String response = "Hello with lock == " + receivedLock.isLocked(); + return response; + } +} diff --git a/jdk/test/javax/rmi/PortableRemoteObject/HelloInterface.java b/jdk/test/javax/rmi/PortableRemoteObject/HelloInterface.java new file mode 100644 index 00000000000..0c1a1635b0f --- /dev/null +++ b/jdk/test/javax/rmi/PortableRemoteObject/HelloInterface.java @@ -0,0 +1,14 @@ +import java.net.InetAddress; +import java.rmi.Remote; +import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.ReentrantLock; + +public interface HelloInterface extends Remote { + public String sayHello( String from ) throws java.rmi.RemoteException; + public String sayHelloToTest( Test test ) throws java.rmi.RemoteException; + public String sayHelloWithInetAddress( InetAddress ipAddr ) throws java.rmi.RemoteException; + public String sayHelloWithHashMap(ConcurrentHashMap hashMap ) throws java.rmi.RemoteException; + public String sayHelloWithHashMap2(HashMap hashMap ) throws java.rmi.RemoteException; + public String sayHelloWithReentrantLock(ReentrantLock lock ) throws java.rmi.RemoteException; +} diff --git a/jdk/test/javax/rmi/PortableRemoteObject/HelloServer.java b/jdk/test/javax/rmi/PortableRemoteObject/HelloServer.java new file mode 100644 index 00000000000..f3ec3991531 --- /dev/null +++ b/jdk/test/javax/rmi/PortableRemoteObject/HelloServer.java @@ -0,0 +1,36 @@ +import javax.naming.InitialContext; +import javax.naming.Context; + +public class HelloServer { + + static final int MAX_RETRY = 10; + static final int ONE_SECOND = 1000; + + public static void main(String[] args) { + int retryCount = 0; + while (retryCount < MAX_RETRY) { + try { + //HelloServer.set("SETTING TEST ITL"); + // Step 1: Instantiate the Hello servant + HelloImpl helloRef = new HelloImpl(); + + // Step 2: Publish the reference in the Naming Service + // using JNDI API + Context initialNamingContext = new InitialContext(); + initialNamingContext.rebind("HelloService", helloRef); + + System.out.println("Hello Server: Ready..."); + break; + } catch (Exception e) { + System.out.println("Server initialization problem: " + e); + e.printStackTrace(); + retryCount++; + try { + Thread.sleep(ONE_SECOND); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + } + } +} diff --git a/jdk/test/javax/rmi/PortableRemoteObject/Test.java b/jdk/test/javax/rmi/PortableRemoteObject/Test.java new file mode 100644 index 00000000000..1fc3ecf939f --- /dev/null +++ b/jdk/test/javax/rmi/PortableRemoteObject/Test.java @@ -0,0 +1,6 @@ +import java.io.Serializable; + + +public class Test implements Serializable { + +} diff --git a/jdk/test/javax/rmi/PortableRemoteObject/_HelloImpl_Tie.java b/jdk/test/javax/rmi/PortableRemoteObject/_HelloImpl_Tie.java new file mode 100644 index 00000000000..040500d8aeb --- /dev/null +++ b/jdk/test/javax/rmi/PortableRemoteObject/_HelloImpl_Tie.java @@ -0,0 +1,128 @@ +// Tie class generated by rmic, do not edit. +// Contents subject to change without notice. + +import java.io.Serializable; +import java.net.InetAddress; +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.ReentrantLock; +import javax.rmi.CORBA.Tie; +import javax.rmi.CORBA.Util; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.CORBA.portable.UnknownException; +import org.omg.CORBA_2_3.portable.ObjectImpl; + + +public class _HelloImpl_Tie extends ObjectImpl implements Tie { + + private HelloImpl target = null; + + private static final String[] _type_ids = { + "RMI:HelloInterface:0000000000000000" + }; + + public void setTarget(Remote target) { + this.target = (HelloImpl) target; + } + + public Remote getTarget() { + return target; + } + + public org.omg.CORBA.Object thisObject() { + return this; + } + + public void deactivate() { + _orb().disconnect(this); + _set_delegate(null); + target = null; + } + + public ORB orb() { + return _orb(); + } + + public void orb(ORB orb) { + orb.connect(this); + } + + public String[] _ids() { + return (String[]) _type_ids.clone(); + } + + public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException { + try { + org.omg.CORBA_2_3.portable.InputStream in = + (org.omg.CORBA_2_3.portable.InputStream) _in; + switch (method.length()) { + case 8: + if (method.equals("sayHello")) { + String arg0 = (String) in.read_value(String.class); + String result = target.sayHello(arg0); + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply(); + out.write_value(result,String.class); + return out; + } + case 14: + if (method.equals("sayHelloToTest")) { + Test arg0 = (Test) in.read_value(Test.class); + String result = target.sayHelloToTest(arg0); + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply(); + out.write_value(result,String.class); + return out; + } + case 19: + if (method.equals("sayHelloWithHashMap")) { + ConcurrentHashMap arg0 = (ConcurrentHashMap) in.read_value(ConcurrentHashMap.class); + String result = target.sayHelloWithHashMap(arg0); + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply(); + out.write_value(result,String.class); + return out; + } + case 20: + if (method.equals("sayHelloWithHashMap2")) { + HashMap arg0 = (HashMap) in.read_value(HashMap.class); + String result = target.sayHelloWithHashMap2(arg0); + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply(); + out.write_value(result,String.class); + return out; + } + case 23: + if (method.equals("sayHelloWithInetAddress")) { + InetAddress arg0 = (InetAddress) in.read_value(InetAddress.class); + String result = target.sayHelloWithInetAddress(arg0); + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply(); + out.write_value(result,String.class); + return out; + } + case 25: + if (method.equals("sayHelloWithReentrantLock")) { + ReentrantLock arg0 = (ReentrantLock) in.read_value(ReentrantLock.class); + String result = target.sayHelloWithReentrantLock(arg0); + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply(); + out.write_value(result,String.class); + return out; + } + } + throw new BAD_OPERATION(); + } catch (SystemException ex) { + throw ex; + } catch (Throwable ex) { + throw new UnknownException(ex); + } + } +} diff --git a/jdk/test/javax/rmi/PortableRemoteObject/_HelloInterface_Stub.java b/jdk/test/javax/rmi/PortableRemoteObject/_HelloInterface_Stub.java new file mode 100644 index 00000000000..4098143151f --- /dev/null +++ b/jdk/test/javax/rmi/PortableRemoteObject/_HelloInterface_Stub.java @@ -0,0 +1,272 @@ +// Stub class generated by rmic, do not edit. +// Contents subject to change without notice. + +import java.io.Serializable; +import java.net.InetAddress; +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.UnexpectedException; +import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.ReentrantLock; +import javax.rmi.CORBA.Stub; +import javax.rmi.CORBA.Util; +import org.omg.CORBA.ORB; +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.CORBA.portable.ServantObject; + + +public class _HelloInterface_Stub extends Stub implements HelloInterface { + + private static final String[] _type_ids = { + "RMI:HelloInterface:0000000000000000" + }; + + public String[] _ids() { + return (String[]) _type_ids.clone(); + } + + public String sayHello(String arg0) throws java.rmi.RemoteException { + if (!Util.isLocal(this)) { + try { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) + _request("sayHello", true); + out.write_value(arg0,String.class); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (String) in.read_value(String.class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String $_id = in.read_string(); + throw new UnexpectedException($_id); + } catch (RemarshalException ex) { + return sayHello(arg0); + } finally { + _releaseReply(in); + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } + } else { + ServantObject so = _servant_preinvoke("sayHello",HelloInterface.class); + if (so == null) { + return sayHello(arg0); + } + try { + return ((HelloInterface)so.servant).sayHello(arg0); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + + public String sayHelloToTest(Test arg0) throws java.rmi.RemoteException { + if (!Util.isLocal(this)) { + try { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) + _request("sayHelloToTest", true); + out.write_value(arg0,Test.class); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (String) in.read_value(String.class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String $_id = in.read_string(); + throw new UnexpectedException($_id); + } catch (RemarshalException ex) { + return sayHelloToTest(arg0); + } finally { + _releaseReply(in); + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } + } else { + ServantObject so = _servant_preinvoke("sayHelloToTest",HelloInterface.class); + if (so == null) { + return sayHelloToTest(arg0); + } + try { + Test arg0Copy = (Test) Util.copyObject(arg0,_orb()); + return ((HelloInterface)so.servant).sayHelloToTest(arg0Copy); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + + public String sayHelloWithInetAddress(InetAddress arg0) throws java.rmi.RemoteException { + if (!Util.isLocal(this)) { + try { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) + _request("sayHelloWithInetAddress", true); + out.write_value(arg0,InetAddress.class); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (String) in.read_value(String.class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String $_id = in.read_string(); + throw new UnexpectedException($_id); + } catch (RemarshalException ex) { + return sayHelloWithInetAddress(arg0); + } finally { + _releaseReply(in); + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } + } else { + ServantObject so = _servant_preinvoke("sayHelloWithInetAddress",HelloInterface.class); + if (so == null) { + return sayHelloWithInetAddress(arg0); + } + try { + InetAddress arg0Copy = (InetAddress) Util.copyObject(arg0,_orb()); + return ((HelloInterface)so.servant).sayHelloWithInetAddress(arg0Copy); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + + public String sayHelloWithHashMap(ConcurrentHashMap arg0) throws java.rmi.RemoteException { + if (!Util.isLocal(this)) { + try { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) + _request("sayHelloWithHashMap", true); + out.write_value(arg0,ConcurrentHashMap.class); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (String) in.read_value(String.class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String $_id = in.read_string(); + throw new UnexpectedException($_id); + } catch (RemarshalException ex) { + return sayHelloWithHashMap(arg0); + } finally { + _releaseReply(in); + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } + } else { + ServantObject so = _servant_preinvoke("sayHelloWithHashMap",HelloInterface.class); + if (so == null) { + return sayHelloWithHashMap(arg0); + } + try { + ConcurrentHashMap arg0Copy = (ConcurrentHashMap) Util.copyObject(arg0,_orb()); + return ((HelloInterface)so.servant).sayHelloWithHashMap(arg0Copy); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + + public String sayHelloWithHashMap2(HashMap arg0) throws java.rmi.RemoteException { + if (!Util.isLocal(this)) { + try { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) + _request("sayHelloWithHashMap2", true); + out.write_value(arg0,HashMap.class); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (String) in.read_value(String.class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String $_id = in.read_string(); + throw new UnexpectedException($_id); + } catch (RemarshalException ex) { + return sayHelloWithHashMap2(arg0); + } finally { + _releaseReply(in); + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } + } else { + ServantObject so = _servant_preinvoke("sayHelloWithHashMap2",HelloInterface.class); + if (so == null) { + return sayHelloWithHashMap2(arg0); + } + try { + HashMap arg0Copy = (HashMap) Util.copyObject(arg0,_orb()); + return ((HelloInterface)so.servant).sayHelloWithHashMap2(arg0Copy); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + + public String sayHelloWithReentrantLock(ReentrantLock arg0) throws java.rmi.RemoteException { + if (!Util.isLocal(this)) { + try { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) + _request("sayHelloWithReentrantLock", true); + out.write_value(arg0,ReentrantLock.class); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (String) in.read_value(String.class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String $_id = in.read_string(); + throw new UnexpectedException($_id); + } catch (RemarshalException ex) { + return sayHelloWithReentrantLock(arg0); + } finally { + _releaseReply(in); + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } + } else { + ServantObject so = _servant_preinvoke("sayHelloWithReentrantLock",HelloInterface.class); + if (so == null) { + return sayHelloWithReentrantLock(arg0); + } + try { + ReentrantLock arg0Copy = (ReentrantLock) Util.copyObject(arg0,_orb()); + return ((HelloInterface)so.servant).sayHelloWithReentrantLock(arg0Copy); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } +} From a0fedc85567914795fcc30b17073b92fb2b546fd Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Mon, 13 Apr 2015 11:15:41 -0700 Subject: [PATCH 099/101] 8077640: DateTimeFormatter does not parse/accept the era.toString() result from MinguoEra/ThaiBuddhistEra To parse and accept the era.toString() for era parsing in lenient/smart mode Reviewed-by: rriggs --- .../time/format/DateTimeFormatterBuilder.java | 12 +++++ .../test/java/time/format/TestTextParser.java | 50 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java index a8f70915012..90c6108c244 100644 --- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java +++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java @@ -70,6 +70,7 @@ import static java.time.temporal.ChronoField.NANO_OF_SECOND; import static java.time.temporal.ChronoField.OFFSET_SECONDS; import static java.time.temporal.ChronoField.SECOND_OF_MINUTE; import static java.time.temporal.ChronoField.YEAR; +import static java.time.temporal.ChronoField.ERA; import java.lang.ref.SoftReference; import java.math.BigDecimal; @@ -84,6 +85,7 @@ import java.time.ZoneId; import java.time.ZoneOffset; import java.time.chrono.ChronoLocalDate; import java.time.chrono.Chronology; +import java.time.chrono.Era; import java.time.chrono.IsoChronology; import java.time.format.DateTimeTextProvider.LocaleStore; import java.time.temporal.ChronoField; @@ -3131,6 +3133,16 @@ public final class DateTimeFormatterBuilder { return context.setParsedField(field, entry.getValue(), position, position + itText.length()); } } + if (field == ERA && !context.isStrict()) { + // parse the possible era name from era.toString() + List eras = chrono.eras(); + for (Era era : eras) { + String name = era.toString(); + if (context.subSequenceEquals(name, 0, parseText, position, name.length())) { + return context.setParsedField(field, era.getValue(), position, position + name.length()); + } + } + } if (context.isStrict()) { return ~position; } diff --git a/jdk/test/java/time/test/java/time/format/TestTextParser.java b/jdk/test/java/time/test/java/time/format/TestTextParser.java index 07bd2146212..a1b264a756b 100644 --- a/jdk/test/java/time/test/java/time/format/TestTextParser.java +++ b/jdk/test/java/time/test/java/time/format/TestTextParser.java @@ -68,10 +68,20 @@ import static org.testng.Assert.assertTrue; import java.text.ParsePosition; import java.time.DayOfWeek; +import java.time.chrono.ChronoLocalDate; +import java.time.chrono.JapaneseChronology; +import java.time.chrono.HijrahDate; +import java.time.chrono.JapaneseDate; +import java.time.chrono.MinguoDate; +import java.time.chrono.ThaiBuddhistDate; import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeFormatterBuilder; import java.time.format.TextStyle; +import java.time.format.SignStyle; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; +import java.time.temporal.ChronoField; import java.util.Locale; import org.testng.annotations.DataProvider; @@ -243,6 +253,8 @@ public class TestTextParser extends AbstractTestPrinterParser { }; } + + @Test(dataProvider="parseText") public void test_parseText(TemporalField field, TextStyle style, int value, String input) throws Exception { ParsePosition pos = new ParsePosition(0); @@ -433,4 +445,42 @@ public class TestTextParser extends AbstractTestPrinterParser { assertEquals(pos.getIndex(), input.length()); } + //----------------------------------------------------------------------- + @DataProvider(name="parseChronoLocalDate") + Object[][] provider_chronoLocalDate() { + return new Object[][] { + { HijrahDate.now() }, + { JapaneseDate.now() }, + { MinguoDate.now() }, + { ThaiBuddhistDate.now() }}; + } + + private static final DateTimeFormatter fmt_chrono = + new DateTimeFormatterBuilder() + .optionalStart() + .appendChronologyId() + .appendLiteral(' ') + .optionalEnd() + .optionalStart() + .appendText(ChronoField.ERA, TextStyle.SHORT) + .appendLiteral(' ') + .optionalEnd() + .appendValue(ChronoField.YEAR_OF_ERA, 1, 9, SignStyle.NORMAL) + .appendLiteral('-') + .appendValue(ChronoField.MONTH_OF_YEAR, 1, 2, SignStyle.NEVER) + .appendLiteral('-') + .appendValue(ChronoField.DAY_OF_MONTH, 1, 2, SignStyle.NEVER) + .toFormatter(); + + @Test(dataProvider="parseChronoLocalDate") + public void test_chronoLocalDate(ChronoLocalDate date) throws Exception { + System.out.printf(" %s, [fmt=%s]%n", date, fmt_chrono.format(date)); + assertEquals(date, fmt_chrono.parse(fmt_chrono.format(date), ChronoLocalDate::from)); + + DateTimeFormatter fmt = DateTimeFormatter.ofPattern("[GGG ]yyy-MM-dd") + .withChronology(date.getChronology()); + System.out.printf(" %s, [fmt=%s]%n", date.toString(), fmt.format(date)); + assertEquals(date, fmt.parse(fmt.format(date), ChronoLocalDate::from)); + } + } From 26006ab751d74095cf947f582d325dc9d93be33f Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Tue, 14 Apr 2015 09:55:42 +0200 Subject: [PATCH 100/101] 8077408: javax/management/remote/mandatory/notif/NotSerializableNotifTest.java fails due to Port already in use: 2468 Reviewed-by: jbachorik --- .../notif/NotSerializableNotifTest.java | 82 +++++-------------- 1 file changed, 21 insertions(+), 61 deletions(-) diff --git a/jdk/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java b/jdk/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java index 24bf863dc88..538658f7b06 100644 --- a/jdk/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java +++ b/jdk/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,37 +34,31 @@ // java imports // import java.net.MalformedURLException; -import java.util.Map; - -// JMX imports -// -import javax.management.* ; - -import javax.management.remote.*; +import javax.management.MBeanNotificationInfo; +import javax.management.MBeanServer; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerFactory; +import javax.management.Notification; +import javax.management.NotificationBroadcasterSupport; +import javax.management.NotificationListener; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; import javax.management.remote.JMXServiceURL; public class NotSerializableNotifTest { private static final MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer(); private static ObjectName emitter; - private static int port = 2468; private static String[] protocols; private static final int sentNotifs = 10; - private static double timeoutFactor = 1.0; - private static final double defaultTimeout = 10; - public static void main(String[] args) throws Exception { System.out.println(">>> Test to send a not serializable notification"); - String timeoutVal = System.getProperty("test.timeout.factor"); - if (timeoutVal != null) { - timeoutFactor = Double.parseDouble( - System.getProperty("test.timeout.factor") - ); - } - // IIOP fails on JDK1.4, see 5034318 final String v = System.getProperty("java.version"); float f = Float.parseFloat(v.substring(0, 3)); @@ -77,35 +71,18 @@ public class NotSerializableNotifTest { emitter = new ObjectName("Default:name=NotificationEmitter"); mbeanServer.registerMBean(new NotificationEmitter(), emitter); - boolean ok = true; for (int i = 0; i < protocols.length; i++) { - try { - if (!test(protocols[i])) { - System.out.println(">>> Test failed for " + protocols[i]); - ok = false; - } else { - System.out.println(">>> Test successed for " + protocols[i]); - } - } catch (Exception e) { - System.out.println(">>> Test failed for " + protocols[i]); - e.printStackTrace(System.out); - ok = false; - } + test(protocols[i]); } - if (ok) { - System.out.println(">>> Test passed"); - } else { - System.out.println(">>> TEST FAILED"); - System.exit(1); - } + System.out.println(">>> Test passed"); } - private static boolean test(String proto) throws Exception { + private static void test(String proto) throws Exception { System.out.println("\n>>> Test for protocol " + proto); - JMXServiceURL url = new JMXServiceURL(proto, null, port++); + JMXServiceURL url = new JMXServiceURL(proto, null, 0); System.out.println(">>> Create a server: "+url); @@ -115,7 +92,7 @@ public class NotSerializableNotifTest { } catch (MalformedURLException e) { System.out.println("System does not recognize URL: " + url + "; ignoring"); - return true; + return; } server.start(); @@ -146,34 +123,17 @@ public class NotSerializableNotifTest { // waiting ... synchronized (listener) { - int top = (int)Math.ceil(timeoutFactor * defaultTimeout); - for (int i=0; i Date: Tue, 14 Apr 2015 14:22:13 +0200 Subject: [PATCH 101/101] 8077419: Launcher mapfile fails linking with SS12u4 Reviewed-by: tbell, dholmes, ihse --- jdk/make/launcher/Launcher-jdk.pack200.gmk | 10 ++++- jdk/make/mapfiles/launchers/mapfile-x86_64 | 8 ++++ .../mapfile-vers-unpack200-solaris-sparc | 41 ++++++++++++++++++ .../mapfile-vers-unpack200-solaris-x86 | 42 +++++++++++++++++++ 4 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 jdk/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-sparc create mode 100644 jdk/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-x86 diff --git a/jdk/make/launcher/Launcher-jdk.pack200.gmk b/jdk/make/launcher/Launcher-jdk.pack200.gmk index affdbdb26eb..dbc135bc76d 100644 --- a/jdk/make/launcher/Launcher-jdk.pack200.gmk +++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk @@ -61,13 +61,19 @@ ifeq ($(OPENJDK_TARGET_OS), solaris) UNPACKEXE_LANG := C++ endif +UNPACK_MAPFILE_DIR := $(JDK_TOPDIR)/make/mapfiles/libunpack +UNPACK_MAPFILE_PLATFORM_FILE := \ + $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH) + # The linker on older SuSE distros (e.g. on SLES 10) complains with: # "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable." # if feeded with a version script which contains named tags. ifeq ($(USING_BROKEN_SUSE_LD), yes) - UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200.anonymous + UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200.anonymous +else ifneq ($(wildcard $(UNPACK_MAPFILE_PLATFORM_FILE)), ) + UNPACK_MAPFILE := $(UNPACK_MAPFILE_PLATFORM_FILE) else - UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200 + UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200 endif $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \ diff --git a/jdk/make/mapfiles/launchers/mapfile-x86_64 b/jdk/make/mapfiles/launchers/mapfile-x86_64 index 61c2d1cc3f2..5700d67f2a0 100644 --- a/jdk/make/mapfiles/launchers/mapfile-x86_64 +++ b/jdk/make/mapfiles/launchers/mapfile-x86_64 @@ -34,6 +34,14 @@ SUNWprivate_1.1 { _environ; __environ_lock; + # These are needed by the c runtime in SS12u4 + ___Argv; + __xargv; + __xargc; + _start; + __longdouble_used; + _lib_version; + local: *; }; diff --git a/jdk/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-sparc b/jdk/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-sparc new file mode 100644 index 00000000000..63f2a41a478 --- /dev/null +++ b/jdk/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-sparc @@ -0,0 +1,41 @@ +# +# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Define library interface. + +SUNWprivate_1.1 { + global: + # These are needed by the c runtime in SS12u4 + _environ; + __environ_lock; + ___Argv; + __xargv; + __xargc; + _start; + _lib_version; + + local: + *; +}; diff --git a/jdk/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-x86 b/jdk/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-x86 new file mode 100644 index 00000000000..60220b18ad3 --- /dev/null +++ b/jdk/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-x86 @@ -0,0 +1,42 @@ +# +# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Define library interface. + +SUNWprivate_1.1 { + global: + # These are needed by the c runtime in SS12u4 + _environ; + __environ_lock; + ___Argv; + __xargv; + __xargc; + _start; + __longdouble_used; + _lib_version; + + local: + *; +};