From 47c9e23d81ad472dd91a7abf541155521bd9ebe6 Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Wed, 30 Apr 2014 02:41:00 +0200 Subject: [PATCH 01/56] 8026396: Remove information duplication in the collector policy Cleaned up the usage of flags in collector policy. Reviewed-by: sjohanss, jcoomes --- .../src/share/vm/memory/collectorPolicy.cpp | 57 ++++++------------- 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp index 6d822a4b9e9..7d6246ec0c6 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp @@ -444,70 +444,51 @@ void GenCollectorPolicy::initialize_flags() { void GenCollectorPolicy::initialize_size_info() { CollectorPolicy::initialize_size_info(); - // _space_alignment is used for alignment within a generation. - // There is additional alignment done down stream for some - // collectors that sometimes causes unwanted rounding up of - // generations sizes. + _initial_gen0_size = NewSize; + _max_gen0_size = MaxNewSize; + _initial_gen1_size = OldSize; // Determine maximum size of gen0 - size_t max_new_size = 0; - if (!FLAG_IS_DEFAULT(MaxNewSize)) { - max_new_size = MaxNewSize; - } else { - max_new_size = scale_by_NewRatio_aligned(_max_heap_byte_size); + if (FLAG_IS_DEFAULT(MaxNewSize)) { + _max_gen0_size = scale_by_NewRatio_aligned(_max_heap_byte_size); // Bound the maximum size by NewSize below (since it historically // would have been NewSize and because the NewRatio calculation could // yield a size that is too small) and bound it by MaxNewSize above. // Ergonomics plays here by previously calculating the desired // NewSize and MaxNewSize. - max_new_size = MIN2(MAX2(max_new_size, NewSize), MaxNewSize); + _max_gen0_size = MIN2(MAX2(_max_gen0_size, _initial_gen0_size), MaxNewSize); } - assert(max_new_size > 0, "All paths should set max_new_size"); // Given the maximum gen0 size, determine the initial and // minimum gen0 sizes. if (_max_heap_byte_size == _initial_heap_byte_size) { - // The maxium and initial heap sizes are the same so the generation's + // The maximum and initial heap sizes are the same so the generation's // initial size must be the same as it maximum size. Use NewSize as the // size if set on command line. - size_t fixed_young_size = FLAG_IS_CMDLINE(NewSize) ? NewSize : max_new_size; - - _initial_gen0_size = fixed_young_size; - _max_gen0_size = fixed_young_size; + _max_gen0_size = FLAG_IS_CMDLINE(NewSize) ? NewSize : _max_gen0_size; + _initial_gen0_size = _max_gen0_size; // Also update the minimum size if min == initial == max. if (_max_heap_byte_size == _min_heap_byte_size) { - _min_gen0_size = fixed_young_size; + _min_gen0_size = _max_gen0_size; } } else { - size_t desired_new_size = 0; if (FLAG_IS_CMDLINE(NewSize)) { // If NewSize is set on the command line, we should use it as // the initial size, but make sure it is within the heap bounds. - desired_new_size = - MIN2(max_new_size, bound_minus_alignment(NewSize, _initial_heap_byte_size)); - _min_gen0_size = bound_minus_alignment(desired_new_size, _min_heap_byte_size); + _initial_gen0_size = + MIN2(_max_gen0_size, bound_minus_alignment(NewSize, _initial_heap_byte_size)); + _min_gen0_size = bound_minus_alignment(_initial_gen0_size, _min_heap_byte_size); } else { // For the case where NewSize is not set on the command line, use // NewRatio to size the initial generation size. Use the current // NewSize as the floor, because if NewRatio is overly large, the resulting // size can be too small. - desired_new_size = - MIN2(max_new_size, MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize)); + _initial_gen0_size = + MIN2(_max_gen0_size, MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize)); } - _initial_gen0_size = desired_new_size; - _max_gen0_size = max_new_size; - } - - // Write back to flags if necessary. - if (NewSize != _initial_gen0_size) { - FLAG_SET_ERGO(uintx, NewSize, _initial_gen0_size); - } - - if (MaxNewSize != _max_gen0_size) { - FLAG_SET_ERGO(uintx, MaxNewSize, _max_gen0_size); } if (PrintGCDetails && Verbose) { @@ -534,7 +515,6 @@ void GenCollectorPolicy::initialize_size_info() { _min_gen1_size = _gen_alignment; _initial_gen1_size = MIN2(_max_gen1_size, MAX2(_initial_heap_byte_size - _initial_gen0_size, _min_gen1_size)); // _max_gen1_size has already been made consistent above - FLAG_SET_ERGO(uintx, OldSize, _initial_gen1_size); } else { // OldSize has been explicitly set on the command line. Use it // for the initial size but make sure the minimum allow a young @@ -543,16 +523,15 @@ void GenCollectorPolicy::initialize_size_info() { // with other command line flags, issue a warning. // The generation minimums and the overall heap minimum should // be within one generation alignment. - if (OldSize > _max_gen1_size) { + if (_initial_gen1_size > _max_gen1_size) { warning("Inconsistency between maximum heap size and maximum " "generation sizes: using maximum heap = " SIZE_FORMAT " -XX:OldSize flag is being ignored", _max_heap_byte_size); - FLAG_SET_ERGO(uintx, OldSize, _max_gen1_size); + _initial_gen1_size = _max_gen1_size; } - _min_gen1_size = MIN2(OldSize, _min_heap_byte_size - _min_gen0_size); - _initial_gen1_size = OldSize; + _min_gen1_size = MIN2(_initial_gen1_size, _min_heap_byte_size - _min_gen0_size); } // The initial generation sizes should match the initial heap size, From ded8b863dd70dc15944905d0d0925453dc46f43d Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Fri, 2 May 2014 02:11:34 +0200 Subject: [PATCH 02/56] 8042298: Remove the names gen0 and gen1 from the GC code Renamed gen0 and gen1 to young and old throughout the GC code. Reviewed-by: sjohanss, jcoomes --- .../cmsAdaptiveSizePolicy.cpp | 11 +- .../cmsCollectorPolicy.cpp | 10 +- .../concurrentMarkSweepGeneration.cpp | 4 +- .../concurrentMarkSweepGeneration.hpp | 5 +- .../gc_implementation/g1/g1CollectedHeap.cpp | 2 +- .../g1/g1CollectorPolicy.cpp | 56 ++-- .../g1/g1CollectorPolicy.hpp | 30 +-- .../parallelScavenge/adjoiningGenerations.cpp | 16 +- .../parallelScavenge/generationSizer.cpp | 4 +- .../parallelScavenge/parallelScavengeHeap.cpp | 4 +- .../parallelScavenge/psMarkSweep.cpp | 4 +- .../parallelScavenge/psParallelCompact.cpp | 4 +- .../parallelScavenge/psScavenge.cpp | 4 +- .../src/share/vm/memory/collectorPolicy.cpp | 242 +++++++++--------- .../src/share/vm/memory/collectorPolicy.hpp | 28 +- .../src/share/vm/memory/genCollectedHeap.cpp | 4 +- .../src/share/vm/memory/tenuredGeneration.hpp | 5 +- hotspot/src/share/vm/runtime/arguments.cpp | 4 + hotspot/src/share/vm/runtime/globals.hpp | 14 +- 19 files changed, 225 insertions(+), 226 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp index 44239d9b7e7..3b3814ff9c9 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp @@ -1341,13 +1341,14 @@ bool CMSAdaptiveSizePolicy::get_and_clear_first_after_collection() { bool CMSAdaptiveSizePolicy::print_adaptive_size_policy_on( outputStream* st) const { - if (!UseAdaptiveSizePolicy) return false; + if (!UseAdaptiveSizePolicy) { + return false; + } GenCollectedHeap* gch = GenCollectedHeap::heap(); - Generation* gen0 = gch->get_gen(0); - DefNewGeneration* def_new = gen0->as_DefNewGeneration(); - return - AdaptiveSizePolicy::print_adaptive_size_policy_on( + Generation* young = gch->get_gen(0); + DefNewGeneration* def_new = young->as_DefNewGeneration(); + return AdaptiveSizePolicy::print_adaptive_size_policy_on( st, def_new->tenuring_threshold()); } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp index a236a10efb3..19d49f039a3 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp @@ -60,21 +60,21 @@ void ConcurrentMarkSweepPolicy::initialize_generations() { if (UseParNewGC) { if (UseAdaptiveSizePolicy) { _generations[0] = new GenerationSpec(Generation::ASParNew, - _initial_gen0_size, _max_gen0_size); + _initial_young_size, _max_young_size); } else { _generations[0] = new GenerationSpec(Generation::ParNew, - _initial_gen0_size, _max_gen0_size); + _initial_young_size, _max_young_size); } } else { _generations[0] = new GenerationSpec(Generation::DefNew, - _initial_gen0_size, _max_gen0_size); + _initial_young_size, _max_young_size); } if (UseAdaptiveSizePolicy) { _generations[1] = new GenerationSpec(Generation::ASConcurrentMarkSweep, - _initial_gen1_size, _max_gen1_size); + _initial_old_size, _max_old_size); } else { _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep, - _initial_gen1_size, _max_gen1_size); + _initial_old_size, _max_old_size); } if (_generations[0] == NULL || _generations[1] == NULL) { diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index dba6f8ca7d7..8cd65e36dca 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -1138,8 +1138,8 @@ static inline size_t percent_of_space(Space* space, HeapWord* addr) void CMSCollector::icms_update_allocation_limits() { - Generation* gen0 = GenCollectedHeap::heap()->get_gen(0); - EdenSpace* eden = gen0->as_DefNewGeneration()->eden(); + Generation* young = GenCollectedHeap::heap()->get_gen(0); + EdenSpace* eden = young->as_DefNewGeneration()->eden(); const unsigned int duty_cycle = stats().icms_update_duty_cycle(); if (CMSTraceIncrementalPacing) { diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index 6cf2f4270b6..09740b6d57c 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -1193,10 +1193,9 @@ class ConcurrentMarkSweepGeneration: public CardGeneration { // Does a "full" (forced) collection invoked on this generation collect // all younger generations as well? Note that the second conjunct is a // hack to allow the collection of the younger gen first if the flag is - // set. This is better than using th policy's should_collect_gen0_first() - // since that causes us to do an extra unnecessary pair of restart-&-stop-world. + // set. virtual bool full_collects_younger_generations() const { - return UseCMSCompactAtFullCollection && !CollectGen0First; + return UseCMSCompactAtFullCollection && !ScavengeBeforeFullGC; } void space_iterate(SpaceClosure* blk, bool usedOnly = false); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 83f819b3919..a1dbb6f1b18 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -3622,7 +3622,7 @@ void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const { void G1CollectedHeap::print_tracing_info() const { // We'll overload this to mean "trace GC pause statistics." - if (TraceGen0Time || TraceGen1Time) { + if (TraceYoungGenTime || TraceOldGenTime) { // The "G1CollectorPolicy" is keeping track of these stats, so delegate // to that. g1_policy()->print_tracing_info(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 89b6f3fa616..1c805c634b3 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -809,7 +809,7 @@ void G1CollectorPolicy::record_full_collection_end() { double full_gc_time_sec = end_sec - _full_collection_start_sec; double full_gc_time_ms = full_gc_time_sec * 1000.0; - _trace_gen1_time_data.record_full_collection(full_gc_time_ms); + _trace_old_gen_time_data.record_full_collection(full_gc_time_ms); update_recent_gc_times(end_sec, full_gc_time_ms); @@ -851,7 +851,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) { _g1->used(), _g1->recalculate_used())); double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0; - _trace_gen0_time_data.record_start_collection(s_w_t_ms); + _trace_young_gen_time_data.record_start_collection(s_w_t_ms); _stop_world_start = 0.0; record_heap_size_info_at_start(false /* full */); @@ -906,7 +906,7 @@ void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() { void G1CollectorPolicy::record_concurrent_pause() { if (_stop_world_start > 0.0) { double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0; - _trace_gen0_time_data.record_yield_time(yield_ms); + _trace_young_gen_time_data.record_yield_time(yield_ms); } } @@ -993,7 +993,7 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua evacuation_info.set_bytes_copied(_bytes_copied_during_gc); if (update_stats) { - _trace_gen0_time_data.record_end_collection(pause_time_ms, phase_times()); + _trace_young_gen_time_data.record_end_collection(pause_time_ms, phase_times()); // this is where we update the allocation rate of the application double app_time_ms = (phase_times()->cur_collection_start_sec() * 1000.0 - _prev_collection_pause_end_ms); @@ -1415,8 +1415,8 @@ size_t G1CollectorPolicy::expansion_amount() { } void G1CollectorPolicy::print_tracing_info() const { - _trace_gen0_time_data.print(); - _trace_gen1_time_data.print(); + _trace_young_gen_time_data.print(); + _trace_old_gen_time_data.print(); } void G1CollectorPolicy::print_yg_surv_rate_info() const { @@ -1973,9 +1973,9 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms, EvacuationInf _last_gc_was_young = gcs_are_young() ? true : false; if (_last_gc_was_young) { - _trace_gen0_time_data.increment_young_collection_count(); + _trace_young_gen_time_data.increment_young_collection_count(); } else { - _trace_gen0_time_data.increment_mixed_collection_count(); + _trace_young_gen_time_data.increment_mixed_collection_count(); } // The young list is laid with the survivor regions from the previous @@ -2156,20 +2156,20 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms, EvacuationInf evacuation_info.set_collectionset_regions(cset_region_length()); } -void TraceGen0TimeData::record_start_collection(double time_to_stop_the_world_ms) { - if(TraceGen0Time) { +void TraceYoungGenTimeData::record_start_collection(double time_to_stop_the_world_ms) { + if(TraceYoungGenTime) { _all_stop_world_times_ms.add(time_to_stop_the_world_ms); } } -void TraceGen0TimeData::record_yield_time(double yield_time_ms) { - if(TraceGen0Time) { +void TraceYoungGenTimeData::record_yield_time(double yield_time_ms) { + if(TraceYoungGenTime) { _all_yield_times_ms.add(yield_time_ms); } } -void TraceGen0TimeData::record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times) { - if(TraceGen0Time) { +void TraceYoungGenTimeData::record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times) { + if(TraceYoungGenTime) { _total.add(pause_time_ms); _other.add(pause_time_ms - phase_times->accounted_time_ms()); _root_region_scan_wait.add(phase_times->root_region_scan_wait_time_ms()); @@ -2194,34 +2194,34 @@ void TraceGen0TimeData::record_end_collection(double pause_time_ms, G1GCPhaseTim } } -void TraceGen0TimeData::increment_young_collection_count() { - if(TraceGen0Time) { +void TraceYoungGenTimeData::increment_young_collection_count() { + if(TraceYoungGenTime) { ++_young_pause_num; } } -void TraceGen0TimeData::increment_mixed_collection_count() { - if(TraceGen0Time) { +void TraceYoungGenTimeData::increment_mixed_collection_count() { + if(TraceYoungGenTime) { ++_mixed_pause_num; } } -void TraceGen0TimeData::print_summary(const char* str, - const NumberSeq* seq) const { +void TraceYoungGenTimeData::print_summary(const char* str, + const NumberSeq* seq) const { double sum = seq->sum(); gclog_or_tty->print_cr("%-27s = %8.2lf s (avg = %8.2lf ms)", str, sum / 1000.0, seq->avg()); } -void TraceGen0TimeData::print_summary_sd(const char* str, - const NumberSeq* seq) const { +void TraceYoungGenTimeData::print_summary_sd(const char* str, + const NumberSeq* seq) const { print_summary(str, seq); gclog_or_tty->print_cr("%+45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", "(num", seq->num(), seq->sd(), seq->maximum()); } -void TraceGen0TimeData::print() const { - if (!TraceGen0Time) { +void TraceYoungGenTimeData::print() const { + if (!TraceYoungGenTime) { return; } @@ -2258,14 +2258,14 @@ void TraceGen0TimeData::print() const { print_summary_sd(" Yields", &_all_yield_times_ms); } -void TraceGen1TimeData::record_full_collection(double full_gc_time_ms) { - if (TraceGen1Time) { +void TraceOldGenTimeData::record_full_collection(double full_gc_time_ms) { + if (TraceOldGenTime) { _all_full_gc_times.add(full_gc_time_ms); } } -void TraceGen1TimeData::print() const { - if (!TraceGen1Time) { +void TraceOldGenTimeData::print() const { + if (!TraceOldGenTime) { return; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp index f2905097190..4f141892e1f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -38,10 +38,10 @@ class HeapRegion; class CollectionSetChooser; class G1GCPhaseTimes; -// TraceGen0Time collects data on _both_ young and mixed evacuation pauses +// TraceYoungGenTime collects data on _both_ young and mixed evacuation pauses // (the latter may contain non-young regions - i.e. regions that are -// technically in Gen1) while TraceGen1Time collects data about full GCs. -class TraceGen0TimeData : public CHeapObj { +// technically in old) while TraceOldGenTime collects data about full GCs. +class TraceYoungGenTimeData : public CHeapObj { private: unsigned _young_pause_num; unsigned _mixed_pause_num; @@ -66,7 +66,7 @@ class TraceGen0TimeData : public CHeapObj { void print_summary_sd(const char* str, const NumberSeq* seq) const; public: - TraceGen0TimeData() : _young_pause_num(0), _mixed_pause_num(0) {}; + TraceYoungGenTimeData() : _young_pause_num(0), _mixed_pause_num(0) {}; void record_start_collection(double time_to_stop_the_world_ms); void record_yield_time(double yield_time_ms); void record_end_collection(double pause_time_ms, G1GCPhaseTimes* phase_times); @@ -75,7 +75,7 @@ public: void print() const; }; -class TraceGen1TimeData : public CHeapObj { +class TraceOldGenTimeData : public CHeapObj { private: NumberSeq _all_full_gc_times; @@ -187,8 +187,8 @@ private: TruncatedSeq* _concurrent_mark_remark_times_ms; TruncatedSeq* _concurrent_mark_cleanup_times_ms; - TraceGen0TimeData _trace_gen0_time_data; - TraceGen1TimeData _trace_gen1_time_data; + TraceYoungGenTimeData _trace_young_gen_time_data; + TraceOldGenTimeData _trace_old_gen_time_data; double _stop_world_start; @@ -202,20 +202,20 @@ private: // locker is active. This should be >= _young_list_target_length; uint _young_list_max_length; - bool _last_gc_was_young; + bool _last_gc_was_young; - bool _during_marking; - bool _in_marking_window; - bool _in_marking_window_im; + bool _during_marking; + bool _in_marking_window; + bool _in_marking_window_im; - SurvRateGroup* _short_lived_surv_rate_group; - SurvRateGroup* _survivor_surv_rate_group; + SurvRateGroup* _short_lived_surv_rate_group; + SurvRateGroup* _survivor_surv_rate_group; // add here any more surv rate groups - double _gc_overhead_perc; + double _gc_overhead_perc; double _reserve_factor; - uint _reserve_regions; + uint _reserve_regions; bool during_marking() { return _during_marking; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp index 468871ea5fc..4ad67face5e 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp @@ -35,14 +35,14 @@ AdjoiningGenerations::AdjoiningGenerations(ReservedSpace old_young_rs, GenerationSizer* policy, size_t alignment) : - _virtual_spaces(old_young_rs, policy->min_gen1_size(), - policy->min_gen0_size(), alignment) { - size_t init_low_byte_size = policy->initial_gen1_size(); - size_t min_low_byte_size = policy->min_gen1_size(); - size_t max_low_byte_size = policy->max_gen1_size(); - size_t init_high_byte_size = policy->initial_gen0_size(); - size_t min_high_byte_size = policy->min_gen0_size(); - size_t max_high_byte_size = policy->max_gen0_size(); + _virtual_spaces(old_young_rs, policy->min_old_size(), + policy->min_young_size(), alignment) { + size_t init_low_byte_size = policy->initial_old_size(); + size_t min_low_byte_size = policy->min_old_size(); + size_t max_low_byte_size = policy->max_old_size(); + size_t init_high_byte_size = policy->initial_young_size(); + size_t min_high_byte_size = policy->min_young_size(); + size_t max_high_byte_size = policy->max_young_size(); assert(min_low_byte_size <= init_low_byte_size && init_low_byte_size <= max_low_byte_size, "Parameter check"); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp index fd8b1332c7a..ff4b53057b8 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/generationSizer.cpp @@ -32,8 +32,8 @@ void GenerationSizer::trace_gen_sizes(const char* const str) { SIZE_FORMAT "," SIZE_FORMAT " " SIZE_FORMAT, str, - _min_gen1_size / K, _max_gen1_size / K, - _min_gen0_size / K, _max_gen0_size / K, + _min_old_size / K, _max_old_size / K, + _min_young_size / K, _max_young_size / K, _max_heap_byte_size / K); } } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp index 5a2f4e79d95..b7d521a4884 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp @@ -623,11 +623,11 @@ void ParallelScavengeHeap::print_gc_threads_on(outputStream* st) const { } void ParallelScavengeHeap::print_tracing_info() const { - if (TraceGen0Time) { + if (TraceYoungGenTime) { double time = PSScavenge::accumulated_time()->seconds(); tty->print_cr("[Accumulated GC generation 0 time %3.7f secs]", time); } - if (TraceGen1Time) { + if (TraceOldGenTime) { double time = UseParallelOldGC ? PSParallelCompact::accumulated_time()->seconds() : PSMarkSweep::accumulated_time()->seconds(); tty->print_cr("[Accumulated GC generation 1 time %3.7f secs]", time); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index 19eaf27aae5..bb829f99602 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -174,7 +174,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { TraceCollectorStats tcs(counters()); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); - if (TraceGen1Time) accumulated_time()->start(); + if (TraceOldGenTime) accumulated_time()->start(); // Let the size policy know we're starting size_policy->major_collection_begin(); @@ -354,7 +354,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { // We collected the heap, recalculate the metaspace capacity MetaspaceGC::compute_new_size(); - if (TraceGen1Time) accumulated_time()->stop(); + if (TraceOldGenTime) accumulated_time()->stop(); if (PrintGC) { if (PrintGCDetails) { diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index a9ffe54bd25..cba23adae9f 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -2061,7 +2061,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { TraceCollectorStats tcs(counters()); TraceMemoryManagerStats tms(true /* Full GC */,gc_cause); - if (TraceGen1Time) accumulated_time()->start(); + if (TraceOldGenTime) accumulated_time()->start(); // Let the size policy know we're starting size_policy->major_collection_begin(); @@ -2188,7 +2188,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { // Resize the metaspace capacity after a collection MetaspaceGC::compute_new_size(); - if (TraceGen1Time) accumulated_time()->stop(); + if (TraceOldGenTime) accumulated_time()->stop(); if (PrintGC) { if (PrintGCDetails) { diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index fd3030462b8..e71122529b1 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -336,7 +336,7 @@ bool PSScavenge::invoke_no_policy() { TraceCollectorStats tcs(counters()); TraceMemoryManagerStats tms(false /* not full GC */,gc_cause); - if (TraceGen0Time) accumulated_time()->start(); + if (TraceYoungGenTime) accumulated_time()->start(); // Let the size policy know we're starting size_policy->minor_collection_begin(); @@ -660,7 +660,7 @@ bool PSScavenge::invoke_no_policy() { CardTableExtension::verify_all_young_refs_imprecise(); } - if (TraceGen0Time) accumulated_time()->stop(); + if (TraceYoungGenTime) accumulated_time()->stop(); if (PrintGC) { if (PrintGCDetails) { diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp index 7d6246ec0c6..de33c9107d7 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp @@ -196,13 +196,13 @@ size_t CollectorPolicy::compute_heap_alignment() { // GenCollectorPolicy methods GenCollectorPolicy::GenCollectorPolicy() : - _min_gen0_size(0), - _initial_gen0_size(0), - _max_gen0_size(0), + _min_young_size(0), + _initial_young_size(0), + _max_young_size(0), _gen_alignment(0), - _min_gen1_size(0), - _initial_gen1_size(0), - _max_gen1_size(0), + _min_old_size(0), + _initial_old_size(0), + _max_old_size(0), _generations(NULL) {} @@ -236,7 +236,7 @@ size_t GenCollectorPolicy::young_gen_size_lower_bound() { #ifdef ASSERT void GenCollectorPolicy::assert_flags() { CollectorPolicy::assert_flags(); - assert(NewSize >= _min_gen0_size, "Ergonomics decided on a too small young gen size"); + assert(NewSize >= _min_young_size, "Ergonomics decided on a too small young gen size"); assert(NewSize <= MaxNewSize, "Ergonomics decided on incompatible initial and maximum young gen sizes"); assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young gen and heap sizes"); assert(NewSize % _gen_alignment == 0, "NewSize alignment"); @@ -249,28 +249,28 @@ void GenCollectorPolicy::assert_size_info() { CollectorPolicy::assert_size_info(); // GenCollectorPolicy::initialize_size_info may update the MaxNewSize assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes"); - assert(NewSize == _initial_gen0_size, "Discrepancy between NewSize flag and local storage"); - assert(MaxNewSize == _max_gen0_size, "Discrepancy between MaxNewSize flag and local storage"); - assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage"); - assert(_min_gen0_size <= _initial_gen0_size, "Ergonomics decided on incompatible minimum and initial young gen sizes"); - assert(_initial_gen0_size <= _max_gen0_size, "Ergonomics decided on incompatible initial and maximum young gen sizes"); - assert(_min_gen0_size % _gen_alignment == 0, "_min_gen0_size alignment"); - assert(_initial_gen0_size % _gen_alignment == 0, "_initial_gen0_size alignment"); - assert(_max_gen0_size % _gen_alignment == 0, "_max_gen0_size alignment"); - assert(_min_gen0_size <= bound_minus_alignment(_min_gen0_size, _min_heap_byte_size), + assert(NewSize == _initial_young_size, "Discrepancy between NewSize flag and local storage"); + assert(MaxNewSize == _max_young_size, "Discrepancy between MaxNewSize flag and local storage"); + assert(OldSize == _initial_old_size, "Discrepancy between OldSize flag and local storage"); + assert(_min_young_size <= _initial_young_size, "Ergonomics decided on incompatible minimum and initial young gen sizes"); + assert(_initial_young_size <= _max_young_size, "Ergonomics decided on incompatible initial and maximum young gen sizes"); + assert(_min_young_size % _gen_alignment == 0, "_min_young_size alignment"); + assert(_initial_young_size % _gen_alignment == 0, "_initial_young_size alignment"); + assert(_max_young_size % _gen_alignment == 0, "_max_young_size alignment"); + assert(_min_young_size <= bound_minus_alignment(_min_young_size, _min_heap_byte_size), "Ergonomics made minimum young generation larger than minimum heap"); - assert(_initial_gen0_size <= bound_minus_alignment(_initial_gen0_size, _initial_heap_byte_size), + assert(_initial_young_size <= bound_minus_alignment(_initial_young_size, _initial_heap_byte_size), "Ergonomics made initial young generation larger than initial heap"); - assert(_max_gen0_size <= bound_minus_alignment(_max_gen0_size, _max_heap_byte_size), + assert(_max_young_size <= bound_minus_alignment(_max_young_size, _max_heap_byte_size), "Ergonomics made maximum young generation lager than maximum heap"); - assert(_min_gen1_size <= _initial_gen1_size, "Ergonomics decided on incompatible minimum and initial old gen sizes"); - assert(_initial_gen1_size <= _max_gen1_size, "Ergonomics decided on incompatible initial and maximum old gen sizes"); - assert(_max_gen1_size % _gen_alignment == 0, "_max_gen1_size alignment"); - assert(_initial_gen1_size % _gen_alignment == 0, "_initial_gen1_size alignment"); - assert(_max_heap_byte_size <= (_max_gen0_size + _max_gen1_size), "Total maximum heap sizes must be sum of generation maximum sizes"); - assert(_min_gen0_size + _min_gen1_size <= _min_heap_byte_size, "Minimum generation sizes exceed minimum heap size"); - assert(_initial_gen0_size + _initial_gen1_size == _initial_heap_byte_size, "Initial generation sizes should match initial heap size"); - assert(_max_gen0_size + _max_gen1_size == _max_heap_byte_size, "Maximum generation sizes should match maximum heap size"); + assert(_min_old_size <= _initial_old_size, "Ergonomics decided on incompatible minimum and initial old gen sizes"); + assert(_initial_old_size <= _max_old_size, "Ergonomics decided on incompatible initial and maximum old gen sizes"); + assert(_max_old_size % _gen_alignment == 0, "_max_old_size alignment"); + assert(_initial_old_size % _gen_alignment == 0, "_initial_old_size alignment"); + assert(_max_heap_byte_size <= (_max_young_size + _max_old_size), "Total maximum heap sizes must be sum of generation maximum sizes"); + assert(_min_young_size + _min_old_size <= _min_heap_byte_size, "Minimum generation sizes exceed minimum heap size"); + assert(_initial_young_size + _initial_old_size == _initial_heap_byte_size, "Initial generation sizes should match initial heap size"); + assert(_max_young_size + _max_old_size == _max_heap_byte_size, "Maximum generation sizes should match maximum heap size"); } #endif // ASSERT @@ -323,8 +323,8 @@ void GenCollectorPolicy::initialize_flags() { // later when setting the initial and minimum young generation size. NewSize = bounded_new_size; } - _min_gen0_size = smallest_new_size; - _initial_gen0_size = NewSize; + _min_young_size = smallest_new_size; + _initial_young_size = NewSize; if (!FLAG_IS_DEFAULT(MaxNewSize)) { if (MaxNewSize >= MaxHeapSize) { @@ -338,14 +338,14 @@ void GenCollectorPolicy::initialize_flags() { FLAG_SET_ERGO(uintx, MaxNewSize, smaller_max_new_size); if (NewSize > MaxNewSize) { FLAG_SET_ERGO(uintx, NewSize, MaxNewSize); - _initial_gen0_size = NewSize; + _initial_young_size = NewSize; } - } else if (MaxNewSize < _initial_gen0_size) { - FLAG_SET_ERGO(uintx, MaxNewSize, _initial_gen0_size); + } else if (MaxNewSize < _initial_young_size) { + FLAG_SET_ERGO(uintx, MaxNewSize, _initial_young_size); } else if (!is_size_aligned(MaxNewSize, _gen_alignment)) { FLAG_SET_ERGO(uintx, MaxNewSize, align_size_down(MaxNewSize, _gen_alignment)); } - _max_gen0_size = MaxNewSize; + _max_young_size = MaxNewSize; } if (NewSize > MaxNewSize) { @@ -357,7 +357,7 @@ void GenCollectorPolicy::initialize_flags() { NewSize/K, MaxNewSize/K, NewSize/K); } FLAG_SET_ERGO(uintx, MaxNewSize, NewSize); - _max_gen0_size = MaxNewSize; + _max_young_size = MaxNewSize; } if (SurvivorRatio < 1 || NewRatio < 1) { @@ -393,7 +393,7 @@ void GenCollectorPolicy::initialize_flags() { 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)); - _initial_gen0_size = NewSize; + _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 @@ -406,16 +406,16 @@ void GenCollectorPolicy::initialize_flags() { } } - // Update NewSize, if possible, to avoid sizing gen0 to small when only + // Update NewSize, if possible, to avoid sizing the young gen too small when only // OldSize is set on the command line. if (FLAG_IS_CMDLINE(OldSize) && !FLAG_IS_CMDLINE(NewSize)) { if (OldSize < _initial_heap_byte_size) { size_t new_size = _initial_heap_byte_size - OldSize; - // Need to compare against the flag value for max since _max_gen0_size + // Need to compare against the flag value for max since _max_young_size // might not have been set yet. - if (new_size >= _min_gen0_size && new_size <= MaxNewSize) { + if (new_size >= _min_young_size && new_size <= MaxNewSize) { FLAG_SET_ERGO(uintx, NewSize, new_size); - _initial_gen0_size = NewSize; + _initial_young_size = NewSize; } } } @@ -444,77 +444,77 @@ void GenCollectorPolicy::initialize_flags() { void GenCollectorPolicy::initialize_size_info() { CollectorPolicy::initialize_size_info(); - _initial_gen0_size = NewSize; - _max_gen0_size = MaxNewSize; - _initial_gen1_size = OldSize; + _initial_young_size = NewSize; + _max_young_size = MaxNewSize; + _initial_old_size = OldSize; - // Determine maximum size of gen0 + // Determine maximum size of the young generation. if (FLAG_IS_DEFAULT(MaxNewSize)) { - _max_gen0_size = scale_by_NewRatio_aligned(_max_heap_byte_size); + _max_young_size = scale_by_NewRatio_aligned(_max_heap_byte_size); // Bound the maximum size by NewSize below (since it historically // would have been NewSize and because the NewRatio calculation could // yield a size that is too small) and bound it by MaxNewSize above. // Ergonomics plays here by previously calculating the desired // NewSize and MaxNewSize. - _max_gen0_size = MIN2(MAX2(_max_gen0_size, _initial_gen0_size), MaxNewSize); + _max_young_size = MIN2(MAX2(_max_young_size, _initial_young_size), MaxNewSize); } - // Given the maximum gen0 size, determine the initial and - // minimum gen0 sizes. + // Given the maximum young size, determine the initial and + // minimum young sizes. if (_max_heap_byte_size == _initial_heap_byte_size) { // The maximum and initial heap sizes are the same so the generation's // initial size must be the same as it maximum size. Use NewSize as the // size if set on command line. - _max_gen0_size = FLAG_IS_CMDLINE(NewSize) ? NewSize : _max_gen0_size; - _initial_gen0_size = _max_gen0_size; + _max_young_size = FLAG_IS_CMDLINE(NewSize) ? NewSize : _max_young_size; + _initial_young_size = _max_young_size; // Also update the minimum size if min == initial == max. if (_max_heap_byte_size == _min_heap_byte_size) { - _min_gen0_size = _max_gen0_size; + _min_young_size = _max_young_size; } } else { if (FLAG_IS_CMDLINE(NewSize)) { // If NewSize is set on the command line, we should use it as // the initial size, but make sure it is within the heap bounds. - _initial_gen0_size = - MIN2(_max_gen0_size, bound_minus_alignment(NewSize, _initial_heap_byte_size)); - _min_gen0_size = bound_minus_alignment(_initial_gen0_size, _min_heap_byte_size); + _initial_young_size = + MIN2(_max_young_size, bound_minus_alignment(NewSize, _initial_heap_byte_size)); + _min_young_size = bound_minus_alignment(_initial_young_size, _min_heap_byte_size); } else { // For the case where NewSize is not set on the command line, use // NewRatio to size the initial generation size. Use the current // NewSize as the floor, because if NewRatio is overly large, the resulting // size can be too small. - _initial_gen0_size = - MIN2(_max_gen0_size, MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize)); + _initial_young_size = + MIN2(_max_young_size, MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize)); } } if (PrintGCDetails && Verbose) { - gclog_or_tty->print_cr("1: Minimum gen0 " SIZE_FORMAT " Initial gen0 " - SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT, - _min_gen0_size, _initial_gen0_size, _max_gen0_size); + gclog_or_tty->print_cr("1: Minimum young " SIZE_FORMAT " Initial young " + SIZE_FORMAT " Maximum young " SIZE_FORMAT, + _min_young_size, _initial_young_size, _max_young_size); } // At this point the minimum, initial and maximum sizes - // of the overall heap and of gen0 have been determined. - // The maximum gen1 size can be determined from the maximum gen0 + // of the overall heap and of the young generation have been determined. + // The maximum old size can be determined from the maximum young // and maximum heap size since no explicit flags exist - // for setting the gen1 maximum. - _max_gen1_size = MAX2(_max_heap_byte_size - _max_gen0_size, _gen_alignment); + // for setting the old generation maximum. + _max_old_size = MAX2(_max_heap_byte_size - _max_young_size, _gen_alignment); // If no explicit command line flag has been set for the - // gen1 size, use what is left for gen1 + // old generation size, use what is left. if (!FLAG_IS_CMDLINE(OldSize)) { // The user has not specified any value but the ergonomics // may have chosen a value (which may or may not be consistent // with the overall heap size). In either case make // the minimum, maximum and initial sizes consistent - // with the gen0 sizes and the overall heap sizes. - _min_gen1_size = _gen_alignment; - _initial_gen1_size = MIN2(_max_gen1_size, MAX2(_initial_heap_byte_size - _initial_gen0_size, _min_gen1_size)); - // _max_gen1_size has already been made consistent above + // with the young sizes and the overall heap sizes. + _min_old_size = _gen_alignment; + _initial_old_size = MIN2(_max_old_size, MAX2(_initial_heap_byte_size - _initial_young_size, _min_old_size)); + // _max_old_size has already been made consistent above. } else { // OldSize has been explicitly set on the command line. Use it // for the initial size but make sure the minimum allow a young @@ -523,68 +523,68 @@ void GenCollectorPolicy::initialize_size_info() { // with other command line flags, issue a warning. // The generation minimums and the overall heap minimum should // be within one generation alignment. - if (_initial_gen1_size > _max_gen1_size) { + if (_initial_old_size > _max_old_size) { warning("Inconsistency between maximum heap size and maximum " "generation sizes: using maximum heap = " SIZE_FORMAT " -XX:OldSize flag is being ignored", _max_heap_byte_size); - _initial_gen1_size = _max_gen1_size; + _initial_old_size = _max_old_size; } - _min_gen1_size = MIN2(_initial_gen1_size, _min_heap_byte_size - _min_gen0_size); + _min_old_size = MIN2(_initial_old_size, _min_heap_byte_size - _min_young_size); } // The initial generation sizes should match the initial heap size, // if not issue a warning and resize the generations. This behavior // differs from JDK8 where the generation sizes have higher priority // than the initial heap size. - if ((_initial_gen1_size + _initial_gen0_size) != _initial_heap_byte_size) { + if ((_initial_old_size + _initial_young_size) != _initial_heap_byte_size) { warning("Inconsistency between generation sizes and heap size, resizing " "the generations to fit the heap."); - size_t desired_gen0_size = _initial_heap_byte_size - _initial_gen1_size; - if (_initial_heap_byte_size < _initial_gen1_size) { + size_t desired_young_size = _initial_heap_byte_size - _initial_old_size; + if (_initial_heap_byte_size < _initial_old_size) { // Old want all memory, use minimum for young and rest for old - _initial_gen0_size = _min_gen0_size; - _initial_gen1_size = _initial_heap_byte_size - _min_gen0_size; - } else if (desired_gen0_size > _max_gen0_size) { + _initial_young_size = _min_young_size; + _initial_old_size = _initial_heap_byte_size - _min_young_size; + } else if (desired_young_size > _max_young_size) { // Need to increase both young and old generation - _initial_gen0_size = _max_gen0_size; - _initial_gen1_size = _initial_heap_byte_size - _max_gen0_size; - } else if (desired_gen0_size < _min_gen0_size) { + _initial_young_size = _max_young_size; + _initial_old_size = _initial_heap_byte_size - _max_young_size; + } else if (desired_young_size < _min_young_size) { // Need to decrease both young and old generation - _initial_gen0_size = _min_gen0_size; - _initial_gen1_size = _initial_heap_byte_size - _min_gen0_size; + _initial_young_size = _min_young_size; + _initial_old_size = _initial_heap_byte_size - _min_young_size; } else { // The young generation boundaries allow us to only update the // young generation. - _initial_gen0_size = desired_gen0_size; + _initial_young_size = desired_young_size; } if (PrintGCDetails && Verbose) { - gclog_or_tty->print_cr("2: Minimum gen0 " SIZE_FORMAT " Initial gen0 " - SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT, - _min_gen0_size, _initial_gen0_size, _max_gen0_size); + gclog_or_tty->print_cr("2: Minimum young " SIZE_FORMAT " Initial young " + SIZE_FORMAT " Maximum young " SIZE_FORMAT, + _min_young_size, _initial_young_size, _max_young_size); } } - // Write back to flags if necessary - if (NewSize != _initial_gen0_size) { - FLAG_SET_ERGO(uintx, NewSize, _initial_gen0_size); + // Write back to flags if necessary. + if (NewSize != _initial_young_size) { + FLAG_SET_ERGO(uintx, NewSize, _initial_young_size); } - if (MaxNewSize != _max_gen0_size) { - FLAG_SET_ERGO(uintx, MaxNewSize, _max_gen0_size); + if (MaxNewSize != _max_young_size) { + FLAG_SET_ERGO(uintx, MaxNewSize, _max_young_size); } - if (OldSize != _initial_gen1_size) { - FLAG_SET_ERGO(uintx, OldSize, _initial_gen1_size); + if (OldSize != _initial_old_size) { + FLAG_SET_ERGO(uintx, OldSize, _initial_old_size); } if (PrintGCDetails && Verbose) { - gclog_or_tty->print_cr("Minimum gen1 " SIZE_FORMAT " Initial gen1 " - SIZE_FORMAT " Maximum gen1 " SIZE_FORMAT, - _min_gen1_size, _initial_gen1_size, _max_gen1_size); + gclog_or_tty->print_cr("Minimum old " SIZE_FORMAT " Initial old " + SIZE_FORMAT " Maximum old " SIZE_FORMAT, + _min_old_size, _initial_old_size, _max_old_size); } DEBUG_ONLY(GenCollectorPolicy::assert_size_info();) @@ -610,11 +610,11 @@ HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, HandleMark hm; // Discard any handles allocated in each iteration. // First allocation attempt is lock-free. - Generation *gen0 = gch->get_gen(0); - assert(gen0->supports_inline_contig_alloc(), + Generation *young = gch->get_gen(0); + assert(young->supports_inline_contig_alloc(), "Otherwise, must do alloc within heap lock"); - if (gen0->should_allocate(size, is_tlab)) { - result = gen0->par_allocate(size, is_tlab); + if (young->should_allocate(size, is_tlab)) { + result = young->par_allocate(size, is_tlab); if (result != NULL) { assert(gch->is_in_reserved(result), "result not in heap"); return result; @@ -896,8 +896,8 @@ MetaWord* CollectorPolicy::satisfy_failed_metadata_allocation( bool GenCollectorPolicy::should_try_older_generation_allocation( size_t word_size) const { GenCollectedHeap* gch = GenCollectedHeap::heap(); - size_t gen0_capacity = gch->get_gen(0)->capacity_before_gc(); - return (word_size > heap_word_size(gen0_capacity)) + size_t young_capacity = gch->get_gen(0)->capacity_before_gc(); + return (word_size > heap_word_size(young_capacity)) || GC_locker::is_active_and_needs_gc() || gch->incremental_collection_failed(); } @@ -919,11 +919,11 @@ void MarkSweepPolicy::initialize_generations() { } if (UseParNewGC) { - _generations[0] = new GenerationSpec(Generation::ParNew, _initial_gen0_size, _max_gen0_size); + _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size); } else { - _generations[0] = new GenerationSpec(Generation::DefNew, _initial_gen0_size, _max_gen0_size); + _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size); } - _generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_gen1_size, _max_gen1_size); + _generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size); if (_generations[0] == NULL || _generations[1] == NULL) { vm_exit_during_initialization("Unable to allocate gen spec"); @@ -957,18 +957,18 @@ public: flag_value = 20 * M; set_basic_flag_values(); FLAG_SET_CMDLINE(uintx, NewSize, flag_value); - verify_gen0_min(flag_value); + verify_young_min(flag_value); set_basic_flag_values(); FLAG_SET_CMDLINE(uintx, NewSize, flag_value); - verify_gen0_initial(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); - verify_gen0_initial(flag_value); + verify_young_initial(flag_value); // If NewSize has been ergonomically set, the collector policy // should use it for min but calculate the initial young size @@ -976,11 +976,11 @@ public: flag_value = 20 * M; set_basic_flag_values(); FLAG_SET_ERGO(uintx, NewSize, flag_value); - verify_gen0_min(flag_value); + verify_young_min(flag_value); set_basic_flag_values(); FLAG_SET_ERGO(uintx, NewSize, flag_value); - verify_scaled_gen0_initial(InitialHeapSize); + verify_scaled_young_initial(InitialHeapSize); restore_flags(); } @@ -995,11 +995,11 @@ public: flag_value = 20 * M; set_basic_flag_values(); FLAG_SET_CMDLINE(uintx, OldSize, flag_value); - verify_gen1_min(flag_value); + verify_old_min(flag_value); set_basic_flag_values(); FLAG_SET_CMDLINE(uintx, OldSize, flag_value); - verify_gen1_initial(flag_value); + verify_old_initial(flag_value); // If MaxNewSize is large, the maximum OldSize will be less than // what's requested on the command line and it should be reset @@ -1010,46 +1010,46 @@ public: FLAG_SET_CMDLINE(uintx, MaxNewSize, 170*M); // Calculate what we expect the flag to be. flag_value = MaxHeapSize - MaxNewSize; - verify_gen1_initial(flag_value); + verify_old_initial(flag_value); } - static void verify_gen0_min(size_t expected) { + static void verify_young_min(size_t expected) { MarkSweepPolicy msp; msp.initialize_all(); - assert(msp.min_gen0_size() <= expected, err_msg("%zu > %zu", msp.min_gen0_size(), expected)); + assert(msp.min_young_size() <= expected, err_msg("%zu > %zu", msp.min_young_size(), expected)); } - static void verify_gen0_initial(size_t expected) { + static void verify_young_initial(size_t expected) { MarkSweepPolicy msp; msp.initialize_all(); - assert(msp.initial_gen0_size() == expected, err_msg("%zu != %zu", msp.initial_gen0_size(), expected)); + assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected)); } - static void verify_scaled_gen0_initial(size_t initial_heap_size) { + static void verify_scaled_young_initial(size_t initial_heap_size) { MarkSweepPolicy msp; msp.initialize_all(); size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size); - assert(msp.initial_gen0_size() == expected, err_msg("%zu != %zu", msp.initial_gen0_size(), expected)); + assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected)); assert(FLAG_IS_ERGO(NewSize) && NewSize == expected, err_msg("NewSize should have been set ergonomically to %zu, but was %zu", expected, NewSize)); } - static void verify_gen1_min(size_t expected) { + static void verify_old_min(size_t expected) { MarkSweepPolicy msp; msp.initialize_all(); - assert(msp.min_gen1_size() <= expected, err_msg("%zu > %zu", msp.min_gen1_size(), expected)); + assert(msp.min_old_size() <= expected, err_msg("%zu > %zu", msp.min_old_size(), expected)); } - static void verify_gen1_initial(size_t expected) { + static void verify_old_initial(size_t expected) { MarkSweepPolicy msp; msp.initialize_all(); - assert(msp.initial_gen1_size() == expected, err_msg("%zu != %zu", msp.initial_gen1_size(), expected)); + assert(msp.initial_old_size() == expected, err_msg("%zu != %zu", msp.initial_old_size(), expected)); } diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp index 1fc62b06c43..57f59b2bd92 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.hpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp @@ -219,12 +219,12 @@ class ClearedAllSoftRefs : public StackObj { class GenCollectorPolicy : public CollectorPolicy { friend class TestGenCollectorPolicy; protected: - size_t _min_gen0_size; - size_t _initial_gen0_size; - size_t _max_gen0_size; - size_t _min_gen1_size; - size_t _initial_gen1_size; - size_t _max_gen1_size; + size_t _min_young_size; + size_t _initial_young_size; + size_t _max_young_size; + size_t _min_old_size; + size_t _initial_old_size; + size_t _max_old_size; // _gen_alignment and _space_alignment will have the same value most of the // time. When using large pages they can differ. @@ -260,13 +260,13 @@ friend class TestGenCollectorPolicy; GenCollectorPolicy(); // Accessors - size_t min_gen0_size() { return _min_gen0_size; } - size_t initial_gen0_size() { return _initial_gen0_size; } - size_t max_gen0_size() { return _max_gen0_size; } - size_t gen_alignment() { return _gen_alignment; } - size_t min_gen1_size() { return _min_gen1_size; } - size_t initial_gen1_size() { return _initial_gen1_size; } - size_t max_gen1_size() { return _max_gen1_size; } + size_t min_young_size() { return _min_young_size; } + size_t initial_young_size() { return _initial_young_size; } + size_t max_young_size() { return _max_young_size; } + size_t gen_alignment() { return _gen_alignment; } + size_t min_old_size() { return _min_old_size; } + size_t initial_old_size() { return _initial_old_size; } + size_t max_old_size() { return _max_old_size; } int number_of_generations() { return 2; } @@ -298,7 +298,7 @@ friend class TestGenCollectorPolicy; size_t init_survivor_size); virtual void post_heap_initialize() { - assert(_max_gen0_size == MaxNewSize, "Should be taken care of by initialize_size_info"); + assert(_max_young_size == MaxNewSize, "Should be taken care of by initialize_size_info"); } BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; } diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 0f75d779d2a..a774f4051e6 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -1119,10 +1119,10 @@ void GenCollectedHeap::print_on_error(outputStream* st) const { } void GenCollectedHeap::print_tracing_info() const { - if (TraceGen0Time) { + if (TraceYoungGenTime) { get_gen(0)->print_summary_info(); } - if (TraceGen1Time) { + if (TraceOldGenTime) { get_gen(1)->print_summary_info(); } } diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.hpp b/hotspot/src/share/vm/memory/tenuredGeneration.hpp index 94a4330aca1..f9d621db54e 100644 --- a/hotspot/src/share/vm/memory/tenuredGeneration.hpp +++ b/hotspot/src/share/vm/memory/tenuredGeneration.hpp @@ -67,10 +67,9 @@ class TenuredGeneration: public OneContigSpaceCardGeneration { // Does a "full" (forced) collection invoked on this generation collect // all younger generations as well? Note that this is a // hack to allow the collection of the younger gen first if the flag is - // set. This is better than using th policy's should_collect_gen0_first() - // since that causes us to do an extra unnecessary pair of restart-&-stop-world. + // set. virtual bool full_collects_younger_generations() const { - return !CollectGen0First; + return !ScavengeBeforeFullGC; } virtual void gc_prologue(bool full); diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 91e485e7aed..eeb469a6010 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -2187,6 +2187,10 @@ bool Arguments::check_vm_args_consistency() { } } + if (!(UseParallelGC || UseParallelOldGC) && FLAG_IS_DEFAULT(ScavengeBeforeFullGC)) { + FLAG_SET_DEFAULT(ScavengeBeforeFullGC, false); + } + status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit"); status = status && verify_percentage(GCTimeLimit, "GCTimeLimit"); if (GCTimeLimit == 100) { diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 9952ad96bb7..9321236d7a6 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1450,8 +1450,7 @@ class CommandLineFlags { "(ParallelGC only)") \ \ product(bool, ScavengeBeforeFullGC, true, \ - "Scavenge youngest generation before each full GC, " \ - "used with UseParallelGC") \ + "Scavenge youngest generation before each full GC.") \ \ develop(bool, ScavengeWithObjectsInToSpace, false, \ "Allow scavenges to occur when to-space contains objects") \ @@ -2252,9 +2251,6 @@ class CommandLineFlags { notproduct(bool, CheckMemoryInitialization, false, \ "Check memory initialization") \ \ - product(bool, CollectGen0First, false, \ - "Collect youngest generation before each full GC") \ - \ diagnostic(bool, BindCMSThreadToCPU, false, \ "Bind CMS Thread to CPU if possible") \ \ @@ -2333,11 +2329,11 @@ class CommandLineFlags { NOT_LP64(2200*K) LP64_ONLY(4*M), \ "Initial size of the boot class loader data metaspace") \ \ - product(bool, TraceGen0Time, false, \ - "Trace accumulated time for Gen 0 collection") \ + product(bool, TraceYoungGenTime, false, \ + "Trace accumulated time for young collection") \ \ - product(bool, TraceGen1Time, false, \ - "Trace accumulated time for Gen 1 collection") \ + product(bool, TraceOldGenTime, false, \ + "Trace accumulated time for old collection") \ \ product(bool, PrintTenuringDistribution, false, \ "Print tenuring age information") \ From fc984ddd848e558a9bc281e46b30c7a97cd3942b Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Thu, 29 May 2014 16:01:13 -0700 Subject: [PATCH 03/56] 8044071: Print format/argument warnings Reviewed-by: drchase, dholmes, lfoltan, twisti --- hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp | 2 +- hotspot/src/cpu/sparc/vm/frame_sparc.cpp | 3 ++- .../src/cpu/sparc/vm/macroAssembler_sparc.cpp | 2 +- hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp | 21 ++++++++++--------- .../sparc/vm/templateInterpreter_sparc.cpp | 18 ++++++++-------- .../src/cpu/sparc/vm/vtableStubs_sparc.cpp | 4 ++-- .../os_cpu/linux_sparc/vm/os_linux_sparc.cpp | 8 +++---- .../linux_sparc/vm/vm_version_linux_sparc.cpp | 2 +- 8 files changed, 31 insertions(+), 29 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp index 791331168d2..92d494fc0ca 100644 --- a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp @@ -135,7 +135,7 @@ void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) if (TraceICs) { ResourceMark rm; tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s", - instruction_address(), + p2i(instruction_address()), callee->name_and_sig_as_C_string()); } diff --git a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp index 29b37f006a5..2feb5eb0925 100644 --- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp @@ -557,7 +557,8 @@ void frame::patch_pc(Thread* thread, address pc) { // QQQ this assert is invalid (or too strong anyway) sice _pc could // be original pc and frame could have the deopt pc. // assert(_pc == *O7_addr() + pc_return_offset, "frame has wrong pc"); - tty->print_cr("patch_pc at address 0x%x [0x%x -> 0x%x] ", O7_addr(), _pc, pc); + tty->print_cr("patch_pc at address " INTPTR_FORMAT " [" INTPTR_FORMAT " -> " INTPTR_FORMAT "]", + p2i(O7_addr()), p2i(_pc), p2i(pc)); } _cb = CodeCache::find_blob(pc); *O7_addr() = pc - pc_return_offset; diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp index d7396f68fbe..1f4cf5654c6 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -1202,7 +1202,7 @@ void RegistersForDebugging::print(outputStream* s) { if ( j != last ) s->print(" - f%d", last); s->print(" = %f", val); s->fill_to(25); - s->print_cr(" (0x%x)", val); + s->print_cr(" (0x%x)", *(int*)&val); j = last + 1; } s->cr(); diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp index c15c3c0994f..3d2f531402c 100644 --- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp @@ -78,7 +78,7 @@ void NativeInstruction::verify() { } void NativeInstruction::print() { - tty->print_cr(INTPTR_FORMAT ": 0x%x", addr_at(0), long_at(0)); + tty->print_cr(INTPTR_FORMAT ": 0x%x", p2i(addr_at(0)), long_at(0)); } void NativeInstruction::set_long_at(int offset, int i) { @@ -142,7 +142,7 @@ void NativeCall::verify() { } void NativeCall::print() { - tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, instruction_address(), destination()); + tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, p2i(instruction_address()), p2i(destination())); } @@ -271,7 +271,7 @@ bool NativeFarCall::is_call_at(address instr) { } void NativeFarCall::print() { - tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, instruction_address(), destination()); + tty->print_cr(INTPTR_FORMAT ": call " INTPTR_FORMAT, p2i(instruction_address()), p2i(destination())); } bool NativeFarCall::destination_is_compiled_verified_entry_point() { @@ -324,7 +324,7 @@ void NativeMovConstReg::verify() { void NativeMovConstReg::print() { - tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, instruction_address(), data()); + tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, p2i(instruction_address()), data()); } @@ -446,7 +446,7 @@ void NativeMovConstRegPatching::verify() { void NativeMovConstRegPatching::print() { - tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, instruction_address(), data()); + tty->print_cr(INTPTR_FORMAT ": mov reg, 0x%x", p2i(instruction_address()), data()); } @@ -585,9 +585,10 @@ void NativeMovRegMem::verify() { void NativeMovRegMem::print() { if (is_immediate()) { - tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %x]", instruction_address(), offset()); + // offset is a signed 13-bit immediate, so casting it to int will not lose significant bits + tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %d]", p2i(instruction_address()), (int)offset()); } else { - tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", instruction_address()); + tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", p2i(instruction_address())); } } @@ -730,9 +731,9 @@ void NativeMovRegMemPatching::verify() { void NativeMovRegMemPatching::print() { if (is_immediate()) { - tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %x]", instruction_address(), offset()); + tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %d]", p2i(instruction_address()), offset()); } else { - tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", instruction_address()); + tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", p2i(instruction_address())); } } @@ -863,7 +864,7 @@ void NativeJump::verify() { void NativeJump::print() { - tty->print_cr(INTPTR_FORMAT ": jmpl reg, " INTPTR_FORMAT, instruction_address(), jump_destination()); + tty->print_cr(INTPTR_FORMAT ": jmpl reg, " INTPTR_FORMAT, p2i(instruction_address()), p2i(jump_destination())); } diff --git a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp index 3c173f4d70f..c281e3bc005 100644 --- a/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateInterpreter_sparc.cpp @@ -1722,15 +1722,15 @@ void AbstractInterpreter::layout_activation(Method* method, if (caller->is_interpreted_frame()) { tty->print("interpreted "); } - tty->print_cr("caller fp=0x%x sp=0x%x", caller->fp(), caller->sp()); - tty->print_cr("save area = 0x%x, 0x%x", caller->sp(), caller->sp() + 16); - tty->print_cr("save area = 0x%x, 0x%x", caller->fp(), caller->fp() + 16); - tty->print_cr("interpreter fp=0x%x sp=0x%x", interpreter_frame->fp(), interpreter_frame->sp()); - tty->print_cr("save area = 0x%x, 0x%x", interpreter_frame->sp(), interpreter_frame->sp() + 16); - tty->print_cr("save area = 0x%x, 0x%x", interpreter_frame->fp(), interpreter_frame->fp() + 16); - tty->print_cr("Llocals = 0x%x", locals); - tty->print_cr("Lesp = 0x%x", esp); - tty->print_cr("Lmonitors = 0x%x", monitors); + tty->print_cr("caller fp=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, p2i(caller->fp()), p2i(caller->sp())); + tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(caller->sp()), p2i(caller->sp() + 16)); + tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(caller->fp()), p2i(caller->fp() + 16)); + tty->print_cr("interpreter fp=" INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->fp()), p2i(interpreter_frame->sp())); + tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->sp()), p2i(interpreter_frame->sp() + 16)); + tty->print_cr("save area = " INTPTR_FORMAT ", " INTPTR_FORMAT, p2i(interpreter_frame->fp()), p2i(interpreter_frame->fp() + 16)); + tty->print_cr("Llocals = " INTPTR_FORMAT, p2i(locals)); + tty->print_cr("Lesp = " INTPTR_FORMAT, p2i(esp)); + tty->print_cr("Lmonitors = " INTPTR_FORMAT, p2i(monitors)); } if (method->max_locals() > 0) { diff --git a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp index cdbb57fbecd..6c0755bab32 100644 --- a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp @@ -111,7 +111,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { if (PrintMiscellaneous && (WizardMode || Verbose)) { tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d", - vtable_index, s->entry_point(), + vtable_index, p2i(s->entry_point()), (int)(s->code_end() - s->entry_point()), (int)(s->code_end() - __ pc())); } @@ -206,7 +206,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) { if (PrintMiscellaneous && (WizardMode || Verbose)) { tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d", - itable_index, s->entry_point(), + itable_index, p2i(s->entry_point()), (int)(s->code_end() - s->entry_point()), (int)(s->code_end() - __ pc())); } diff --git a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp index f8f23122d4d..6e364f4087a 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -234,7 +234,7 @@ void os::print_context(outputStream *st, void *context) { SIG_REGS(sc).u_regs[CON_G3], SIG_REGS(sc).u_regs[CON_G4]); st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT - " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT, + " G7=" INTPTR_FORMAT " Y=0x%x", SIG_REGS(sc).u_regs[CON_G5], SIG_REGS(sc).u_regs[CON_G6], SIG_REGS(sc).u_regs[CON_G7], @@ -285,7 +285,7 @@ void os::print_context(outputStream *st, void *context) { st->cr(); st->cr(); - st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); + st->print_cr("Top of Stack: (sp=" INTPTR_FORMAT ")", p2i(sp)); print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); st->cr(); @@ -293,7 +293,7 @@ void os::print_context(outputStream *st, void *context) { // point to garbage if entry point in an nmethod is corrupted. Leave // this at the end, and hope for the best. address pc = os::Linux::ucontext_get_pc(uc); - st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); + st->print_cr("Instructions: (pc=" INTPTR_FORMAT ")", p2i(pc)); print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); } @@ -453,7 +453,7 @@ inline static bool checkVerifyOops(address pc, address fault, address* stub) { && pc < MacroAssembler::_verify_oop_implicit_branch[1] ) { *stub = MacroAssembler::_verify_oop_implicit_branch[2]; warning("fixed up memory fault in +VerifyOops at address " - INTPTR_FORMAT, fault); + INTPTR_FORMAT, p2i(fault)); return true; } return false; diff --git a/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp index c3d244d987d..70dc8f0e5d8 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp @@ -36,7 +36,7 @@ static bool detect_niagara() { } while (!feof(fp)) { - if (fscanf(fp, "cpu\t\t: %100[^\n]", &cpu) == 1) { + if (fscanf(fp, "cpu\t\t: %100[^\n]", cpu) == 1) { if (strstr(cpu, "Niagara") != NULL) { rv = true; } From a3b9ebba8d224e1281e32ed93155d69d6520f300 Mon Sep 17 00:00:00 2001 From: Albert Noll Date: Fri, 30 May 2014 06:50:38 +0200 Subject: [PATCH 04/56] 8011646: SEGV in compiled code with loop predication Remove control edge of load node to ensure that castPP removal sets the control edge correctly Reviewed-by: kvn, roland --- hotspot/src/share/vm/opto/library_call.cpp | 50 ++++++------- .../intrinsics/hashcode/TestHashCode.java | 73 +++++++++++++++++++ 2 files changed, 98 insertions(+), 25 deletions(-) create mode 100644 hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 5cf1188435a..8489fcf42c0 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -3985,8 +3985,11 @@ LibraryCallKit::generate_method_call(vmIntrinsics::ID method_id, bool is_virtual } -//------------------------------inline_native_hashcode-------------------- -// Build special case code for calls to hashCode on an object. +/** + * Build special case code for calls to hashCode on an object. This call may + * be virtual (invokevirtual) or bound (invokespecial). For each case we generate + * slightly different code. + */ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) { assert(is_static == callee()->is_static(), "correct intrinsic selection"); assert(!(is_virtual && is_static), "either virtual, special, or static"); @@ -3994,11 +3997,9 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) { enum { _slow_path = 1, _fast_path, _null_path, PATH_LIMIT }; RegionNode* result_reg = new(C) RegionNode(PATH_LIMIT); - PhiNode* result_val = new(C) PhiNode(result_reg, - TypeInt::INT); + PhiNode* result_val = new(C) PhiNode(result_reg, TypeInt::INT); PhiNode* result_io = new(C) PhiNode(result_reg, Type::ABIO); - PhiNode* result_mem = new(C) PhiNode(result_reg, Type::MEMORY, - TypePtr::BOTTOM); + PhiNode* result_mem = new(C) PhiNode(result_reg, Type::MEMORY, TypePtr::BOTTOM); Node* obj = NULL; if (!is_static) { // Check for hashing null object @@ -4024,12 +4025,6 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) { return true; } - // After null check, get the object's klass. - Node* obj_klass = load_object_klass(obj); - - // This call may be virtual (invokevirtual) or bound (invokespecial). - // For each case we generate slightly different code. - // We only go to the fast case code if we pass a number of guards. The // paths which do not pass are accumulated in the slow_region. RegionNode* slow_region = new (C) RegionNode(1); @@ -4042,19 +4037,24 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) { // guard for non-virtual calls -- the caller is known to be the native // Object hashCode(). if (is_virtual) { + // After null check, get the object's klass. + Node* obj_klass = load_object_klass(obj); generate_virtual_guard(obj_klass, slow_region); } // Get the header out of the object, use LoadMarkNode when available Node* header_addr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes()); - Node* header = make_load(control(), header_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered); + // The control of the load must be NULL. Otherwise, the load can move before + // the null check after castPP removal. + Node* no_ctrl = NULL; + Node* header = make_load(no_ctrl, header_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered); // Test the header to see if it is unlocked. - Node *lock_mask = _gvn.MakeConX(markOopDesc::biased_lock_mask_in_place); - Node *lmasked_header = _gvn.transform(new (C) AndXNode(header, lock_mask)); - Node *unlocked_val = _gvn.MakeConX(markOopDesc::unlocked_value); - Node *chk_unlocked = _gvn.transform(new (C) CmpXNode( lmasked_header, unlocked_val)); - Node *test_unlocked = _gvn.transform(new (C) BoolNode( chk_unlocked, BoolTest::ne)); + Node* lock_mask = _gvn.MakeConX(markOopDesc::biased_lock_mask_in_place); + Node* lmasked_header = _gvn.transform(new (C) AndXNode(header, lock_mask)); + Node* unlocked_val = _gvn.MakeConX(markOopDesc::unlocked_value); + Node* chk_unlocked = _gvn.transform(new (C) CmpXNode( lmasked_header, unlocked_val)); + Node* test_unlocked = _gvn.transform(new (C) BoolNode( chk_unlocked, BoolTest::ne)); generate_slow_guard(test_unlocked, slow_region); @@ -4062,19 +4062,19 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) { // We depend on hash_mask being at most 32 bits and avoid the use of // hash_mask_in_place because it could be larger than 32 bits in a 64-bit // vm: see markOop.hpp. - Node *hash_mask = _gvn.intcon(markOopDesc::hash_mask); - Node *hash_shift = _gvn.intcon(markOopDesc::hash_shift); - Node *hshifted_header= _gvn.transform(new (C) URShiftXNode(header, hash_shift)); + Node* hash_mask = _gvn.intcon(markOopDesc::hash_mask); + Node* hash_shift = _gvn.intcon(markOopDesc::hash_shift); + Node* hshifted_header= _gvn.transform(new (C) URShiftXNode(header, hash_shift)); // This hack lets the hash bits live anywhere in the mark object now, as long // as the shift drops the relevant bits into the low 32 bits. Note that // Java spec says that HashCode is an int so there's no point in capturing // an 'X'-sized hashcode (32 in 32-bit build or 64 in 64-bit build). hshifted_header = ConvX2I(hshifted_header); - Node *hash_val = _gvn.transform(new (C) AndINode(hshifted_header, hash_mask)); + Node* hash_val = _gvn.transform(new (C) AndINode(hshifted_header, hash_mask)); - Node *no_hash_val = _gvn.intcon(markOopDesc::no_hash); - Node *chk_assigned = _gvn.transform(new (C) CmpINode( hash_val, no_hash_val)); - Node *test_assigned = _gvn.transform(new (C) BoolNode( chk_assigned, BoolTest::eq)); + Node* no_hash_val = _gvn.intcon(markOopDesc::no_hash); + Node* chk_assigned = _gvn.transform(new (C) CmpINode( hash_val, no_hash_val)); + Node* test_assigned = _gvn.transform(new (C) BoolNode( chk_assigned, BoolTest::eq)); generate_slow_guard(test_assigned, slow_region); diff --git a/hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java b/hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java new file mode 100644 index 00000000000..f7d5450b351 --- /dev/null +++ b/hotspot/test/compiler/intrinsics/hashcode/TestHashCode.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 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. + * + * 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 8011646 + * @summary SEGV in compiled code with loop predication + * @run main/othervm -XX:-TieredCompilation -XX:CompileOnly=TestHashCode.m1,Object.hashCode TestHashCode + * + */ + +public class TestHashCode { + static class A { + int i; + } + + static class B extends A { + } + + static boolean crash = false; + + static A m2() { + if (crash) { + return null; + } + return new A(); + } + + static int m1(A aa) { + int res = 0; + for (int i = 0; i < 10; i++) { + A a = m2(); + int j = a.i; + if (aa instanceof B) { + } + res += a.hashCode(); + } + return res; + } + + public static void main(String[] args) { + A a = new A(); + for (int i = 0; i < 20000; i++) { + m1(a); + } + crash = true; + try { + m1(a); + } catch (NullPointerException e) { + System.out.println("Test passed"); + } + } +} From 1ed4c8394859f6c36e165c4f59a6b5c9fbd793ee Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Fri, 30 May 2014 09:26:48 +0200 Subject: [PATCH 05/56] 8021775: compiler/8009761/Test8009761.java "Failed: init recursive calls: 51. After deopt 50" Reimplemented the test using the Whitebox API to deterministically trigger compilation and deoptimization. Now allowing number of recursive calls to vary by 1. Reviewed-by: twisti, roland, iignatyev --- hotspot/test/TEST.groups | 1 + .../test/compiler/8009761/Test8009761.java | 69 +++++++++++++++---- 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index cd616303ede..8d7427dd313 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -115,6 +115,7 @@ compact3 = \ # Tests that require compact3 API's # needs_compact3 = \ + compiler/8009761/Test8009761.java \ compiler/whitebox/DeoptimizeMethodTest.java \ compiler/whitebox/SetForceInlineMethodTest.java \ compiler/whitebox/SetDontInlineMethodTest.java \ diff --git a/hotspot/test/compiler/8009761/Test8009761.java b/hotspot/test/compiler/8009761/Test8009761.java index 401458b6b92..39a25748348 100644 --- a/hotspot/test/compiler/8009761/Test8009761.java +++ b/hotspot/test/compiler/8009761/Test8009761.java @@ -21,19 +21,27 @@ * questions. */ +import com.sun.management.HotSpotDiagnosticMXBean; +import com.sun.management.VMOption; +import sun.hotspot.WhiteBox; +import sun.management.ManagementFactoryHelper; + +import java.lang.reflect.Method; + /* * @test * @bug 8009761 + * @library /testlibrary /testlibrary/whitebox * @summary Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates - * @run main/othervm -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss256K Test8009761 - * + * @build Test8009761 + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=exclude,Test8009761::m2 -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xss256K Test8009761 */ - public class Test8009761 { - static class UnloadedClass { - volatile int i; - } + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + private static int COMP_LEVEL_FULL_OPTIMIZATION = 4; + private static Method m3 = null; static Object m1(boolean deopt) { // When running interpreted, on sparc, the caller's stack is @@ -142,9 +150,11 @@ public class Test8009761 { ll508, ll509, ll510, ll511; if (deopt) { - UnloadedClass res = new UnloadedClass(); // sufficient to force deopt with c2 but not c1 - res.i = 0; // forces deopt with c1 - return res; + // Force deoptimization of m3 + WHITE_BOX.deoptimizeMethod(m3); + if(WHITE_BOX.isMethodCompiled(m3)) { + throw new RuntimeException(m3 + " not deoptimized"); + } } return null; } @@ -225,6 +235,18 @@ public class Test8009761 { } static public void main(String[] args) { + // Make sure background compilation is disabled + if (backgroundCompilationEnabled()) { + throw new RuntimeException("Background compilation enabled"); + } + + try { + // Get Method object for m3 + m3 = Test8009761.class.getDeclaredMethod("m3", boolean.class, boolean.class); + } catch (NoSuchMethodException | SecurityException ex) { + throw new RuntimeException("Failed to retrieve method m3"); + } + int c1; // Call m2 from m3 recursively until stack overflow. Count the number of recursive calls. try { @@ -232,10 +254,14 @@ public class Test8009761 { } catch(StackOverflowError soe) { } c1 = count; + // Force the compilation of m3() that will inline m1() - for (int i = 0; i < 20000; i++) { - m3(false, false); + WHITE_BOX.enqueueMethodForCompilation(m3, COMP_LEVEL_FULL_OPTIMIZATION); + // Because background compilation is disabled, method should now be compiled + if(!WHITE_BOX.isMethodCompiled(m3)) { + throw new RuntimeException(m3 + " not compiled"); } + count = 0; // Force deoptimization of m3() in m1(), then return from m1() // to m3(), call recursively m2(). If deoptimization correctly @@ -245,11 +271,26 @@ public class Test8009761 { m3(false, true); } catch(StackOverflowError soe) { } - if (c1 != count) { - System.out.println("Failed: init recursive calls: " + c1 + ". After deopt " + count); - System.exit(97); + // Allow number of recursive calls to vary by 1 + if ((c1 < (count - 1)) || (c1 > (count + 1))) { + throw new RuntimeException("Failed: init recursive calls: " + c1 + ". After deopt " + count); } else { System.out.println("PASSED " + c1); } } + + /** + * Checks if background compilation (-XX:+BackgroundCompilation) is enabled. + * @return True if background compilation is enabled, false otherwise + */ + private static boolean backgroundCompilationEnabled() { + HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); + VMOption backgroundCompilation; + try { + backgroundCompilation = diagnostic.getVMOption("BackgroundCompilation"); + } catch (IllegalArgumentException e) { + return false; + } + return Boolean.valueOf(backgroundCompilation.getValue()); + } } From f99eed3f243221a897dbfd9ae1caf07992a493ec Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 30 May 2014 17:20:48 +0400 Subject: [PATCH 06/56] 8038756: new WB API :: get/setVMFlag Reviewed-by: vlivanov, sla --- hotspot/src/share/vm/prims/whitebox.cpp | 180 +++++++++++++++++- hotspot/src/share/vm/runtime/globals.cpp | 24 +-- hotspot/src/share/vm/runtime/globals.hpp | 48 ++--- .../whitebox/sun/hotspot/WhiteBox.java | 15 +- .../whitebox/vm_flags/BooleanTest.java | 87 +++++++++ .../whitebox/vm_flags/DoubleTest.java | 47 +++++ .../whitebox/vm_flags/IntxTest.java | 46 +++++ .../whitebox/vm_flags/StringTest.java | 45 +++++ .../whitebox/vm_flags/Uint64Test.java | 46 +++++ .../whitebox/vm_flags/UintxTest.java | 51 +++++ .../whitebox/vm_flags/VmFlagTest.java | 115 +++++++++++ 11 files changed, 661 insertions(+), 43 deletions(-) create mode 100644 hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java create mode 100644 hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java create mode 100644 hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java create mode 100644 hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java create mode 100644 hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java create mode 100644 hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java create mode 100644 hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index a68ed456899..15f316aa6c2 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -503,6 +503,159 @@ WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method)) } WB_END +template +static bool GetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, bool (*TAt)(const char*, T*)) { + if (name == NULL) { + return false; + } + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + const char* flag_name = env->GetStringUTFChars(name, NULL); + bool result = (*TAt)(flag_name, value); + env->ReleaseStringUTFChars(name, flag_name); + return result; +} + +template +static bool SetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, bool (*TAtPut)(const char*, T*, Flag::Flags)) { + if (name == NULL) { + return false; + } + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + const char* flag_name = env->GetStringUTFChars(name, NULL); + bool result = (*TAtPut)(flag_name, value, Flag::INTERNAL); + env->ReleaseStringUTFChars(name, flag_name); + return result; +} + +template +static jobject box(JavaThread* thread, JNIEnv* env, Symbol* name, Symbol* sig, T value) { + ResourceMark rm(thread); + jclass clazz = env->FindClass(name->as_C_string()); + CHECK_JNI_EXCEPTION_(env, NULL); + jmethodID methodID = env->GetStaticMethodID(clazz, + vmSymbols::valueOf_name()->as_C_string(), + sig->as_C_string()); + CHECK_JNI_EXCEPTION_(env, NULL); + jobject result = env->CallStaticObjectMethod(clazz, methodID, value); + CHECK_JNI_EXCEPTION_(env, NULL); + return result; +} + +static jobject booleanBox(JavaThread* thread, JNIEnv* env, jboolean value) { + return box(thread, env, vmSymbols::java_lang_Boolean(), vmSymbols::Boolean_valueOf_signature(), value); +} +static jobject integerBox(JavaThread* thread, JNIEnv* env, jint value) { + return box(thread, env, vmSymbols::java_lang_Integer(), vmSymbols::Integer_valueOf_signature(), value); +} +static jobject longBox(JavaThread* thread, JNIEnv* env, jlong value) { + return box(thread, env, vmSymbols::java_lang_Long(), vmSymbols::Long_valueOf_signature(), value); +} +/* static jobject floatBox(JavaThread* thread, JNIEnv* env, jfloat value) { + return box(thread, env, vmSymbols::java_lang_Float(), vmSymbols::Float_valueOf_signature(), value); +}*/ +static jobject doubleBox(JavaThread* thread, JNIEnv* env, jdouble value) { + return box(thread, env, vmSymbols::java_lang_Double(), vmSymbols::Double_valueOf_signature(), value); +} + +WB_ENTRY(jobject, WB_GetBooleanVMFlag(JNIEnv* env, jobject o, jstring name)) + bool result; + if (GetVMFlag (thread, env, name, &result, &CommandLineFlags::boolAt)) { + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + return booleanBox(thread, env, result); + } + return NULL; +WB_END + +WB_ENTRY(jobject, WB_GetIntxVMFlag(JNIEnv* env, jobject o, jstring name)) + intx result; + if (GetVMFlag (thread, env, name, &result, &CommandLineFlags::intxAt)) { + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + return longBox(thread, env, result); + } + return NULL; +WB_END + +WB_ENTRY(jobject, WB_GetUintxVMFlag(JNIEnv* env, jobject o, jstring name)) + uintx result; + if (GetVMFlag (thread, env, name, &result, &CommandLineFlags::uintxAt)) { + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + return longBox(thread, env, result); + } + return NULL; +WB_END + +WB_ENTRY(jobject, WB_GetUint64VMFlag(JNIEnv* env, jobject o, jstring name)) + uint64_t result; + if (GetVMFlag (thread, env, name, &result, &CommandLineFlags::uint64_tAt)) { + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + return longBox(thread, env, result); + } + return NULL; +WB_END + +WB_ENTRY(jobject, WB_GetDoubleVMFlag(JNIEnv* env, jobject o, jstring name)) + double result; + if (GetVMFlag (thread, env, name, &result, &CommandLineFlags::doubleAt)) { + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + return doubleBox(thread, env, result); + } + return NULL; +WB_END + +WB_ENTRY(jstring, WB_GetStringVMFlag(JNIEnv* env, jobject o, jstring name)) + ccstr ccstrResult; + if (GetVMFlag (thread, env, name, &ccstrResult, &CommandLineFlags::ccstrAt)) { + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + jstring result = env->NewStringUTF(ccstrResult); + CHECK_JNI_EXCEPTION_(env, NULL); + return result; + } + return NULL; +WB_END + +WB_ENTRY(void, WB_SetBooleanVMFlag(JNIEnv* env, jobject o, jstring name, jboolean value)) + bool result = value == JNI_TRUE ? true : false; + SetVMFlag (thread, env, name, &result, &CommandLineFlags::boolAtPut); +WB_END + +WB_ENTRY(void, WB_SetIntxVMFlag(JNIEnv* env, jobject o, jstring name, jlong value)) + intx result = value; + SetVMFlag (thread, env, name, &result, &CommandLineFlags::intxAtPut); +WB_END + +WB_ENTRY(void, WB_SetUintxVMFlag(JNIEnv* env, jobject o, jstring name, jlong value)) + uintx result = value; + SetVMFlag (thread, env, name, &result, &CommandLineFlags::uintxAtPut); +WB_END + +WB_ENTRY(void, WB_SetUint64VMFlag(JNIEnv* env, jobject o, jstring name, jlong value)) + uint64_t result = value; + SetVMFlag (thread, env, name, &result, &CommandLineFlags::uint64_tAtPut); +WB_END + +WB_ENTRY(void, WB_SetDoubleVMFlag(JNIEnv* env, jobject o, jstring name, jdouble value)) + double result = value; + SetVMFlag (thread, env, name, &result, &CommandLineFlags::doubleAtPut); +WB_END + +WB_ENTRY(void, WB_SetStringVMFlag(JNIEnv* env, jobject o, jstring name, jstring value)) + ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI + const char* ccstrValue = (value == NULL) ? NULL : env->GetStringUTFChars(value, NULL); + ccstr ccstrResult = ccstrValue; + bool needFree; + { + ThreadInVMfromNative ttvfn(thread); // back to VM + needFree = SetVMFlag (thread, env, name, &ccstrResult, &CommandLineFlags::ccstrAtPut); + } + if (value != NULL) { + env->ReleaseStringUTFChars(value, ccstrValue); + } + if (needFree) { + FREE_C_HEAP_ARRAY(char, ccstrResult, mtInternal); + } +WB_END + + WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString)) ResourceMark rm(THREAD); int len; @@ -561,11 +714,7 @@ WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jbo return result; } - clazz = env->FindClass(vmSymbols::java_lang_Integer()->as_C_string()); - CHECK_JNI_EXCEPTION_(env, NULL); - jmethodID constructor = env->GetMethodID(clazz, vmSymbols::object_initializer_name()->as_C_string(), vmSymbols::int_void_signature()->as_C_string()); - CHECK_JNI_EXCEPTION_(env, NULL); - jobject obj = env->NewObject(clazz, constructor, code->comp_level()); + jobject obj = integerBox(thread, env, code->comp_level()); CHECK_JNI_EXCEPTION_(env, NULL); env->SetObjectArrayElement(result, 0, obj); @@ -695,7 +844,26 @@ static JNINativeMethod methods[] = { CC"(Ljava/lang/reflect/Executable;II)Z", (void*)&WB_EnqueueMethodForCompilation}, {CC"clearMethodState", CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_ClearMethodState}, - {CC"isInStringTable", CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable }, + {CC"setBooleanVMFlag", CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag}, + {CC"setIntxVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetIntxVMFlag}, + {CC"setUintxVMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetUintxVMFlag}, + {CC"setUint64VMFlag", CC"(Ljava/lang/String;J)V",(void*)&WB_SetUint64VMFlag}, + {CC"setDoubleVMFlag", CC"(Ljava/lang/String;D)V",(void*)&WB_SetDoubleVMFlag}, + {CC"setStringVMFlag", CC"(Ljava/lang/String;Ljava/lang/String;)V", + (void*)&WB_SetStringVMFlag}, + {CC"getBooleanVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Boolean;", + (void*)&WB_GetBooleanVMFlag}, + {CC"getIntxVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Long;", + (void*)&WB_GetIntxVMFlag}, + {CC"getUintxVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Long;", + (void*)&WB_GetUintxVMFlag}, + {CC"getUint64VMFlag", CC"(Ljava/lang/String;)Ljava/lang/Long;", + (void*)&WB_GetUint64VMFlag}, + {CC"getDoubleVMFlag", CC"(Ljava/lang/String;)Ljava/lang/Double;", + (void*)&WB_GetDoubleVMFlag}, + {CC"getStringVMFlag", CC"(Ljava/lang/String;)Ljava/lang/String;", + (void*)&WB_GetStringVMFlag}, + {CC"isInStringTable", CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable }, {CC"fullGC", CC"()V", (void*)&WB_FullGC }, {CC"readReservedMemory", CC"()V", (void*)&WB_ReadReservedMemory }, {CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures }, diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index 05daec54cf8..928f7134e14 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -611,7 +611,7 @@ static void trace_flag_changed(const char* name, const T old_value, const T new_ e.commit(); } -bool CommandLineFlags::boolAt(char* name, size_t len, bool* value) { +bool CommandLineFlags::boolAt(const char* name, size_t len, bool* value) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_bool()) return false; @@ -619,7 +619,7 @@ bool CommandLineFlags::boolAt(char* name, size_t len, bool* value) { return true; } -bool CommandLineFlags::boolAtPut(char* name, size_t len, bool* value, Flag::Flags origin) { +bool CommandLineFlags::boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_bool()) return false; @@ -639,7 +639,7 @@ void CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, Fla faddr->set_origin(origin); } -bool CommandLineFlags::intxAt(char* name, size_t len, intx* value) { +bool CommandLineFlags::intxAt(const char* name, size_t len, intx* value) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_intx()) return false; @@ -647,7 +647,7 @@ bool CommandLineFlags::intxAt(char* name, size_t len, intx* value) { return true; } -bool CommandLineFlags::intxAtPut(char* name, size_t len, intx* value, Flag::Flags origin) { +bool CommandLineFlags::intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_intx()) return false; @@ -667,7 +667,7 @@ void CommandLineFlagsEx::intxAtPut(CommandLineFlagWithType flag, intx value, Fla faddr->set_origin(origin); } -bool CommandLineFlags::uintxAt(char* name, size_t len, uintx* value) { +bool CommandLineFlags::uintxAt(const char* name, size_t len, uintx* value) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_uintx()) return false; @@ -675,7 +675,7 @@ bool CommandLineFlags::uintxAt(char* name, size_t len, uintx* value) { return true; } -bool CommandLineFlags::uintxAtPut(char* name, size_t len, uintx* value, Flag::Flags origin) { +bool CommandLineFlags::uintxAtPut(const char* name, size_t len, uintx* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_uintx()) return false; @@ -695,7 +695,7 @@ void CommandLineFlagsEx::uintxAtPut(CommandLineFlagWithType flag, uintx value, F faddr->set_origin(origin); } -bool CommandLineFlags::uint64_tAt(char* name, size_t len, uint64_t* value) { +bool CommandLineFlags::uint64_tAt(const char* name, size_t len, uint64_t* value) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_uint64_t()) return false; @@ -703,7 +703,7 @@ bool CommandLineFlags::uint64_tAt(char* name, size_t len, uint64_t* value) { return true; } -bool CommandLineFlags::uint64_tAtPut(char* name, size_t len, uint64_t* value, Flag::Flags origin) { +bool CommandLineFlags::uint64_tAtPut(const char* name, size_t len, uint64_t* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_uint64_t()) return false; @@ -723,7 +723,7 @@ void CommandLineFlagsEx::uint64_tAtPut(CommandLineFlagWithType flag, uint64_t va faddr->set_origin(origin); } -bool CommandLineFlags::doubleAt(char* name, size_t len, double* value) { +bool CommandLineFlags::doubleAt(const char* name, size_t len, double* value) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_double()) return false; @@ -731,7 +731,7 @@ bool CommandLineFlags::doubleAt(char* name, size_t len, double* value) { return true; } -bool CommandLineFlags::doubleAtPut(char* name, size_t len, double* value, Flag::Flags origin) { +bool CommandLineFlags::doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_double()) return false; @@ -751,7 +751,7 @@ void CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, faddr->set_origin(origin); } -bool CommandLineFlags::ccstrAt(char* name, size_t len, ccstr* value) { +bool CommandLineFlags::ccstrAt(const char* name, size_t len, ccstr* value) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_ccstr()) return false; @@ -759,7 +759,7 @@ bool CommandLineFlags::ccstrAt(char* name, size_t len, ccstr* value) { return true; } -bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin) { +bool CommandLineFlags::ccstrAtPut(const char* name, size_t len, ccstr* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; if (!result->is_ccstr()) return false; diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 9952ad96bb7..b0a342c1352 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -362,37 +362,37 @@ class DoubleFlagSetting { class CommandLineFlags { public: - static bool boolAt(char* name, size_t len, bool* value); - static bool boolAt(char* name, bool* value) { return boolAt(name, strlen(name), value); } - static bool boolAtPut(char* name, size_t len, bool* value, Flag::Flags origin); - static bool boolAtPut(char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); } + static bool boolAt(const char* name, size_t len, bool* value); + static bool boolAt(const char* name, bool* value) { return boolAt(name, strlen(name), value); } + static bool boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin); + static bool boolAtPut(const char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); } - static bool intxAt(char* name, size_t len, intx* value); - static bool intxAt(char* name, intx* value) { return intxAt(name, strlen(name), value); } - static bool intxAtPut(char* name, size_t len, intx* value, Flag::Flags origin); - static bool intxAtPut(char* name, intx* value, Flag::Flags origin) { return intxAtPut(name, strlen(name), value, origin); } + static bool intxAt(const char* name, size_t len, intx* value); + static bool intxAt(const char* name, intx* value) { return intxAt(name, strlen(name), value); } + static bool intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin); + static bool intxAtPut(const char* name, intx* value, Flag::Flags origin) { return intxAtPut(name, strlen(name), value, origin); } - static bool uintxAt(char* name, size_t len, uintx* value); - static bool uintxAt(char* name, uintx* value) { return uintxAt(name, strlen(name), value); } - static bool uintxAtPut(char* name, size_t len, uintx* value, Flag::Flags origin); - static bool uintxAtPut(char* name, uintx* value, Flag::Flags origin) { return uintxAtPut(name, strlen(name), value, origin); } + static bool uintxAt(const char* name, size_t len, uintx* value); + static bool uintxAt(const char* name, uintx* value) { return uintxAt(name, strlen(name), value); } + static bool uintxAtPut(const char* name, size_t len, uintx* value, Flag::Flags origin); + static bool uintxAtPut(const char* name, uintx* value, Flag::Flags origin) { return uintxAtPut(name, strlen(name), value, origin); } - static bool uint64_tAt(char* name, size_t len, uint64_t* value); - static bool uint64_tAt(char* name, uint64_t* value) { return uint64_tAt(name, strlen(name), value); } - static bool uint64_tAtPut(char* name, size_t len, uint64_t* value, Flag::Flags origin); - static bool uint64_tAtPut(char* name, uint64_t* value, Flag::Flags origin) { return uint64_tAtPut(name, strlen(name), value, origin); } + static bool uint64_tAt(const char* name, size_t len, uint64_t* value); + static bool uint64_tAt(const char* name, uint64_t* value) { return uint64_tAt(name, strlen(name), value); } + static bool uint64_tAtPut(const char* name, size_t len, uint64_t* value, Flag::Flags origin); + static bool uint64_tAtPut(const char* name, uint64_t* value, Flag::Flags origin) { return uint64_tAtPut(name, strlen(name), value, origin); } - static bool doubleAt(char* name, size_t len, double* value); - static bool doubleAt(char* name, double* value) { return doubleAt(name, strlen(name), value); } - static bool doubleAtPut(char* name, size_t len, double* value, Flag::Flags origin); - static bool doubleAtPut(char* name, double* value, Flag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); } + static bool doubleAt(const char* name, size_t len, double* value); + static bool doubleAt(const char* name, double* value) { return doubleAt(name, strlen(name), value); } + static bool doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin); + static bool doubleAtPut(const char* name, double* value, Flag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); } - static bool ccstrAt(char* name, size_t len, ccstr* value); - static bool ccstrAt(char* name, ccstr* value) { return ccstrAt(name, strlen(name), value); } + static bool ccstrAt(const char* name, size_t len, ccstr* value); + static bool ccstrAt(const char* name, ccstr* value) { return ccstrAt(name, strlen(name), value); } // Contract: Flag will make private copy of the incoming value. // Outgoing value is always malloc-ed, and caller MUST call free. - static bool ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin); - static bool ccstrAtPut(char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); } + static bool ccstrAtPut(const char* name, size_t len, ccstr* value, Flag::Flags origin); + static bool ccstrAtPut(const char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); } // Returns false if name is not a command line flag. static bool wasSetOnCmdline(const char* name, bool* value); diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java index a959900459a..8c817182e4c 100644 --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java +++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java @@ -129,7 +129,7 @@ public class WhiteBox { } public native int getCompileQueueSize(int compLevel); public native boolean testSetForceInlineMethod(Executable method, boolean value); - public boolean enqueueMethodForCompilation(Executable method, int compLevel) { + public boolean enqueueMethodForCompilation(Executable method, int compLevel) { return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/); } public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci); @@ -156,4 +156,17 @@ public class WhiteBox { // CPU features public native String getCPUFeatures(); + // VM flags + public native void setBooleanVMFlag(String name, boolean value); + public native void setIntxVMFlag(String name, long value); + public native void setUintxVMFlag(String name, long value); + public native void setUint64VMFlag(String name, long value); + public native void setStringVMFlag(String name, String value); + public native void setDoubleVMFlag(String name, double value); + public native Boolean getBooleanVMFlag(String name); + public native Long getIntxVMFlag(String name); + public native Long getUintxVMFlag(String name); + public native Long getUint64VMFlag(String name); + public native String getStringVMFlag(String name); + public native Double getDoubleVMFlag(String name); } diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java new file mode 100644 index 00000000000..cf313c37962 --- /dev/null +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 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. + * + * 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 BooleanTest + * @bug 8028756 + * @library /testlibrary /testlibrary/whitebox + * @build BooleanTest + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BooleanTest + * @summary testing of WB::set/getBooleanVMFlag() + * @author igor.ignatyev@oracle.com + */ + +import sun.hotspot.WhiteBox; +import com.oracle.java.testlibrary.*; +import sun.management.*; +import com.sun.management.*; + +public class BooleanTest { + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + private static final Boolean[] TESTS = {true, false, true, true, false}; + private static final String TEST_NAME = "BooleanTest"; + private static final String FLAG_NAME = "PrintCompilation"; + private static final String METHOD = TEST_NAME + "::method"; + private static final String METHOD1 = METHOD + "1"; + private static final String METHOD2 = METHOD + "2"; + + public static void main(String[] args) throws Exception { + if (args.length == 0) { + VmFlagTest.runTest(FLAG_NAME, TESTS, + VmFlagTest.WHITE_BOX::setBooleanVMFlag, + VmFlagTest.WHITE_BOX::getBooleanVMFlag); + testFunctional(false); + testFunctional(true); + } else { + boolean value = Boolean.valueOf(args[0]); + method1(); + VmFlagTest.WHITE_BOX.setBooleanVMFlag(FLAG_NAME, value); + method2(); + } + } + + private static void testFunctional(boolean value) throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Xbootclasspath/a:.", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+WhiteBoxAPI", + "-Xcomp", + "-XX:CompileCommand=compileonly," + METHOD + "*", + "-XX:" + (value ? "-" : "+") + FLAG_NAME, + TEST_NAME, + "" + value); + OutputAnalyzer out = new OutputAnalyzer(pb.start()); + if (value) { + out.shouldNotContain(METHOD1); + out.shouldContain(METHOD2); + } else { + out.shouldContain(METHOD1); + out.shouldNotContain(METHOD2); + } + } + + private static void method1() { } + private static void method2() { } +} + diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java new file mode 100644 index 00000000000..2110fb9d7a7 --- /dev/null +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 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. + * + * 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 DoubleTest + * @bug 8028756 + * @library /testlibrary /testlibrary/whitebox + * @build DoubleTest + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI DoubleTest + * @summary testing of WB::set/getDoubleVMFlag() + * @author igor.ignatyev@oracle.com + */ + +public class DoubleTest { + private static final String FLAG_NAME = null; + private static final Double[] TESTS = {0d, -0d, -1d, 1d, + Double.MAX_VALUE, Double.MIN_VALUE, Double.NaN, + Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY}; + + public static void main(String[] args) throws Exception { + VmFlagTest.runTest(FLAG_NAME, TESTS, + VmFlagTest.WHITE_BOX::setDoubleVMFlag, + VmFlagTest.WHITE_BOX::getDoubleVMFlag); + } +} + diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java new file mode 100644 index 00000000000..6ffbd832611 --- /dev/null +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 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. + * + * 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 IntxTest + * @bug 8028756 + * @library /testlibrary /testlibrary/whitebox + * @build IntxTest + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI IntxTest + * @summary testing of WB::set/getIntxVMFlag() + * @author igor.ignatyev@oracle.com + */ + +public class IntxTest { + private static final String FLAG_NAME = "OnStackReplacePercentage"; + private static final Long[] TESTS = {0L, 100L, -1L, + (long) Integer.MAX_VALUE, (long) Integer.MIN_VALUE}; + + public static void main(String[] args) throws Exception { + VmFlagTest.runTest(FLAG_NAME, TESTS, + VmFlagTest.WHITE_BOX::setIntxVMFlag, + VmFlagTest.WHITE_BOX::getIntxVMFlag); + } +} + diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java new file mode 100644 index 00000000000..70aa0664c54 --- /dev/null +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 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. + * + * 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 StringTest + * @bug 8028756 + * @library /testlibrary /testlibrary/whitebox + * @build StringTest + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI StringTest + * @summary testing of WB::set/getStringVMFlag() + * @author igor.ignatyev@oracle.com + */ + +public class StringTest { + private static final String FLAG_NAME = "CompileOnly"; + private static final String[] TESTS = {"StringTest::*", ""}; + + public static void main(String[] args) throws Exception { + VmFlagTest.runTest(FLAG_NAME, TESTS, + VmFlagTest.WHITE_BOX::setStringVMFlag, + VmFlagTest.WHITE_BOX::getStringVMFlag); + } +} + diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java new file mode 100644 index 00000000000..2f616d45507 --- /dev/null +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 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. + * + * 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 Uint64Test + * @bug 8028756 + * @library /testlibrary /testlibrary/whitebox + * @build Uint64Test + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI Uint64Test + * @summary testing of WB::set/getUint64VMFlag() + * @author igor.ignatyev@oracle.com + */ + +public class Uint64Test { + private static final String FLAG_NAME = "MaxRAM"; + private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE, + -1L, Long.MAX_VALUE, Long.MIN_VALUE}; + + public static void main(String[] args) throws Exception { + VmFlagTest.runTest(FLAG_NAME, TESTS, + VmFlagTest.WHITE_BOX::setUint64VMFlag, + VmFlagTest.WHITE_BOX::getUint64VMFlag); + } +} + diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java new file mode 100644 index 00000000000..688962f0267 --- /dev/null +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 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. + * + * 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 UintxTest + * @bug 8028756 + * @library /testlibrary /testlibrary/whitebox + * @build UintxTest + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI UintxTest + * @summary testing of WB::set/getUintxVMFlag() + * @author igor.ignatyev@oracle.com + */ +import com.oracle.java.testlibrary.Platform; + +public class UintxTest { + private static final String FLAG_NAME = "TypeProfileLevel"; + private static final Long[] TESTS = {0L, 100L, (long) Integer.MAX_VALUE, + (1L << 32L) - 1L, 1L << 32L}; + private static final Long[] EXPECTED_64 = TESTS; + private static final Long[] EXPECTED_32 = {0L, 100L, + (long) Integer.MAX_VALUE, (1L << 32L) - 1L, 0L}; + + public static void main(String[] args) throws Exception { + VmFlagTest.runTest(FLAG_NAME, TESTS, + Platform.is64bit() ? EXPECTED_64 : EXPECTED_32, + VmFlagTest.WHITE_BOX::setUintxVMFlag, + VmFlagTest.WHITE_BOX::getUintxVMFlag); + } +} + diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java new file mode 100644 index 00000000000..fa8915f3a49 --- /dev/null +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/VmFlagTest.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 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. + * + * 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. + */ + +import java.util.Objects; +import java.util.function.BiConsumer; +import java.util.function.Function; +import sun.hotspot.WhiteBox; +import sun.management.*; +import com.sun.management.*; +import com.oracle.java.testlibrary.*; + +public final class VmFlagTest { + public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + + private static final String NONEXISTENT_FLAG = "NonexistentFlag"; + private final String flagName; + private final BiConsumer test; + private final BiConsumer set; + private final Function get; + + protected VmFlagTest(String flagName, BiConsumer set, + Function get, boolean isPositive) { + this.flagName = flagName; + this.set = set; + this.get = get; + if (isPositive) { + test = this::testPositive; + } else { + test = this::testNegative; + } + } + + private void setNewValue(T value) { + set.accept(flagName, value); + } + + private T getValue() { + T t = get.apply(flagName); + System.out.println("T = " + t); + return t; + } + + protected static void runTest(String existentFlag, T[] tests, + BiConsumer set, Function get) { + runTest(existentFlag, tests, tests, set, get); + } + + protected static void runTest(String existentFlag, T[] tests, + T[] results, BiConsumer set, Function get) { + if (existentFlag != null) { + new VmFlagTest(existentFlag, set, get, true).test(tests, results); + } + new VmFlagTest(NONEXISTENT_FLAG, set, get, false).test(tests, results); + } + + public final void test(T[] tests, T[] results) { + Asserts.assertEQ(tests.length, results.length, "[TESTBUG] tests.length != results.length"); + for (int i = 0, n = tests.length ; i < n; ++i) { + test.accept(tests[i], results[i]); + } + } + + protected String getVMOptionAsString() { + HotSpotDiagnosticMXBean diagnostic + = ManagementFactoryHelper.getDiagnosticMXBean(); + VMOption tmp; + try { + tmp = diagnostic.getVMOption(flagName); + } catch (IllegalArgumentException e) { + tmp = null; + } + return tmp == null ? null : tmp.getValue(); + } + + private void testPositive(T value, T expected) { + Asserts.assertEQ(getVMOptionAsString(), asString(getValue())); + setNewValue(value); + String newValue = getVMOptionAsString(); + Asserts.assertEQ(newValue, asString(expected)); + Asserts.assertEQ(getVMOptionAsString(), asString(getValue())); + } + + private void testNegative(T value, T expected) { + String oldValue = getVMOptionAsString(); + Asserts.assertEQ(oldValue, asString(getValue())); + setNewValue(value); + String newValue = getVMOptionAsString(); + Asserts.assertEQ(oldValue, newValue); + } + + private String asString(Object value) { + return value == null ? null : "" + value; + } +} + From 2a0815a55e21ead2657cd08f36eee5e3c55366c8 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Mon, 2 Jun 2014 08:07:29 +0200 Subject: [PATCH 07/56] 8034812: remove IDX_INIT macro hack in Node class The IDX_INIT macro used by Node::Node(...) to retrieve the Compile object is removed and replaced by a call to Compile::current(). The Node constructor, new operator and all calls to it are adapted accordingly. Reviewed-by: kvn, jrose, iveresov, goetz --- hotspot/src/cpu/ppc/vm/ppc.ad | 188 +++--- hotspot/src/cpu/x86/vm/x86_32.ad | 12 +- hotspot/src/share/vm/adlc/output_c.cpp | 36 +- hotspot/src/share/vm/opto/addnode.cpp | 64 +- hotspot/src/share/vm/opto/block.cpp | 6 +- hotspot/src/share/vm/opto/callGenerator.cpp | 14 +- hotspot/src/share/vm/opto/callnode.cpp | 22 +- hotspot/src/share/vm/opto/castnode.cpp | 8 +- hotspot/src/share/vm/opto/cfgnode.cpp | 60 +- hotspot/src/share/vm/opto/chaitin.cpp | 4 +- hotspot/src/share/vm/opto/coalesce.cpp | 6 +- hotspot/src/share/vm/opto/compile.cpp | 26 +- hotspot/src/share/vm/opto/connode.cpp | 22 +- hotspot/src/share/vm/opto/connode.hpp | 12 +- hotspot/src/share/vm/opto/convertnode.cpp | 14 +- hotspot/src/share/vm/opto/divnode.cpp | 168 +++--- hotspot/src/share/vm/opto/doCall.cpp | 14 +- .../src/share/vm/opto/generateOptoStub.cpp | 75 ++- hotspot/src/share/vm/opto/graphKit.cpp | 254 ++++---- hotspot/src/share/vm/opto/graphKit.hpp | 42 +- hotspot/src/share/vm/opto/idealKit.cpp | 20 +- hotspot/src/share/vm/opto/idealKit.hpp | 34 +- hotspot/src/share/vm/opto/ifnode.cpp | 52 +- hotspot/src/share/vm/opto/lcm.cpp | 8 +- hotspot/src/share/vm/opto/library_call.cpp | 559 +++++++++--------- hotspot/src/share/vm/opto/loopPredicate.cpp | 30 +- hotspot/src/share/vm/opto/loopTransform.cpp | 142 ++--- hotspot/src/share/vm/opto/loopUnswitch.cpp | 10 +- hotspot/src/share/vm/opto/loopnode.cpp | 110 ++-- hotspot/src/share/vm/opto/loopopts.cpp | 46 +- hotspot/src/share/vm/opto/machnode.hpp | 5 +- hotspot/src/share/vm/opto/macro.cpp | 225 ++++--- hotspot/src/share/vm/opto/macro.hpp | 2 +- hotspot/src/share/vm/opto/matcher.cpp | 44 +- hotspot/src/share/vm/opto/memnode.cpp | 142 ++--- hotspot/src/share/vm/opto/movenode.cpp | 26 +- hotspot/src/share/vm/opto/mulnode.cpp | 132 ++--- hotspot/src/share/vm/opto/node.cpp | 45 +- hotspot/src/share/vm/opto/node.hpp | 8 +- hotspot/src/share/vm/opto/output.cpp | 26 +- hotspot/src/share/vm/opto/parse1.cpp | 80 +-- hotspot/src/share/vm/opto/parse2.cpp | 210 +++---- hotspot/src/share/vm/opto/parse3.cpp | 4 +- hotspot/src/share/vm/opto/parseHelper.cpp | 24 +- hotspot/src/share/vm/opto/phaseX.cpp | 6 +- hotspot/src/share/vm/opto/reg_split.cpp | 8 +- hotspot/src/share/vm/opto/split_if.cpp | 2 +- hotspot/src/share/vm/opto/stringopts.cpp | 42 +- hotspot/src/share/vm/opto/subnode.cpp | 96 +-- hotspot/src/share/vm/opto/superword.cpp | 34 +- hotspot/src/share/vm/opto/vectornode.cpp | 126 ++-- 51 files changed, 1659 insertions(+), 1686 deletions(-) diff --git a/hotspot/src/cpu/ppc/vm/ppc.ad b/hotspot/src/cpu/ppc/vm/ppc.ad index 214ea62029b..d2d51379a22 100644 --- a/hotspot/src/cpu/ppc/vm/ppc.ad +++ b/hotspot/src/cpu/ppc/vm/ppc.ad @@ -1285,9 +1285,9 @@ bool MachConstantBaseNode::requires_postalloc_expand() const { return true; } void MachConstantBaseNode::postalloc_expand(GrowableArray *nodes, PhaseRegAlloc *ra_) { Compile *C = ra_->C; - iRegPdstOper *op_dst = new (C) iRegPdstOper(); - MachNode *m1 = new (C) loadToc_hiNode(); - MachNode *m2 = new (C) loadToc_loNode(); + iRegPdstOper *op_dst = new iRegPdstOper(); + MachNode *m1 = new loadToc_hiNode(); + MachNode *m2 = new loadToc_loNode(); m1->add_req(NULL); m2->add_req(NULL, m1); @@ -2232,9 +2232,9 @@ const bool Matcher::isSimpleConstant64(jlong value) { MachTypeNode *Matcher::make_decode_node(Compile *C) { assert(Universe::narrow_oop_base() == NULL && Universe::narrow_oop_shift() == 0, "This method is only implemented for unscaled cOops mode so far"); - MachTypeNode *decode = new (C) decodeN_unscaledNode(); - decode->set_opnd_array(0, new (C) iRegPdstOper()); - decode->set_opnd_array(1, new (C) iRegNsrcOper()); + MachTypeNode *decode = new decodeN_unscaledNode(); + decode->set_opnd_array(0, new iRegPdstOper()); + decode->set_opnd_array(1, new iRegNsrcOper()); return decode; } */ @@ -2600,20 +2600,20 @@ loadConLNodesTuple loadConLNodesTuple_create(Compile *C, PhaseRegAlloc *ra_, Nod const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000; if (large_constant_pool) { // Create new nodes. - loadConL_hiNode *m1 = new (C) loadConL_hiNode(); - loadConL_loNode *m2 = new (C) loadConL_loNode(); + loadConL_hiNode *m1 = new loadConL_hiNode(); + loadConL_loNode *m2 = new loadConL_loNode(); // inputs for new nodes m1->add_req(NULL, toc); m2->add_req(NULL, m1); // operands for new nodes - m1->_opnds[0] = new (C) iRegLdstOper(); // dst - m1->_opnds[1] = immSrc; // src - m1->_opnds[2] = new (C) iRegPdstOper(); // toc - m2->_opnds[0] = new (C) iRegLdstOper(); // dst - m2->_opnds[1] = immSrc; // src - m2->_opnds[2] = new (C) iRegLdstOper(); // base + m1->_opnds[0] = new iRegLdstOper(); // dst + m1->_opnds[1] = immSrc; // src + m1->_opnds[2] = new iRegPdstOper(); // toc + m2->_opnds[0] = new iRegLdstOper(); // dst + m2->_opnds[1] = immSrc; // src + m2->_opnds[2] = new iRegLdstOper(); // base // Initialize ins_attrib TOC fields. m1->_const_toc_offset = -1; @@ -2633,15 +2633,15 @@ loadConLNodesTuple loadConLNodesTuple_create(Compile *C, PhaseRegAlloc *ra_, Nod nodes._last = nodes._large_lo; assert(m2->bottom_type()->isa_long(), "must be long"); } else { - loadConLNode *m2 = new (C) loadConLNode(); + loadConLNode *m2 = new loadConLNode(); // inputs for new nodes m2->add_req(NULL, toc); // operands for new nodes - m2->_opnds[0] = new (C) iRegLdstOper(); // dst - m2->_opnds[1] = immSrc; // src - m2->_opnds[2] = new (C) iRegPdstOper(); // toc + m2->_opnds[0] = new iRegLdstOper(); // dst + m2->_opnds[1] = immSrc; // src + m2->_opnds[2] = new iRegPdstOper(); // toc // Initialize ins_attrib instruction offset. m2->_cbuf_insts_offset = -1; @@ -2750,20 +2750,20 @@ encode %{ const bool large_constant_pool = true; // TODO: PPC port C->cfg()->_consts_size > 4000; if (large_constant_pool) { // Create new nodes. - loadConP_hiNode *m1 = new (C) loadConP_hiNode(); - loadConP_loNode *m2 = new (C) loadConP_loNode(); + loadConP_hiNode *m1 = new loadConP_hiNode(); + loadConP_loNode *m2 = new loadConP_loNode(); // inputs for new nodes m1->add_req(NULL, n_toc); m2->add_req(NULL, m1); // operands for new nodes - m1->_opnds[0] = new (C) iRegPdstOper(); // dst - m1->_opnds[1] = op_src; // src - m1->_opnds[2] = new (C) iRegPdstOper(); // toc - m2->_opnds[0] = new (C) iRegPdstOper(); // dst - m2->_opnds[1] = op_src; // src - m2->_opnds[2] = new (C) iRegLdstOper(); // base + m1->_opnds[0] = new iRegPdstOper(); // dst + m1->_opnds[1] = op_src; // src + m1->_opnds[2] = new iRegPdstOper(); // toc + m2->_opnds[0] = new iRegPdstOper(); // dst + m2->_opnds[1] = op_src; // src + m2->_opnds[2] = new iRegLdstOper(); // base // Initialize ins_attrib TOC fields. m1->_const_toc_offset = -1; @@ -2777,15 +2777,15 @@ encode %{ nodes->push(m2); assert(m2->bottom_type()->isa_ptr(), "must be ptr"); } else { - loadConPNode *m2 = new (C) loadConPNode(); + loadConPNode *m2 = new loadConPNode(); // inputs for new nodes m2->add_req(NULL, n_toc); // operands for new nodes - m2->_opnds[0] = new (C) iRegPdstOper(); // dst - m2->_opnds[1] = op_src; // src - m2->_opnds[2] = new (C) iRegPdstOper(); // toc + m2->_opnds[0] = new iRegPdstOper(); // dst + m2->_opnds[1] = op_src; // src + m2->_opnds[2] = new iRegPdstOper(); // toc // Register allocation for new nodes. ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); @@ -2802,9 +2802,9 @@ encode %{ MachNode *m2; if (large_constant_pool) { - m2 = new (C) loadConFCompNode(); + m2 = new loadConFCompNode(); } else { - m2 = new (C) loadConFNode(); + m2 = new loadConFNode(); } // inputs for new nodes m2->add_req(NULL, n_toc); @@ -2812,7 +2812,7 @@ encode %{ // operands for new nodes m2->_opnds[0] = op_dst; m2->_opnds[1] = op_src; - m2->_opnds[2] = new (C) iRegPdstOper(); // constanttablebase + m2->_opnds[2] = new iRegPdstOper(); // constanttablebase // register allocation for new nodes ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); @@ -2826,9 +2826,9 @@ encode %{ MachNode *m2; if (large_constant_pool) { - m2 = new (C) loadConDCompNode(); + m2 = new loadConDCompNode(); } else { - m2 = new (C) loadConDNode(); + m2 = new loadConDNode(); } // inputs for new nodes m2->add_req(NULL, n_toc); @@ -2836,7 +2836,7 @@ encode %{ // operands for new nodes m2->_opnds[0] = op_dst; m2->_opnds[1] = op_src; - m2->_opnds[2] = new (C) iRegPdstOper(); // constanttablebase + m2->_opnds[2] = new iRegPdstOper(); // constanttablebase // register allocation for new nodes ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this)); @@ -2918,15 +2918,15 @@ encode %{ if (VM_Version::has_isel()) { // use isel instruction with Power 7 - cmpP_reg_imm16Node *n_compare = new (C) cmpP_reg_imm16Node(); - encodeP_subNode *n_sub_base = new (C) encodeP_subNode(); - encodeP_shiftNode *n_shift = new (C) encodeP_shiftNode(); - cond_set_0_oopNode *n_cond_set = new (C) cond_set_0_oopNode(); + cmpP_reg_imm16Node *n_compare = new cmpP_reg_imm16Node(); + encodeP_subNode *n_sub_base = new encodeP_subNode(); + encodeP_shiftNode *n_shift = new encodeP_shiftNode(); + cond_set_0_oopNode *n_cond_set = new cond_set_0_oopNode(); n_compare->add_req(n_region, n_src); n_compare->_opnds[0] = op_crx; n_compare->_opnds[1] = op_src; - n_compare->_opnds[2] = new (C) immL16Oper(0); + n_compare->_opnds[2] = new immL16Oper(0); n_sub_base->add_req(n_region, n_src); n_sub_base->_opnds[0] = op_dst; @@ -2956,10 +2956,10 @@ encode %{ } else { // before Power 7 - moveRegNode *n_move = new (C) moveRegNode(); - cmpP_reg_imm16Node *n_compare = new (C) cmpP_reg_imm16Node(); - encodeP_shiftNode *n_shift = new (C) encodeP_shiftNode(); - cond_sub_baseNode *n_sub_base = new (C) cond_sub_baseNode(); + moveRegNode *n_move = new moveRegNode(); + cmpP_reg_imm16Node *n_compare = new cmpP_reg_imm16Node(); + encodeP_shiftNode *n_shift = new encodeP_shiftNode(); + cond_sub_baseNode *n_sub_base = new cond_sub_baseNode(); n_move->add_req(n_region, n_src); n_move->_opnds[0] = op_dst; @@ -2971,7 +2971,7 @@ encode %{ n_compare->_opnds[0] = op_crx; n_compare->_opnds[1] = op_src; - n_compare->_opnds[2] = new (C) immL16Oper(0); + n_compare->_opnds[2] = new immL16Oper(0); n_sub_base->add_req(n_region, n_compare, n_src); n_sub_base->_opnds[0] = op_dst; @@ -3000,13 +3000,13 @@ encode %{ enc_class postalloc_expand_encode_oop_not_null(iRegNdst dst, iRegPdst src) %{ - encodeP_subNode *n1 = new (C) encodeP_subNode(); + encodeP_subNode *n1 = new encodeP_subNode(); n1->add_req(n_region, n_src); n1->_opnds[0] = op_dst; n1->_opnds[1] = op_src; n1->_bottom_type = _bottom_type; - encodeP_shiftNode *n2 = new (C) encodeP_shiftNode(); + encodeP_shiftNode *n2 = new encodeP_shiftNode(); n2->add_req(n_region, n1); n2->_opnds[0] = op_dst; n2->_opnds[1] = op_dst; @@ -3020,13 +3020,13 @@ encode %{ %} enc_class postalloc_expand_decode_oop(iRegPdst dst, iRegNsrc src, flagsReg crx) %{ - decodeN_shiftNode *n_shift = new (C) decodeN_shiftNode(); - cmpN_reg_imm0Node *n_compare = new (C) cmpN_reg_imm0Node(); + decodeN_shiftNode *n_shift = new decodeN_shiftNode(); + cmpN_reg_imm0Node *n_compare = new cmpN_reg_imm0Node(); n_compare->add_req(n_region, n_src); n_compare->_opnds[0] = op_crx; n_compare->_opnds[1] = op_src; - n_compare->_opnds[2] = new (C) immN_0Oper(TypeNarrowOop::NULL_PTR); + n_compare->_opnds[2] = new immN_0Oper(TypeNarrowOop::NULL_PTR); n_shift->add_req(n_region, n_src); n_shift->_opnds[0] = op_dst; @@ -3036,13 +3036,13 @@ encode %{ if (VM_Version::has_isel()) { // use isel instruction with Power 7 - decodeN_addNode *n_add_base = new (C) decodeN_addNode(); + decodeN_addNode *n_add_base = new decodeN_addNode(); n_add_base->add_req(n_region, n_shift); n_add_base->_opnds[0] = op_dst; n_add_base->_opnds[1] = op_dst; n_add_base->_bottom_type = _bottom_type; - cond_set_0_ptrNode *n_cond_set = new (C) cond_set_0_ptrNode(); + cond_set_0_ptrNode *n_cond_set = new cond_set_0_ptrNode(); n_cond_set->add_req(n_region, n_compare, n_add_base); n_cond_set->_opnds[0] = op_dst; n_cond_set->_opnds[1] = op_crx; @@ -3064,7 +3064,7 @@ encode %{ } else { // before Power 7 - cond_add_baseNode *n_add_base = new (C) cond_add_baseNode(); + cond_add_baseNode *n_add_base = new cond_add_baseNode(); n_add_base->add_req(n_region, n_compare, n_shift); n_add_base->_opnds[0] = op_dst; @@ -3086,13 +3086,13 @@ encode %{ %} enc_class postalloc_expand_decode_oop_not_null(iRegPdst dst, iRegNsrc src) %{ - decodeN_shiftNode *n1 = new (C) decodeN_shiftNode(); + decodeN_shiftNode *n1 = new decodeN_shiftNode(); n1->add_req(n_region, n_src); n1->_opnds[0] = op_dst; n1->_opnds[1] = op_src; n1->_bottom_type = _bottom_type; - decodeN_addNode *n2 = new (C) decodeN_addNode(); + decodeN_addNode *n2 = new decodeN_addNode(); n2->add_req(n_region, n1); n2->_opnds[0] = op_dst; n2->_opnds[1] = op_dst; @@ -3388,7 +3388,7 @@ encode %{ // Create new nodes. // Make an operand with the bit pattern to load as float. - immLOper *op_repl = new (C) immLOper((jlong)replicate_immF(op_src->constantF())); + immLOper *op_repl = new immLOper((jlong)replicate_immF(op_src->constantF())); loadConLNodesTuple loadConLNodes = loadConLNodesTuple_create(C, ra_, n_toc, op_repl, @@ -3611,11 +3611,11 @@ encode %{ // Create the nodes for loading the IC from the TOC. loadConLNodesTuple loadConLNodes_IC = - loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong)Universe::non_oop_word()), + loadConLNodesTuple_create(C, ra_, n_toc, new immLOper((jlong)Universe::non_oop_word()), OptoReg::Name(R19_H_num), OptoReg::Name(R19_num)); // Create the call node. - CallDynamicJavaDirectSchedNode *call = new (C) CallDynamicJavaDirectSchedNode(); + CallDynamicJavaDirectSchedNode *call = new CallDynamicJavaDirectSchedNode(); call->_method_handle_invoke = _method_handle_invoke; call->_vtable_index = _vtable_index; call->_method = _method; @@ -3765,7 +3765,7 @@ encode %{ #if defined(ABI_ELFv2) jlong entry_address = (jlong) this->entry_point(); assert(entry_address, "need address here"); - loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper(entry_address), + loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper(entry_address), OptoReg::Name(R12_H_num), OptoReg::Name(R12_num)); #else // Get the struct that describes the function we are about to call. @@ -3777,42 +3777,42 @@ encode %{ loadConLNodesTuple loadConLNodes_Toc; // Create nodes and operands for loading the entry point. - loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper(entry_address), + loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper(entry_address), OptoReg::Name(R12_H_num), OptoReg::Name(R12_num)); // Create nodes and operands for loading the env pointer. if (fd->env() != NULL) { - loadConLNodes_Env = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong) fd->env()), + loadConLNodes_Env = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper((jlong) fd->env()), OptoReg::Name(R11_H_num), OptoReg::Name(R11_num)); } else { loadConLNodes_Env._large_hi = NULL; loadConLNodes_Env._large_lo = NULL; loadConLNodes_Env._small = NULL; - loadConLNodes_Env._last = new (C) loadConL16Node(); - loadConLNodes_Env._last->_opnds[0] = new (C) iRegLdstOper(); - loadConLNodes_Env._last->_opnds[1] = new (C) immL16Oper(0); + loadConLNodes_Env._last = new loadConL16Node(); + loadConLNodes_Env._last->_opnds[0] = new iRegLdstOper(); + loadConLNodes_Env._last->_opnds[1] = new immL16Oper(0); ra_->set_pair(loadConLNodes_Env._last->_idx, OptoReg::Name(R11_H_num), OptoReg::Name(R11_num)); } // Create nodes and operands for loading the Toc point. - loadConLNodes_Toc = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong) fd->toc()), + loadConLNodes_Toc = loadConLNodesTuple_create(C, ra_, n_toc, new immLOper((jlong) fd->toc()), OptoReg::Name(R2_H_num), OptoReg::Name(R2_num)); #endif // ABI_ELFv2 // mtctr node - MachNode *mtctr = new (C) CallLeafDirect_mtctrNode(); + MachNode *mtctr = new CallLeafDirect_mtctrNode(); assert(loadConLNodes_Entry._last != NULL, "entry must exist"); mtctr->add_req(0, loadConLNodes_Entry._last); - mtctr->_opnds[0] = new (C) iRegLdstOper(); - mtctr->_opnds[1] = new (C) iRegLdstOper(); + mtctr->_opnds[0] = new iRegLdstOper(); + mtctr->_opnds[1] = new iRegLdstOper(); // call node - MachCallLeafNode *call = new (C) CallLeafDirectNode(); + MachCallLeafNode *call = new CallLeafDirectNode(); call->_opnds[0] = _opnds[0]; - call->_opnds[1] = new (C) methodOper((intptr_t) entry_address); // May get set later. + call->_opnds[1] = new methodOper((intptr_t) entry_address); // May get set later. // Make the new call node look like the old one. call->_name = _name; @@ -6050,9 +6050,9 @@ instruct loadConN_Ex(iRegNdst dst, immN src) %{ format %{ "LoadN $dst, $src \t// postalloc expanded" %} // mask postalloc_expand %{ - MachNode *m1 = new (C) loadConN_hiNode(); - MachNode *m2 = new (C) loadConN_loNode(); - MachNode *m3 = new (C) clearMs32bNode(); + MachNode *m1 = new loadConN_hiNode(); + MachNode *m2 = new loadConN_loNode(); + MachNode *m3 = new clearMs32bNode(); m1->add_req(NULL); m2->add_req(NULL, m1); m3->add_req(NULL, m2); @@ -6117,7 +6117,7 @@ instruct loadConNKlass_Ex(iRegNdst dst, immNKlass src) %{ format %{ "LoadN $dst, $src \t// postalloc expanded" %} // mask postalloc_expand %{ // Load high bits into register. Sign extended. - MachNode *m1 = new (C) loadConNKlass_hiNode(); + MachNode *m1 = new loadConNKlass_hiNode(); m1->add_req(NULL); m1->_opnds[0] = op_dst; m1->_opnds[1] = op_src; @@ -6127,7 +6127,7 @@ instruct loadConNKlass_Ex(iRegNdst dst, immNKlass src) %{ MachNode *m2 = m1; if (!Assembler::is_uimm((jlong)Klass::encode_klass((Klass *)op_src->constant()), 31)) { // Value might be 1-extended. Mask out these bits. - m2 = new (C) clearMs32bNode(); + m2 = new clearMs32bNode(); m2->add_req(NULL, m1); m2->_opnds[0] = op_dst; m2->_opnds[1] = op_dst; @@ -6135,7 +6135,7 @@ instruct loadConNKlass_Ex(iRegNdst dst, immNKlass src) %{ nodes->push(m2); } - MachNode *m3 = new (C) loadConNKlass_loNode(); + MachNode *m3 = new loadConNKlass_loNode(); m3->add_req(NULL, m2); m3->_opnds[0] = op_dst; m3->_opnds[1] = op_src; @@ -6987,14 +6987,14 @@ instruct encodePKlass_not_null_Ex(iRegNdst dst, iRegLsrc base, iRegPsrc src) %{ format %{ "EncodePKlass $dst, $src\t// $src != Null, postalloc expanded" %} postalloc_expand %{ - encodePKlass_sub_baseNode *n1 = new (C) encodePKlass_sub_baseNode(); + encodePKlass_sub_baseNode *n1 = new encodePKlass_sub_baseNode(); n1->add_req(n_region, n_base, n_src); n1->_opnds[0] = op_dst; n1->_opnds[1] = op_base; n1->_opnds[2] = op_src; n1->_bottom_type = _bottom_type; - encodePKlass_shiftNode *n2 = new (C) encodePKlass_shiftNode(); + encodePKlass_shiftNode *n2 = new encodePKlass_shiftNode(); n2->add_req(n_region, n1); n2->_opnds[0] = op_dst; n2->_opnds[1] = op_dst; @@ -7064,14 +7064,14 @@ instruct decodeNKlass_notNull_addBase_Ex(iRegPdst dst, iRegLsrc base, iRegNsrc s format %{ "DecodeNKlass $dst = $base + ($src << 3) \t// $src != NULL, postalloc expanded" %} postalloc_expand %{ - decodeNKlass_add_baseNode *n1 = new (C) decodeNKlass_add_baseNode(); + decodeNKlass_add_baseNode *n1 = new decodeNKlass_add_baseNode(); n1->add_req(n_region, n_base, n_src); n1->_opnds[0] = op_dst; n1->_opnds[1] = op_base; n1->_opnds[2] = op_src; n1->_bottom_type = _bottom_type; - decodeNKlass_shiftNode *n2 = new (C) decodeNKlass_shiftNode(); + decodeNKlass_shiftNode *n2 = new decodeNKlass_shiftNode(); n2->add_req(n_region, n1); n2->_opnds[0] = op_dst; n2->_opnds[1] = op_dst; @@ -9773,8 +9773,8 @@ instruct cmovI_bso_stackSlotL_conLvalue0_Ex(iRegIdst dst, flagsReg crx, stackSlo // // Create new nodes. - MachNode *m1 = new (C) loadConI16Node(); - MachNode *m2 = new (C) cmovI_bso_stackSlotLNode(); + MachNode *m1 = new loadConI16Node(); + MachNode *m2 = new cmovI_bso_stackSlotLNode(); // inputs for new nodes m1->add_req(n_region); @@ -9785,7 +9785,7 @@ instruct cmovI_bso_stackSlotL_conLvalue0_Ex(iRegIdst dst, flagsReg crx, stackSlo // operands for new nodes m1->_opnds[0] = op_dst; - m1->_opnds[1] = new (C) immI16Oper(0); + m1->_opnds[1] = new immI16Oper(0); m2->_opnds[0] = op_dst; m2->_opnds[1] = op_crx; @@ -9942,8 +9942,8 @@ instruct cmovL_bso_stackSlotL_conLvalue0_Ex(iRegLdst dst, flagsReg crx, stackSlo // // Create new nodes. - MachNode *m1 = new (C) loadConL16Node(); - MachNode *m2 = new (C) cmovL_bso_stackSlotLNode(); + MachNode *m1 = new loadConL16Node(); + MachNode *m2 = new cmovL_bso_stackSlotLNode(); // inputs for new nodes m1->add_req(n_region); @@ -9952,7 +9952,7 @@ instruct cmovL_bso_stackSlotL_conLvalue0_Ex(iRegLdst dst, flagsReg crx, stackSlo // operands for new nodes m1->_opnds[0] = op_dst; - m1->_opnds[1] = new (C) immL16Oper(0); + m1->_opnds[1] = new immL16Oper(0); m2->_opnds[0] = op_dst; m2->_opnds[1] = op_crx; m2->_opnds[2] = op_mem; @@ -10288,8 +10288,8 @@ instruct cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(iRegIdst dst, flagsReg c // // Create new nodes. - MachNode *m1 = new (C) loadConI16Node(); - MachNode *m2 = new (C) cmovI_conIvalueMinus1_conIvalue1Node(); + MachNode *m1 = new loadConI16Node(); + MachNode *m2 = new cmovI_conIvalueMinus1_conIvalue1Node(); // inputs for new nodes m1->add_req(n_region); @@ -10298,7 +10298,7 @@ instruct cmovI_conIvalueMinus1_conIvalue0_conIvalue1_Ex(iRegIdst dst, flagsReg c // operands for new nodes m1->_opnds[0] = op_dst; - m1->_opnds[1] = new (C) immI16Oper(0); + m1->_opnds[1] = new immI16Oper(0); m2->_opnds[0] = op_dst; m2->_opnds[1] = op_crx; @@ -10623,8 +10623,8 @@ instruct cmpF_reg_reg_Ex(flagsReg crx, regF src1, regF src2) %{ // // Create new nodes. - MachNode *m1 = new (C) cmpFUnordered_reg_regNode(); - MachNode *m2 = new (C) cmov_bns_lessNode(); + MachNode *m1 = new cmpFUnordered_reg_regNode(); + MachNode *m2 = new cmov_bns_lessNode(); // inputs for new nodes m1->add_req(n_region, n_src1, n_src2); @@ -10698,8 +10698,8 @@ instruct cmpD_reg_reg_Ex(flagsReg crx, regD src1, regD src2) %{ // // create new nodes - MachNode *m1 = new (C) cmpDUnordered_reg_regNode(); - MachNode *m2 = new (C) cmov_bns_lessNode(); + MachNode *m1 = new cmpDUnordered_reg_regNode(); + MachNode *m2 = new cmov_bns_lessNode(); // inputs for new nodes m1->add_req(n_region, n_src1, n_src2); diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad index 63a7a066304..c246f2d2deb 100644 --- a/hotspot/src/cpu/x86/vm/x86_32.ad +++ b/hotspot/src/cpu/x86/vm/x86_32.ad @@ -1401,22 +1401,22 @@ void Matcher::pd_implicit_null_fixup(MachNode *node, uint idx) { // No transformation necessary. return; case INDIRECT: - new_memory = new (C) indirect_win95_safeOper( ); + new_memory = new indirect_win95_safeOper( ); break; case INDOFFSET8: - new_memory = new (C) indOffset8_win95_safeOper(memory->disp(NULL, NULL, 0)); + new_memory = new indOffset8_win95_safeOper(memory->disp(NULL, NULL, 0)); break; case INDOFFSET32: - new_memory = new (C) indOffset32_win95_safeOper(memory->disp(NULL, NULL, 0)); + new_memory = new indOffset32_win95_safeOper(memory->disp(NULL, NULL, 0)); break; case INDINDEXOFFSET: - new_memory = new (C) indIndexOffset_win95_safeOper(memory->disp(NULL, NULL, 0)); + new_memory = new indIndexOffset_win95_safeOper(memory->disp(NULL, NULL, 0)); break; case INDINDEXSCALE: - new_memory = new (C) indIndexScale_win95_safeOper(memory->scale()); + new_memory = new indIndexScale_win95_safeOper(memory->scale()); break; case INDINDEXSCALEOFFSET: - new_memory = new (C) indIndexScaleOffset_win95_safeOper(memory->scale(), memory->disp(NULL, NULL, 0)); + new_memory = new indIndexScaleOffset_win95_safeOper(memory->scale(), memory->disp(NULL, NULL, 0)); break; case LOAD_LONG_INDIRECT: case LOAD_LONG_INDOFFSET32: diff --git a/hotspot/src/share/vm/adlc/output_c.cpp b/hotspot/src/share/vm/adlc/output_c.cpp index bd2393c578c..6169c8f62b7 100644 --- a/hotspot/src/share/vm/adlc/output_c.cpp +++ b/hotspot/src/share/vm/adlc/output_c.cpp @@ -1000,7 +1000,7 @@ void ArchDesc::build_pipe_classes(FILE *fp_cpp) { fprintf(fp_cpp, "void Bundle::initialize_nops(MachNode * nop_list[%d], Compile *C) {\n", nopcnt); int i = 0; for ( _pipeline->_noplist.reset(); (nop = _pipeline->_noplist.iter()) != NULL; i++ ) { - fprintf(fp_cpp, " nop_list[%d] = (MachNode *) new (C) %sNode();\n", i, nop); + fprintf(fp_cpp, " nop_list[%d] = (MachNode *) new %sNode();\n", i, nop); } fprintf(fp_cpp, "};\n\n"); fprintf(fp_cpp, "#ifndef PRODUCT\n"); @@ -1328,7 +1328,7 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch preplace->next_instruction(root_inst); InstructForm *root_form = globals[root_inst]->is_instruction(); assert( root_form != NULL, "Replacement instruction was not previously defined"); - fprintf(fp, " %sNode *root = new (C) %sNode();\n", root_inst, root_inst); + fprintf(fp, " %sNode *root = new %sNode();\n", root_inst, root_inst); int inst_num; const char *op_name; @@ -1497,11 +1497,11 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) { new_oper = frm->is_operand(); char *tmp = (char *)node->_exprule->_newopconst[new_id]; if (tmp == NULL) { - fprintf(fp," MachOper *op%d = new (C) %sOper();\n", + fprintf(fp," MachOper *op%d = new %sOper();\n", cnt, new_oper->_ident); } else { - fprintf(fp," MachOper *op%d = new (C) %sOper(%s);\n", + fprintf(fp," MachOper *op%d = new %sOper(%s);\n", cnt, new_oper->_ident, tmp); } } @@ -1566,7 +1566,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) { } // Build the node for the instruction - fprintf(fp,"\n %sNode *n%d = new (C) %sNode();\n", new_id, cnt, new_id); + fprintf(fp,"\n %sNode *n%d = new %sNode();\n", new_id, cnt, new_id); // Add control edge for this node fprintf(fp," n%d->add_req(_in[0]);\n", cnt); // Build the operand for the value this node defines. @@ -1729,7 +1729,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) { declared_def = true; } if (op && op->_interface && op->_interface->is_RegInterface()) { - fprintf(fp," def = new (C) MachTempNode(state->MachOperGenerator( %s, C ));\n", + fprintf(fp," def = new MachTempNode(state->MachOperGenerator( %s, C ));\n", machOperEnum(op->_ident)); fprintf(fp," add_req(def);\n"); // The operand for TEMP is already constructed during @@ -1760,7 +1760,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) { } fprintf(fp," kill = "); - fprintf(fp,"new (C) MachProjNode( %s, %d, (%s), Op_%s );\n", + fprintf(fp,"new MachProjNode( %s, %d, (%s), Op_%s );\n", machNode, proj_no++, regmask, ideal_type); fprintf(fp," proj_list.push(kill);\n"); } @@ -2840,7 +2840,7 @@ static void defineIn_RegMask(FILE *fp, FormDict &globals, OperandForm &oper) { // generate code to create a clone for a class derived from MachOper // // (0) MachOper *MachOperXOper::clone(Compile* C) const { -// (1) return new (C) MachXOper( _ccode, _c0, _c1, ..., _cn); +// (1) return new MachXOper( _ccode, _c0, _c1, ..., _cn); // (2) } // static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) { @@ -2849,7 +2849,7 @@ static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) { const int num_consts = oper.num_consts(globalNames); const bool is_ideal_bool = oper.is_ideal_bool(); if( (num_consts > 0) ) { - fprintf(fp," return new (C) %sOper(", oper._ident); + fprintf(fp," return new %sOper(", oper._ident); // generate parameters for constants int i = 0; fprintf(fp,"_c%d", i); @@ -2861,7 +2861,7 @@ static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) { } else { assert( num_consts == 0, "Currently support zero or one constant per operand clone function"); - fprintf(fp," return new (C) %sOper();\n", oper._ident); + fprintf(fp," return new %sOper();\n", oper._ident); } // finish method fprintf(fp,"}\n"); @@ -3106,7 +3106,7 @@ void ArchDesc::defineClasses(FILE *fp) { defineIn_RegMask(_CPP_MISC_file._fp, _globalNames, *oper); fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper->_ident); - fprintf(fp," return new (C) %sOper(_label, _block_num);\n", oper->_ident); + fprintf(fp," return new %sOper(_label, _block_num);\n", oper->_ident); fprintf(fp,"}\n"); fprintf(fp,"uint %sOper::opcode() const { return %s; }\n", @@ -3125,7 +3125,7 @@ void ArchDesc::defineClasses(FILE *fp) { defineIn_RegMask(_CPP_MISC_file._fp, _globalNames, *oper); fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper->_ident); - fprintf(fp," return new (C) %sOper(_method);\n", oper->_ident); + fprintf(fp," return new %sOper(_method);\n", oper->_ident); fprintf(fp,"}\n"); fprintf(fp,"uint %sOper::opcode() const { return %s; }\n", @@ -3815,7 +3815,7 @@ static void genMachOperCase(FILE *fp, FormDict &globalNames, ArchDesc &AD, // Generate the case statement for this opcode fprintf(fp, " case %s:", opEnumName); - fprintf(fp, "\n return new (C) %sOper(", opName); + fprintf(fp, "\n return new %sOper(", opName); // Access parameters for constructor from the stat object // // Build access to condition code value @@ -3894,7 +3894,7 @@ void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *inden const char *opClass = inst->_ident; // Create the MachNode object - fprintf(fp_cpp, "%s %sNode *node = new (C) %sNode();\n",indent, opClass,opClass); + fprintf(fp_cpp, "%s %sNode *node = new %sNode();\n",indent, opClass,opClass); if ( (inst->num_post_match_opnds() != 0) ) { // Instruction that contains operands which are not in match rule. @@ -3936,7 +3936,7 @@ void ArchDesc::buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *inden // Check for multiple constants and then fill them in. // Just like MachOperGenerator const char *opName = inst->_matrule->_rChild->_opType; - fprintf(fp_cpp, "new (C) %sOper(", opName); + fprintf(fp_cpp, "new %sOper(", opName); // Grab operand form OperandForm *op = (_globalNames[opName])->is_operand(); // Look up the number of constants @@ -4010,7 +4010,7 @@ bool InstructForm::define_cisc_version(ArchDesc &AD, FILE *fp_cpp) { fprintf(fp_cpp, "// Build CISC version of this instruction\n"); fprintf(fp_cpp, "MachNode *%sNode::cisc_version( int offset, Compile* C ) {\n", this->_ident); // Create the MachNode object - fprintf(fp_cpp, " %sNode *node = new (C) %sNode();\n", name, name); + fprintf(fp_cpp, " %sNode *node = new %sNode();\n", name, name); // Fill in the bottom_type where requested if ( this->captures_bottom_type(AD.globalNames()) ) { fprintf(fp_cpp, " node->_bottom_type = bottom_type();\n"); @@ -4026,7 +4026,7 @@ bool InstructForm::define_cisc_version(ArchDesc &AD, FILE *fp_cpp) { fprintf(fp_cpp, " fill_new_machnode(node, C);\n"); // Construct operand to access [stack_pointer + offset] fprintf(fp_cpp, " // Construct operand to access [stack_pointer + offset]\n"); - fprintf(fp_cpp, " node->set_opnd_array(cisc_operand(), new (C) %sOper(offset));\n", cisc_oper_name); + fprintf(fp_cpp, " node->set_opnd_array(cisc_operand(), new %sOper(offset));\n", cisc_oper_name); fprintf(fp_cpp, "\n"); // Return result and exit scope @@ -4057,7 +4057,7 @@ bool InstructForm::define_short_branch_methods(ArchDesc &AD, FILE *fp_cpp) { fprintf(fp_cpp, "// Build short branch version of this instruction\n"); fprintf(fp_cpp, "MachNode *%sNode::short_branch_version(Compile* C) {\n", this->_ident); // Create the MachNode object - fprintf(fp_cpp, " %sNode *node = new (C) %sNode();\n", name, name); + fprintf(fp_cpp, " %sNode *node = new %sNode();\n", name, name); if( is_ideal_if() ) { fprintf(fp_cpp, " node->_prob = _prob;\n"); fprintf(fp_cpp, " node->_fcnt = _fcnt;\n"); diff --git a/hotspot/src/share/vm/opto/addnode.cpp b/hotspot/src/share/vm/opto/addnode.cpp index a586eba1322..a88ee2e1d22 100644 --- a/hotspot/src/share/vm/opto/addnode.cpp +++ b/hotspot/src/share/vm/opto/addnode.cpp @@ -254,47 +254,46 @@ Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) { const Type *t_sub1 = phase->type( in1->in(1) ); const Type *t_2 = phase->type( in2 ); if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP ) - return new (phase->C) SubINode(phase->makecon( add_ring( t_sub1, t_2 ) ), - in1->in(2) ); + return new SubINode(phase->makecon( add_ring( t_sub1, t_2 ) ), in1->in(2) ); // Convert "(a-b)+(c-d)" into "(a+c)-(b+d)" if( op2 == Op_SubI ) { // Check for dead cycle: d = (a-b)+(c-d) assert( in1->in(2) != this && in2->in(2) != this, "dead loop in AddINode::Ideal" ); - Node *sub = new (phase->C) SubINode(NULL, NULL); - sub->init_req(1, phase->transform(new (phase->C) AddINode(in1->in(1), in2->in(1) ) )); - sub->init_req(2, phase->transform(new (phase->C) AddINode(in1->in(2), in2->in(2) ) )); + Node *sub = new SubINode(NULL, NULL); + sub->init_req(1, phase->transform(new AddINode(in1->in(1), in2->in(1) ) )); + sub->init_req(2, phase->transform(new AddINode(in1->in(2), in2->in(2) ) )); return sub; } // Convert "(a-b)+(b+c)" into "(a+c)" if( op2 == Op_AddI && in1->in(2) == in2->in(1) ) { assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal"); - return new (phase->C) AddINode(in1->in(1), in2->in(2)); + return new AddINode(in1->in(1), in2->in(2)); } // Convert "(a-b)+(c+b)" into "(a+c)" if( op2 == Op_AddI && in1->in(2) == in2->in(2) ) { assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddINode::Ideal"); - return new (phase->C) AddINode(in1->in(1), in2->in(1)); + return new AddINode(in1->in(1), in2->in(1)); } // Convert "(a-b)+(b-c)" into "(a-c)" if( op2 == Op_SubI && in1->in(2) == in2->in(1) ) { assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal"); - return new (phase->C) SubINode(in1->in(1), in2->in(2)); + return new SubINode(in1->in(1), in2->in(2)); } // Convert "(a-b)+(c-a)" into "(c-b)" if( op2 == Op_SubI && in1->in(1) == in2->in(2) ) { assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddINode::Ideal"); - return new (phase->C) SubINode(in2->in(1), in1->in(2)); + return new SubINode(in2->in(1), in1->in(2)); } } // Convert "x+(0-y)" into "(x-y)" if( op2 == Op_SubI && phase->type(in2->in(1)) == TypeInt::ZERO ) - return new (phase->C) SubINode(in1, in2->in(2) ); + return new SubINode(in1, in2->in(2) ); // Convert "(0-y)+x" into "(x-y)" if( op1 == Op_SubI && phase->type(in1->in(1)) == TypeInt::ZERO ) - return new (phase->C) SubINode( in2, in1->in(2) ); + return new SubINode( in2, in1->in(2) ); // Convert (x>>>z)+y into (x+(y<>>z for small constant z and y. // Helps with array allocation math constant folding @@ -315,8 +314,8 @@ Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) { if( z < 5 && -5 < y && y < 0 ) { const Type *t_in11 = phase->type(in1->in(1)); if( t_in11 != Type::TOP && (t_in11->is_int()->_lo >= -(y << z)) ) { - Node *a = phase->transform( new (phase->C) AddINode( in1->in(1), phase->intcon(y<C) URShiftINode( a, in1->in(2) ); + Node *a = phase->transform( new AddINode( in1->in(1), phase->intcon(y<in(2) ); } } } @@ -387,47 +386,46 @@ Node *AddLNode::Ideal(PhaseGVN *phase, bool can_reshape) { const Type *t_sub1 = phase->type( in1->in(1) ); const Type *t_2 = phase->type( in2 ); if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP ) - return new (phase->C) SubLNode(phase->makecon( add_ring( t_sub1, t_2 ) ), - in1->in(2) ); + return new SubLNode(phase->makecon( add_ring( t_sub1, t_2 ) ), in1->in(2) ); // Convert "(a-b)+(c-d)" into "(a+c)-(b+d)" if( op2 == Op_SubL ) { // Check for dead cycle: d = (a-b)+(c-d) assert( in1->in(2) != this && in2->in(2) != this, "dead loop in AddLNode::Ideal" ); - Node *sub = new (phase->C) SubLNode(NULL, NULL); - sub->init_req(1, phase->transform(new (phase->C) AddLNode(in1->in(1), in2->in(1) ) )); - sub->init_req(2, phase->transform(new (phase->C) AddLNode(in1->in(2), in2->in(2) ) )); + Node *sub = new SubLNode(NULL, NULL); + sub->init_req(1, phase->transform(new AddLNode(in1->in(1), in2->in(1) ) )); + sub->init_req(2, phase->transform(new AddLNode(in1->in(2), in2->in(2) ) )); return sub; } // Convert "(a-b)+(b+c)" into "(a+c)" if( op2 == Op_AddL && in1->in(2) == in2->in(1) ) { assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal"); - return new (phase->C) AddLNode(in1->in(1), in2->in(2)); + return new AddLNode(in1->in(1), in2->in(2)); } // Convert "(a-b)+(c+b)" into "(a+c)" if( op2 == Op_AddL && in1->in(2) == in2->in(2) ) { assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal"); - return new (phase->C) AddLNode(in1->in(1), in2->in(1)); + return new AddLNode(in1->in(1), in2->in(1)); } // Convert "(a-b)+(b-c)" into "(a-c)" if( op2 == Op_SubL && in1->in(2) == in2->in(1) ) { assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal"); - return new (phase->C) SubLNode(in1->in(1), in2->in(2)); + return new SubLNode(in1->in(1), in2->in(2)); } // Convert "(a-b)+(c-a)" into "(c-b)" if( op2 == Op_SubL && in1->in(1) == in1->in(2) ) { assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal"); - return new (phase->C) SubLNode(in2->in(1), in1->in(2)); + return new SubLNode(in2->in(1), in1->in(2)); } } // Convert "x+(0-y)" into "(x-y)" if( op2 == Op_SubL && phase->type(in2->in(1)) == TypeLong::ZERO ) - return new (phase->C) SubLNode( in1, in2->in(2) ); + return new SubLNode( in1, in2->in(2) ); // Convert "(0-y)+x" into "(x-y)" if( op1 == Op_SubL && phase->type(in1->in(1)) == TypeInt::ZERO ) - return new (phase->C) SubLNode( in2, in1->in(2) ); + return new SubLNode( in2, in1->in(2) ); // Convert "X+X+X+X+X...+X+Y" into "k*X+Y" or really convert "X+(X+Y)" // into "(X<<1)+Y" and let shift-folding happen. @@ -435,8 +433,8 @@ Node *AddLNode::Ideal(PhaseGVN *phase, bool can_reshape) { in2->in(1) == in1 && op1 != Op_ConL && 0 ) { - Node *shift = phase->transform(new (phase->C) LShiftLNode(in1,phase->intcon(1))); - return new (phase->C) AddLNode(shift,in2->in(2)); + Node *shift = phase->transform(new LShiftLNode(in1,phase->intcon(1))); + return new AddLNode(shift,in2->in(2)); } return AddNode::Ideal(phase, can_reshape); @@ -596,7 +594,7 @@ Node *AddPNode::Ideal(PhaseGVN *phase, bool can_reshape) { offset = phase->MakeConX(t2->get_con() + t12->get_con()); } else { // Else move the constant to the right. ((A+con)+B) into ((A+B)+con) - address = phase->transform(new (phase->C) AddPNode(in(Base),addp->in(Address),in(Offset))); + address = phase->transform(new AddPNode(in(Base),addp->in(Address),in(Offset))); offset = addp->in(Offset); } PhaseIterGVN *igvn = phase->is_IterGVN(); @@ -616,7 +614,7 @@ Node *AddPNode::Ideal(PhaseGVN *phase, bool can_reshape) { // If this is a NULL+long form (from unsafe accesses), switch to a rawptr. if (phase->type(in(Address)) == TypePtr::NULL_PTR) { Node* offset = in(Offset); - return new (phase->C) CastX2PNode(offset); + return new CastX2PNode(offset); } } @@ -628,7 +626,7 @@ Node *AddPNode::Ideal(PhaseGVN *phase, bool can_reshape) { if( add->Opcode() == Op_AddX && add->in(1) != add ) { const Type *t22 = phase->type( add->in(2) ); if( t22->singleton() && (t22 != Type::TOP) ) { // Right input is an add of a constant? - set_req(Address, phase->transform(new (phase->C) AddPNode(in(Base),in(Address),add->in(1)))); + set_req(Address, phase->transform(new AddPNode(in(Base),in(Address),add->in(1)))); set_req(Offset, add->in(2)); PhaseIterGVN *igvn = phase->is_IterGVN(); if (add->outcnt() == 0 && igvn) { @@ -858,7 +856,7 @@ Node *MinINode::Ideal(PhaseGVN *phase, bool can_reshape) { // to force a right-spline graph for the rest of MinINode::Ideal(). if( l->Opcode() == Op_MinI ) { assert( l != l->in(1), "dead loop in MinINode::Ideal" ); - r = phase->transform(new (phase->C) MinINode(l->in(2),r)); + r = phase->transform(new MinINode(l->in(2),r)); l = l->in(1); set_req(1, l); set_req(2, r); @@ -906,18 +904,18 @@ Node *MinINode::Ideal(PhaseGVN *phase, bool can_reshape) { } if( x->_idx > y->_idx ) - return new (phase->C) MinINode(r->in(1),phase->transform(new (phase->C) MinINode(l,r->in(2)))); + return new MinINode(r->in(1),phase->transform(new MinINode(l,r->in(2)))); // See if covers: MIN2(x+c0,MIN2(y+c1,z)) if( !phase->eqv(x,y) ) return NULL; // If (y == x) transform MIN2(x+c0, MIN2(x+c1,z)) into // MIN2(x+c0 or x+c1 which less, z). - return new (phase->C) MinINode(phase->transform(new (phase->C) AddINode(x,phase->intcon(MIN2(x_off,y_off)))),r->in(2)); + return new MinINode(phase->transform(new AddINode(x,phase->intcon(MIN2(x_off,y_off)))),r->in(2)); } else { // See if covers: MIN2(x+c0,y+c1) if( !phase->eqv(x,y) ) return NULL; // If (y == x) transform MIN2(x+c0,x+c1) into x+c0 or x+c1 which less. - return new (phase->C) AddINode(x,phase->intcon(MIN2(x_off,y_off))); + return new AddINode(x,phase->intcon(MIN2(x_off,y_off))); } } diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp index 85598d636a3..7c32b68d015 100644 --- a/hotspot/src/share/vm/opto/block.cpp +++ b/hotspot/src/share/vm/opto/block.cpp @@ -373,7 +373,7 @@ PhaseCFG::PhaseCFG(Arena* arena, RootNode* root, Matcher& matcher) // I'll need a few machine-specific GotoNodes. Make an Ideal GotoNode, // then Match it into a machine-specific Node. Then clone the machine // Node on demand. - Node *x = new (C) GotoNode(NULL); + Node *x = new GotoNode(NULL); x->init_req(0, x); _goto = matcher.match_tree(x); assert(_goto != NULL, ""); @@ -426,7 +426,7 @@ uint PhaseCFG::build_cfg() { !p->is_block_start() ); // Make the block begin with one of Region or StartNode. if( !p->is_block_start() ) { - RegionNode *r = new (C) RegionNode( 2 ); + RegionNode *r = new RegionNode( 2 ); r->init_req(1, p); // Insert RegionNode in the way proj->set_req(0, r); // Insert RegionNode in the way p = r; @@ -501,7 +501,7 @@ void PhaseCFG::insert_goto_at(uint block_no, uint succ_no) { // get ProjNode corresponding to the succ_no'th successor of the in block ProjNode* proj = in->get_node(in->number_of_nodes() - in->_num_succs + succ_no)->as_Proj(); // create region for basic block - RegionNode* region = new (C) RegionNode(2); + RegionNode* region = new RegionNode(2); region->init_req(1, proj); // setup corresponding basic block Block* block = new (_block_arena) Block(_block_arena, region); diff --git a/hotspot/src/share/vm/opto/callGenerator.cpp b/hotspot/src/share/vm/opto/callGenerator.cpp index 249e0215c60..563f5ae4d78 100644 --- a/hotspot/src/share/vm/opto/callGenerator.cpp +++ b/hotspot/src/share/vm/opto/callGenerator.cpp @@ -136,7 +136,7 @@ JVMState* DirectCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { kit.C->log()->elem("direct_call bci='%d'", jvms->bci()); } - CallStaticJavaNode *call = new (kit.C) CallStaticJavaNode(kit.C, tf(), target, method(), kit.bci()); + CallStaticJavaNode *call = new CallStaticJavaNode(kit.C, tf(), target, method(), kit.bci()); _call_node = call; // Save the call node in case we need it later if (!is_static) { // Make an explicit receiver null_check as part of this call. @@ -225,7 +225,7 @@ JVMState* VirtualCallGenerator::generate(JVMState* jvms, Parse* parent_parser) { "no vtable calls if +UseInlineCaches "); address target = SharedRuntime::get_resolve_virtual_call_stub(); // Normal inline cache used for call - CallDynamicJavaNode *call = new (kit.C) CallDynamicJavaNode(tf(), target, method(), _vtable_index, kit.bci()); + CallDynamicJavaNode *call = new CallDynamicJavaNode(tf(), target, method(), _vtable_index, kit.bci()); kit.set_arguments_for_java_call(call); kit.set_edges_for_java_call(call); Node* ret = kit.set_results_for_java_call(call); @@ -350,7 +350,7 @@ void LateInlineCallGenerator::do_late_inline() { JVMState* old_jvms = call->jvms(); JVMState* jvms = old_jvms->clone_shallow(C); uint size = call->req(); - SafePointNode* map = new (C) SafePointNode(size, jvms); + SafePointNode* map = new SafePointNode(size, jvms); for (uint i1 = 0; i1 < size; i1++) { map->init_req(i1, call->in(i1)); } @@ -717,7 +717,7 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms, Parse* parent_parser) // Finish the diamond. kit.C->set_has_split_ifs(true); // Has chance for split-if optimization - RegionNode* region = new (kit.C) RegionNode(3); + RegionNode* region = new RegionNode(3); region->init_req(1, kit.control()); region->init_req(2, slow_map->control()); kit.set_control(gvn.transform(region)); @@ -825,7 +825,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr(); const Type* sig_type = TypeOopPtr::make_from_klass(signature->accessing_klass()); if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { - Node* cast_obj = gvn.transform(new (C) CheckCastPPNode(kit.control(), arg, sig_type)); + Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type)); kit.set_argument(0, cast_obj); } } @@ -837,7 +837,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr(); const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass()); if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { - Node* cast_obj = gvn.transform(new (C) CheckCastPPNode(kit.control(), arg, sig_type)); + Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type)); kit.set_argument(receiver_skip + i, cast_obj); } } @@ -978,7 +978,7 @@ JVMState* PredictedIntrinsicGenerator::generate(JVMState* jvms, Parse* parent_pa // Finish the diamond. kit.C->set_has_split_ifs(true); // Has chance for split-if optimization - RegionNode* region = new (kit.C) RegionNode(3); + RegionNode* region = new RegionNode(3); region->init_req(1, kit.control()); region->init_req(2, slow_map->control()); kit.set_control(gvn.transform(region)); diff --git a/hotspot/src/share/vm/opto/callnode.cpp b/hotspot/src/share/vm/opto/callnode.cpp index b2cd166b4dd..848e3aeb029 100644 --- a/hotspot/src/share/vm/opto/callnode.cpp +++ b/hotspot/src/share/vm/opto/callnode.cpp @@ -74,20 +74,20 @@ Node *StartNode::match( const ProjNode *proj, const Matcher *match ) { case TypeFunc::Control: case TypeFunc::I_O: case TypeFunc::Memory: - return new (match->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); + return new MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); case TypeFunc::FramePtr: - return new (match->C) MachProjNode(this,proj->_con,Matcher::c_frame_ptr_mask, Op_RegP); + return new MachProjNode(this,proj->_con,Matcher::c_frame_ptr_mask, Op_RegP); case TypeFunc::ReturnAdr: - return new (match->C) MachProjNode(this,proj->_con,match->_return_addr_mask,Op_RegP); + return new MachProjNode(this,proj->_con,match->_return_addr_mask,Op_RegP); case TypeFunc::Parms: default: { uint parm_num = proj->_con - TypeFunc::Parms; const Type *t = _domain->field_at(proj->_con); if (t->base() == Type::Half) // 2nd half of Longs and Doubles - return new (match->C) ConNode(Type::TOP); + return new ConNode(Type::TOP); uint ideal_reg = t->ideal_reg(); RegMask &rm = match->_calling_convention_mask[parm_num]; - return new (match->C) MachProjNode(this,proj->_con,rm,ideal_reg); + return new MachProjNode(this,proj->_con,rm,ideal_reg); } } return NULL; @@ -685,12 +685,12 @@ Node *CallNode::match( const ProjNode *proj, const Matcher *match ) { case TypeFunc::Control: case TypeFunc::I_O: case TypeFunc::Memory: - return new (match->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); + return new MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); case TypeFunc::Parms+1: // For LONG & DOUBLE returns assert(tf()->_range->field_at(TypeFunc::Parms+1) == Type::HALF, ""); // 2nd half of doubles and longs - return new (match->C) MachProjNode(this,proj->_con, RegMask::Empty, (uint)OptoReg::Bad); + return new MachProjNode(this,proj->_con, RegMask::Empty, (uint)OptoReg::Bad); case TypeFunc::Parms: { // Normal returns uint ideal_reg = tf()->range()->field_at(TypeFunc::Parms)->ideal_reg(); @@ -700,7 +700,7 @@ Node *CallNode::match( const ProjNode *proj, const Matcher *match ) { RegMask rm = RegMask(regs.first()); if( OptoReg::is_valid(regs.second()) ) rm.Insert( regs.second() ); - return new (match->C) MachProjNode(this,proj->_con,rm,ideal_reg); + return new MachProjNode(this,proj->_con,rm,ideal_reg); } case TypeFunc::ReturnAdr: @@ -1288,10 +1288,10 @@ Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* nproj = catchproj->clone(); igvn->register_new_node_with_optimizer(nproj); - Node *frame = new (phase->C) ParmNode( phase->C->start(), TypeFunc::FramePtr ); + Node *frame = new ParmNode( phase->C->start(), TypeFunc::FramePtr ); frame = phase->transform(frame); // Halt & Catch Fire - Node *halt = new (phase->C) HaltNode( nproj, frame ); + Node *halt = new HaltNode( nproj, frame ); phase->C->root()->add_req(halt); phase->transform(halt); @@ -1333,7 +1333,7 @@ Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseTran if (!allow_new_nodes) return NULL; // Create a cast which is control dependent on the initialization to // propagate the fact that the array length must be positive. - length = new (phase->C) CastIINode(length, narrow_length_type); + length = new CastIINode(length, narrow_length_type); length->set_req(0, initialization()->proj_out(0)); } } diff --git a/hotspot/src/share/vm/opto/castnode.cpp b/hotspot/src/share/vm/opto/castnode.cpp index b8a35a72df9..afaddaf72fb 100644 --- a/hotspot/src/share/vm/opto/castnode.cpp +++ b/hotspot/src/share/vm/opto/castnode.cpp @@ -228,11 +228,11 @@ static inline Node* addP_of_X2P(PhaseGVN *phase, Node* dispX, bool negate = false) { if (negate) { - dispX = new (phase->C) SubXNode(phase->MakeConX(0), phase->transform(dispX)); + dispX = new SubXNode(phase->MakeConX(0), phase->transform(dispX)); } - return new (phase->C) AddPNode(phase->C->top(), - phase->transform(new (phase->C) CastX2PNode(base)), - phase->transform(dispX)); + return new AddPNode(phase->C->top(), + phase->transform(new CastX2PNode(base)), + phase->transform(dispX)); } Node *CastX2PNode::Ideal(PhaseGVN *phase, bool can_reshape) { diff --git a/hotspot/src/share/vm/opto/cfgnode.cpp b/hotspot/src/share/vm/opto/cfgnode.cpp index 02ec25fda2d..d99118edc83 100644 --- a/hotspot/src/share/vm/opto/cfgnode.cpp +++ b/hotspot/src/share/vm/opto/cfgnode.cpp @@ -662,17 +662,17 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) { convf2i->in(1) == bot_in ) { // Matched pattern, including LShiftI; RShiftI, replace with integer compares // max test - Node *cmp = gvn->register_new_node_with_optimizer(new (phase->C) CmpINode( convf2i, min )); - Node *boo = gvn->register_new_node_with_optimizer(new (phase->C) BoolNode( cmp, BoolTest::lt )); - IfNode *iff = (IfNode*)gvn->register_new_node_with_optimizer(new (phase->C) IfNode( top_if->in(0), boo, PROB_UNLIKELY_MAG(5), top_if->_fcnt )); - Node *if_min= gvn->register_new_node_with_optimizer(new (phase->C) IfTrueNode (iff)); - Node *ifF = gvn->register_new_node_with_optimizer(new (phase->C) IfFalseNode(iff)); + Node *cmp = gvn->register_new_node_with_optimizer(new CmpINode( convf2i, min )); + Node *boo = gvn->register_new_node_with_optimizer(new BoolNode( cmp, BoolTest::lt )); + IfNode *iff = (IfNode*)gvn->register_new_node_with_optimizer(new IfNode( top_if->in(0), boo, PROB_UNLIKELY_MAG(5), top_if->_fcnt )); + Node *if_min= gvn->register_new_node_with_optimizer(new IfTrueNode (iff)); + Node *ifF = gvn->register_new_node_with_optimizer(new IfFalseNode(iff)); // min test - cmp = gvn->register_new_node_with_optimizer(new (phase->C) CmpINode( convf2i, max )); - boo = gvn->register_new_node_with_optimizer(new (phase->C) BoolNode( cmp, BoolTest::gt )); - iff = (IfNode*)gvn->register_new_node_with_optimizer(new (phase->C) IfNode( ifF, boo, PROB_UNLIKELY_MAG(5), bot_if->_fcnt )); - Node *if_max= gvn->register_new_node_with_optimizer(new (phase->C) IfTrueNode (iff)); - ifF = gvn->register_new_node_with_optimizer(new (phase->C) IfFalseNode(iff)); + cmp = gvn->register_new_node_with_optimizer(new CmpINode( convf2i, max )); + boo = gvn->register_new_node_with_optimizer(new BoolNode( cmp, BoolTest::gt )); + iff = (IfNode*)gvn->register_new_node_with_optimizer(new IfNode( ifF, boo, PROB_UNLIKELY_MAG(5), bot_if->_fcnt )); + Node *if_max= gvn->register_new_node_with_optimizer(new IfTrueNode (iff)); + ifF = gvn->register_new_node_with_optimizer(new IfFalseNode(iff)); // update input edges to region node set_req_X( min_idx, if_min, gvn ); set_req_X( max_idx, if_max, gvn ); @@ -731,7 +731,7 @@ const TypePtr* flatten_phi_adr_type(const TypePtr* at) { PhiNode* PhiNode::make(Node* r, Node* x, const Type *t, const TypePtr* at) { uint preds = r->req(); // Number of predecessor paths assert(t != Type::MEMORY || at == flatten_phi_adr_type(at), "flatten at"); - PhiNode* p = new (Compile::current()) PhiNode(r, t, at); + PhiNode* p = new PhiNode(r, t, at); for (uint j = 1; j < preds; j++) { // Fill in all inputs, except those which the region does not yet have if (r->in(j) != NULL) @@ -749,7 +749,7 @@ PhiNode* PhiNode::make_blank(Node* r, Node* x) { const Type* t = x->bottom_type(); const TypePtr* at = NULL; if (t == Type::MEMORY) at = flatten_phi_adr_type(x->adr_type()); - return new (Compile::current()) PhiNode(r, t, at); + return new PhiNode(r, t, at); } @@ -1258,9 +1258,9 @@ static Node *is_x2logic( PhaseGVN *phase, PhiNode *phi, int true_path ) { } else return NULL; // Build int->bool conversion - Node *n = new (phase->C) Conv2BNode( cmp->in(1) ); + Node *n = new Conv2BNode( cmp->in(1) ); if( flipped ) - n = new (phase->C) XorINode( phase->transform(n), phase->intcon(1) ); + n = new XorINode( phase->transform(n), phase->intcon(1) ); return n; } @@ -1320,9 +1320,9 @@ static Node* is_cond_add(PhaseGVN *phase, PhiNode *phi, int true_path) { if( q->is_Con() && phase->type(q) != TypeInt::ZERO && y->is_Con() ) return NULL; - Node *cmplt = phase->transform( new (phase->C) CmpLTMaskNode(p,q) ); - Node *j_and = phase->transform( new (phase->C) AndINode(cmplt,y) ); - return new (phase->C) AddINode(j_and,x); + Node *cmplt = phase->transform( new CmpLTMaskNode(p,q) ); + Node *j_and = phase->transform( new AndINode(cmplt,y) ); + return new AddINode(j_and,x); } //------------------------------is_absolute------------------------------------ @@ -1384,17 +1384,17 @@ static Node* is_absolute( PhaseGVN *phase, PhiNode *phi_root, int true_path) { if( sub->Opcode() != Op_SubF || sub->in(2) != x || phase->type(sub->in(1)) != tzero ) return NULL; - x = new (phase->C) AbsFNode(x); + x = new AbsFNode(x); if (flip) { - x = new (phase->C) SubFNode(sub->in(1), phase->transform(x)); + x = new SubFNode(sub->in(1), phase->transform(x)); } } else { if( sub->Opcode() != Op_SubD || sub->in(2) != x || phase->type(sub->in(1)) != tzero ) return NULL; - x = new (phase->C) AbsDNode(x); + x = new AbsDNode(x); if (flip) { - x = new (phase->C) SubDNode(sub->in(1), phase->transform(x)); + x = new SubDNode(sub->in(1), phase->transform(x)); } } @@ -1469,7 +1469,7 @@ static Node* split_flow_path(PhaseGVN *phase, PhiNode *phi) { // Now start splitting out the flow paths that merge the same value. // Split first the RegionNode. PhaseIterGVN *igvn = phase->is_IterGVN(); - RegionNode *newr = new (phase->C) RegionNode(hit+1); + RegionNode *newr = new RegionNode(hit+1); split_once(igvn, phi, val, r, newr); // Now split all other Phis than this one @@ -1781,13 +1781,13 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { } if (doit) { if (base == NULL) { - base = new (phase->C) PhiNode(in(0), type, NULL); + base = new PhiNode(in(0), type, NULL); for (uint i = 1; i < req(); i++) { base->init_req(i, in(i)->in(AddPNode::Base)); } phase->is_IterGVN()->register_new_node_with_optimizer(base); } - return new (phase->C) AddPNode(base, base, y); + return new AddPNode(base, base, y); } } } @@ -1864,7 +1864,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Phi(...MergeMem(m0, m1:AT1, m2:AT2)...) into // MergeMem(Phi(...m0...), Phi:AT1(...m1...), Phi:AT2(...m2...)) PhaseIterGVN *igvn = phase->is_IterGVN(); - Node* hook = new (phase->C) Node(1); + Node* hook = new Node(1); PhiNode* new_base = (PhiNode*) clone(); // Must eagerly register phis, since they participate in loops. if (igvn) { @@ -1961,7 +1961,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { } else { narrow_t = TypeNarrowKlass::make(this->bottom_type()->is_ptr()); } - PhiNode* new_phi = new (phase->C) PhiNode(r, narrow_t); + PhiNode* new_phi = new PhiNode(r, narrow_t); uint orig_cnt = req(); for (uint i=1; iC) EncodePNode(ii, narrow_t); + new_ii = new EncodePNode(ii, narrow_t); } else { - new_ii = new (phase->C) EncodePKlassNode(ii, narrow_t); + new_ii = new EncodePKlassNode(ii, narrow_t); } igvn->register_new_node_with_optimizer(new_ii); } @@ -1986,9 +1986,9 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { } igvn->register_new_node_with_optimizer(new_phi, this); if (is_decodeN) { - progress = new (phase->C) DecodeNNode(new_phi, bottom_type()); + progress = new DecodeNNode(new_phi, bottom_type()); } else { - progress = new (phase->C) DecodeNKlassNode(new_phi, bottom_type()); + progress = new DecodeNKlassNode(new_phi, bottom_type()); } } } diff --git a/hotspot/src/share/vm/opto/chaitin.cpp b/hotspot/src/share/vm/opto/chaitin.cpp index f6e2065e26d..822d83a9c23 100644 --- a/hotspot/src/share/vm/opto/chaitin.cpp +++ b/hotspot/src/share/vm/opto/chaitin.cpp @@ -1730,7 +1730,7 @@ Node *PhaseChaitin::find_base_for_derived( Node **derived_base_map, Node *derive // Now we see we need a base-Phi here to merge the bases const Type *t = base->bottom_type(); - base = new (C) PhiNode( derived->in(0), t ); + base = new PhiNode( derived->in(0), t ); for( i = 1; i < derived->req(); i++ ) { base->init_req(i, find_base_for_derived(derived_base_map, derived->in(i), maxlrg)); t = t->meet(base->in(i)->bottom_type()); @@ -1800,7 +1800,7 @@ bool PhaseChaitin::stretch_base_pointer_live_ranges(ResourceArea *a) { Block *phi_block = _cfg.get_block_for_node(phi); if (_cfg.get_block_for_node(phi_block->pred(2)) == block) { const RegMask *mask = C->matcher()->idealreg2spillmask[Op_RegI]; - Node *spill = new (C) MachSpillCopyNode(MachSpillCopyNode::LoopPhiInput, phi, *mask, *mask); + Node *spill = new MachSpillCopyNode(MachSpillCopyNode::LoopPhiInput, phi, *mask, *mask); insert_proj( phi_block, 1, spill, maxlrg++ ); n->set_req(1,spill); must_recompute_live = true; diff --git a/hotspot/src/share/vm/opto/coalesce.cpp b/hotspot/src/share/vm/opto/coalesce.cpp index 5579d90c485..57a20bcb638 100644 --- a/hotspot/src/share/vm/opto/coalesce.cpp +++ b/hotspot/src/share/vm/opto/coalesce.cpp @@ -291,7 +291,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) { _phc.clone_projs(pred, pred->end_idx(), m, copy, _phc._lrg_map); } else { const RegMask *rm = C->matcher()->idealreg2spillmask[m->ideal_reg()]; - copy = new (C) MachSpillCopyNode(MachSpillCopyNode::PhiInput, m, *rm, *rm); + copy = new MachSpillCopyNode(MachSpillCopyNode::PhiInput, m, *rm, *rm); // Find a good place to insert. Kinda tricky, use a subroutine insert_copy_with_overlap(pred,copy,phi_name,src_name); } @@ -325,7 +325,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) { l += _phc.clone_projs(b, l, m, copy, _phc._lrg_map); } else { const RegMask *rm = C->matcher()->idealreg2spillmask[m->ideal_reg()]; - copy = new (C) MachSpillCopyNode(MachSpillCopyNode::TwoAddress, m, *rm, *rm); + copy = new MachSpillCopyNode(MachSpillCopyNode::TwoAddress, m, *rm, *rm); // Insert the copy in the basic block, just before us b->insert_node(copy, l++); } @@ -372,7 +372,7 @@ void PhaseAggressiveCoalesce::insert_copies( Matcher &matcher ) { continue; // Live out; do not pre-split // Split the lrg at this use const RegMask *rm = C->matcher()->idealreg2spillmask[inp->ideal_reg()]; - Node* copy = new (C) MachSpillCopyNode(MachSpillCopyNode::DebugUse, inp, *rm, *rm); + Node* copy = new MachSpillCopyNode(MachSpillCopyNode::DebugUse, inp, *rm, *rm); // Insert the copy in the use-def chain n->set_req(inpidx, copy ); // Insert the copy in the basic block, just before us diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 9c05d1da889..f93e985ae11 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -95,7 +95,7 @@ // Constant table base node singleton. MachConstantBaseNode* Compile::mach_constant_base_node() { if (_mach_constant_base_node == NULL) { - _mach_constant_base_node = new (C) MachConstantBaseNode(); + _mach_constant_base_node = new MachConstantBaseNode(); _mach_constant_base_node->add_req(C->root()); } return _mach_constant_base_node; @@ -748,14 +748,14 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr const TypeTuple *domain = StartOSRNode::osr_domain(); const TypeTuple *range = TypeTuple::make_range(method()->signature()); init_tf(TypeFunc::make(domain, range)); - StartNode* s = new (this) StartOSRNode(root(), domain); + StartNode* s = new StartOSRNode(root(), domain); initial_gvn()->set_type_bottom(s); init_start(s); cg = CallGenerator::for_osr(method(), entry_bci()); } else { // Normal case. init_tf(TypeFunc::make(method())); - StartNode* s = new (this) StartNode(root(), tf()->domain()); + StartNode* s = new StartNode(root(), tf()->domain()); initial_gvn()->set_type_bottom(s); init_start(s); if (method()->intrinsic_id() == vmIntrinsics::_Reference_get && UseG1GC) { @@ -1061,9 +1061,9 @@ void Compile::Init(int aliaslevel) { // Globally visible Nodes // First set TOP to NULL to give safe behavior during creation of RootNode set_cached_top_node(NULL); - set_root(new (this) RootNode()); + set_root(new RootNode()); // Now that you have a Root to point to, create the real TOP - set_cached_top_node( new (this) ConNode(Type::TOP) ); + set_cached_top_node( new ConNode(Type::TOP) ); set_recent_alloc(NULL, NULL); // Create Debug Information Recorder to record scopes, oopmaps, etc. @@ -2757,9 +2757,9 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { // Decode a narrow oop to match address // [R12 + narrow_oop_reg<<3 + offset] if (t->isa_oopptr()) { - nn = new (this) DecodeNNode(nn, t); + nn = new DecodeNNode(nn, t); } else { - nn = new (this) DecodeNKlassNode(nn, t); + nn = new DecodeNKlassNode(nn, t); } n->set_req(AddPNode::Base, nn); n->set_req(AddPNode::Address, nn); @@ -2880,7 +2880,7 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { } } if (new_in2 != NULL) { - Node* cmpN = new (this) CmpNNode(in1->in(1), new_in2); + Node* cmpN = new CmpNNode(in1->in(1), new_in2); n->subsume_by(cmpN, this); if (in1->outcnt() == 0) { in1->disconnect_inputs(NULL, this); @@ -2979,8 +2979,8 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { n->subsume_by(divmod->mod_proj(), this); } else { // replace a%b with a-((a/b)*b) - Node* mult = new (this) MulINode(d, d->in(2)); - Node* sub = new (this) SubINode(d->in(1), mult); + Node* mult = new MulINode(d, d->in(2)); + Node* sub = new SubINode(d->in(1), mult); n->subsume_by(sub, this); } } @@ -2999,8 +2999,8 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { n->subsume_by(divmod->mod_proj(), this); } else { // replace a%b with a-((a/b)*b) - Node* mult = new (this) MulLNode(d, d->in(2)); - Node* sub = new (this) SubLNode(d->in(1), mult); + Node* mult = new MulLNode(d, d->in(2)); + Node* sub = new SubLNode(d->in(1), mult); n->subsume_by(sub, this); } } @@ -3049,7 +3049,7 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { } } else { if (t == NULL || t->_lo < 0 || t->_hi > (int)mask) { - Node* shift = new (this) AndINode(in2, ConNode::make(this, TypeInt::make(mask))); + Node* shift = new AndINode(in2, ConNode::make(this, TypeInt::make(mask))); n->set_req(2, shift); } } diff --git a/hotspot/src/share/vm/opto/connode.cpp b/hotspot/src/share/vm/opto/connode.cpp index 8485aba1303..485e8df7951 100644 --- a/hotspot/src/share/vm/opto/connode.cpp +++ b/hotspot/src/share/vm/opto/connode.cpp @@ -45,17 +45,17 @@ uint ConNode::hash() const { //------------------------------make------------------------------------------- ConNode *ConNode::make( Compile* C, const Type *t ) { switch( t->basic_type() ) { - case T_INT: return new (C) ConINode( t->is_int() ); - case T_LONG: return new (C) ConLNode( t->is_long() ); - case T_FLOAT: return new (C) ConFNode( t->is_float_constant() ); - case T_DOUBLE: return new (C) ConDNode( t->is_double_constant() ); - case T_VOID: return new (C) ConNode ( Type::TOP ); - case T_OBJECT: return new (C) ConPNode( t->is_ptr() ); - case T_ARRAY: return new (C) ConPNode( t->is_aryptr() ); - case T_ADDRESS: return new (C) ConPNode( t->is_ptr() ); - case T_NARROWOOP: return new (C) ConNNode( t->is_narrowoop() ); - case T_NARROWKLASS: return new (C) ConNKlassNode( t->is_narrowklass() ); - case T_METADATA: return new (C) ConPNode( t->is_ptr() ); + case T_INT: return new ConINode( t->is_int() ); + case T_LONG: return new ConLNode( t->is_long() ); + case T_FLOAT: return new ConFNode( t->is_float_constant() ); + case T_DOUBLE: return new ConDNode( t->is_double_constant() ); + case T_VOID: return new ConNode ( Type::TOP ); + case T_OBJECT: return new ConPNode( t->is_ptr() ); + case T_ARRAY: return new ConPNode( t->is_aryptr() ); + case T_ADDRESS: return new ConPNode( t->is_ptr() ); + case T_NARROWOOP: return new ConNNode( t->is_narrowoop() ); + case T_NARROWKLASS: return new ConNKlassNode( t->is_narrowklass() ); + case T_METADATA: return new ConPNode( t->is_ptr() ); // Expected cases: TypePtr::NULL_PTR, any is_rawptr() // Also seen: AnyPtr(TopPTR *+top); from command line: // r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660 diff --git a/hotspot/src/share/vm/opto/connode.hpp b/hotspot/src/share/vm/opto/connode.hpp index a25e4c128a0..446b807a846 100644 --- a/hotspot/src/share/vm/opto/connode.hpp +++ b/hotspot/src/share/vm/opto/connode.hpp @@ -58,7 +58,7 @@ public: // Factory method: static ConINode* make( Compile* C, int con ) { - return new (C) ConINode( TypeInt::make(con) ); + return new ConINode( TypeInt::make(con) ); } }; @@ -73,9 +73,9 @@ public: // Factory methods: static ConPNode* make( Compile *C ,address con ) { if (con == NULL) - return new (C) ConPNode( TypePtr::NULL_PTR ) ; + return new ConPNode( TypePtr::NULL_PTR ) ; else - return new (C) ConPNode( TypeRawPtr::make(con) ); + return new ConPNode( TypeRawPtr::make(con) ); } }; @@ -106,7 +106,7 @@ public: // Factory method: static ConLNode* make( Compile *C ,jlong con ) { - return new (C) ConLNode( TypeLong::make(con) ); + return new ConLNode( TypeLong::make(con) ); } }; @@ -120,7 +120,7 @@ public: // Factory method: static ConFNode* make( Compile *C, float con ) { - return new (C) ConFNode( TypeF::make(con) ); + return new ConFNode( TypeF::make(con) ); } }; @@ -134,7 +134,7 @@ public: // Factory method: static ConDNode* make( Compile *C, double con ) { - return new (C) ConDNode( TypeD::make(con) ); + return new ConDNode( TypeD::make(con) ); } }; diff --git a/hotspot/src/share/vm/opto/convertnode.cpp b/hotspot/src/share/vm/opto/convertnode.cpp index bf09d3fbb90..8c42aaed679 100644 --- a/hotspot/src/share/vm/opto/convertnode.cpp +++ b/hotspot/src/share/vm/opto/convertnode.cpp @@ -374,11 +374,11 @@ Node *ConvI2LNode::Ideal(PhaseGVN *phase, bool can_reshape) { ryhi = -rylo0; } - Node* cx = phase->transform( new (phase->C) ConvI2LNode(x, TypeLong::make(rxlo, rxhi, widen)) ); - Node* cy = phase->transform( new (phase->C) ConvI2LNode(y, TypeLong::make(rylo, ryhi, widen)) ); + Node* cx = phase->transform( new ConvI2LNode(x, TypeLong::make(rxlo, rxhi, widen)) ); + Node* cy = phase->transform( new ConvI2LNode(y, TypeLong::make(rylo, ryhi, widen)) ); switch (op) { - case Op_AddI: return new (phase->C) AddLNode(cx, cy); - case Op_SubI: return new (phase->C) SubLNode(cx, cy); + case Op_AddI: return new AddLNode(cx, cy); + case Op_SubI: return new SubLNode(cx, cy); default: ShouldNotReachHere(); } } @@ -452,9 +452,9 @@ Node *ConvL2INode::Ideal(PhaseGVN *phase, bool can_reshape) { assert( x != andl && y != andl, "dead loop in ConvL2INode::Ideal" ); if (phase->type(x) == Type::TOP) return NULL; if (phase->type(y) == Type::TOP) return NULL; - Node *add1 = phase->transform(new (phase->C) ConvL2INode(x)); - Node *add2 = phase->transform(new (phase->C) ConvL2INode(y)); - return new (phase->C) AddINode(add1,add2); + Node *add1 = phase->transform(new ConvL2INode(x)); + Node *add2 = phase->transform(new ConvL2INode(y)); + return new AddINode(add1,add2); } // Disable optimization: LoadL->ConvL2I ==> LoadI. diff --git a/hotspot/src/share/vm/opto/divnode.cpp b/hotspot/src/share/vm/opto/divnode.cpp index 40bd21fbc4c..8a27c24e37e 100644 --- a/hotspot/src/share/vm/opto/divnode.cpp +++ b/hotspot/src/share/vm/opto/divnode.cpp @@ -106,7 +106,7 @@ static Node *transform_int_divide( PhaseGVN *phase, Node *dividend, jint divisor // division by +/- 1 if (!d_pos) { // Just negate the value - q = new (phase->C) SubINode(phase->intcon(0), dividend); + q = new SubINode(phase->intcon(0), dividend); } } else if ( is_power_of_2(d) ) { // division by +/- a power of 2 @@ -143,18 +143,18 @@ static Node *transform_int_divide( PhaseGVN *phase, Node *dividend, jint divisor // (-2+3)>>2 becomes 0, etc. // Compute 0 or -1, based on sign bit - Node *sign = phase->transform(new (phase->C) RShiftINode(dividend, phase->intcon(N - 1))); + Node *sign = phase->transform(new RShiftINode(dividend, phase->intcon(N - 1))); // Mask sign bit to the low sign bits - Node *round = phase->transform(new (phase->C) URShiftINode(sign, phase->intcon(N - l))); + Node *round = phase->transform(new URShiftINode(sign, phase->intcon(N - l))); // Round up before shifting - dividend = phase->transform(new (phase->C) AddINode(dividend, round)); + dividend = phase->transform(new AddINode(dividend, round)); } // Shift for division - q = new (phase->C) RShiftINode(dividend, phase->intcon(l)); + q = new RShiftINode(dividend, phase->intcon(l)); if (!d_pos) { - q = new (phase->C) SubINode(phase->intcon(0), phase->transform(q)); + q = new SubINode(phase->intcon(0), phase->transform(q)); } } else { // Attempt the jint constant divide -> multiply transform found in @@ -166,33 +166,33 @@ static Node *transform_int_divide( PhaseGVN *phase, Node *dividend, jint divisor jint shift_const; if (magic_int_divide_constants(d, magic_const, shift_const)) { Node *magic = phase->longcon(magic_const); - Node *dividend_long = phase->transform(new (phase->C) ConvI2LNode(dividend)); + Node *dividend_long = phase->transform(new ConvI2LNode(dividend)); // Compute the high half of the dividend x magic multiplication - Node *mul_hi = phase->transform(new (phase->C) MulLNode(dividend_long, magic)); + Node *mul_hi = phase->transform(new MulLNode(dividend_long, magic)); if (magic_const < 0) { - mul_hi = phase->transform(new (phase->C) RShiftLNode(mul_hi, phase->intcon(N))); - mul_hi = phase->transform(new (phase->C) ConvL2INode(mul_hi)); + mul_hi = phase->transform(new RShiftLNode(mul_hi, phase->intcon(N))); + mul_hi = phase->transform(new ConvL2INode(mul_hi)); // The magic multiplier is too large for a 32 bit constant. We've adjusted // it down by 2^32, but have to add 1 dividend back in after the multiplication. // This handles the "overflow" case described by Granlund and Montgomery. - mul_hi = phase->transform(new (phase->C) AddINode(dividend, mul_hi)); + mul_hi = phase->transform(new AddINode(dividend, mul_hi)); // Shift over the (adjusted) mulhi if (shift_const != 0) { - mul_hi = phase->transform(new (phase->C) RShiftINode(mul_hi, phase->intcon(shift_const))); + mul_hi = phase->transform(new RShiftINode(mul_hi, phase->intcon(shift_const))); } } else { // No add is required, we can merge the shifts together. - mul_hi = phase->transform(new (phase->C) RShiftLNode(mul_hi, phase->intcon(N + shift_const))); - mul_hi = phase->transform(new (phase->C) ConvL2INode(mul_hi)); + mul_hi = phase->transform(new RShiftLNode(mul_hi, phase->intcon(N + shift_const))); + mul_hi = phase->transform(new ConvL2INode(mul_hi)); } // Get a 0 or -1 from the sign of the dividend. Node *addend0 = mul_hi; - Node *addend1 = phase->transform(new (phase->C) RShiftINode(dividend, phase->intcon(N-1))); + Node *addend1 = phase->transform(new RShiftINode(dividend, phase->intcon(N-1))); // If the divisor is negative, swap the order of the input addends; // this has the effect of negating the quotient. @@ -202,7 +202,7 @@ static Node *transform_int_divide( PhaseGVN *phase, Node *dividend, jint divisor // Adjust the final quotient by subtracting -1 (adding 1) // from the mul_hi. - q = new (phase->C) SubINode(addend0, addend1); + q = new SubINode(addend0, addend1); } } @@ -261,7 +261,7 @@ static Node* long_by_long_mulhi(PhaseGVN* phase, Node* dividend, jlong magic_con // no need to synthesize it in ideal nodes. if (Matcher::has_match_rule(Op_MulHiL)) { Node* v = phase->longcon(magic_const); - return new (phase->C) MulHiLNode(dividend, v); + return new MulHiLNode(dividend, v); } // Taken from Hacker's Delight, Fig. 8-2. Multiply high signed. @@ -287,11 +287,11 @@ static Node* long_by_long_mulhi(PhaseGVN* phase, Node* dividend, jlong magic_con const int N = 64; // Dummy node to keep intermediate nodes alive during construction - Node* hook = new (phase->C) Node(4); + Node* hook = new Node(4); // u0 = u & 0xFFFFFFFF; u1 = u >> 32; - Node* u0 = phase->transform(new (phase->C) AndLNode(dividend, phase->longcon(0xFFFFFFFF))); - Node* u1 = phase->transform(new (phase->C) RShiftLNode(dividend, phase->intcon(N / 2))); + Node* u0 = phase->transform(new AndLNode(dividend, phase->longcon(0xFFFFFFFF))); + Node* u1 = phase->transform(new RShiftLNode(dividend, phase->intcon(N / 2))); hook->init_req(0, u0); hook->init_req(1, u1); @@ -300,29 +300,29 @@ static Node* long_by_long_mulhi(PhaseGVN* phase, Node* dividend, jlong magic_con Node* v1 = phase->longcon(magic_const >> (N / 2)); // w0 = u0*v0; - Node* w0 = phase->transform(new (phase->C) MulLNode(u0, v0)); + Node* w0 = phase->transform(new MulLNode(u0, v0)); // t = u1*v0 + (w0 >> 32); - Node* u1v0 = phase->transform(new (phase->C) MulLNode(u1, v0)); - Node* temp = phase->transform(new (phase->C) URShiftLNode(w0, phase->intcon(N / 2))); - Node* t = phase->transform(new (phase->C) AddLNode(u1v0, temp)); + Node* u1v0 = phase->transform(new MulLNode(u1, v0)); + Node* temp = phase->transform(new URShiftLNode(w0, phase->intcon(N / 2))); + Node* t = phase->transform(new AddLNode(u1v0, temp)); hook->init_req(2, t); // w1 = t & 0xFFFFFFFF; - Node* w1 = phase->transform(new (phase->C) AndLNode(t, phase->longcon(0xFFFFFFFF))); + Node* w1 = phase->transform(new AndLNode(t, phase->longcon(0xFFFFFFFF))); hook->init_req(3, w1); // w2 = t >> 32; - Node* w2 = phase->transform(new (phase->C) RShiftLNode(t, phase->intcon(N / 2))); + Node* w2 = phase->transform(new RShiftLNode(t, phase->intcon(N / 2))); // w1 = u0*v1 + w1; - Node* u0v1 = phase->transform(new (phase->C) MulLNode(u0, v1)); - w1 = phase->transform(new (phase->C) AddLNode(u0v1, w1)); + Node* u0v1 = phase->transform(new MulLNode(u0, v1)); + w1 = phase->transform(new AddLNode(u0v1, w1)); // return u1*v1 + w2 + (w1 >> 32); - Node* u1v1 = phase->transform(new (phase->C) MulLNode(u1, v1)); - Node* temp1 = phase->transform(new (phase->C) AddLNode(u1v1, w2)); - Node* temp2 = phase->transform(new (phase->C) RShiftLNode(w1, phase->intcon(N / 2))); + Node* u1v1 = phase->transform(new MulLNode(u1, v1)); + Node* temp1 = phase->transform(new AddLNode(u1v1, w2)); + Node* temp2 = phase->transform(new RShiftLNode(w1, phase->intcon(N / 2))); // Remove the bogus extra edges used to keep things alive PhaseIterGVN* igvn = phase->is_IterGVN(); @@ -334,7 +334,7 @@ static Node* long_by_long_mulhi(PhaseGVN* phase, Node* dividend, jlong magic_con } } - return new (phase->C) AddLNode(temp1, temp2); + return new AddLNode(temp1, temp2); } @@ -357,7 +357,7 @@ static Node *transform_long_divide( PhaseGVN *phase, Node *dividend, jlong divis // division by +/- 1 if (!d_pos) { // Just negate the value - q = new (phase->C) SubLNode(phase->longcon(0), dividend); + q = new SubLNode(phase->longcon(0), dividend); } } else if ( is_power_of_2_long(d) ) { @@ -396,18 +396,18 @@ static Node *transform_long_divide( PhaseGVN *phase, Node *dividend, jlong divis // (-2+3)>>2 becomes 0, etc. // Compute 0 or -1, based on sign bit - Node *sign = phase->transform(new (phase->C) RShiftLNode(dividend, phase->intcon(N - 1))); + Node *sign = phase->transform(new RShiftLNode(dividend, phase->intcon(N - 1))); // Mask sign bit to the low sign bits - Node *round = phase->transform(new (phase->C) URShiftLNode(sign, phase->intcon(N - l))); + Node *round = phase->transform(new URShiftLNode(sign, phase->intcon(N - l))); // Round up before shifting - dividend = phase->transform(new (phase->C) AddLNode(dividend, round)); + dividend = phase->transform(new AddLNode(dividend, round)); } // Shift for division - q = new (phase->C) RShiftLNode(dividend, phase->intcon(l)); + q = new RShiftLNode(dividend, phase->intcon(l)); if (!d_pos) { - q = new (phase->C) SubLNode(phase->longcon(0), phase->transform(q)); + q = new SubLNode(phase->longcon(0), phase->transform(q)); } } else if ( !Matcher::use_asm_for_ldiv_by_con(d) ) { // Use hardware DIV instruction when // it is faster than code generated below. @@ -427,17 +427,17 @@ static Node *transform_long_divide( PhaseGVN *phase, Node *dividend, jlong divis // The magic multiplier is too large for a 64 bit constant. We've adjusted // it down by 2^64, but have to add 1 dividend back in after the multiplication. // This handles the "overflow" case described by Granlund and Montgomery. - mul_hi = phase->transform(new (phase->C) AddLNode(dividend, mul_hi)); + mul_hi = phase->transform(new AddLNode(dividend, mul_hi)); } // Shift over the (adjusted) mulhi if (shift_const != 0) { - mul_hi = phase->transform(new (phase->C) RShiftLNode(mul_hi, phase->intcon(shift_const))); + mul_hi = phase->transform(new RShiftLNode(mul_hi, phase->intcon(shift_const))); } // Get a 0 or -1 from the sign of the dividend. Node *addend0 = mul_hi; - Node *addend1 = phase->transform(new (phase->C) RShiftLNode(dividend, phase->intcon(N-1))); + Node *addend1 = phase->transform(new RShiftLNode(dividend, phase->intcon(N-1))); // If the divisor is negative, swap the order of the input addends; // this has the effect of negating the quotient. @@ -447,7 +447,7 @@ static Node *transform_long_divide( PhaseGVN *phase, Node *dividend, jlong divis // Adjust the final quotient by subtracting -1 (adding 1) // from the mul_hi. - q = new (phase->C) SubLNode(addend0, addend1); + q = new SubLNode(addend0, addend1); } } @@ -737,7 +737,7 @@ Node *DivFNode::Ideal(PhaseGVN *phase, bool can_reshape) { assert( frexp((double)reciprocal, &exp) == 0.5, "reciprocal should be power of 2" ); // return multiplication by the reciprocal - return (new (phase->C) MulFNode(in(1), phase->makecon(TypeF::make(reciprocal)))); + return (new MulFNode(in(1), phase->makecon(TypeF::make(reciprocal)))); } //============================================================================= @@ -831,7 +831,7 @@ Node *DivDNode::Ideal(PhaseGVN *phase, bool can_reshape) { assert( frexp(reciprocal, &exp) == 0.5, "reciprocal should be power of 2" ); // return multiplication by the reciprocal - return (new (phase->C) MulDNode(in(1), phase->makecon(TypeD::make(reciprocal)))); + return (new MulDNode(in(1), phase->makecon(TypeD::make(reciprocal)))); } //============================================================================= @@ -858,7 +858,7 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) { if( !ti->is_con() ) return NULL; jint con = ti->get_con(); - Node *hook = new (phase->C) Node(1); + Node *hook = new Node(1); // First, special check for modulo 2^k-1 if( con >= 0 && con < max_jint && is_power_of_2(con+1) ) { @@ -878,24 +878,24 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) { hook->init_req(0, x); // Add a use to x to prevent him from dying // Generate code to reduce X rapidly to nearly 2^k-1. for( int i = 0; i < trip_count; i++ ) { - Node *xl = phase->transform( new (phase->C) AndINode(x,divisor) ); - Node *xh = phase->transform( new (phase->C) RShiftINode(x,phase->intcon(k)) ); // Must be signed - x = phase->transform( new (phase->C) AddINode(xh,xl) ); + Node *xl = phase->transform( new AndINode(x,divisor) ); + Node *xh = phase->transform( new RShiftINode(x,phase->intcon(k)) ); // Must be signed + x = phase->transform( new AddINode(xh,xl) ); hook->set_req(0, x); } // Generate sign-fixup code. Was original value positive? // int hack_res = (i >= 0) ? divisor : 1; - Node *cmp1 = phase->transform( new (phase->C) CmpINode( in(1), phase->intcon(0) ) ); - Node *bol1 = phase->transform( new (phase->C) BoolNode( cmp1, BoolTest::ge ) ); - Node *cmov1= phase->transform( new (phase->C) CMoveINode(bol1, phase->intcon(1), divisor, TypeInt::POS) ); + Node *cmp1 = phase->transform( new CmpINode( in(1), phase->intcon(0) ) ); + Node *bol1 = phase->transform( new BoolNode( cmp1, BoolTest::ge ) ); + Node *cmov1= phase->transform( new CMoveINode(bol1, phase->intcon(1), divisor, TypeInt::POS) ); // if( x >= hack_res ) x -= divisor; - Node *sub = phase->transform( new (phase->C) SubINode( x, divisor ) ); - Node *cmp2 = phase->transform( new (phase->C) CmpINode( x, cmov1 ) ); - Node *bol2 = phase->transform( new (phase->C) BoolNode( cmp2, BoolTest::ge ) ); + Node *sub = phase->transform( new SubINode( x, divisor ) ); + Node *cmp2 = phase->transform( new CmpINode( x, cmov1 ) ); + Node *bol2 = phase->transform( new BoolNode( cmp2, BoolTest::ge ) ); // Convention is to not transform the return value of an Ideal // since Ideal is expected to return a modified 'this' or a new node. - Node *cmov2= new (phase->C) CMoveINode(bol2, x, sub, TypeInt::INT); + Node *cmov2= new CMoveINode(bol2, x, sub, TypeInt::INT); // cmov2 is now the mod // Now remove the bogus extra edges used to keep things alive @@ -918,7 +918,7 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) { jint pos_con = (con >= 0) ? con : -con; // integer Mod 1 is always 0 - if( pos_con == 1 ) return new (phase->C) ConINode(TypeInt::ZERO); + if( pos_con == 1 ) return new ConINode(TypeInt::ZERO); int log2_con = -1; @@ -931,7 +931,7 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) { // See if this can be masked, if the dividend is non-negative if( dti && dti->_lo >= 0 ) - return ( new (phase->C) AndINode( in(1), phase->intcon( pos_con-1 ) ) ); + return ( new AndINode( in(1), phase->intcon( pos_con-1 ) ) ); } // Save in(1) so that it cannot be changed or deleted @@ -946,12 +946,12 @@ Node *ModINode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *mult = NULL; if( log2_con >= 0 ) - mult = phase->transform( new (phase->C) LShiftINode( divide, phase->intcon( log2_con ) ) ); + mult = phase->transform( new LShiftINode( divide, phase->intcon( log2_con ) ) ); else - mult = phase->transform( new (phase->C) MulINode( divide, phase->intcon( pos_con ) ) ); + mult = phase->transform( new MulINode( divide, phase->intcon( pos_con ) ) ); // Finally, subtract the multiplied divided value from the original - result = new (phase->C) SubINode( in(1), mult ); + result = new SubINode( in(1), mult ); } // Now remove the bogus extra edges used to keep things alive @@ -1029,7 +1029,7 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) { if( !tl->is_con() ) return NULL; jlong con = tl->get_con(); - Node *hook = new (phase->C) Node(1); + Node *hook = new Node(1); // Expand mod if( con >= 0 && con < max_jlong && is_power_of_2_long(con+1) ) { @@ -1051,24 +1051,24 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) { hook->init_req(0, x); // Add a use to x to prevent him from dying // Generate code to reduce X rapidly to nearly 2^k-1. for( int i = 0; i < trip_count; i++ ) { - Node *xl = phase->transform( new (phase->C) AndLNode(x,divisor) ); - Node *xh = phase->transform( new (phase->C) RShiftLNode(x,phase->intcon(k)) ); // Must be signed - x = phase->transform( new (phase->C) AddLNode(xh,xl) ); + Node *xl = phase->transform( new AndLNode(x,divisor) ); + Node *xh = phase->transform( new RShiftLNode(x,phase->intcon(k)) ); // Must be signed + x = phase->transform( new AddLNode(xh,xl) ); hook->set_req(0, x); // Add a use to x to prevent him from dying } // Generate sign-fixup code. Was original value positive? // long hack_res = (i >= 0) ? divisor : CONST64(1); - Node *cmp1 = phase->transform( new (phase->C) CmpLNode( in(1), phase->longcon(0) ) ); - Node *bol1 = phase->transform( new (phase->C) BoolNode( cmp1, BoolTest::ge ) ); - Node *cmov1= phase->transform( new (phase->C) CMoveLNode(bol1, phase->longcon(1), divisor, TypeLong::LONG) ); + Node *cmp1 = phase->transform( new CmpLNode( in(1), phase->longcon(0) ) ); + Node *bol1 = phase->transform( new BoolNode( cmp1, BoolTest::ge ) ); + Node *cmov1= phase->transform( new CMoveLNode(bol1, phase->longcon(1), divisor, TypeLong::LONG) ); // if( x >= hack_res ) x -= divisor; - Node *sub = phase->transform( new (phase->C) SubLNode( x, divisor ) ); - Node *cmp2 = phase->transform( new (phase->C) CmpLNode( x, cmov1 ) ); - Node *bol2 = phase->transform( new (phase->C) BoolNode( cmp2, BoolTest::ge ) ); + Node *sub = phase->transform( new SubLNode( x, divisor ) ); + Node *cmp2 = phase->transform( new CmpLNode( x, cmov1 ) ); + Node *bol2 = phase->transform( new BoolNode( cmp2, BoolTest::ge ) ); // Convention is to not transform the return value of an Ideal // since Ideal is expected to return a modified 'this' or a new node. - Node *cmov2= new (phase->C) CMoveLNode(bol2, x, sub, TypeLong::LONG); + Node *cmov2= new CMoveLNode(bol2, x, sub, TypeLong::LONG); // cmov2 is now the mod // Now remove the bogus extra edges used to keep things alive @@ -1091,7 +1091,7 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) { jlong pos_con = (con >= 0) ? con : -con; // integer Mod 1 is always 0 - if( pos_con == 1 ) return new (phase->C) ConLNode(TypeLong::ZERO); + if( pos_con == 1 ) return new ConLNode(TypeLong::ZERO); int log2_con = -1; @@ -1104,7 +1104,7 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) { // See if this can be masked, if the dividend is non-negative if( dtl && dtl->_lo >= 0 ) - return ( new (phase->C) AndLNode( in(1), phase->longcon( pos_con-1 ) ) ); + return ( new AndLNode( in(1), phase->longcon( pos_con-1 ) ) ); } // Save in(1) so that it cannot be changed or deleted @@ -1119,12 +1119,12 @@ Node *ModLNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *mult = NULL; if( log2_con >= 0 ) - mult = phase->transform( new (phase->C) LShiftLNode( divide, phase->intcon( log2_con ) ) ); + mult = phase->transform( new LShiftLNode( divide, phase->intcon( log2_con ) ) ); else - mult = phase->transform( new (phase->C) MulLNode( divide, phase->longcon( pos_con ) ) ); + mult = phase->transform( new MulLNode( divide, phase->longcon( pos_con ) ) ); // Finally, subtract the multiplied divided value from the original - result = new (phase->C) SubLNode( in(1), mult ); + result = new SubLNode( in(1), mult ); } // Now remove the bogus extra edges used to keep things alive @@ -1279,9 +1279,9 @@ DivModINode* DivModINode::make(Compile* C, Node* div_or_mod) { assert(n->Opcode() == Op_DivI || n->Opcode() == Op_ModI, "only div or mod input pattern accepted"); - DivModINode* divmod = new (C) DivModINode(n->in(0), n->in(1), n->in(2)); - Node* dproj = new (C) ProjNode(divmod, DivModNode::div_proj_num); - Node* mproj = new (C) ProjNode(divmod, DivModNode::mod_proj_num); + DivModINode* divmod = new DivModINode(n->in(0), n->in(1), n->in(2)); + Node* dproj = new ProjNode(divmod, DivModNode::div_proj_num); + Node* mproj = new ProjNode(divmod, DivModNode::mod_proj_num); return divmod; } @@ -1291,9 +1291,9 @@ DivModLNode* DivModLNode::make(Compile* C, Node* div_or_mod) { assert(n->Opcode() == Op_DivL || n->Opcode() == Op_ModL, "only div or mod input pattern accepted"); - DivModLNode* divmod = new (C) DivModLNode(n->in(0), n->in(1), n->in(2)); - Node* dproj = new (C) ProjNode(divmod, DivModNode::div_proj_num); - Node* mproj = new (C) ProjNode(divmod, DivModNode::mod_proj_num); + DivModLNode* divmod = new DivModLNode(n->in(0), n->in(1), n->in(2)); + Node* dproj = new ProjNode(divmod, DivModNode::div_proj_num); + Node* mproj = new ProjNode(divmod, DivModNode::mod_proj_num); return divmod; } @@ -1308,7 +1308,7 @@ Node *DivModINode::match( const ProjNode *proj, const Matcher *match ) { assert(proj->_con == mod_proj_num, "must be div or mod projection"); rm = match->modI_proj_mask(); } - return new (match->C)MachProjNode(this, proj->_con, rm, ideal_reg); + return new MachProjNode(this, proj->_con, rm, ideal_reg); } @@ -1323,5 +1323,5 @@ Node *DivModLNode::match( const ProjNode *proj, const Matcher *match ) { assert(proj->_con == mod_proj_num, "must be div or mod projection"); rm = match->modL_proj_mask(); } - return new (match->C)MachProjNode(this, proj->_con, rm, ideal_reg); + return new MachProjNode(this, proj->_con, rm, ideal_reg); } diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index 2c48e604497..d3a85d4d29f 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -596,7 +596,7 @@ void Parse::do_call() { const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { Node* retnode = pop(); - Node* cast_obj = _gvn.transform(new (C) CheckCastPPNode(control(), retnode, sig_type)); + Node* cast_obj = _gvn.transform(new CheckCastPPNode(control(), retnode, sig_type)); push(cast_obj); } } @@ -689,7 +689,7 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) { } int len = bcis->length(); - CatchNode *cn = new (C) CatchNode(control(), i_o, len+1); + CatchNode *cn = new CatchNode(control(), i_o, len+1); Node *catch_ = _gvn.transform(cn); // now branch with the exception state to each of the (potential) @@ -700,14 +700,14 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) { // Locals are just copied from before the call. // Get control from the CatchNode. int handler_bci = bcis->at(i); - Node* ctrl = _gvn.transform( new (C) CatchProjNode(catch_, i+1,handler_bci)); + Node* ctrl = _gvn.transform( new CatchProjNode(catch_, i+1,handler_bci)); // This handler cannot happen? if (ctrl == top()) continue; set_control(ctrl); // Create exception oop const TypeInstPtr* extype = extypes->at(i)->is_instptr(); - Node *ex_oop = _gvn.transform(new (C) CreateExNode(extypes->at(i), ctrl, i_o)); + Node *ex_oop = _gvn.transform(new CreateExNode(extypes->at(i), ctrl, i_o)); // Handle unloaded exception classes. if (saw_unloaded->contains(handler_bci)) { @@ -746,7 +746,7 @@ void Parse::catch_call_exceptions(ciExceptionHandlerStream& handlers) { // The first CatchProj is for the normal return. // (Note: If this is a call to rethrow_Java, this node goes dead.) - set_control(_gvn.transform( new (C) CatchProjNode(catch_, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci))); + set_control(_gvn.transform( new CatchProjNode(catch_, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci))); } @@ -797,7 +797,7 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) { // I'm loading the class from, I can replace the LoadKlass with the // klass constant for the exception oop. if( ex_node->is_Phi() ) { - ex_klass_node = new (C) PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); + ex_klass_node = new PhiNode( ex_node->in(0), TypeKlassPtr::OBJECT ); for( uint i = 1; i < ex_node->req(); i++ ) { Node* p = basic_plus_adr( ex_node->in(i), ex_node->in(i), oopDesc::klass_offset_in_bytes() ); Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) ); @@ -863,7 +863,7 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) { PreserveJVMState pjvms(this); const TypeInstPtr* tinst = TypeOopPtr::make_from_klass_unique(klass)->cast_to_ptr_type(TypePtr::NotNull)->is_instptr(); assert(klass->has_subklass() || tinst->klass_is_exact(), "lost exactness"); - Node* ex_oop = _gvn.transform(new (C) CheckCastPPNode(control(), ex_node, tinst)); + Node* ex_oop = _gvn.transform(new CheckCastPPNode(control(), ex_node, tinst)); push_ex_oop(ex_oop); // Push exception oop for handler #ifndef PRODUCT if (PrintOpto && WizardMode) { diff --git a/hotspot/src/share/vm/opto/generateOptoStub.cpp b/hotspot/src/share/vm/opto/generateOptoStub.cpp index f75110842b9..0472f45adeb 100644 --- a/hotspot/src/share/vm/opto/generateOptoStub.cpp +++ b/hotspot/src/share/vm/opto/generateOptoStub.cpp @@ -50,7 +50,7 @@ void GraphKit::gen_stub(address C_function, const TypeTuple *jrange = C->tf()->range(); // The procedure start - StartNode* start = new (C) StartNode(root(), jdomain); + StartNode* start = new StartNode(root(), jdomain); _gvn.set_type_bottom(start); // Make a map, with JVM state @@ -64,7 +64,7 @@ void GraphKit::gen_stub(address C_function, jvms->set_scloff(max_map); jvms->set_endoff(max_map); { - SafePointNode *map = new (C) SafePointNode( max_map, jvms ); + SafePointNode *map = new SafePointNode( max_map, jvms ); jvms->set_map(map); set_jvms(jvms); assert(map == this->map(), "kit.map is set"); @@ -73,7 +73,7 @@ void GraphKit::gen_stub(address C_function, // Make up the parameters uint i; for( i = 0; i < parm_cnt; i++ ) - map()->init_req(i, _gvn.transform(new (C) ParmNode(start, i))); + map()->init_req(i, _gvn.transform(new ParmNode(start, i))); for( ; ireq(); i++ ) map()->init_req(i, top()); // For nicer debugging @@ -81,7 +81,7 @@ void GraphKit::gen_stub(address C_function, set_all_memory(map()->memory()); // Get base of thread-local storage area - Node* thread = _gvn.transform( new (C) ThreadLocalNode() ); + Node* thread = _gvn.transform( new ThreadLocalNode() ); const int NoAlias = Compile::AliasIdxBot; @@ -166,8 +166,7 @@ void GraphKit::gen_stub(address C_function, //----------------------------- // Make the call node - CallRuntimeNode *call = new (C) - CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM); + CallRuntimeNode *call = new CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM); //----------------------------- // Fix-up the debug info for the call @@ -184,7 +183,7 @@ void GraphKit::gen_stub(address C_function, for (; i < parm_cnt; i++) { // Regular input arguments // Convert ints to longs if required. if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(i)->isa_int()) { - Node* int_as_long = _gvn.transform(new (C) ConvI2LNode(map()->in(i))); + Node* int_as_long = _gvn.transform(new ConvI2LNode(map()->in(i))); call->init_req(cnt++, int_as_long); // long call->init_req(cnt++, top()); // half } else { @@ -200,23 +199,23 @@ void GraphKit::gen_stub(address C_function, //----------------------------- // Now set up the return results - set_control( _gvn.transform( new (C) ProjNode(call,TypeFunc::Control)) ); - set_i_o( _gvn.transform( new (C) ProjNode(call,TypeFunc::I_O )) ); + set_control( _gvn.transform( new ProjNode(call,TypeFunc::Control)) ); + set_i_o( _gvn.transform( new ProjNode(call,TypeFunc::I_O )) ); set_all_memory_call(call); if (range->cnt() > TypeFunc::Parms) { - Node* retnode = _gvn.transform( new (C) ProjNode(call,TypeFunc::Parms) ); + Node* retnode = _gvn.transform( new ProjNode(call,TypeFunc::Parms) ); // C-land is allowed to return sub-word values. Convert to integer type. assert( retval != Type::TOP, "" ); if (retval == TypeInt::BOOL) { - retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFF)) ); + retnode = _gvn.transform( new AndINode(retnode, intcon(0xFF)) ); } else if (retval == TypeInt::CHAR) { - retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFFFF)) ); + retnode = _gvn.transform( new AndINode(retnode, intcon(0xFFFF)) ); } else if (retval == TypeInt::BYTE) { - retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(24)) ); - retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(24)) ); + retnode = _gvn.transform( new LShiftINode(retnode, intcon(24)) ); + retnode = _gvn.transform( new RShiftINode(retnode, intcon(24)) ); } else if (retval == TypeInt::SHORT) { - retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(16)) ); - retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(16)) ); + retnode = _gvn.transform( new LShiftINode(retnode, intcon(16)) ); + retnode = _gvn.transform( new RShiftINode(retnode, intcon(16)) ); } map()->set_req( TypeFunc::Parms, retnode ); } @@ -253,21 +252,21 @@ void GraphKit::gen_stub(address C_function, Node* exit_memory = reset_memory(); - Node* cmp = _gvn.transform( new (C) CmpPNode(pending, null()) ); - Node* bo = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ne) ); + Node* cmp = _gvn.transform( new CmpPNode(pending, null()) ); + Node* bo = _gvn.transform( new BoolNode(cmp, BoolTest::ne) ); IfNode *iff = create_and_map_if(control(), bo, PROB_MIN, COUNT_UNKNOWN); - Node* if_null = _gvn.transform( new (C) IfFalseNode(iff) ); - Node* if_not_null = _gvn.transform( new (C) IfTrueNode(iff) ); + Node* if_null = _gvn.transform( new IfFalseNode(iff) ); + Node* if_not_null = _gvn.transform( new IfTrueNode(iff) ); assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before"); Node *exc_target = makecon(TypeRawPtr::make( StubRoutines::forward_exception_entry() )); - Node *to_exc = new (C) TailCallNode(if_not_null, - i_o(), - exit_memory, - frameptr(), - returnadr(), - exc_target, null()); + Node *to_exc = new TailCallNode(if_not_null, + i_o(), + exit_memory, + frameptr(), + returnadr(), + exc_target, null()); root()->add_req(_gvn.transform(to_exc)); // bind to root to keep live C->init_start(start); @@ -277,27 +276,27 @@ void GraphKit::gen_stub(address C_function, switch( is_fancy_jump ) { case 0: // Make a return instruction // Return to caller, free any space for return address - ret = new (C) ReturnNode(TypeFunc::Parms, if_null, - i_o(), - exit_memory, - frameptr(), - returnadr()); + ret = new ReturnNode(TypeFunc::Parms, if_null, + i_o(), + exit_memory, + frameptr(), + returnadr()); if (C->tf()->range()->cnt() > TypeFunc::Parms) ret->add_req( map()->in(TypeFunc::Parms) ); break; case 1: // This is a fancy tail-call jump. Jump to computed address. // Jump to new callee; leave old return address alone. - ret = new (C) TailCallNode(if_null, - i_o(), - exit_memory, - frameptr(), - returnadr(), - target, map()->in(TypeFunc::Parms)); + ret = new TailCallNode(if_null, + i_o(), + exit_memory, + frameptr(), + returnadr(), + target, map()->in(TypeFunc::Parms)); break; case 2: // Pop return address & jump // Throw away old return address; jump to new computed address //assert(C_function == CAST_FROM_FN_PTR(address, OptoRuntime::rethrow_C), "fancy_jump==2 only for rethrow"); - ret = new (C) TailJumpNode(if_null, + ret = new TailJumpNode(if_null, i_o(), exit_memory, frameptr(), diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index 123e28fa95b..9e07ebf8949 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -294,7 +294,7 @@ JVMState* GraphKit::transfer_exceptions_into_jvms() { JVMState* jvms = new (C) JVMState(_method, NULL); jvms->set_bci(_bci); jvms->set_sp(_sp); - jvms->set_map(new (C) SafePointNode(TypeFunc::Parms, jvms)); + jvms->set_map(new SafePointNode(TypeFunc::Parms, jvms)); set_jvms(jvms); for (uint i = 0; i < map()->req(); i++) map()->init_req(i, top()); set_all_memory(top()); @@ -347,7 +347,7 @@ void GraphKit::combine_exception_states(SafePointNode* ex_map, SafePointNode* ph if (region->in(0) != hidden_merge_mark) { // The control input is not (yet) a specially-marked region in phi_map. // Make it so, and build some phis. - region = new (C) RegionNode(2); + region = new RegionNode(2); _gvn.set_type(region, Type::CONTROL); region->set_req(0, hidden_merge_mark); // marks an internal ex-state region->init_req(1, phi_map->control()); @@ -496,13 +496,13 @@ void GraphKit::uncommon_trap_if_should_post_on_exceptions(Deoptimization::DeoptR // take the uncommon_trap in the BuildCutout below. // first must access the should_post_on_exceptions_flag in this thread's JavaThread - Node* jthread = _gvn.transform(new (C) ThreadLocalNode()); + Node* jthread = _gvn.transform(new ThreadLocalNode()); Node* adr = basic_plus_adr(top(), jthread, in_bytes(JavaThread::should_post_on_exceptions_flag_offset())); Node* should_post_flag = make_load(control(), adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw, MemNode::unordered); // Test the should_post_on_exceptions_flag vs. 0 - Node* chk = _gvn.transform( new (C) CmpINode(should_post_flag, intcon(0)) ); - Node* tst = _gvn.transform( new (C) BoolNode(chk, BoolTest::eq) ); + Node* chk = _gvn.transform( new CmpINode(should_post_flag, intcon(0)) ); + Node* tst = _gvn.transform( new BoolNode(chk, BoolTest::eq) ); // Branch to slow_path if should_post_on_exceptions_flag was true { BuildCutout unless(this, tst, PROB_MAX); @@ -675,8 +675,8 @@ BuildCutout::BuildCutout(GraphKit* kit, Node* p, float prob, float cnt) SafePointNode* outer_map = _map; // preserved map is caller's SafePointNode* inner_map = kit->map(); IfNode* iff = kit->create_and_map_if(outer_map->control(), p, prob, cnt); - outer_map->set_control(kit->gvn().transform( new (kit->C) IfTrueNode(iff) )); - inner_map->set_control(kit->gvn().transform( new (kit->C) IfFalseNode(iff) )); + outer_map->set_control(kit->gvn().transform( new IfTrueNode(iff) )); + inner_map->set_control(kit->gvn().transform( new IfFalseNode(iff) )); } BuildCutout::~BuildCutout() { GraphKit* kit = _kit; @@ -1118,7 +1118,7 @@ bool GraphKit::compute_stack_effects(int& inputs, int& depth) { Node* GraphKit::basic_plus_adr(Node* base, Node* ptr, Node* offset) { // short-circuit a common case if (offset == intcon(0)) return ptr; - return _gvn.transform( new (C) AddPNode(base, ptr, offset) ); + return _gvn.transform( new AddPNode(base, ptr, offset) ); } Node* GraphKit::ConvI2L(Node* offset) { @@ -1127,7 +1127,7 @@ Node* GraphKit::ConvI2L(Node* offset) { if (offset_con != Type::OffsetBot) { return longcon((jlong) offset_con); } - return _gvn.transform( new (C) ConvI2LNode(offset)); + return _gvn.transform( new ConvI2LNode(offset)); } Node* GraphKit::ConvI2UL(Node* offset) { @@ -1135,9 +1135,9 @@ Node* GraphKit::ConvI2UL(Node* offset) { if (offset_con != (juint) Type::OffsetBot) { return longcon((julong) offset_con); } - Node* conv = _gvn.transform( new (C) ConvI2LNode(offset)); + Node* conv = _gvn.transform( new ConvI2LNode(offset)); Node* mask = _gvn.transform( ConLNode::make(C, (julong) max_juint) ); - return _gvn.transform( new (C) AndLNode(conv, mask) ); + return _gvn.transform( new AndLNode(conv, mask) ); } Node* GraphKit::ConvL2I(Node* offset) { @@ -1146,7 +1146,7 @@ Node* GraphKit::ConvL2I(Node* offset) { if (offset_con != (jlong)Type::OffsetBot) { return intcon((int) offset_con); } - return _gvn.transform( new (C) ConvL2INode(offset)); + return _gvn.transform( new ConvL2INode(offset)); } //-------------------------load_object_klass----------------------------------- @@ -1165,7 +1165,7 @@ Node* GraphKit::load_array_length(Node* array) { Node *alen; if (alloc == NULL) { Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes()); - alen = _gvn.transform( new (C) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS)); + alen = _gvn.transform( new LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS)); } else { alen = alloc->Ideal_length(); Node* ccast = alloc->make_ideal_length(_gvn.type(array)->is_oopptr(), &_gvn); @@ -1199,8 +1199,8 @@ Node* GraphKit::null_check_common(Node* value, BasicType type, // Construct NULL check Node *chk = NULL; switch(type) { - case T_LONG : chk = new (C) CmpLNode(value, _gvn.zerocon(T_LONG)); break; - case T_INT : chk = new (C) CmpINode(value, _gvn.intcon(0)); break; + case T_LONG : chk = new CmpLNode(value, _gvn.zerocon(T_LONG)); break; + case T_INT : chk = new CmpINode(value, _gvn.intcon(0)); break; case T_ARRAY : // fall through type = T_OBJECT; // simplify further tests case T_OBJECT : { @@ -1247,7 +1247,7 @@ Node* GraphKit::null_check_common(Node* value, BasicType type, return value; // Elided null check quickly! } } - chk = new (C) CmpPNode( value, null() ); + chk = new CmpPNode( value, null() ); break; } @@ -1258,7 +1258,7 @@ Node* GraphKit::null_check_common(Node* value, BasicType type, chk = _gvn.transform(chk); BoolTest::mask btest = assert_null ? BoolTest::eq : BoolTest::ne; - BoolNode *btst = new (C) BoolNode( chk, btest); + BoolNode *btst = new BoolNode( chk, btest); Node *tst = _gvn.transform( btst ); //----------- @@ -1325,8 +1325,8 @@ Node* GraphKit::null_check_common(Node* value, BasicType type, if (null_control != NULL) { IfNode* iff = create_and_map_if(control(), tst, ok_prob, COUNT_UNKNOWN); - Node* null_true = _gvn.transform( new (C) IfFalseNode(iff)); - set_control( _gvn.transform( new (C) IfTrueNode(iff))); + Node* null_true = _gvn.transform( new IfFalseNode(iff)); + set_control( _gvn.transform( new IfTrueNode(iff))); if (null_true == top()) explicit_null_checks_elided++; (*null_control) = null_true; @@ -1378,7 +1378,7 @@ Node* GraphKit::cast_not_null(Node* obj, bool do_replace_in_map) { // Object is already not-null? if( t == t_not_null ) return obj; - Node *cast = new (C) CastPPNode(obj,t_not_null); + Node *cast = new CastPPNode(obj,t_not_null); cast->init_req(0, control()); cast = _gvn.transform( cast ); @@ -1486,7 +1486,7 @@ void GraphKit::set_all_memory(Node* newmem) { //------------------------------set_all_memory_call---------------------------- void GraphKit::set_all_memory_call(Node* call, bool separate_io_proj) { - Node* newmem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory, separate_io_proj) ); + Node* newmem = _gvn.transform( new ProjNode(call, TypeFunc::Memory, separate_io_proj) ); set_all_memory(newmem); } @@ -1721,9 +1721,9 @@ Node* GraphKit::array_element_address(Node* ary, Node* idx, BasicType elembt, int index_max = max_jint - 1; // array size is max_jint, index is one less if (sizetype != NULL) index_max = sizetype->_hi - 1; const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax); - idx = _gvn.transform( new (C) ConvI2LNode(idx, lidxtype) ); + idx = _gvn.transform( new ConvI2LNode(idx, lidxtype) ); #endif - Node* scale = _gvn.transform( new (C) LShiftXNode(idx, intcon(shift)) ); + Node* scale = _gvn.transform( new LShiftXNode(idx, intcon(shift)) ); return basic_plus_adr(ary, base, scale); } @@ -1771,8 +1771,8 @@ void GraphKit::set_edges_for_java_call(CallJavaNode* call, bool must_throw, bool // Re-use the current map to produce the result. - set_control(_gvn.transform(new (C) ProjNode(call, TypeFunc::Control))); - set_i_o( _gvn.transform(new (C) ProjNode(call, TypeFunc::I_O , separate_io_proj))); + set_control(_gvn.transform(new ProjNode(call, TypeFunc::Control))); + set_i_o( _gvn.transform(new ProjNode(call, TypeFunc::I_O , separate_io_proj))); set_all_memory_call(xcall, separate_io_proj); //return xcall; // no need, caller already has it @@ -1786,7 +1786,7 @@ Node* GraphKit::set_results_for_java_call(CallJavaNode* call, bool separate_io_p if (call->method() == NULL || call->method()->return_type()->basic_type() == T_VOID) ret = top(); - else ret = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms)); + else ret = _gvn.transform(new ProjNode(call, TypeFunc::Parms)); // Note: Since any out-of-line call can produce an exception, // we always insert an I_O projection from the call into the result. @@ -1797,8 +1797,8 @@ Node* GraphKit::set_results_for_java_call(CallJavaNode* call, bool separate_io_p // The caller requested separate projections be used by the fall // through and exceptional paths, so replace the projections for // the fall through path. - set_i_o(_gvn.transform( new (C) ProjNode(call, TypeFunc::I_O) )); - set_all_memory(_gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) )); + set_i_o(_gvn.transform( new ProjNode(call, TypeFunc::I_O) )); + set_all_memory(_gvn.transform( new ProjNode(call, TypeFunc::Memory) )); } return ret; } @@ -1838,13 +1838,13 @@ void GraphKit::set_predefined_output_for_runtime_call(Node* call, Node* keep_mem, const TypePtr* hook_mem) { // no i/o - set_control(_gvn.transform( new (C) ProjNode(call,TypeFunc::Control) )); + set_control(_gvn.transform( new ProjNode(call,TypeFunc::Control) )); if (keep_mem) { // First clone the existing memory state set_all_memory(keep_mem); if (hook_mem != NULL) { // Make memory for the call - Node* mem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) ); + Node* mem = _gvn.transform( new ProjNode(call, TypeFunc::Memory) ); // Set the RawPtr memory state only. This covers all the heap top/GC stuff // We also use hook_mem to extract specific effects from arraycopy stubs. set_memory(mem, hook_mem); @@ -1968,7 +1968,7 @@ void GraphKit::increment_counter(Node* counter_addr) { int adr_type = Compile::AliasIdxRaw; Node* ctrl = control(); Node* cnt = make_load(ctrl, counter_addr, TypeInt::INT, T_INT, adr_type, MemNode::unordered); - Node* incr = _gvn.transform(new (C) AddINode(cnt, _gvn.intcon(1))); + Node* incr = _gvn.transform(new AddINode(cnt, _gvn.intcon(1))); store_to_memory(ctrl, counter_addr, incr, T_INT, adr_type, MemNode::unordered); } @@ -2087,7 +2087,7 @@ void GraphKit::uncommon_trap(int trap_request, // The debug info is the only real input to this call. // Halt-and-catch fire here. The above call should never return! - HaltNode* halt = new(C) HaltNode(control(), frameptr()); + HaltNode* halt = new HaltNode(control(), frameptr()); _gvn.set_type_bottom(halt); root()->add_req(halt); @@ -2169,7 +2169,7 @@ Node* GraphKit::record_profile_for_speculation(Node* n, ciKlass* exact_kls, bool // the new type. The new type depends on the control: what // profiling tells us is only valid from here as far as we can // tell. - Node* cast = new(C) CheckCastPPNode(control(), n, current_type->remove_speculative()->join_speculative(spec_type)); + Node* cast = new CheckCastPPNode(control(), n, current_type->remove_speculative()->join_speculative(spec_type)); cast = _gvn.transform(cast); replace_in_map(n, cast); n = cast; @@ -2287,7 +2287,7 @@ void GraphKit::round_double_result(ciMethod* dest_method) { Node* GraphKit::precision_rounding(Node* n) { return UseStrictFP && _method->flags().is_strict() && UseSSE == 0 && Matcher::strict_fp_requires_explicit_rounding - ? _gvn.transform( new (C) RoundFloatNode(0, n) ) + ? _gvn.transform( new RoundFloatNode(0, n) ) : n; } @@ -2295,7 +2295,7 @@ Node* GraphKit::precision_rounding(Node* n) { Node* GraphKit::dprecision_rounding(Node *n) { return UseStrictFP && _method->flags().is_strict() && UseSSE <= 1 && Matcher::strict_fp_requires_explicit_rounding - ? _gvn.transform( new (C) RoundDoubleNode(0, n) ) + ? _gvn.transform( new RoundDoubleNode(0, n) ) : n; } @@ -2303,7 +2303,7 @@ Node* GraphKit::dprecision_rounding(Node *n) { Node* GraphKit::dstore_rounding(Node* n) { return Matcher::strict_fp_requires_explicit_rounding && UseSSE <= 1 - ? _gvn.transform( new (C) RoundDoubleNode(0, n) ) + ? _gvn.transform( new RoundDoubleNode(0, n) ) : n; } @@ -2382,11 +2382,11 @@ Node* GraphKit::opt_iff(Node* region, Node* iff) { IfNode *opt_iff = _gvn.transform(iff)->as_If(); // Fast path taken; set region slot 2 - Node *fast_taken = _gvn.transform( new (C) IfFalseNode(opt_iff) ); + Node *fast_taken = _gvn.transform( new IfFalseNode(opt_iff) ); region->init_req(2,fast_taken); // Capture fast-control // Fast path not-taken, i.e. slow path - Node *slow_taken = _gvn.transform( new (C) IfTrueNode(opt_iff) ); + Node *slow_taken = _gvn.transform( new IfTrueNode(opt_iff) ); return slow_taken; } @@ -2410,12 +2410,12 @@ Node* GraphKit::make_runtime_call(int flags, } CallNode* call; if (!is_leaf) { - call = new(C) CallStaticJavaNode(call_type, call_addr, call_name, + call = new CallStaticJavaNode(call_type, call_addr, call_name, bci(), adr_type); } else if (flags & RC_NO_FP) { - call = new(C) CallLeafNoFPNode(call_type, call_addr, call_name, adr_type); + call = new CallLeafNoFPNode(call_type, call_addr, call_name, adr_type); } else { - call = new(C) CallLeafNode(call_type, call_addr, call_name, adr_type); + call = new CallLeafNode(call_type, call_addr, call_name, adr_type); } // The following is similar to set_edges_for_java_call, @@ -2476,7 +2476,7 @@ Node* GraphKit::make_runtime_call(int flags, } if (has_io) { - set_i_o(_gvn.transform(new (C) ProjNode(call, TypeFunc::I_O))); + set_i_o(_gvn.transform(new ProjNode(call, TypeFunc::I_O))); } return call; @@ -2517,10 +2517,10 @@ void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool sep if (stopped()) return; // Make a catch node with just two handlers: fall-through and catch-all - Node* i_o = _gvn.transform( new (C) ProjNode(call, TypeFunc::I_O, separate_io_proj) ); - Node* catc = _gvn.transform( new (C) CatchNode(control(), i_o, 2) ); - Node* norm = _gvn.transform( new (C) CatchProjNode(catc, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci) ); - Node* excp = _gvn.transform( new (C) CatchProjNode(catc, CatchProjNode::catch_all_index, CatchProjNode::no_handler_bci) ); + Node* i_o = _gvn.transform( new ProjNode(call, TypeFunc::I_O, separate_io_proj) ); + Node* catc = _gvn.transform( new CatchNode(control(), i_o, 2) ); + Node* norm = _gvn.transform( new CatchProjNode(catc, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci) ); + Node* excp = _gvn.transform( new CatchProjNode(catc, CatchProjNode::catch_all_index, CatchProjNode::no_handler_bci) ); { PreserveJVMState pjvms(this); set_control(excp); @@ -2530,7 +2530,7 @@ void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool sep // Create an exception state also. // Use an exact type if the caller has specified a specific exception. const Type* ex_type = TypeOopPtr::make_from_klass_unique(ex_klass)->cast_to_ptr_type(TypePtr::NotNull); - Node* ex_oop = new (C) CreateExNode(ex_type, control(), i_o); + Node* ex_oop = new CreateExNode(ex_type, control(), i_o); add_exception_state(make_exception_state(_gvn.transform(ex_oop))); } } @@ -2580,11 +2580,11 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) { case SSC_easy_test: { // Just do a direct pointer compare and be done. - Node* cmp = _gvn.transform( new(C) CmpPNode(subklass, superklass) ); - Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) ); + Node* cmp = _gvn.transform( new CmpPNode(subklass, superklass) ); + Node* bol = _gvn.transform( new BoolNode(cmp, BoolTest::eq) ); IfNode* iff = create_and_xform_if(control(), bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN); - set_control( _gvn.transform( new(C) IfTrueNode (iff) ) ); - return _gvn.transform( new(C) IfFalseNode(iff) ); + set_control( _gvn.transform( new IfTrueNode (iff) ) ); + return _gvn.transform( new IfFalseNode(iff) ); } case SSC_full_test: break; @@ -2599,7 +2599,7 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) { // First load the super-klass's check-offset Node *p1 = basic_plus_adr( superklass, superklass, in_bytes(Klass::super_check_offset_offset()) ); - Node *chk_off = _gvn.transform(new (C) LoadINode(NULL, memory(p1), p1, _gvn.type(p1)->is_ptr(), + Node *chk_off = _gvn.transform(new LoadINode(NULL, memory(p1), p1, _gvn.type(p1)->is_ptr(), TypeInt::INT, MemNode::unordered)); int cacheoff_con = in_bytes(Klass::secondary_super_cache_offset()); bool might_be_cache = (find_int_con(chk_off, cacheoff_con) == cacheoff_con); @@ -2611,7 +2611,7 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) { // Worst-case type is a little odd: NULL is allowed as a result (usually // klass loads can never produce a NULL). Node *chk_off_X = ConvI2X(chk_off); - Node *p2 = _gvn.transform( new (C) AddPNode(subklass,subklass,chk_off_X) ); + Node *p2 = _gvn.transform( new AddPNode(subklass,subklass,chk_off_X) ); // For some types like interfaces the following loadKlass is from a 1-word // cache which is mutable so can't use immutable memory. Other // types load from the super-class display table which is immutable. @@ -2625,11 +2625,11 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) { // See if we get an immediate positive hit. Happens roughly 83% of the // time. Test to see if the value loaded just previously from the subklass // is exactly the superklass. - Node *cmp1 = _gvn.transform( new (C) CmpPNode( superklass, nkls ) ); - Node *bol1 = _gvn.transform( new (C) BoolNode( cmp1, BoolTest::eq ) ); + Node *cmp1 = _gvn.transform( new CmpPNode( superklass, nkls ) ); + Node *bol1 = _gvn.transform( new BoolNode( cmp1, BoolTest::eq ) ); IfNode *iff1 = create_and_xform_if( control(), bol1, PROB_LIKELY(0.83f), COUNT_UNKNOWN ); - Node *iftrue1 = _gvn.transform( new (C) IfTrueNode ( iff1 ) ); - set_control( _gvn.transform( new (C) IfFalseNode( iff1 ) ) ); + Node *iftrue1 = _gvn.transform( new IfTrueNode ( iff1 ) ); + set_control( _gvn.transform( new IfFalseNode( iff1 ) ) ); // Compile speed common case: Check for being deterministic right now. If // chk_off is a constant and not equal to cacheoff then we are NOT a @@ -2642,9 +2642,9 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) { } // Gather the various success & failures here - RegionNode *r_ok_subtype = new (C) RegionNode(4); + RegionNode *r_ok_subtype = new RegionNode(4); record_for_igvn(r_ok_subtype); - RegionNode *r_not_subtype = new (C) RegionNode(3); + RegionNode *r_not_subtype = new RegionNode(3); record_for_igvn(r_not_subtype); r_ok_subtype->init_req(1, iftrue1); @@ -2655,20 +2655,20 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) { // cache. If it points to the display (and NOT the cache) and the display // missed then it's not a subtype. Node *cacheoff = _gvn.intcon(cacheoff_con); - Node *cmp2 = _gvn.transform( new (C) CmpINode( chk_off, cacheoff ) ); - Node *bol2 = _gvn.transform( new (C) BoolNode( cmp2, BoolTest::ne ) ); + Node *cmp2 = _gvn.transform( new CmpINode( chk_off, cacheoff ) ); + Node *bol2 = _gvn.transform( new BoolNode( cmp2, BoolTest::ne ) ); IfNode *iff2 = create_and_xform_if( control(), bol2, PROB_LIKELY(0.63f), COUNT_UNKNOWN ); - r_not_subtype->init_req(1, _gvn.transform( new (C) IfTrueNode (iff2) ) ); - set_control( _gvn.transform( new (C) IfFalseNode(iff2) ) ); + r_not_subtype->init_req(1, _gvn.transform( new IfTrueNode (iff2) ) ); + set_control( _gvn.transform( new IfFalseNode(iff2) ) ); // Check for self. Very rare to get here, but it is taken 1/3 the time. // No performance impact (too rare) but allows sharing of secondary arrays // which has some footprint reduction. - Node *cmp3 = _gvn.transform( new (C) CmpPNode( subklass, superklass ) ); - Node *bol3 = _gvn.transform( new (C) BoolNode( cmp3, BoolTest::eq ) ); + Node *cmp3 = _gvn.transform( new CmpPNode( subklass, superklass ) ); + Node *bol3 = _gvn.transform( new BoolNode( cmp3, BoolTest::eq ) ); IfNode *iff3 = create_and_xform_if( control(), bol3, PROB_LIKELY(0.36f), COUNT_UNKNOWN ); - r_ok_subtype->init_req(2, _gvn.transform( new (C) IfTrueNode ( iff3 ) ) ); - set_control( _gvn.transform( new (C) IfFalseNode( iff3 ) ) ); + r_ok_subtype->init_req(2, _gvn.transform( new IfTrueNode ( iff3 ) ) ); + set_control( _gvn.transform( new IfFalseNode( iff3 ) ) ); // -- Roads not taken here: -- // We could also have chosen to perform the self-check at the beginning @@ -2692,13 +2692,13 @@ Node* GraphKit::gen_subtype_check(Node* subklass, Node* superklass) { // The decision to inline or out-of-line this final check is platform // dependent, and is found in the AD file definition of PartialSubtypeCheck. Node* psc = _gvn.transform( - new (C) PartialSubtypeCheckNode(control(), subklass, superklass) ); + new PartialSubtypeCheckNode(control(), subklass, superklass) ); - Node *cmp4 = _gvn.transform( new (C) CmpPNode( psc, null() ) ); - Node *bol4 = _gvn.transform( new (C) BoolNode( cmp4, BoolTest::ne ) ); + Node *cmp4 = _gvn.transform( new CmpPNode( psc, null() ) ); + Node *bol4 = _gvn.transform( new BoolNode( cmp4, BoolTest::ne ) ); IfNode *iff4 = create_and_xform_if( control(), bol4, PROB_FAIR, COUNT_UNKNOWN ); - r_not_subtype->init_req(2, _gvn.transform( new (C) IfTrueNode (iff4) ) ); - r_ok_subtype ->init_req(3, _gvn.transform( new (C) IfFalseNode(iff4) ) ); + r_not_subtype->init_req(2, _gvn.transform( new IfTrueNode (iff4) ) ); + r_ok_subtype ->init_req(3, _gvn.transform( new IfFalseNode(iff4) ) ); // Return false path; set default control to true path. set_control( _gvn.transform(r_ok_subtype) ); @@ -2762,18 +2762,18 @@ Node* GraphKit::type_check_receiver(Node* receiver, ciKlass* klass, const TypeKlassPtr* tklass = TypeKlassPtr::make(klass); Node* recv_klass = load_object_klass(receiver); Node* want_klass = makecon(tklass); - Node* cmp = _gvn.transform( new(C) CmpPNode(recv_klass, want_klass) ); - Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) ); + Node* cmp = _gvn.transform( new CmpPNode(recv_klass, want_klass) ); + Node* bol = _gvn.transform( new BoolNode(cmp, BoolTest::eq) ); IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN); - set_control( _gvn.transform( new(C) IfTrueNode (iff) )); - Node* fail = _gvn.transform( new(C) IfFalseNode(iff) ); + set_control( _gvn.transform( new IfTrueNode (iff) )); + Node* fail = _gvn.transform( new IfFalseNode(iff) ); const TypeOopPtr* recv_xtype = tklass->as_instance_type(); assert(recv_xtype->klass_is_exact(), ""); // Subsume downstream occurrences of receiver with a cast to // recv_xtype, since now we know what the type will be. - Node* cast = new(C) CheckCastPPNode(control(), receiver, recv_xtype); + Node* cast = new CheckCastPPNode(control(), receiver, recv_xtype); (*casted_receiver) = _gvn.transform(cast); // (User must make the replace_in_map call.) @@ -2920,8 +2920,8 @@ Node* GraphKit::gen_instanceof(Node* obj, Node* superklass, bool safe_for_replac // Make the merge point enum { _obj_path = 1, _fail_path, _null_path, PATH_LIMIT }; - RegionNode* region = new(C) RegionNode(PATH_LIMIT); - Node* phi = new(C) PhiNode(region, TypeInt::BOOL); + RegionNode* region = new RegionNode(PATH_LIMIT); + Node* phi = new PhiNode(region, TypeInt::BOOL); C->set_has_split_ifs(true); // Has chance for split-if optimization ciProfileData* data = NULL; @@ -3052,8 +3052,8 @@ Node* GraphKit::gen_checkcast(Node *obj, Node* superklass, // Make the merge point enum { _obj_path = 1, _null_path, PATH_LIMIT }; - RegionNode* region = new (C) RegionNode(PATH_LIMIT); - Node* phi = new (C) PhiNode(region, toop); + RegionNode* region = new RegionNode(PATH_LIMIT); + Node* phi = new PhiNode(region, toop); C->set_has_split_ifs(true); // Has chance for split-if optimization // Use null-cast information if it is available @@ -3114,8 +3114,7 @@ Node* GraphKit::gen_checkcast(Node *obj, Node* superklass, Node* not_subtype_ctrl = gen_subtype_check( obj_klass, superklass ); // Plug in success path into the merge - cast_obj = _gvn.transform(new (C) CheckCastPPNode(control(), - not_null_obj, toop)); + cast_obj = _gvn.transform(new CheckCastPPNode(control(), not_null_obj, toop)); // Failure path ends in uncommon trap (or may be dead - failure impossible) if (failure_control == NULL) { if (not_subtype_ctrl != top()) { // If failure is possible @@ -3168,7 +3167,7 @@ Node* GraphKit::insert_mem_bar(int opcode, Node* precedent) { mb->init_req(TypeFunc::Control, control()); mb->init_req(TypeFunc::Memory, reset_memory()); Node* membar = _gvn.transform(mb); - set_control(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Control))); + set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control))); set_all_memory_call(membar); return membar; } @@ -3197,11 +3196,11 @@ Node* GraphKit::insert_mem_bar_volatile(int opcode, int alias_idx, Node* precede mb->set_req(TypeFunc::Memory, memory(alias_idx)); } Node* membar = _gvn.transform(mb); - set_control(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Control))); + set_control(_gvn.transform(new ProjNode(membar, TypeFunc::Control))); if (alias_idx == Compile::AliasIdxBot) { - merged_memory()->set_base_memory(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Memory))); + merged_memory()->set_base_memory(_gvn.transform(new ProjNode(membar, TypeFunc::Memory))); } else { - set_memory(_gvn.transform(new (C) ProjNode(membar, TypeFunc::Memory)),alias_idx); + set_memory(_gvn.transform(new ProjNode(membar, TypeFunc::Memory)),alias_idx); } return membar; } @@ -3221,10 +3220,10 @@ FastLockNode* GraphKit::shared_lock(Node* obj) { assert(dead_locals_are_killed(), "should kill locals before sync. point"); // Box the stack location - Node* box = _gvn.transform(new (C) BoxLockNode(next_monitor())); + Node* box = _gvn.transform(new BoxLockNode(next_monitor())); Node* mem = reset_memory(); - FastLockNode * flock = _gvn.transform(new (C) FastLockNode(0, obj, box) )->as_FastLock(); + FastLockNode * flock = _gvn.transform(new FastLockNode(0, obj, box) )->as_FastLock(); if (UseBiasedLocking && PrintPreciseBiasedLockingStatistics) { // Create the counters for this fast lock. flock->create_lock_counter(sync_jvms()); // sync_jvms used to get current bci @@ -3238,7 +3237,7 @@ FastLockNode* GraphKit::shared_lock(Node* obj) { map()->push_monitor( flock ); const TypeFunc *tf = LockNode::lock_type(); - LockNode *lock = new (C) LockNode(C, tf); + LockNode *lock = new LockNode(C, tf); lock->init_req( TypeFunc::Control, control() ); lock->init_req( TypeFunc::Memory , mem ); @@ -3292,7 +3291,7 @@ void GraphKit::shared_unlock(Node* box, Node* obj) { insert_mem_bar(Op_MemBarReleaseLock); const TypeFunc *tf = OptoRuntime::complete_monitor_exit_Type(); - UnlockNode *unlock = new (C) UnlockNode(C, tf); + UnlockNode *unlock = new UnlockNode(C, tf); uint raw_idx = Compile::AliasIdxRaw; unlock->init_req( TypeFunc::Control, control() ); unlock->init_req( TypeFunc::Memory , memory(raw_idx) ); @@ -3358,19 +3357,19 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, alloc->set_req( TypeFunc::FramePtr, frameptr() ); add_safepoint_edges(alloc); Node* allocx = _gvn.transform(alloc); - set_control( _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Control) ) ); + set_control( _gvn.transform(new ProjNode(allocx, TypeFunc::Control) ) ); // create memory projection for i_o - set_memory ( _gvn.transform( new (C) ProjNode(allocx, TypeFunc::Memory, true) ), rawidx ); + set_memory ( _gvn.transform( new ProjNode(allocx, TypeFunc::Memory, true) ), rawidx ); make_slow_call_ex(allocx, env()->Throwable_klass(), true); // create a memory projection as for the normal control path - Node* malloc = _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Memory)); + Node* malloc = _gvn.transform(new ProjNode(allocx, TypeFunc::Memory)); set_memory(malloc, rawidx); // a normal slow-call doesn't change i_o, but an allocation does // we create a separate i_o projection for the normal control path - set_i_o(_gvn.transform( new (C) ProjNode(allocx, TypeFunc::I_O, false) ) ); - Node* rawoop = _gvn.transform( new (C) ProjNode(allocx, TypeFunc::Parms) ); + set_i_o(_gvn.transform( new ProjNode(allocx, TypeFunc::I_O, false) ) ); + Node* rawoop = _gvn.transform( new ProjNode(allocx, TypeFunc::Parms) ); // put in an initialization barrier InitializeNode* init = insert_mem_bar_volatile(Op_Initialize, rawidx, @@ -3406,7 +3405,7 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, } // Cast raw oop to the real thing... - Node* javaoop = new (C) CheckCastPPNode(control(), rawoop, oop_type); + Node* javaoop = new CheckCastPPNode(control(), rawoop, oop_type); javaoop = _gvn.transform(javaoop); C->set_recent_alloc(control(), javaoop); assert(just_allocated_object(control()) == javaoop, "just allocated"); @@ -3465,9 +3464,9 @@ Node* GraphKit::new_instance(Node* klass_node, // (It may be stress-tested by specifying StressReflectiveCode.) // Basically, we want to get into the VM is there's an illegal argument. Node* bit = intcon(Klass::_lh_instance_slow_path_bit); - initial_slow_test = _gvn.transform( new (C) AndINode(layout_val, bit) ); + initial_slow_test = _gvn.transform( new AndINode(layout_val, bit) ); if (extra_slow_test != intcon(0)) { - initial_slow_test = _gvn.transform( new (C) OrINode(initial_slow_test, extra_slow_test) ); + initial_slow_test = _gvn.transform( new OrINode(initial_slow_test, extra_slow_test) ); } // (Macro-expander will further convert this to a Bool, if necessary.) } @@ -3484,7 +3483,7 @@ Node* GraphKit::new_instance(Node* klass_node, // Clear the low bits to extract layout_helper_size_in_bytes: assert((int)Klass::_lh_instance_slow_path_bit < BytesPerLong, "clear bit"); Node* mask = MakeConX(~ (intptr_t)right_n_bits(LogBytesPerLong)); - size = _gvn.transform( new (C) AndXNode(size, mask) ); + size = _gvn.transform( new AndXNode(size, mask) ); } if (return_size_val != NULL) { (*return_size_val) = size; @@ -3504,11 +3503,10 @@ Node* GraphKit::new_instance(Node* klass_node, Node *mem = reset_memory(); set_all_memory(mem); // Create new memory state - AllocateNode* alloc - = new (C) AllocateNode(C, AllocateNode::alloc_type(Type::TOP), - control(), mem, i_o(), - size, klass_node, - initial_slow_test); + AllocateNode* alloc = new AllocateNode(C, AllocateNode::alloc_type(Type::TOP), + control(), mem, i_o(), + size, klass_node, + initial_slow_test); return set_output_for_allocation(alloc, oop_type); } @@ -3531,8 +3529,8 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) // Optimistically assume that it is a subtype of Object[], // so that we can fold up all the address arithmetic. layout_con = Klass::array_layout_helper(T_OBJECT); - Node* cmp_lh = _gvn.transform( new(C) CmpINode(layout_val, intcon(layout_con)) ); - Node* bol_lh = _gvn.transform( new(C) BoolNode(cmp_lh, BoolTest::eq) ); + Node* cmp_lh = _gvn.transform( new CmpINode(layout_val, intcon(layout_con)) ); + Node* bol_lh = _gvn.transform( new BoolNode(cmp_lh, BoolTest::eq) ); { BuildCutout unless(this, bol_lh, PROB_MAX); inc_sp(nargs); uncommon_trap(Deoptimization::Reason_class_check, @@ -3556,8 +3554,8 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) fast_size_limit <<= (LogBytesPerLong - log2_esize); } - Node* initial_slow_cmp = _gvn.transform( new (C) CmpUNode( length, intcon( fast_size_limit ) ) ); - Node* initial_slow_test = _gvn.transform( new (C) BoolNode( initial_slow_cmp, BoolTest::gt ) ); + Node* initial_slow_cmp = _gvn.transform( new CmpUNode( length, intcon( fast_size_limit ) ) ); + Node* initial_slow_test = _gvn.transform( new BoolNode( initial_slow_cmp, BoolTest::gt ) ); if (initial_slow_test->is_Bool()) { // Hide it behind a CMoveI, or else PhaseIdealLoop::split_up will get sick. initial_slow_test = initial_slow_test->as_Bool()->as_int_value(&_gvn); @@ -3585,10 +3583,10 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) } else { Node* hss = intcon(Klass::_lh_header_size_shift); Node* hsm = intcon(Klass::_lh_header_size_mask); - Node* hsize = _gvn.transform( new(C) URShiftINode(layout_val, hss) ); - hsize = _gvn.transform( new(C) AndINode(hsize, hsm) ); + Node* hsize = _gvn.transform( new URShiftINode(layout_val, hss) ); + hsize = _gvn.transform( new AndINode(hsize, hsm) ); Node* mask = intcon(round_mask); - header_size = _gvn.transform( new(C) AddINode(hsize, mask) ); + header_size = _gvn.transform( new AddINode(hsize, mask) ); } Node* elem_shift = NULL; @@ -3613,7 +3611,7 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) jlong size_max = arrayOopDesc::max_array_length(T_BYTE); if (size_max > tllen->_hi) size_max = tllen->_hi; const TypeLong* tlcon = TypeLong::make(CONST64(0), size_max, Type::WidenMin); - lengthx = _gvn.transform( new (C) ConvI2LNode(length, tlcon)); + lengthx = _gvn.transform( new ConvI2LNode(length, tlcon)); } } #endif @@ -3624,11 +3622,11 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) // after a successful allocation. Node* abody = lengthx; if (elem_shift != NULL) - abody = _gvn.transform( new(C) LShiftXNode(lengthx, elem_shift) ); - Node* size = _gvn.transform( new(C) AddXNode(headerx, abody) ); + abody = _gvn.transform( new LShiftXNode(lengthx, elem_shift) ); + Node* size = _gvn.transform( new AddXNode(headerx, abody) ); if (round_mask != 0) { Node* mask = MakeConX(~round_mask); - size = _gvn.transform( new(C) AndXNode(size, mask) ); + size = _gvn.transform( new AndXNode(size, mask) ); } // else if round_mask == 0, the size computation is self-rounding @@ -3646,11 +3644,11 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) // Create the AllocateArrayNode and its result projections AllocateArrayNode* alloc - = new (C) AllocateArrayNode(C, AllocateArrayNode::alloc_type(TypeInt::INT), - control(), mem, i_o(), - size, klass_node, - initial_slow_test, - length); + = new AllocateArrayNode(C, AllocateArrayNode::alloc_type(TypeInt::INT), + control(), mem, i_o(), + size, klass_node, + initial_slow_test, + length); // Cast to correct type. Note that the klass_node may be constant or not, // and in the latter case the actual array type will be inexact also. @@ -3760,10 +3758,10 @@ void GraphKit::add_predicate_impl(Deoptimization::DeoptReason reason, int nargs) } Node *cont = _gvn.intcon(1); - Node* opq = _gvn.transform(new (C) Opaque1Node(C, cont)); - Node *bol = _gvn.transform(new (C) Conv2BNode(opq)); + Node* opq = _gvn.transform(new Opaque1Node(C, cont)); + Node *bol = _gvn.transform(new Conv2BNode(opq)); IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN); - Node* iffalse = _gvn.transform(new (C) IfFalseNode(iff)); + Node* iffalse = _gvn.transform(new IfFalseNode(iff)); C->add_predicate_opaq(opq); { PreserveJVMState pjvms(this); @@ -3771,7 +3769,7 @@ void GraphKit::add_predicate_impl(Deoptimization::DeoptReason reason, int nargs) inc_sp(nargs); uncommon_trap(reason, Deoptimization::Action_maybe_recompile); } - Node* iftrue = _gvn.transform(new (C) IfTrueNode(iff)); + Node* iftrue = _gvn.transform(new IfTrueNode(iff)); set_control(iftrue); } @@ -3963,7 +3961,7 @@ void GraphKit::g1_write_barrier_pre(bool do_load, __ if_then(index, BoolTest::ne, zeroX, likely); { // decrement the index - Node* next_index = _gvn.transform(new (C) SubXNode(index, __ ConX(sizeof(intptr_t)))); + Node* next_index = _gvn.transform(new SubXNode(index, __ ConX(sizeof(intptr_t)))); // Now get the buffer location we will log the previous value into and store it Node *log_addr = __ AddP(no_base, buffer, next_index); @@ -4006,7 +4004,7 @@ void GraphKit::g1_mark_card(IdealKit& ideal, // Now do the queue work __ if_then(index, BoolTest::ne, zeroX); { - Node* next_index = _gvn.transform(new (C) SubXNode(index, __ ConX(sizeof(intptr_t)))); + Node* next_index = _gvn.transform(new SubXNode(index, __ ConX(sizeof(intptr_t)))); Node* log_addr = __ AddP(no_base, buffer, next_index); // Order, see storeCM. @@ -4213,5 +4211,5 @@ void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) { Node* GraphKit::cast_array_to_stable(Node* ary, const TypeAryPtr* ary_type) { // Reify the property as a CastPP node in Ideal graph to comply with monotonicity // assumption of CCP analysis. - return _gvn.transform(new(C) CastPPNode(ary, ary_type->cast_to_stable(true))); + return _gvn.transform(new CastPPNode(ary, ary_type->cast_to_stable(true))); } diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp index 0d2c6b07a81..2433c95d2ab 100644 --- a/hotspot/src/share/vm/opto/graphKit.hpp +++ b/hotspot/src/share/vm/opto/graphKit.hpp @@ -309,31 +309,31 @@ class GraphKit : public Phase { // Some convenient shortcuts for common nodes - Node* IfTrue(IfNode* iff) { return _gvn.transform(new (C) IfTrueNode(iff)); } - Node* IfFalse(IfNode* iff) { return _gvn.transform(new (C) IfFalseNode(iff)); } + Node* IfTrue(IfNode* iff) { return _gvn.transform(new IfTrueNode(iff)); } + Node* IfFalse(IfNode* iff) { return _gvn.transform(new IfFalseNode(iff)); } - Node* AddI(Node* l, Node* r) { return _gvn.transform(new (C) AddINode(l, r)); } - Node* SubI(Node* l, Node* r) { return _gvn.transform(new (C) SubINode(l, r)); } - Node* MulI(Node* l, Node* r) { return _gvn.transform(new (C) MulINode(l, r)); } - Node* DivI(Node* ctl, Node* l, Node* r) { return _gvn.transform(new (C) DivINode(ctl, l, r)); } + Node* AddI(Node* l, Node* r) { return _gvn.transform(new AddINode(l, r)); } + Node* SubI(Node* l, Node* r) { return _gvn.transform(new SubINode(l, r)); } + Node* MulI(Node* l, Node* r) { return _gvn.transform(new MulINode(l, r)); } + Node* DivI(Node* ctl, Node* l, Node* r) { return _gvn.transform(new DivINode(ctl, l, r)); } - Node* AndI(Node* l, Node* r) { return _gvn.transform(new (C) AndINode(l, r)); } - Node* OrI(Node* l, Node* r) { return _gvn.transform(new (C) OrINode(l, r)); } - Node* XorI(Node* l, Node* r) { return _gvn.transform(new (C) XorINode(l, r)); } + Node* AndI(Node* l, Node* r) { return _gvn.transform(new AndINode(l, r)); } + Node* OrI(Node* l, Node* r) { return _gvn.transform(new OrINode(l, r)); } + Node* XorI(Node* l, Node* r) { return _gvn.transform(new XorINode(l, r)); } - Node* MaxI(Node* l, Node* r) { return _gvn.transform(new (C) MaxINode(l, r)); } - Node* MinI(Node* l, Node* r) { return _gvn.transform(new (C) MinINode(l, r)); } + Node* MaxI(Node* l, Node* r) { return _gvn.transform(new MaxINode(l, r)); } + Node* MinI(Node* l, Node* r) { return _gvn.transform(new MinINode(l, r)); } - Node* LShiftI(Node* l, Node* r) { return _gvn.transform(new (C) LShiftINode(l, r)); } - Node* RShiftI(Node* l, Node* r) { return _gvn.transform(new (C) RShiftINode(l, r)); } - Node* URShiftI(Node* l, Node* r) { return _gvn.transform(new (C) URShiftINode(l, r)); } + Node* LShiftI(Node* l, Node* r) { return _gvn.transform(new LShiftINode(l, r)); } + Node* RShiftI(Node* l, Node* r) { return _gvn.transform(new RShiftINode(l, r)); } + Node* URShiftI(Node* l, Node* r) { return _gvn.transform(new URShiftINode(l, r)); } - Node* CmpI(Node* l, Node* r) { return _gvn.transform(new (C) CmpINode(l, r)); } - Node* CmpL(Node* l, Node* r) { return _gvn.transform(new (C) CmpLNode(l, r)); } - Node* CmpP(Node* l, Node* r) { return _gvn.transform(new (C) CmpPNode(l, r)); } - Node* Bool(Node* cmp, BoolTest::mask relop) { return _gvn.transform(new (C) BoolNode(cmp, relop)); } + Node* CmpI(Node* l, Node* r) { return _gvn.transform(new CmpINode(l, r)); } + Node* CmpL(Node* l, Node* r) { return _gvn.transform(new CmpLNode(l, r)); } + Node* CmpP(Node* l, Node* r) { return _gvn.transform(new CmpPNode(l, r)); } + Node* Bool(Node* cmp, BoolTest::mask relop) { return _gvn.transform(new BoolNode(cmp, relop)); } - Node* AddP(Node* b, Node* a, Node* o) { return _gvn.transform(new (C) AddPNode(b, a, o)); } + Node* AddP(Node* b, Node* a, Node* o) { return _gvn.transform(new AddPNode(b, a, o)); } // Convert between int and long, and size_t. // (See macros ConvI2X, etc., in type.hpp for ConvI2X, etc.) @@ -867,7 +867,7 @@ class GraphKit : public Phase { // Handy for making control flow IfNode* create_and_map_if(Node* ctrl, Node* tst, float prob, float cnt) { - IfNode* iff = new (C) IfNode(ctrl, tst, prob, cnt);// New IfNode's + IfNode* iff = new IfNode(ctrl, tst, prob, cnt);// New IfNode's _gvn.set_type(iff, iff->Value(&_gvn)); // Value may be known at parse-time // Place 'if' on worklist if it will be in graph if (!tst->is_Con()) record_for_igvn(iff); // Range-check and Null-check removal is later @@ -875,7 +875,7 @@ class GraphKit : public Phase { } IfNode* create_and_xform_if(Node* ctrl, Node* tst, float prob, float cnt) { - IfNode* iff = new (C) IfNode(ctrl, tst, prob, cnt);// New IfNode's + IfNode* iff = new IfNode(ctrl, tst, prob, cnt);// New IfNode's _gvn.transform(iff); // Value may be known at parse-time // Place 'if' on worklist if it will be in graph if (!tst->is_Con()) record_for_igvn(iff); // Range-check and Null-check removal is later diff --git a/hotspot/src/share/vm/opto/idealKit.cpp b/hotspot/src/share/vm/opto/idealKit.cpp index ee4c212d1ca..a0a9cbe62cc 100644 --- a/hotspot/src/share/vm/opto/idealKit.cpp +++ b/hotspot/src/share/vm/opto/idealKit.cpp @@ -86,7 +86,7 @@ void IdealKit::if_then(Node* left, BoolTest::mask relop, } // Delay gvn.tranform on if-nodes until construction is finished // to prevent a constant bool input from discarding a control output. - IfNode* iff = delay_transform(new (C) IfNode(ctrl(), bol, prob, cnt))->as_If(); + IfNode* iff = delay_transform(new IfNode(ctrl(), bol, prob, cnt))->as_If(); Node* then = IfTrue(iff); Node* elsen = IfFalse(iff); Node* else_cvstate = copy_cvstate(); @@ -205,7 +205,7 @@ Node* IdealKit::make_label(int goto_ct) { assert(_cvstate != NULL, "must declare variables before labels"); Node* lab = new_cvstate(); int sz = 1 + goto_ct + 1 /* fall thru */; - Node* reg = delay_transform(new (C) RegionNode(sz)); + Node* reg = delay_transform(new RegionNode(sz)); lab->init_req(TypeFunc::Control, reg); return lab; } @@ -312,7 +312,7 @@ Node* IdealKit::delay_transform(Node* n) { //-----------------------------new_cvstate----------------------------------- Node* IdealKit::new_cvstate() { uint sz = _var_ct + first_var; - return new (C) Node(sz); + return new Node(sz); } //-----------------------------copy_cvstate----------------------------------- @@ -397,7 +397,7 @@ Node* IdealKit::storeCM(Node* ctl, Node* adr, Node *val, Node* oop_store, int oo // Add required edge to oop_store, optimizer does not support precedence edges. // Convert required edge to precedence edge before allocation. - Node* st = new (C) StoreCMNode(ctl, mem, adr, adr_type, val, oop_store, oop_adr_idx); + Node* st = new StoreCMNode(ctl, mem, adr, adr_type, val, oop_store, oop_adr_idx); st = transform(st); set_memory(st, adr_idx); @@ -497,7 +497,7 @@ void IdealKit::make_leaf_call(const TypeFunc *slow_call_type, uint adr_idx = C->get_alias_index(adr_type); // Slow-path leaf call - CallNode *call = (CallNode*)new (C) CallLeafNode( slow_call_type, slow_call, leaf_name, adr_type); + CallNode *call = (CallNode*)new CallLeafNode( slow_call_type, slow_call, leaf_name, adr_type); // Set fixed predefined input arguments call->init_req( TypeFunc::Control, ctrl() ); @@ -518,10 +518,10 @@ void IdealKit::make_leaf_call(const TypeFunc *slow_call_type, // Slow leaf call has no side-effects, sets few values - set_ctrl(transform( new (C) ProjNode(call,TypeFunc::Control) )); + set_ctrl(transform( new ProjNode(call,TypeFunc::Control) )); // Make memory for the call - Node* mem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) ); + Node* mem = _gvn.transform( new ProjNode(call, TypeFunc::Memory) ); // Set the RawPtr memory state only. set_memory(mem, adr_idx); @@ -544,7 +544,7 @@ void IdealKit::make_leaf_call_no_fp(const TypeFunc *slow_call_type, uint adr_idx = C->get_alias_index(adr_type); // Slow-path leaf call - CallNode *call = (CallNode*)new (C) CallLeafNoFPNode( slow_call_type, slow_call, leaf_name, adr_type); + CallNode *call = (CallNode*)new CallLeafNoFPNode( slow_call_type, slow_call, leaf_name, adr_type); // Set fixed predefined input arguments call->init_req( TypeFunc::Control, ctrl() ); @@ -565,10 +565,10 @@ void IdealKit::make_leaf_call_no_fp(const TypeFunc *slow_call_type, // Slow leaf call has no side-effects, sets few values - set_ctrl(transform( new (C) ProjNode(call,TypeFunc::Control) )); + set_ctrl(transform( new ProjNode(call,TypeFunc::Control) )); // Make memory for the call - Node* mem = _gvn.transform( new (C) ProjNode(call, TypeFunc::Memory) ); + Node* mem = _gvn.transform( new ProjNode(call, TypeFunc::Memory) ); // Set the RawPtr memory state only. set_memory(mem, adr_idx); diff --git a/hotspot/src/share/vm/opto/idealKit.hpp b/hotspot/src/share/vm/opto/idealKit.hpp index f20d6bfee57..3828d30cc0b 100644 --- a/hotspot/src/share/vm/opto/idealKit.hpp +++ b/hotspot/src/share/vm/opto/idealKit.hpp @@ -173,43 +173,43 @@ class IdealKit: public StackObj { void goto_(Node* lab, bool bind = false); void declarations_done(); - Node* IfTrue(IfNode* iff) { return transform(new (C) IfTrueNode(iff)); } - Node* IfFalse(IfNode* iff) { return transform(new (C) IfFalseNode(iff)); } + Node* IfTrue(IfNode* iff) { return transform(new IfTrueNode(iff)); } + Node* IfFalse(IfNode* iff) { return transform(new IfFalseNode(iff)); } // Data Node* ConI(jint k) { return (Node*)gvn().intcon(k); } Node* makecon(const Type *t) const { return _gvn.makecon(t); } - Node* AddI(Node* l, Node* r) { return transform(new (C) AddINode(l, r)); } - Node* SubI(Node* l, Node* r) { return transform(new (C) SubINode(l, r)); } - Node* AndI(Node* l, Node* r) { return transform(new (C) AndINode(l, r)); } - Node* MaxI(Node* l, Node* r) { return transform(new (C) MaxINode(l, r)); } - Node* LShiftI(Node* l, Node* r) { return transform(new (C) LShiftINode(l, r)); } - Node* CmpI(Node* l, Node* r) { return transform(new (C) CmpINode(l, r)); } - Node* Bool(Node* cmp, BoolTest::mask relop) { return transform(new (C) BoolNode(cmp, relop)); } + Node* AddI(Node* l, Node* r) { return transform(new AddINode(l, r)); } + Node* SubI(Node* l, Node* r) { return transform(new SubINode(l, r)); } + Node* AndI(Node* l, Node* r) { return transform(new AndINode(l, r)); } + Node* MaxI(Node* l, Node* r) { return transform(new MaxINode(l, r)); } + Node* LShiftI(Node* l, Node* r) { return transform(new LShiftINode(l, r)); } + Node* CmpI(Node* l, Node* r) { return transform(new CmpINode(l, r)); } + Node* Bool(Node* cmp, BoolTest::mask relop) { return transform(new BoolNode(cmp, relop)); } void increment(IdealVariable& v, Node* j) { set(v, AddI(value(v), j)); } void decrement(IdealVariable& v, Node* j) { set(v, SubI(value(v), j)); } - Node* CmpL(Node* l, Node* r) { return transform(new (C) CmpLNode(l, r)); } + Node* CmpL(Node* l, Node* r) { return transform(new CmpLNode(l, r)); } // TLS - Node* thread() { return gvn().transform(new (C) ThreadLocalNode()); } + Node* thread() { return gvn().transform(new ThreadLocalNode()); } // Pointers // Raw address should be transformed regardless 'delay_transform' flag // to produce canonical form CastX2P(offset). - Node* AddP(Node *base, Node *ptr, Node *off) { return _gvn.transform(new (C) AddPNode(base, ptr, off)); } + Node* AddP(Node *base, Node *ptr, Node *off) { return _gvn.transform(new AddPNode(base, ptr, off)); } - Node* CmpP(Node* l, Node* r) { return transform(new (C) CmpPNode(l, r)); } + Node* CmpP(Node* l, Node* r) { return transform(new CmpPNode(l, r)); } #ifdef _LP64 - Node* XorX(Node* l, Node* r) { return transform(new (C) XorLNode(l, r)); } + Node* XorX(Node* l, Node* r) { return transform(new XorLNode(l, r)); } #else // _LP64 - Node* XorX(Node* l, Node* r) { return transform(new (C) XorINode(l, r)); } + Node* XorX(Node* l, Node* r) { return transform(new XorINode(l, r)); } #endif // _LP64 - Node* URShiftX(Node* l, Node* r) { return transform(new (C) URShiftXNode(l, r)); } + Node* URShiftX(Node* l, Node* r) { return transform(new URShiftXNode(l, r)); } Node* ConX(jint k) { return (Node*)gvn().MakeConX(k); } - Node* CastPX(Node* ctl, Node* p) { return transform(new (C) CastP2XNode(ctl, p)); } + Node* CastPX(Node* ctl, Node* p) { return transform(new CastP2XNode(ctl, p)); } // Memory operations diff --git a/hotspot/src/share/vm/opto/ifnode.cpp b/hotspot/src/share/vm/opto/ifnode.cpp index 587c3b8c864..96551a804d2 100644 --- a/hotspot/src/share/vm/opto/ifnode.cpp +++ b/hotspot/src/share/vm/opto/ifnode.cpp @@ -238,10 +238,10 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) { Node* predicate_x = NULL; bool counted_loop = r->is_CountedLoop(); - Node *region_c = new (igvn->C) RegionNode(req_c + 1); + Node *region_c = new RegionNode(req_c + 1); Node *phi_c = con1; uint len = r->req(); - Node *region_x = new (igvn->C) RegionNode(len - req_c); + Node *region_x = new RegionNode(len - req_c); Node *phi_x = PhiNode::make_blank(region_x, phi); for (uint i = 1, i_c = 1, i_x = 1; i < len; i++) { if (phi->in(i) == con1) { @@ -272,7 +272,7 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) { // Prevent the untimely death of phi_x. Currently he has no uses. He is // about to get one. If this only use goes away, then phi_x will look dead. // However, he will be picking up some more uses down below. - Node *hook = new (igvn->C) Node(4); + Node *hook = new Node(4); hook->init_req(0, phi_x); hook->init_req(1, phi_c); phi_x = phase->transform( phi_x ); @@ -284,30 +284,30 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) { cmp_x->set_req(2,con2); cmp_x = phase->transform(cmp_x); // Make the bool - Node *b_c = phase->transform(new (igvn->C) BoolNode(cmp_c,b->_test._test)); - Node *b_x = phase->transform(new (igvn->C) BoolNode(cmp_x,b->_test._test)); + Node *b_c = phase->transform(new BoolNode(cmp_c,b->_test._test)); + Node *b_x = phase->transform(new BoolNode(cmp_x,b->_test._test)); // Make the IfNode - IfNode *iff_c = new (igvn->C) IfNode(region_c,b_c,iff->_prob,iff->_fcnt); + IfNode *iff_c = new IfNode(region_c,b_c,iff->_prob,iff->_fcnt); igvn->set_type_bottom(iff_c); igvn->_worklist.push(iff_c); hook->init_req(2, iff_c); - IfNode *iff_x = new (igvn->C) IfNode(region_x,b_x,iff->_prob, iff->_fcnt); + IfNode *iff_x = new IfNode(region_x,b_x,iff->_prob, iff->_fcnt); igvn->set_type_bottom(iff_x); igvn->_worklist.push(iff_x); hook->init_req(3, iff_x); // Make the true/false arms - Node *iff_c_t = phase->transform(new (igvn->C) IfTrueNode (iff_c)); - Node *iff_c_f = phase->transform(new (igvn->C) IfFalseNode(iff_c)); + Node *iff_c_t = phase->transform(new IfTrueNode (iff_c)); + Node *iff_c_f = phase->transform(new IfFalseNode(iff_c)); if (predicate_c != NULL) { assert(predicate_x == NULL, "only one predicate entry expected"); // Clone loop predicates to each path iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t, !counted_loop); iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f, !counted_loop); } - Node *iff_x_t = phase->transform(new (igvn->C) IfTrueNode (iff_x)); - Node *iff_x_f = phase->transform(new (igvn->C) IfFalseNode(iff_x)); + Node *iff_x_t = phase->transform(new IfTrueNode (iff_x)); + Node *iff_x_f = phase->transform(new IfFalseNode(iff_x)); if (predicate_x != NULL) { assert(predicate_c == NULL, "only one predicate entry expected"); // Clone loop predicates to each path @@ -316,14 +316,14 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) { } // Merge the TRUE paths - Node *region_s = new (igvn->C) RegionNode(3); + Node *region_s = new RegionNode(3); igvn->_worklist.push(region_s); region_s->init_req(1, iff_c_t); region_s->init_req(2, iff_x_t); igvn->register_new_node_with_optimizer( region_s ); // Merge the FALSE paths - Node *region_f = new (igvn->C) RegionNode(3); + Node *region_f = new RegionNode(3); igvn->_worklist.push(region_f); region_f->init_req(1, iff_c_f); region_f->init_req(2, iff_x_f); @@ -438,7 +438,7 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) { // Must return either the original node (now dead) or a new node // (Do not return a top here, since that would break the uniqueness of top.) - return new (igvn->C) ConINode(TypeInt::ZERO); + return new ConINode(TypeInt::ZERO); } //------------------------------is_range_check--------------------------------- @@ -541,16 +541,16 @@ static void adjust_check(Node* proj, Node* range, Node* index, // Compute a new check Node *new_add = gvn->intcon(off_lo); if( index ) { - new_add = off_lo ? gvn->transform(new (gvn->C) AddINode( index, new_add )) : index; + new_add = off_lo ? gvn->transform(new AddINode( index, new_add )) : index; } Node *new_cmp = (flip == 1) - ? new (gvn->C) CmpUNode( new_add, range ) - : new (gvn->C) CmpUNode( range, new_add ); + ? new CmpUNode( new_add, range ) + : new CmpUNode( range, new_add ); new_cmp = gvn->transform(new_cmp); // See if no need to adjust the existing check if( new_cmp == cmp ) return; // Else, adjust existing check - Node *new_bol = gvn->transform( new (gvn->C) BoolNode( new_cmp, bol->as_Bool()->_test._test ) ); + Node *new_bol = gvn->transform( new BoolNode( new_cmp, bol->as_Bool()->_test._test ) ); igvn->rehash_node_delayed( iff ); iff->set_req_X( 1, new_bol, igvn ); } @@ -728,9 +728,9 @@ Node* IfNode::fold_compares(PhaseGVN* phase) { if (failtype->_hi != max_jint && failtype->_lo != min_jint && bound > 1) { // Merge the two compares into a single unsigned compare by building (CmpU (n - lo) hi) BoolTest::mask cond = fail->as_Proj()->_con ? BoolTest::lt : BoolTest::ge; - Node* adjusted = phase->transform(new (phase->C) SubINode(n, phase->intcon(failtype->_lo))); - Node* newcmp = phase->transform(new (phase->C) CmpUNode(adjusted, phase->intcon(bound))); - Node* newbool = phase->transform(new (phase->C) BoolNode(newcmp, cond)); + Node* adjusted = phase->transform(new SubINode(n, phase->intcon(failtype->_lo))); + Node* newcmp = phase->transform(new CmpUNode(adjusted, phase->intcon(bound))); + Node* newbool = phase->transform(new BoolNode(newcmp, cond)); phase->is_IterGVN()->replace_input_of(dom_iff, 1, phase->intcon(ctrl->as_Proj()->_con)); phase->hash_delete(this); set_req(1, newbool); @@ -1003,7 +1003,7 @@ Node *IfNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Must return either the original node (now dead) or a new node // (Do not return a top here, since that would break the uniqueness of top.) - return new (phase->C) ConINode(TypeInt::ZERO); + return new ConINode(TypeInt::ZERO); } //------------------------------dominated_by----------------------------------- @@ -1099,7 +1099,7 @@ static IfNode* idealize_test(PhaseGVN* phase, IfNode* iff) { // Flip test to be canonical. Requires flipping the IfFalse/IfTrue and // cloning the IfNode. - Node* new_b = phase->transform( new (phase->C) BoolNode(b->in(1), bt.negate()) ); + Node* new_b = phase->transform( new BoolNode(b->in(1), bt.negate()) ); if( !new_b->is_Bool() ) return NULL; b = new_b->as_Bool(); @@ -1107,7 +1107,7 @@ static IfNode* idealize_test(PhaseGVN* phase, IfNode* iff) { assert( igvn, "Test is not canonical in parser?" ); // The IF node never really changes, but it needs to be cloned - iff = new (phase->C) IfNode( iff->in(0), b, 1.0-iff->_prob, iff->_fcnt); + iff = new IfNode( iff->in(0), b, 1.0-iff->_prob, iff->_fcnt); Node *prior = igvn->hash_find_insert(iff); if( prior ) { @@ -1120,8 +1120,8 @@ static IfNode* idealize_test(PhaseGVN* phase, IfNode* iff) { igvn->_worklist.push(iff); // Now handle projections. Cloning not required. - Node* new_if_f = (Node*)(new (phase->C) IfFalseNode( iff )); - Node* new_if_t = (Node*)(new (phase->C) IfTrueNode ( iff )); + Node* new_if_f = (Node*)(new IfFalseNode( iff )); + Node* new_if_t = (Node*)(new IfTrueNode ( iff )); igvn->register_new_node_with_optimizer(new_if_f); igvn->register_new_node_with_optimizer(new_if_t); diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp index 8398bb3d254..10daf5694f9 100644 --- a/hotspot/src/share/vm/opto/lcm.cpp +++ b/hotspot/src/share/vm/opto/lcm.cpp @@ -419,7 +419,7 @@ void PhaseCFG::implicit_null_check(Block* block, Node *proj, Node *val, int allo Node *tmp2 = block->get_node(block->end_idx()+2); block->map_node(tmp2, block->end_idx()+1); block->map_node(tmp1, block->end_idx()+2); - Node *tmp = new (C) Node(C->top()); // Use not NULL input + Node *tmp = new Node(C->top()); // Use not NULL input tmp1->replace_by(tmp); tmp2->replace_by(tmp1); tmp->replace_by(tmp2); @@ -430,7 +430,7 @@ void PhaseCFG::implicit_null_check(Block* block, Node *proj, Node *val, int allo // Since schedule-local needs precise def-use info, we need to correct // it as well. Node *old_tst = proj->in(0); - MachNode *nul_chk = new (C) MachNullCheckNode(old_tst->in(0),best,bidx); + MachNode *nul_chk = new MachNullCheckNode(old_tst->in(0),best,bidx); block->map_node(nul_chk, block->end_idx()); map_node_to_block(nul_chk, block); // Redirect users of old_test to nul_chk @@ -671,7 +671,7 @@ uint PhaseCFG::sched_call(Block* block, uint node_cnt, Node_List& worklist, Grow // Set all registers killed and not already defined by the call. uint r_cnt = mcall->tf()->range()->cnt(); int op = mcall->ideal_Opcode(); - MachProjNode *proj = new (C) MachProjNode( mcall, r_cnt+1, RegMask::Empty, MachProjNode::fat_proj ); + MachProjNode *proj = new MachProjNode( mcall, r_cnt+1, RegMask::Empty, MachProjNode::fat_proj ); map_node_to_block(proj, block); block->insert_node(proj, node_cnt++); @@ -900,7 +900,7 @@ bool PhaseCFG::schedule_local(Block* block, GrowableArray& ready_cnt, Vecto regs.Insert(_matcher.c_frame_pointer()); regs.OR(n->out_RegMask()); - MachProjNode *proj = new (C) MachProjNode( n, 1, RegMask::Empty, MachProjNode::fat_proj ); + MachProjNode *proj = new MachProjNode( n, 1, RegMask::Empty, MachProjNode::fat_proj ); map_node_to_block(proj, block); block->insert_node(proj, phi_cnt++); diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 8489fcf42c0..5199e224a49 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -969,7 +969,7 @@ Node* LibraryCallKit::generate_guard(Node* test, RegionNode* region, float true_ IfNode* iff = create_and_map_if(control(), test, true_prob, COUNT_UNKNOWN); - Node* if_slow = _gvn.transform(new (C) IfTrueNode(iff)); + Node* if_slow = _gvn.transform(new IfTrueNode(iff)); if (if_slow == top()) { // The slow branch is never taken. No need to build this guard. return NULL; @@ -978,7 +978,7 @@ Node* LibraryCallKit::generate_guard(Node* test, RegionNode* region, float true_ if (region != NULL) region->add_req(if_slow); - Node* if_fast = _gvn.transform(new (C) IfFalseNode(iff)); + Node* if_fast = _gvn.transform(new IfFalseNode(iff)); set_control(if_fast); return if_slow; @@ -997,12 +997,12 @@ inline Node* LibraryCallKit::generate_negative_guard(Node* index, RegionNode* re return NULL; // already stopped if (_gvn.type(index)->higher_equal(TypeInt::POS)) // [0,maxint] return NULL; // index is already adequately typed - Node* cmp_lt = _gvn.transform(new (C) CmpINode(index, intcon(0))); - Node* bol_lt = _gvn.transform(new (C) BoolNode(cmp_lt, BoolTest::lt)); + Node* cmp_lt = _gvn.transform(new CmpINode(index, intcon(0))); + Node* bol_lt = _gvn.transform(new BoolNode(cmp_lt, BoolTest::lt)); Node* is_neg = generate_guard(bol_lt, region, PROB_MIN); if (is_neg != NULL && pos_index != NULL) { // Emulate effect of Parse::adjust_map_after_if. - Node* ccast = new (C) CastIINode(index, TypeInt::POS); + Node* ccast = new CastIINode(index, TypeInt::POS); ccast->set_req(0, control()); (*pos_index) = _gvn.transform(ccast); } @@ -1015,13 +1015,13 @@ inline Node* LibraryCallKit::generate_nonpositive_guard(Node* index, bool never_ return NULL; // already stopped if (_gvn.type(index)->higher_equal(TypeInt::POS1)) // [1,maxint] return NULL; // index is already adequately typed - Node* cmp_le = _gvn.transform(new (C) CmpINode(index, intcon(0))); + Node* cmp_le = _gvn.transform(new CmpINode(index, intcon(0))); BoolTest::mask le_or_eq = (never_negative ? BoolTest::eq : BoolTest::le); - Node* bol_le = _gvn.transform(new (C) BoolNode(cmp_le, le_or_eq)); + Node* bol_le = _gvn.transform(new BoolNode(cmp_le, le_or_eq)); Node* is_notp = generate_guard(bol_le, NULL, PROB_MIN); if (is_notp != NULL && pos_index != NULL) { // Emulate effect of Parse::adjust_map_after_if. - Node* ccast = new (C) CastIINode(index, TypeInt::POS1); + Node* ccast = new CastIINode(index, TypeInt::POS1); ccast->set_req(0, control()); (*pos_index) = _gvn.transform(ccast); } @@ -1053,9 +1053,9 @@ inline Node* LibraryCallKit::generate_limit_guard(Node* offset, return NULL; // common case of whole-array copy Node* last = subseq_length; if (!zero_offset) // last += offset - last = _gvn.transform(new (C) AddINode(last, offset)); - Node* cmp_lt = _gvn.transform(new (C) CmpUNode(array_length, last)); - Node* bol_lt = _gvn.transform(new (C) BoolNode(cmp_lt, BoolTest::lt)); + last = _gvn.transform(new AddINode(last, offset)); + Node* cmp_lt = _gvn.transform(new CmpUNode(array_length, last)); + Node* bol_lt = _gvn.transform(new BoolNode(cmp_lt, BoolTest::lt)); Node* is_over = generate_guard(bol_lt, region, PROB_MIN); return is_over; } @@ -1065,7 +1065,7 @@ inline Node* LibraryCallKit::generate_limit_guard(Node* offset, Node* LibraryCallKit::generate_current_thread(Node* &tls_output) { ciKlass* thread_klass = env()->Thread_klass(); const Type* thread_type = TypeOopPtr::make_from_klass(thread_klass)->cast_to_ptr_type(TypePtr::NotNull); - Node* thread = _gvn.transform(new (C) ThreadLocalNode()); + Node* thread = _gvn.transform(new ThreadLocalNode()); Node* p = basic_plus_adr(top()/*!oop*/, thread, in_bytes(JavaThread::threadObj_offset())); Node* threadObj = make_load(NULL, p, thread_type, T_OBJECT, MemNode::unordered); tls_output = thread; @@ -1100,18 +1100,18 @@ Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1, Node* str2 // Get length of string 2 str2_len = load_String_length(no_ctrl, str2); - result = new (C) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), - str1_start, str1_len, str2_start, str2_len); + result = new StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str1_len, str2_start, str2_len); break; case Op_StrComp: // Get length of string 2 str2_len = load_String_length(no_ctrl, str2); - result = new (C) StrCompNode(control(), memory(TypeAryPtr::CHARS), - str1_start, str1_len, str2_start, str2_len); + result = new StrCompNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str1_len, str2_start, str2_len); break; case Op_StrEquals: - result = new (C) StrEqualsNode(control(), memory(TypeAryPtr::CHARS), + result = new StrEqualsNode(control(), memory(TypeAryPtr::CHARS), str1_start, str2_start, str1_len); break; default: @@ -1133,16 +1133,16 @@ Node* LibraryCallKit::make_string_method_node(int opcode, Node* str1_start, Node Node* result = NULL; switch (opcode) { case Op_StrIndexOf: - result = new (C) StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), - str1_start, cnt1, str2_start, cnt2); + result = new StrIndexOfNode(control(), memory(TypeAryPtr::CHARS), + str1_start, cnt1, str2_start, cnt2); break; case Op_StrComp: - result = new (C) StrCompNode(control(), memory(TypeAryPtr::CHARS), - str1_start, cnt1, str2_start, cnt2); + result = new StrCompNode(control(), memory(TypeAryPtr::CHARS), + str1_start, cnt1, str2_start, cnt2); break; case Op_StrEquals: - result = new (C) StrEqualsNode(control(), memory(TypeAryPtr::CHARS), - str1_start, str2_start, cnt1); + result = new StrEqualsNode(control(), memory(TypeAryPtr::CHARS), + str1_start, str2_start, cnt1); break; default: ShouldNotReachHere(); @@ -1178,12 +1178,12 @@ bool LibraryCallKit::inline_string_equals() { } // paths (plus control) merge - RegionNode* region = new (C) RegionNode(5); - Node* phi = new (C) PhiNode(region, TypeInt::BOOL); + RegionNode* region = new RegionNode(5); + Node* phi = new PhiNode(region, TypeInt::BOOL); // does source == target string? - Node* cmp = _gvn.transform(new (C) CmpPNode(receiver, argument)); - Node* bol = _gvn.transform(new (C) BoolNode(cmp, BoolTest::eq)); + Node* cmp = _gvn.transform(new CmpPNode(receiver, argument)); + Node* bol = _gvn.transform(new BoolNode(cmp, BoolTest::eq)); Node* if_eq = generate_slow_guard(bol, NULL); if (if_eq != NULL) { @@ -1197,8 +1197,8 @@ bool LibraryCallKit::inline_string_equals() { if (!stopped()) { Node* inst = gen_instanceof(argument, makecon(TypeKlassPtr::make(klass))); - Node* cmp = _gvn.transform(new (C) CmpINode(inst, intcon(1))); - Node* bol = _gvn.transform(new (C) BoolNode(cmp, BoolTest::ne)); + Node* cmp = _gvn.transform(new CmpINode(inst, intcon(1))); + Node* bol = _gvn.transform(new BoolNode(cmp, BoolTest::ne)); Node* inst_false = generate_guard(bol, NULL, PROB_MIN); //instanceOf == true, fallthrough @@ -1213,7 +1213,7 @@ bool LibraryCallKit::inline_string_equals() { const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); // Properly cast the argument to String - argument = _gvn.transform(new (C) CheckCastPPNode(control(), argument, string_type)); + argument = _gvn.transform(new CheckCastPPNode(control(), argument, string_type)); // This path is taken only when argument's type is String:NotNull. argument = cast_not_null(argument, false); @@ -1236,8 +1236,8 @@ bool LibraryCallKit::inline_string_equals() { Node* argument_cnt = load_String_length(no_ctrl, argument); // Check for receiver count != argument count - Node* cmp = _gvn.transform(new(C) CmpINode(receiver_cnt, argument_cnt)); - Node* bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::ne)); + Node* cmp = _gvn.transform(new CmpINode(receiver_cnt, argument_cnt)); + Node* bol = _gvn.transform(new BoolNode(cmp, BoolTest::ne)); Node* if_ne = generate_slow_guard(bol, NULL); if (if_ne != NULL) { phi->init_req(4, intcon(0)); @@ -1265,7 +1265,7 @@ bool LibraryCallKit::inline_string_equals() { bool LibraryCallKit::inline_array_equals() { Node* arg1 = argument(0); Node* arg2 = argument(1); - set_result(_gvn.transform(new (C) AryEqNode(control(), memory(TypeAryPtr::CHARS), arg1, arg2))); + set_result(_gvn.transform(new AryEqNode(control(), memory(TypeAryPtr::CHARS), arg1, arg2))); return true; } @@ -1434,8 +1434,8 @@ bool LibraryCallKit::inline_string_indexOf() { const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(str_klass); // Make the merge point - RegionNode* result_rgn = new (C) RegionNode(4); - Node* result_phi = new (C) PhiNode(result_rgn, TypeInt::INT); + RegionNode* result_rgn = new RegionNode(4); + Node* result_phi = new PhiNode(result_rgn, TypeInt::INT); Node* no_ctrl = NULL; // Get start addr of source string @@ -1455,8 +1455,8 @@ bool LibraryCallKit::inline_string_indexOf() { Node* substr_cnt = load_String_length(no_ctrl, arg); // Check for substr count > string count - Node* cmp = _gvn.transform(new(C) CmpINode(substr_cnt, source_cnt)); - Node* bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::gt)); + Node* cmp = _gvn.transform(new CmpINode(substr_cnt, source_cnt)); + Node* bol = _gvn.transform(new BoolNode(cmp, BoolTest::gt)); Node* if_gt = generate_slow_guard(bol, NULL); if (if_gt != NULL) { result_phi->init_req(2, intcon(-1)); @@ -1465,8 +1465,8 @@ bool LibraryCallKit::inline_string_indexOf() { if (!stopped()) { // Check for substr count == 0 - cmp = _gvn.transform(new(C) CmpINode(substr_cnt, intcon(0))); - bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::eq)); + cmp = _gvn.transform(new CmpINode(substr_cnt, intcon(0))); + bol = _gvn.transform(new BoolNode(cmp, BoolTest::eq)); Node* if_zero = generate_slow_guard(bol, NULL); if (if_zero != NULL) { result_phi->init_req(3, intcon(0)); @@ -1558,7 +1558,7 @@ bool LibraryCallKit::inline_string_indexOf() { // Round a double node if necessary. Node* LibraryCallKit::round_double_node(Node* n) { if (Matcher::strict_fp_requires_explicit_rounding && UseSSE <= 1) - n = _gvn.transform(new (C) RoundDoubleNode(0, n)); + n = _gvn.transform(new RoundDoubleNode(0, n)); return n; } @@ -1571,10 +1571,10 @@ bool LibraryCallKit::inline_math(vmIntrinsics::ID id) { Node* arg = round_double_node(argument(0)); Node* n; switch (id) { - case vmIntrinsics::_dabs: n = new (C) AbsDNode( arg); break; - case vmIntrinsics::_dsqrt: n = new (C) SqrtDNode(C, control(), arg); break; - case vmIntrinsics::_dlog: n = new (C) LogDNode(C, control(), arg); break; - case vmIntrinsics::_dlog10: n = new (C) Log10DNode(C, control(), arg); break; + case vmIntrinsics::_dabs: n = new AbsDNode( arg); break; + case vmIntrinsics::_dsqrt: n = new SqrtDNode(C, control(), arg); break; + case vmIntrinsics::_dlog: n = new LogDNode(C, control(), arg); break; + case vmIntrinsics::_dlog10: n = new Log10DNode(C, control(), arg); break; default: fatal_unexpected_iid(id); break; } set_result(_gvn.transform(n)); @@ -1589,9 +1589,9 @@ bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) { Node* n = NULL; switch (id) { - case vmIntrinsics::_dsin: n = new (C) SinDNode(C, control(), arg); break; - case vmIntrinsics::_dcos: n = new (C) CosDNode(C, control(), arg); break; - case vmIntrinsics::_dtan: n = new (C) TanDNode(C, control(), arg); break; + case vmIntrinsics::_dsin: n = new SinDNode(C, control(), arg); break; + case vmIntrinsics::_dcos: n = new CosDNode(C, control(), arg); break; + case vmIntrinsics::_dtan: n = new TanDNode(C, control(), arg); break; default: fatal_unexpected_iid(id); break; } n = _gvn.transform(n); @@ -1632,17 +1632,17 @@ bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) { // probably do the math inside the SIN encoding. // Make the merge point - RegionNode* r = new (C) RegionNode(3); - Node* phi = new (C) PhiNode(r, Type::DOUBLE); + RegionNode* r = new RegionNode(3); + Node* phi = new PhiNode(r, Type::DOUBLE); // Flatten arg so we need only 1 test - Node *abs = _gvn.transform(new (C) AbsDNode(arg)); + Node *abs = _gvn.transform(new AbsDNode(arg)); // Node for PI/4 constant Node *pi4 = makecon(TypeD::make(pi_4)); // Check PI/4 : abs(arg) - Node *cmp = _gvn.transform(new (C) CmpDNode(pi4,abs)); + Node *cmp = _gvn.transform(new CmpDNode(pi4,abs)); // Check: If PI/4 < abs(arg) then go slow - Node *bol = _gvn.transform(new (C) BoolNode( cmp, BoolTest::lt )); + Node *bol = _gvn.transform(new BoolNode( cmp, BoolTest::lt )); // Branch either way IfNode *iff = create_and_xform_if(control(),bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN); set_control(opt_iff(r,iff)); @@ -1670,7 +1670,7 @@ bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) { break; } assert(control()->in(0) == call, ""); - Node* slow_result = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms)); + Node* slow_result = _gvn.transform(new ProjNode(call, TypeFunc::Parms)); r->init_req(1, control()); phi->init_req(1, slow_result); @@ -1690,9 +1690,9 @@ Node* LibraryCallKit::finish_pow_exp(Node* result, Node* x, Node* y, const TypeF //result=(result.isNaN())? funcAddr():result; // Check: If isNaN() by checking result!=result? then either trap // or go to runtime - Node* cmpisnan = _gvn.transform(new (C) CmpDNode(result, result)); + Node* cmpisnan = _gvn.transform(new CmpDNode(result, result)); // Build the boolean node - Node* bolisnum = _gvn.transform(new (C) BoolNode(cmpisnan, BoolTest::eq)); + Node* bolisnum = _gvn.transform(new BoolNode(cmpisnan, BoolTest::eq)); if (!too_many_traps(Deoptimization::Reason_intrinsic)) { { BuildCutout unless(this, bolisnum, PROB_STATIC_FREQUENT); @@ -1707,12 +1707,12 @@ Node* LibraryCallKit::finish_pow_exp(Node* result, Node* x, Node* y, const TypeF // to the runtime to properly handle corner cases IfNode* iff = create_and_xform_if(control(), bolisnum, PROB_STATIC_FREQUENT, COUNT_UNKNOWN); - Node* if_slow = _gvn.transform(new (C) IfFalseNode(iff)); - Node* if_fast = _gvn.transform(new (C) IfTrueNode(iff)); + Node* if_slow = _gvn.transform(new IfFalseNode(iff)); + Node* if_fast = _gvn.transform(new IfTrueNode(iff)); if (!if_slow->is_top()) { - RegionNode* result_region = new (C) RegionNode(3); - PhiNode* result_val = new (C) PhiNode(result_region, Type::DOUBLE); + RegionNode* result_region = new RegionNode(3); + PhiNode* result_val = new PhiNode(result_region, Type::DOUBLE); result_region->init_req(1, if_fast); result_val->init_req(1, result); @@ -1723,9 +1723,9 @@ Node* LibraryCallKit::finish_pow_exp(Node* result, Node* x, Node* y, const TypeF Node* rt = make_runtime_call(RC_LEAF, call_type, funcAddr, funcName, no_memory_effects, x, top(), y, y ? top() : NULL); - Node* value = _gvn.transform(new (C) ProjNode(rt, TypeFunc::Parms+0)); + Node* value = _gvn.transform(new ProjNode(rt, TypeFunc::Parms+0)); #ifdef ASSERT - Node* value_top = _gvn.transform(new (C) ProjNode(rt, TypeFunc::Parms+1)); + Node* value_top = _gvn.transform(new ProjNode(rt, TypeFunc::Parms+1)); assert(value_top == top(), "second value must be top"); #endif @@ -1744,7 +1744,7 @@ Node* LibraryCallKit::finish_pow_exp(Node* result, Node* x, Node* y, const TypeF // really odd corner cases (+/- Infinity). Just uncommon-trap them. bool LibraryCallKit::inline_exp() { Node* arg = round_double_node(argument(0)); - Node* n = _gvn.transform(new (C) ExpDNode(C, control(), arg)); + Node* n = _gvn.transform(new ExpDNode(C, control(), arg)); n = finish_pow_exp(n, arg, NULL, OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP"); set_result(n); @@ -1783,76 +1783,76 @@ bool LibraryCallKit::inline_pow() { Node* result = NULL; Node* const_two_node = makecon(TypeD::make(2.0)); - Node* cmp_node = _gvn.transform(new (C) CmpDNode(y, const_two_node)); - Node* bool_node = _gvn.transform(new (C) BoolNode(cmp_node, BoolTest::eq)); + Node* cmp_node = _gvn.transform(new CmpDNode(y, const_two_node)); + Node* bool_node = _gvn.transform(new BoolNode(cmp_node, BoolTest::eq)); IfNode* if_node = create_and_xform_if(control(), bool_node, PROB_STATIC_INFREQUENT, COUNT_UNKNOWN); - Node* if_true = _gvn.transform(new (C) IfTrueNode(if_node)); - Node* if_false = _gvn.transform(new (C) IfFalseNode(if_node)); + Node* if_true = _gvn.transform(new IfTrueNode(if_node)); + Node* if_false = _gvn.transform(new IfFalseNode(if_node)); - RegionNode* region_node = new (C) RegionNode(3); + RegionNode* region_node = new RegionNode(3); region_node->init_req(1, if_true); - Node* phi_node = new (C) PhiNode(region_node, Type::DOUBLE); + Node* phi_node = new PhiNode(region_node, Type::DOUBLE); // special case for x^y where y == 2, we can convert it to x * x - phi_node->init_req(1, _gvn.transform(new (C) MulDNode(x, x))); + phi_node->init_req(1, _gvn.transform(new MulDNode(x, x))); // set control to if_false since we will now process the false branch set_control(if_false); if (!too_many_traps(Deoptimization::Reason_intrinsic)) { // Short form: skip the fancy tests and just check for NaN result. - result = _gvn.transform(new (C) PowDNode(C, control(), x, y)); + result = _gvn.transform(new PowDNode(C, control(), x, y)); } else { // If this inlining ever returned NaN in the past, include all // checks + call to the runtime. // Set the merge point for If node with condition of (x <= 0.0) // There are four possible paths to region node and phi node - RegionNode *r = new (C) RegionNode(4); - Node *phi = new (C) PhiNode(r, Type::DOUBLE); + RegionNode *r = new RegionNode(4); + Node *phi = new PhiNode(r, Type::DOUBLE); // Build the first if node: if (x <= 0.0) // Node for 0 constant Node *zeronode = makecon(TypeD::ZERO); // Check x:0 - Node *cmp = _gvn.transform(new (C) CmpDNode(x, zeronode)); + Node *cmp = _gvn.transform(new CmpDNode(x, zeronode)); // Check: If (x<=0) then go complex path - Node *bol1 = _gvn.transform(new (C) BoolNode( cmp, BoolTest::le )); + Node *bol1 = _gvn.transform(new BoolNode( cmp, BoolTest::le )); // Branch either way IfNode *if1 = create_and_xform_if(control(),bol1, PROB_STATIC_INFREQUENT, COUNT_UNKNOWN); // Fast path taken; set region slot 3 - Node *fast_taken = _gvn.transform(new (C) IfFalseNode(if1)); + Node *fast_taken = _gvn.transform(new IfFalseNode(if1)); r->init_req(3,fast_taken); // Capture fast-control // Fast path not-taken, i.e. slow path - Node *complex_path = _gvn.transform(new (C) IfTrueNode(if1)); + Node *complex_path = _gvn.transform(new IfTrueNode(if1)); // Set fast path result - Node *fast_result = _gvn.transform(new (C) PowDNode(C, control(), x, y)); + Node *fast_result = _gvn.transform(new PowDNode(C, control(), x, y)); phi->init_req(3, fast_result); // Complex path // Build the second if node (if y is long) // Node for (long)y - Node *longy = _gvn.transform(new (C) ConvD2LNode(y)); + Node *longy = _gvn.transform(new ConvD2LNode(y)); // Node for (double)((long) y) - Node *doublelongy= _gvn.transform(new (C) ConvL2DNode(longy)); + Node *doublelongy= _gvn.transform(new ConvL2DNode(longy)); // Check (double)((long) y) : y - Node *cmplongy= _gvn.transform(new (C) CmpDNode(doublelongy, y)); + Node *cmplongy= _gvn.transform(new CmpDNode(doublelongy, y)); // Check if (y isn't long) then go to slow path - Node *bol2 = _gvn.transform(new (C) BoolNode( cmplongy, BoolTest::ne )); + Node *bol2 = _gvn.transform(new BoolNode( cmplongy, BoolTest::ne )); // Branch either way IfNode *if2 = create_and_xform_if(complex_path,bol2, PROB_STATIC_INFREQUENT, COUNT_UNKNOWN); - Node* ylong_path = _gvn.transform(new (C) IfFalseNode(if2)); + Node* ylong_path = _gvn.transform(new IfFalseNode(if2)); - Node *slow_path = _gvn.transform(new (C) IfTrueNode(if2)); + Node *slow_path = _gvn.transform(new IfTrueNode(if2)); // Calculate DPow(abs(x), y)*(1 & (long)y) // Node for constant 1 Node *conone = longcon(1); // 1& (long)y - Node *signnode= _gvn.transform(new (C) AndLNode(conone, longy)); + Node *signnode= _gvn.transform(new AndLNode(conone, longy)); // A huge number is always even. Detect a huge number by checking // if y + 1 == y and set integer to be tested for parity to 0. @@ -1860,18 +1860,18 @@ bool LibraryCallKit::inline_pow() { // (long)9.223372036854776E18 = max_jlong // (double)(long)9.223372036854776E18 = 9.223372036854776E18 // max_jlong is odd but 9.223372036854776E18 is even - Node* yplus1 = _gvn.transform(new (C) AddDNode(y, makecon(TypeD::make(1)))); - Node *cmpyplus1= _gvn.transform(new (C) CmpDNode(yplus1, y)); - Node *bolyplus1 = _gvn.transform(new (C) BoolNode( cmpyplus1, BoolTest::eq )); + Node* yplus1 = _gvn.transform(new AddDNode(y, makecon(TypeD::make(1)))); + Node *cmpyplus1= _gvn.transform(new CmpDNode(yplus1, y)); + Node *bolyplus1 = _gvn.transform(new BoolNode( cmpyplus1, BoolTest::eq )); Node* correctedsign = NULL; if (ConditionalMoveLimit != 0) { correctedsign = _gvn.transform( CMoveNode::make(C, NULL, bolyplus1, signnode, longcon(0), TypeLong::LONG)); } else { IfNode *ifyplus1 = create_and_xform_if(ylong_path,bolyplus1, PROB_FAIR, COUNT_UNKNOWN); - RegionNode *r = new (C) RegionNode(3); - Node *phi = new (C) PhiNode(r, TypeLong::LONG); - r->init_req(1, _gvn.transform(new (C) IfFalseNode(ifyplus1))); - r->init_req(2, _gvn.transform(new (C) IfTrueNode(ifyplus1))); + RegionNode *r = new RegionNode(3); + Node *phi = new PhiNode(r, TypeLong::LONG); + r->init_req(1, _gvn.transform(new IfFalseNode(ifyplus1))); + r->init_req(2, _gvn.transform(new IfTrueNode(ifyplus1))); phi->init_req(1, signnode); phi->init_req(2, longcon(0)); correctedsign = _gvn.transform(phi); @@ -1882,25 +1882,25 @@ bool LibraryCallKit::inline_pow() { // zero node Node *conzero = longcon(0); // Check (1&(long)y)==0? - Node *cmpeq1 = _gvn.transform(new (C) CmpLNode(correctedsign, conzero)); + Node *cmpeq1 = _gvn.transform(new CmpLNode(correctedsign, conzero)); // Check if (1&(long)y)!=0?, if so the result is negative - Node *bol3 = _gvn.transform(new (C) BoolNode( cmpeq1, BoolTest::ne )); + Node *bol3 = _gvn.transform(new BoolNode( cmpeq1, BoolTest::ne )); // abs(x) - Node *absx=_gvn.transform(new (C) AbsDNode(x)); + Node *absx=_gvn.transform(new AbsDNode(x)); // abs(x)^y - Node *absxpowy = _gvn.transform(new (C) PowDNode(C, control(), absx, y)); + Node *absxpowy = _gvn.transform(new PowDNode(C, control(), absx, y)); // -abs(x)^y - Node *negabsxpowy = _gvn.transform(new (C) NegDNode (absxpowy)); + Node *negabsxpowy = _gvn.transform(new NegDNode (absxpowy)); // (1&(long)y)==1?-DPow(abs(x), y):DPow(abs(x), y) Node *signresult = NULL; if (ConditionalMoveLimit != 0) { signresult = _gvn.transform( CMoveNode::make(C, NULL, bol3, absxpowy, negabsxpowy, Type::DOUBLE)); } else { IfNode *ifyeven = create_and_xform_if(ylong_path,bol3, PROB_FAIR, COUNT_UNKNOWN); - RegionNode *r = new (C) RegionNode(3); - Node *phi = new (C) PhiNode(r, Type::DOUBLE); - r->init_req(1, _gvn.transform(new (C) IfFalseNode(ifyeven))); - r->init_req(2, _gvn.transform(new (C) IfTrueNode(ifyeven))); + RegionNode *r = new RegionNode(3); + Node *phi = new PhiNode(r, Type::DOUBLE); + r->init_req(1, _gvn.transform(new IfFalseNode(ifyeven))); + r->init_req(2, _gvn.transform(new IfTrueNode(ifyeven))); phi->init_req(1, absxpowy); phi->init_req(2, negabsxpowy); signresult = _gvn.transform(phi); @@ -1949,9 +1949,9 @@ bool LibraryCallKit::runtime_math(const TypeFunc* call_type, address funcAddr, c Node* trig = make_runtime_call(RC_LEAF, call_type, funcAddr, funcName, no_memory_effects, a, top(), b, b ? top() : NULL); - Node* value = _gvn.transform(new (C) ProjNode(trig, TypeFunc::Parms+0)); + Node* value = _gvn.transform(new ProjNode(trig, TypeFunc::Parms+0)); #ifdef ASSERT - Node* value_top = _gvn.transform(new (C) ProjNode(trig, TypeFunc::Parms+1)); + Node* value_top = _gvn.transform(new ProjNode(trig, TypeFunc::Parms+1)); assert(value_top == top(), "second value must be top"); #endif @@ -2011,10 +2011,10 @@ bool LibraryCallKit::inline_min_max(vmIntrinsics::ID id) { } void LibraryCallKit::inline_math_mathExact(Node* math, Node *test) { - Node* bol = _gvn.transform( new (C) BoolNode(test, BoolTest::overflow) ); + Node* bol = _gvn.transform( new BoolNode(test, BoolTest::overflow) ); IfNode* check = create_and_map_if(control(), bol, PROB_UNLIKELY_MAG(3), COUNT_UNKNOWN); - Node* fast_path = _gvn.transform( new (C) IfFalseNode(check)); - Node* slow_path = _gvn.transform( new (C) IfTrueNode(check) ); + Node* fast_path = _gvn.transform( new IfFalseNode(check)); + Node* slow_path = _gvn.transform( new IfTrueNode(check) ); { PreserveJVMState pjvms(this); @@ -2036,9 +2036,9 @@ template bool LibraryCallKit::inline_math_overflow(Node* arg1, Node* arg2) { typedef typename OverflowOp::MathOp MathOp; - MathOp* mathOp = new(C) MathOp(arg1, arg2); + MathOp* mathOp = new MathOp(arg1, arg2); Node* operation = _gvn.transform( mathOp ); - Node* ofcheck = _gvn.transform( new(C) OverflowOp(arg1, arg2) ); + Node* ofcheck = _gvn.transform( new OverflowOp(arg1, arg2) ); inline_math_mathExact(operation, ofcheck); return true; } @@ -2106,7 +2106,7 @@ LibraryCallKit::generate_min_max(vmIntrinsics::ID id, Node* x0, Node* y0) { int cmp_op = Op_CmpI; Node* xkey = xvalue; Node* ykey = yvalue; - Node* ideal_cmpxy = _gvn.transform(new(C) CmpINode(xkey, ykey)); + Node* ideal_cmpxy = _gvn.transform(new CmpINode(xkey, ykey)); if (ideal_cmpxy->is_Cmp()) { // E.g., if we have CmpI(length - offset, count), // it might idealize to CmpI(length, count + offset) @@ -2199,7 +2199,7 @@ LibraryCallKit::generate_min_max(vmIntrinsics::ID id, Node* x0, Node* y0) { default: if (cmpxy == NULL) cmpxy = ideal_cmpxy; - best_bol = _gvn.transform(new(C) BoolNode(cmpxy, BoolTest::lt)); + best_bol = _gvn.transform(new BoolNode(cmpxy, BoolTest::lt)); // and fall through: case BoolTest::lt: // x < y case BoolTest::le: // x <= y @@ -2259,7 +2259,7 @@ LibraryCallKit::classify_unsafe_addr(Node* &base, Node* &offset) { return Type::AnyPtr; } else if (base_type == TypePtr::NULL_PTR) { // Since this is a NULL+long form, we have to switch to a rawptr. - base = _gvn.transform(new (C) CastX2PNode(offset)); + base = _gvn.transform(new CastX2PNode(offset)); offset = MakeConX(0); return Type::RawPtr; } else if (base_type->base() == Type::RawPtr) { @@ -2312,16 +2312,16 @@ bool LibraryCallKit::inline_number_methods(vmIntrinsics::ID id) { Node* arg = argument(0); Node* n; switch (id) { - case vmIntrinsics::_numberOfLeadingZeros_i: n = new (C) CountLeadingZerosINode( arg); break; - case vmIntrinsics::_numberOfLeadingZeros_l: n = new (C) CountLeadingZerosLNode( arg); break; - case vmIntrinsics::_numberOfTrailingZeros_i: n = new (C) CountTrailingZerosINode(arg); break; - case vmIntrinsics::_numberOfTrailingZeros_l: n = new (C) CountTrailingZerosLNode(arg); break; - case vmIntrinsics::_bitCount_i: n = new (C) PopCountINode( arg); break; - case vmIntrinsics::_bitCount_l: n = new (C) PopCountLNode( arg); break; - case vmIntrinsics::_reverseBytes_c: n = new (C) ReverseBytesUSNode(0, arg); break; - case vmIntrinsics::_reverseBytes_s: n = new (C) ReverseBytesSNode( 0, arg); break; - case vmIntrinsics::_reverseBytes_i: n = new (C) ReverseBytesINode( 0, arg); break; - case vmIntrinsics::_reverseBytes_l: n = new (C) ReverseBytesLNode( 0, arg); break; + case vmIntrinsics::_numberOfLeadingZeros_i: n = new CountLeadingZerosINode( arg); break; + case vmIntrinsics::_numberOfLeadingZeros_l: n = new CountLeadingZerosLNode( arg); break; + case vmIntrinsics::_numberOfTrailingZeros_i: n = new CountTrailingZerosINode(arg); break; + case vmIntrinsics::_numberOfTrailingZeros_l: n = new CountTrailingZerosLNode(arg); break; + case vmIntrinsics::_bitCount_i: n = new PopCountINode( arg); break; + case vmIntrinsics::_bitCount_l: n = new PopCountLNode( arg); break; + case vmIntrinsics::_reverseBytes_c: n = new ReverseBytesUSNode(0, arg); break; + case vmIntrinsics::_reverseBytes_s: n = new ReverseBytesSNode( 0, arg); break; + case vmIntrinsics::_reverseBytes_i: n = new ReverseBytesINode( 0, arg); break; + case vmIntrinsics::_reverseBytes_l: n = new ReverseBytesLNode( 0, arg); break; default: fatal_unexpected_iid(id); break; } set_result(_gvn.transform(n)); @@ -2637,7 +2637,7 @@ bool LibraryCallKit::inline_unsafe_access(bool is_native_ptr, bool is_store, Bas break; case T_ADDRESS: // Cast to an int type. - p = _gvn.transform(new (C) CastP2XNode(NULL, p)); + p = _gvn.transform(new CastP2XNode(NULL, p)); p = ConvX2UL(p); break; default: @@ -2658,7 +2658,7 @@ bool LibraryCallKit::inline_unsafe_access(bool is_native_ptr, bool is_store, Bas case T_ADDRESS: // Repackage the long as a pointer. val = ConvL2X(val); - val = _gvn.transform(new (C) CastX2PNode(val)); + val = _gvn.transform(new CastX2PNode(val)); break; } @@ -2766,9 +2766,9 @@ bool LibraryCallKit::inline_unsafe_prefetch(bool is_native_ptr, bool is_store, b // Generate the read or write prefetch Node *prefetch; if (is_store) { - prefetch = new (C) PrefetchWriteNode(i_o(), adr); + prefetch = new PrefetchWriteNode(i_o(), adr); } else { - prefetch = new (C) PrefetchReadNode(i_o(), adr); + prefetch = new PrefetchReadNode(i_o(), adr); } prefetch->init_req(0, control()); set_i_o(_gvn.transform(prefetch)); @@ -2906,22 +2906,22 @@ bool LibraryCallKit::inline_unsafe_load_store(BasicType type, LoadStoreKind kind switch(type) { case T_INT: if (kind == LS_xadd) { - load_store = _gvn.transform(new (C) GetAndAddINode(control(), mem, adr, newval, adr_type)); + load_store = _gvn.transform(new GetAndAddINode(control(), mem, adr, newval, adr_type)); } else if (kind == LS_xchg) { - load_store = _gvn.transform(new (C) GetAndSetINode(control(), mem, adr, newval, adr_type)); + load_store = _gvn.transform(new GetAndSetINode(control(), mem, adr, newval, adr_type)); } else if (kind == LS_cmpxchg) { - load_store = _gvn.transform(new (C) CompareAndSwapINode(control(), mem, adr, newval, oldval)); + load_store = _gvn.transform(new CompareAndSwapINode(control(), mem, adr, newval, oldval)); } else { ShouldNotReachHere(); } break; case T_LONG: if (kind == LS_xadd) { - load_store = _gvn.transform(new (C) GetAndAddLNode(control(), mem, adr, newval, adr_type)); + load_store = _gvn.transform(new GetAndAddLNode(control(), mem, adr, newval, adr_type)); } else if (kind == LS_xchg) { - load_store = _gvn.transform(new (C) GetAndSetLNode(control(), mem, adr, newval, adr_type)); + load_store = _gvn.transform(new GetAndSetLNode(control(), mem, adr, newval, adr_type)); } else if (kind == LS_cmpxchg) { - load_store = _gvn.transform(new (C) CompareAndSwapLNode(control(), mem, adr, newval, oldval)); + load_store = _gvn.transform(new CompareAndSwapLNode(control(), mem, adr, newval, oldval)); } else { ShouldNotReachHere(); } @@ -2958,24 +2958,24 @@ bool LibraryCallKit::inline_unsafe_load_store(BasicType type, LoadStoreKind kind #ifdef _LP64 if (adr->bottom_type()->is_ptr_to_narrowoop()) { - Node *newval_enc = _gvn.transform(new (C) EncodePNode(newval, newval->bottom_type()->make_narrowoop())); + Node *newval_enc = _gvn.transform(new EncodePNode(newval, newval->bottom_type()->make_narrowoop())); if (kind == LS_xchg) { - load_store = _gvn.transform(new (C) GetAndSetNNode(control(), mem, adr, - newval_enc, adr_type, value_type->make_narrowoop())); + load_store = _gvn.transform(new GetAndSetNNode(control(), mem, adr, + newval_enc, adr_type, value_type->make_narrowoop())); } else { assert(kind == LS_cmpxchg, "wrong LoadStore operation"); - Node *oldval_enc = _gvn.transform(new (C) EncodePNode(oldval, oldval->bottom_type()->make_narrowoop())); - load_store = _gvn.transform(new (C) CompareAndSwapNNode(control(), mem, adr, + Node *oldval_enc = _gvn.transform(new EncodePNode(oldval, oldval->bottom_type()->make_narrowoop())); + load_store = _gvn.transform(new CompareAndSwapNNode(control(), mem, adr, newval_enc, oldval_enc)); } } else #endif { if (kind == LS_xchg) { - load_store = _gvn.transform(new (C) GetAndSetPNode(control(), mem, adr, newval, adr_type, value_type->is_oopptr())); + load_store = _gvn.transform(new GetAndSetPNode(control(), mem, adr, newval, adr_type, value_type->is_oopptr())); } else { assert(kind == LS_cmpxchg, "wrong LoadStore operation"); - load_store = _gvn.transform(new (C) CompareAndSwapPNode(control(), mem, adr, newval, oldval)); + load_store = _gvn.transform(new CompareAndSwapPNode(control(), mem, adr, newval, oldval)); } } post_barrier(control(), load_store, base, adr, alias_idx, newval, T_OBJECT, true); @@ -2988,13 +2988,13 @@ bool LibraryCallKit::inline_unsafe_load_store(BasicType type, LoadStoreKind kind // SCMemProjNodes represent the memory state of a LoadStore. Their // main role is to prevent LoadStore nodes from being optimized away // when their results aren't used. - Node* proj = _gvn.transform(new (C) SCMemProjNode(load_store)); + Node* proj = _gvn.transform(new SCMemProjNode(load_store)); set_memory(proj, alias_idx); if (type == T_OBJECT && kind == LS_xchg) { #ifdef _LP64 if (adr->bottom_type()->is_ptr_to_narrowoop()) { - load_store = _gvn.transform(new (C) DecodeNNode(load_store, load_store->get_ptr_type())); + load_store = _gvn.transform(new DecodeNNode(load_store, load_store->get_ptr_type())); } #endif if (can_move_pre_barrier()) { @@ -3136,7 +3136,7 @@ bool LibraryCallKit::inline_unsafe_allocate() { // can generate code to load it as unsigned byte. Node* inst = make_load(NULL, insp, TypeInt::UBYTE, T_BOOLEAN, MemNode::unordered); Node* bits = intcon(InstanceKlass::fully_initialized); - test = _gvn.transform(new (C) SubINode(inst, bits)); + test = _gvn.transform(new SubINode(inst, bits)); // The 'test' is non-zero if we need to take a slow path. } @@ -3160,9 +3160,9 @@ bool LibraryCallKit::inline_native_classID() { Node* insp = basic_plus_adr(kls, in_bytes(offset)); Node* tvalue = make_load(NULL, insp, TypeLong::LONG, T_LONG, MemNode::unordered); Node* bits = longcon(~0x03l); // ignore bit 0 & 1 - Node* andl = _gvn.transform(new (C) AndLNode(tvalue, bits)); + Node* andl = _gvn.transform(new AndLNode(tvalue, bits)); Node* clsused = longcon(0x01l); // set the class bit - Node* orl = _gvn.transform(new (C) OrLNode(tvalue, clsused)); + Node* orl = _gvn.transform(new OrLNode(tvalue, clsused)); const TypePtr *adr_type = _gvn.type(insp)->isa_ptr(); store_to_memory(control(), insp, orl, T_LONG, adr_type, MemNode::unordered); @@ -3198,9 +3198,9 @@ bool LibraryCallKit::inline_native_time_funcs(address funcAddr, const char* func const TypeFunc* tf = OptoRuntime::void_long_Type(); const TypePtr* no_memory_effects = NULL; Node* time = make_runtime_call(RC_LEAF, tf, funcAddr, funcName, no_memory_effects); - Node* value = _gvn.transform(new (C) ProjNode(time, TypeFunc::Parms+0)); + Node* value = _gvn.transform(new ProjNode(time, TypeFunc::Parms+0)); #ifdef ASSERT - Node* value_top = _gvn.transform(new (C) ProjNode(time, TypeFunc::Parms+1)); + Node* value_top = _gvn.transform(new ProjNode(time, TypeFunc::Parms+1)); assert(value_top == top(), "second value must be top"); #endif set_result(value); @@ -3241,18 +3241,18 @@ bool LibraryCallKit::inline_native_isInterrupted() { // out of the function. insert_mem_bar(Op_MemBarCPUOrder); - RegionNode* result_rgn = new (C) RegionNode(PATH_LIMIT); - PhiNode* result_val = new (C) PhiNode(result_rgn, TypeInt::BOOL); + RegionNode* result_rgn = new RegionNode(PATH_LIMIT); + PhiNode* result_val = new PhiNode(result_rgn, TypeInt::BOOL); - RegionNode* slow_region = new (C) RegionNode(1); + RegionNode* slow_region = new RegionNode(1); record_for_igvn(slow_region); // (a) Receiving thread must be the current thread. Node* rec_thr = argument(0); Node* tls_ptr = NULL; Node* cur_thr = generate_current_thread(tls_ptr); - Node* cmp_thr = _gvn.transform(new (C) CmpPNode(cur_thr, rec_thr)); - Node* bol_thr = _gvn.transform(new (C) BoolNode(cmp_thr, BoolTest::ne)); + Node* cmp_thr = _gvn.transform(new CmpPNode(cur_thr, rec_thr)); + Node* bol_thr = _gvn.transform(new BoolNode(cmp_thr, BoolTest::ne)); generate_slow_guard(bol_thr, slow_region); @@ -3263,33 +3263,33 @@ bool LibraryCallKit::inline_native_isInterrupted() { // Set the control input on the field _interrupted read to prevent it floating up. Node* int_bit = make_load(control(), p, TypeInt::BOOL, T_INT, MemNode::unordered); - Node* cmp_bit = _gvn.transform(new (C) CmpINode(int_bit, intcon(0))); - Node* bol_bit = _gvn.transform(new (C) BoolNode(cmp_bit, BoolTest::ne)); + Node* cmp_bit = _gvn.transform(new CmpINode(int_bit, intcon(0))); + Node* bol_bit = _gvn.transform(new BoolNode(cmp_bit, BoolTest::ne)); IfNode* iff_bit = create_and_map_if(control(), bol_bit, PROB_UNLIKELY_MAG(3), COUNT_UNKNOWN); // First fast path: if (!TLS._interrupted) return false; - Node* false_bit = _gvn.transform(new (C) IfFalseNode(iff_bit)); + Node* false_bit = _gvn.transform(new IfFalseNode(iff_bit)); result_rgn->init_req(no_int_result_path, false_bit); result_val->init_req(no_int_result_path, intcon(0)); // drop through to next case - set_control( _gvn.transform(new (C) IfTrueNode(iff_bit))); + set_control( _gvn.transform(new IfTrueNode(iff_bit))); #ifndef TARGET_OS_FAMILY_windows // (c) Or, if interrupt bit is set and clear_int is false, use 2nd fast path. Node* clr_arg = argument(1); - Node* cmp_arg = _gvn.transform(new (C) CmpINode(clr_arg, intcon(0))); - Node* bol_arg = _gvn.transform(new (C) BoolNode(cmp_arg, BoolTest::ne)); + Node* cmp_arg = _gvn.transform(new CmpINode(clr_arg, intcon(0))); + Node* bol_arg = _gvn.transform(new BoolNode(cmp_arg, BoolTest::ne)); IfNode* iff_arg = create_and_map_if(control(), bol_arg, PROB_FAIR, COUNT_UNKNOWN); // Second fast path: ... else if (!clear_int) return true; - Node* false_arg = _gvn.transform(new (C) IfFalseNode(iff_arg)); + Node* false_arg = _gvn.transform(new IfFalseNode(iff_arg)); result_rgn->init_req(no_clear_result_path, false_arg); result_val->init_req(no_clear_result_path, intcon(1)); // drop through to next case - set_control( _gvn.transform(new (C) IfTrueNode(iff_arg))); + set_control( _gvn.transform(new IfTrueNode(iff_arg))); #else // To return true on Windows you must read the _interrupted field // and check the the event state i.e. take the slow path. @@ -3375,9 +3375,9 @@ Node* LibraryCallKit::generate_access_flags_guard(Node* kls, int modifier_mask, Node* mods = make_load(NULL, modp, TypeInt::INT, T_INT, MemNode::unordered); Node* mask = intcon(modifier_mask); Node* bits = intcon(modifier_bits); - Node* mbit = _gvn.transform(new (C) AndINode(mods, mask)); - Node* cmp = _gvn.transform(new (C) CmpINode(mbit, bits)); - Node* bol = _gvn.transform(new (C) BoolNode(cmp, BoolTest::ne)); + Node* mbit = _gvn.transform(new AndINode(mods, mask)); + Node* cmp = _gvn.transform(new CmpINode(mbit, bits)); + Node* bol = _gvn.transform(new BoolNode(cmp, BoolTest::ne)); return generate_fair_guard(bol, region); } Node* LibraryCallKit::generate_interface_guard(Node* kls, RegionNode* region) { @@ -3450,9 +3450,9 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) { #endif // Null-check the mirror, and the mirror's klass ptr (in case it is a primitive). - RegionNode* region = new (C) RegionNode(PATH_LIMIT); + RegionNode* region = new RegionNode(PATH_LIMIT); record_for_igvn(region); - PhiNode* phi = new (C) PhiNode(region, return_type); + PhiNode* phi = new PhiNode(region, return_type); // The mirror will never be null of Reflection.getClassAccessFlags, however // it may be null for Class.isInstance or Class.getModifiers. Throw a NPE @@ -3594,8 +3594,8 @@ bool LibraryCallKit::inline_native_subtype_check() { PATH_LIMIT }; - RegionNode* region = new (C) RegionNode(PATH_LIMIT); - Node* phi = new (C) PhiNode(region, TypeInt::BOOL); + RegionNode* region = new RegionNode(PATH_LIMIT); + Node* phi = new PhiNode(region, TypeInt::BOOL); record_for_igvn(region); const TypePtr* adr_type = TypeRawPtr::BOTTOM; // memory type of loads @@ -3642,8 +3642,8 @@ bool LibraryCallKit::inline_native_subtype_check() { set_control(region->in(_prim_0_path)); // go back to first null check if (!stopped()) { // Since superc is primitive, make a guard for the superc==subc case. - Node* cmp_eq = _gvn.transform(new (C) CmpPNode(args[0], args[1])); - Node* bol_eq = _gvn.transform(new (C) BoolNode(cmp_eq, BoolTest::eq)); + Node* cmp_eq = _gvn.transform(new CmpPNode(args[0], args[1])); + Node* bol_eq = _gvn.transform(new BoolNode(cmp_eq, BoolTest::eq)); generate_guard(bol_eq, region, PROB_FAIR); if (region->req() == PATH_LIMIT+1) { // A guard was added. If the added guard is taken, superc==subc. @@ -3708,11 +3708,11 @@ Node* LibraryCallKit::generate_array_guard_common(Node* kls, RegionNode* region, ? ((jint)Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift) : Klass::_lh_neutral_value); - Node* cmp = _gvn.transform(new(C) CmpINode(layout_val, intcon(nval))); + Node* cmp = _gvn.transform(new CmpINode(layout_val, intcon(nval))); BoolTest::mask btest = BoolTest::lt; // correct for testing is_[obj]array // invert the test if we are looking for a non-array if (not_array) btest = BoolTest(btest).negate(); - Node* bol = _gvn.transform(new(C) BoolNode(cmp, btest)); + Node* bol = _gvn.transform(new BoolNode(cmp, btest)); return generate_fair_guard(bol, region); } @@ -3728,12 +3728,10 @@ bool LibraryCallKit::inline_native_newArray() { if (stopped()) return true; enum { _normal_path = 1, _slow_path = 2, PATH_LIMIT }; - RegionNode* result_reg = new(C) RegionNode(PATH_LIMIT); - PhiNode* result_val = new(C) PhiNode(result_reg, - TypeInstPtr::NOTNULL); - PhiNode* result_io = new(C) PhiNode(result_reg, Type::ABIO); - PhiNode* result_mem = new(C) PhiNode(result_reg, Type::MEMORY, - TypePtr::BOTTOM); + RegionNode* result_reg = new RegionNode(PATH_LIMIT); + PhiNode* result_val = new PhiNode(result_reg, TypeInstPtr::NOTNULL); + PhiNode* result_io = new PhiNode(result_reg, Type::ABIO); + PhiNode* result_mem = new PhiNode(result_reg, Type::MEMORY, TypePtr::BOTTOM); bool never_see_null = !too_many_traps(Deoptimization::Reason_null_check); Node* klass_node = load_array_klass_from_mirror(mirror, never_see_null, @@ -3840,7 +3838,7 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { Node* klass_node = load_klass_from_mirror(array_type_mirror, false, NULL, 0); klass_node = null_check(klass_node); - RegionNode* bailout = new (C) RegionNode(1); + RegionNode* bailout = new RegionNode(1); record_for_igvn(bailout); // Despite the generic type of Arrays.copyOf, the mirror might be int, int[], etc. @@ -3850,7 +3848,7 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { // Improve the klass node's type from the new optimistic assumption: ciKlass* ak = ciArrayKlass::make(env()->Object_klass()); const Type* akls = TypeKlassPtr::make(TypePtr::NotNull, ak, 0/*offset*/); - Node* cast = new (C) CastPPNode(klass_node, akls); + Node* cast = new CastPPNode(klass_node, akls); cast->init_req(0, control()); klass_node = _gvn.transform(cast); } @@ -3861,7 +3859,7 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { Node* length = end; if (_gvn.type(start) != TypeInt::ZERO) { - length = _gvn.transform(new (C) SubINode(end, start)); + length = _gvn.transform(new SubINode(end, start)); } // Bail out if length is negative. @@ -3880,7 +3878,7 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { if (!stopped()) { // How many elements will we copy from the original? // The answer is MinI(orig_length - start, length). - Node* orig_tail = _gvn.transform(new (C) SubINode(orig_length, start)); + Node* orig_tail = _gvn.transform(new SubINode(orig_length, start)); Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length); newcopy = new_array(klass_node, length, 0); // no argments to push @@ -3927,8 +3925,8 @@ Node* LibraryCallKit::generate_virtual_guard(Node* obj_klass, const TypePtr* native_call_addr = TypeMetadataPtr::make(method); Node* native_call = makecon(native_call_addr); - Node* chk_native = _gvn.transform(new(C) CmpPNode(target_call, native_call)); - Node* test_native = _gvn.transform(new(C) BoolNode(chk_native, BoolTest::ne)); + Node* chk_native = _gvn.transform(new CmpPNode(target_call, native_call)); + Node* test_native = _gvn.transform(new BoolNode(chk_native, BoolTest::ne)); return generate_slow_guard(test_native, slow_region); } @@ -3953,7 +3951,7 @@ LibraryCallKit::generate_method_call(vmIntrinsics::ID method_id, bool is_virtual CallJavaNode* slow_call; if (is_static) { assert(!is_virtual, ""); - slow_call = new(C) CallStaticJavaNode(C, tf, + slow_call = new CallStaticJavaNode(C, tf, SharedRuntime::get_resolve_static_call_stub(), method, bci()); } else if (is_virtual) { @@ -3969,12 +3967,12 @@ LibraryCallKit::generate_method_call(vmIntrinsics::ID method_id, bool is_virtual assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, err_msg_res("bad index %d", vtable_index)); } - slow_call = new(C) CallDynamicJavaNode(tf, + slow_call = new CallDynamicJavaNode(tf, SharedRuntime::get_resolve_virtual_call_stub(), method, vtable_index, bci()); } else { // neither virtual nor static: opt_virtual null_check_receiver(); - slow_call = new(C) CallStaticJavaNode(C, tf, + slow_call = new CallStaticJavaNode(C, tf, SharedRuntime::get_resolve_opt_virtual_call_stub(), method, bci()); slow_call->set_optimized_virtual(true); @@ -3996,10 +3994,10 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) { enum { _slow_path = 1, _fast_path, _null_path, PATH_LIMIT }; - RegionNode* result_reg = new(C) RegionNode(PATH_LIMIT); - PhiNode* result_val = new(C) PhiNode(result_reg, TypeInt::INT); - PhiNode* result_io = new(C) PhiNode(result_reg, Type::ABIO); - PhiNode* result_mem = new(C) PhiNode(result_reg, Type::MEMORY, TypePtr::BOTTOM); + RegionNode* result_reg = new RegionNode(PATH_LIMIT); + PhiNode* result_val = new PhiNode(result_reg, TypeInt::INT); + PhiNode* result_io = new PhiNode(result_reg, Type::ABIO); + PhiNode* result_mem = new PhiNode(result_reg, Type::MEMORY, TypePtr::BOTTOM); Node* obj = NULL; if (!is_static) { // Check for hashing null object @@ -4027,7 +4025,7 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) { // We only go to the fast case code if we pass a number of guards. The // paths which do not pass are accumulated in the slow_region. - RegionNode* slow_region = new (C) RegionNode(1); + RegionNode* slow_region = new RegionNode(1); record_for_igvn(slow_region); // If this is a virtual call, we generate a funny guard. We pull out @@ -4050,11 +4048,11 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) { Node* header = make_load(no_ctrl, header_addr, TypeX_X, TypeX_X->basic_type(), MemNode::unordered); // Test the header to see if it is unlocked. - Node* lock_mask = _gvn.MakeConX(markOopDesc::biased_lock_mask_in_place); - Node* lmasked_header = _gvn.transform(new (C) AndXNode(header, lock_mask)); - Node* unlocked_val = _gvn.MakeConX(markOopDesc::unlocked_value); - Node* chk_unlocked = _gvn.transform(new (C) CmpXNode( lmasked_header, unlocked_val)); - Node* test_unlocked = _gvn.transform(new (C) BoolNode( chk_unlocked, BoolTest::ne)); + Node *lock_mask = _gvn.MakeConX(markOopDesc::biased_lock_mask_in_place); + Node *lmasked_header = _gvn.transform(new AndXNode(header, lock_mask)); + Node *unlocked_val = _gvn.MakeConX(markOopDesc::unlocked_value); + Node *chk_unlocked = _gvn.transform(new CmpXNode( lmasked_header, unlocked_val)); + Node *test_unlocked = _gvn.transform(new BoolNode( chk_unlocked, BoolTest::ne)); generate_slow_guard(test_unlocked, slow_region); @@ -4062,19 +4060,19 @@ bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) { // We depend on hash_mask being at most 32 bits and avoid the use of // hash_mask_in_place because it could be larger than 32 bits in a 64-bit // vm: see markOop.hpp. - Node* hash_mask = _gvn.intcon(markOopDesc::hash_mask); - Node* hash_shift = _gvn.intcon(markOopDesc::hash_shift); - Node* hshifted_header= _gvn.transform(new (C) URShiftXNode(header, hash_shift)); + Node *hash_mask = _gvn.intcon(markOopDesc::hash_mask); + Node *hash_shift = _gvn.intcon(markOopDesc::hash_shift); + Node *hshifted_header= _gvn.transform(new URShiftXNode(header, hash_shift)); // This hack lets the hash bits live anywhere in the mark object now, as long // as the shift drops the relevant bits into the low 32 bits. Note that // Java spec says that HashCode is an int so there's no point in capturing // an 'X'-sized hashcode (32 in 32-bit build or 64 in 64-bit build). hshifted_header = ConvX2I(hshifted_header); - Node* hash_val = _gvn.transform(new (C) AndINode(hshifted_header, hash_mask)); + Node *hash_val = _gvn.transform(new AndINode(hshifted_header, hash_mask)); - Node* no_hash_val = _gvn.intcon(markOopDesc::no_hash); - Node* chk_assigned = _gvn.transform(new (C) CmpINode( hash_val, no_hash_val)); - Node* test_assigned = _gvn.transform(new (C) BoolNode( chk_assigned, BoolTest::eq)); + Node *no_hash_val = _gvn.intcon(markOopDesc::no_hash); + Node *chk_assigned = _gvn.transform(new CmpINode( hash_val, no_hash_val)); + Node *test_assigned = _gvn.transform(new BoolNode( chk_assigned, BoolTest::eq)); generate_slow_guard(test_assigned, slow_region); @@ -4213,19 +4211,19 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) { Node* result; switch (id) { - case vmIntrinsics::_floatToRawIntBits: result = new (C) MoveF2INode(arg); break; - case vmIntrinsics::_intBitsToFloat: result = new (C) MoveI2FNode(arg); break; - case vmIntrinsics::_doubleToRawLongBits: result = new (C) MoveD2LNode(arg); break; - case vmIntrinsics::_longBitsToDouble: result = new (C) MoveL2DNode(arg); break; + case vmIntrinsics::_floatToRawIntBits: result = new MoveF2INode(arg); break; + case vmIntrinsics::_intBitsToFloat: result = new MoveI2FNode(arg); break; + case vmIntrinsics::_doubleToRawLongBits: result = new MoveD2LNode(arg); break; + case vmIntrinsics::_longBitsToDouble: result = new MoveL2DNode(arg); break; case vmIntrinsics::_doubleToLongBits: { // two paths (plus control) merge in a wood - RegionNode *r = new (C) RegionNode(3); - Node *phi = new (C) PhiNode(r, TypeLong::LONG); + RegionNode *r = new RegionNode(3); + Node *phi = new PhiNode(r, TypeLong::LONG); - Node *cmpisnan = _gvn.transform(new (C) CmpDNode(arg, arg)); + Node *cmpisnan = _gvn.transform(new CmpDNode(arg, arg)); // Build the boolean node - Node *bolisnan = _gvn.transform(new (C) BoolNode(cmpisnan, BoolTest::ne)); + Node *bolisnan = _gvn.transform(new BoolNode(cmpisnan, BoolTest::ne)); // Branch either way. // NaN case is less traveled, which makes all the difference. @@ -4233,7 +4231,7 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) { Node *opt_isnan = _gvn.transform(ifisnan); assert( opt_isnan->is_If(), "Expect an IfNode"); IfNode *opt_ifisnan = (IfNode*)opt_isnan; - Node *iftrue = _gvn.transform(new (C) IfTrueNode(opt_ifisnan)); + Node *iftrue = _gvn.transform(new IfTrueNode(opt_ifisnan)); set_control(iftrue); @@ -4243,10 +4241,10 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) { r->init_req(1, iftrue); // Else fall through - Node *iffalse = _gvn.transform(new (C) IfFalseNode(opt_ifisnan)); + Node *iffalse = _gvn.transform(new IfFalseNode(opt_ifisnan)); set_control(iffalse); - phi->init_req(2, _gvn.transform(new (C) MoveD2LNode(arg))); + phi->init_req(2, _gvn.transform(new MoveD2LNode(arg))); r->init_req(2, iffalse); // Post merge @@ -4261,12 +4259,12 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) { case vmIntrinsics::_floatToIntBits: { // two paths (plus control) merge in a wood - RegionNode *r = new (C) RegionNode(3); - Node *phi = new (C) PhiNode(r, TypeInt::INT); + RegionNode *r = new RegionNode(3); + Node *phi = new PhiNode(r, TypeInt::INT); - Node *cmpisnan = _gvn.transform(new (C) CmpFNode(arg, arg)); + Node *cmpisnan = _gvn.transform(new CmpFNode(arg, arg)); // Build the boolean node - Node *bolisnan = _gvn.transform(new (C) BoolNode(cmpisnan, BoolTest::ne)); + Node *bolisnan = _gvn.transform(new BoolNode(cmpisnan, BoolTest::ne)); // Branch either way. // NaN case is less traveled, which makes all the difference. @@ -4274,7 +4272,7 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) { Node *opt_isnan = _gvn.transform(ifisnan); assert( opt_isnan->is_If(), "Expect an IfNode"); IfNode *opt_ifisnan = (IfNode*)opt_isnan; - Node *iftrue = _gvn.transform(new (C) IfTrueNode(opt_ifisnan)); + Node *iftrue = _gvn.transform(new IfTrueNode(opt_ifisnan)); set_control(iftrue); @@ -4284,10 +4282,10 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) { r->init_req(1, iftrue); // Else fall through - Node *iffalse = _gvn.transform(new (C) IfFalseNode(opt_ifisnan)); + Node *iffalse = _gvn.transform(new IfFalseNode(opt_ifisnan)); set_control(iffalse); - phi->init_req(2, _gvn.transform(new (C) MoveF2INode(arg))); + phi->init_req(2, _gvn.transform(new MoveF2INode(arg))); r->init_req(2, iffalse); // Post merge @@ -4403,8 +4401,8 @@ void LibraryCallKit::copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, b // Compute the length also, if needed: Node* countx = size; - countx = _gvn.transform(new (C) SubXNode(countx, MakeConX(base_off))); - countx = _gvn.transform(new (C) URShiftXNode(countx, intcon(LogBytesPerLong) )); + countx = _gvn.transform(new SubXNode(countx, MakeConX(base_off))); + countx = _gvn.transform(new URShiftXNode(countx, intcon(LogBytesPerLong) )); const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM; bool disjoint_bases = true; @@ -4493,12 +4491,10 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { _instance_path, // plain instance allocation, plus arrayof_long_arraycopy PATH_LIMIT }; - RegionNode* result_reg = new(C) RegionNode(PATH_LIMIT); - result_val = new(C) PhiNode(result_reg, - TypeInstPtr::NOTNULL); - PhiNode* result_i_o = new(C) PhiNode(result_reg, Type::ABIO); - PhiNode* result_mem = new(C) PhiNode(result_reg, Type::MEMORY, - TypePtr::BOTTOM); + RegionNode* result_reg = new RegionNode(PATH_LIMIT); + result_val = new PhiNode(result_reg, TypeInstPtr::NOTNULL); + PhiNode* result_i_o = new PhiNode(result_reg, Type::ABIO); + PhiNode* result_mem = new PhiNode(result_reg, Type::MEMORY, TypePtr::BOTTOM); record_for_igvn(result_reg); const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM; @@ -4554,7 +4550,7 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { // We only go to the instance fast case code if we pass a number of guards. // The paths which do not pass are accumulated in the slow_region. - RegionNode* slow_region = new (C) RegionNode(1); + RegionNode* slow_region = new RegionNode(1); record_for_igvn(slow_region); if (!stopped()) { // It's an instance (we did array above). Make the slow-path tests. @@ -4811,7 +4807,7 @@ bool LibraryCallKit::inline_arraycopy() { // (8) dest_offset + length must not exceed length of dest. // (9) each element of an oop array must be assignable - RegionNode* slow_region = new (C) RegionNode(1); + RegionNode* slow_region = new RegionNode(1); record_for_igvn(slow_region); // (3) operands must not be null @@ -4899,7 +4895,7 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type, RegionNode* slow_region) { if (slow_region == NULL) { - slow_region = new(C) RegionNode(1); + slow_region = new RegionNode(1); record_for_igvn(slow_region); } @@ -4947,9 +4943,9 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type, bcopy_path = 5, // copy primitive array by 64-bit blocks PATH_LIMIT = 6 }; - RegionNode* result_region = new(C) RegionNode(PATH_LIMIT); - PhiNode* result_i_o = new(C) PhiNode(result_region, Type::ABIO); - PhiNode* result_memory = new(C) PhiNode(result_region, Type::MEMORY, adr_type); + RegionNode* result_region = new RegionNode(PATH_LIMIT); + PhiNode* result_i_o = new PhiNode(result_region, Type::ABIO); + PhiNode* result_memory = new PhiNode(result_region, Type::MEMORY, adr_type); record_for_igvn(result_region); _gvn.set_type_bottom(result_i_o); _gvn.set_type_bottom(result_memory); @@ -5023,8 +5019,7 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type, // are dest_head = dest[0..off] and dest_tail = dest[off+len..dest.length]. Node* dest_size = alloc->in(AllocateNode::AllocSize); Node* dest_length = alloc->in(AllocateNode::ALength); - Node* dest_tail = _gvn.transform(new(C) AddINode(dest_offset, - copy_length)); + Node* dest_tail = _gvn.transform(new AddINode(dest_offset, copy_length)); // If there is a head section that needs zeroing, do it now. if (find_int_con(dest_offset, -1) != 0) { @@ -5040,8 +5035,8 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type, // the copy to a more hardware-friendly word size of 64 bits. Node* tail_ctl = NULL; if (!stopped() && !dest_tail->eqv_uncast(dest_length)) { - Node* cmp_lt = _gvn.transform(new(C) CmpINode(dest_tail, dest_length)); - Node* bol_lt = _gvn.transform(new(C) BoolNode(cmp_lt, BoolTest::lt)); + Node* cmp_lt = _gvn.transform(new CmpINode(dest_tail, dest_length)); + Node* bol_lt = _gvn.transform(new BoolNode(cmp_lt, BoolTest::lt)); tail_ctl = generate_slow_guard(bol_lt, NULL); assert(tail_ctl != NULL || !stopped(), "must be an outcome"); } @@ -5075,8 +5070,8 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type, dest_size); } else { // Make a local merge. - Node* done_ctl = new(C) RegionNode(3); - Node* done_mem = new(C) PhiNode(done_ctl, Type::MEMORY, adr_type); + Node* done_ctl = new RegionNode(3); + Node* done_mem = new PhiNode(done_ctl, Type::MEMORY, adr_type); done_ctl->init_req(1, notail_ctl); done_mem->init_req(1, memory(adr_type)); generate_clear_array(adr_type, dest, basic_elem_type, @@ -5171,21 +5166,21 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type, // Clean up after the checked call. // The returned value is either 0 or -1^K, // where K = number of partially transferred array elements. - Node* cmp = _gvn.transform(new(C) CmpINode(checked_value, intcon(0))); - Node* bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::eq)); + Node* cmp = _gvn.transform(new CmpINode(checked_value, intcon(0))); + Node* bol = _gvn.transform(new BoolNode(cmp, BoolTest::eq)); IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN); // If it is 0, we are done, so transfer to the end. - Node* checks_done = _gvn.transform(new(C) IfTrueNode(iff)); + Node* checks_done = _gvn.transform(new IfTrueNode(iff)); result_region->init_req(checked_path, checks_done); result_i_o ->init_req(checked_path, checked_i_o); result_memory->init_req(checked_path, checked_mem); // If it is not zero, merge into the slow call. - set_control( _gvn.transform(new(C) IfFalseNode(iff) )); - RegionNode* slow_reg2 = new(C) RegionNode(3); - PhiNode* slow_i_o2 = new(C) PhiNode(slow_reg2, Type::ABIO); - PhiNode* slow_mem2 = new(C) PhiNode(slow_reg2, Type::MEMORY, adr_type); + set_control( _gvn.transform(new IfFalseNode(iff) )); + RegionNode* slow_reg2 = new RegionNode(3); + PhiNode* slow_i_o2 = new PhiNode(slow_reg2, Type::ABIO); + PhiNode* slow_mem2 = new PhiNode(slow_reg2, Type::MEMORY, adr_type); record_for_igvn(slow_reg2); slow_reg2 ->init_req(1, slow_control); slow_i_o2 ->init_req(1, slow_i_o); @@ -5205,16 +5200,16 @@ LibraryCallKit::generate_arraycopy(const TypePtr* adr_type, } else { // We must continue the copy exactly where it failed, or else // another thread might see the wrong number of writes to dest. - Node* checked_offset = _gvn.transform(new(C) XorINode(checked_value, intcon(-1))); - Node* slow_offset = new(C) PhiNode(slow_reg2, TypeInt::INT); + Node* checked_offset = _gvn.transform(new XorINode(checked_value, intcon(-1))); + Node* slow_offset = new PhiNode(slow_reg2, TypeInt::INT); slow_offset->init_req(1, intcon(0)); slow_offset->init_req(2, checked_offset); slow_offset = _gvn.transform(slow_offset); // Adjust the arguments by the conditionally incoming offset. - Node* src_off_plus = _gvn.transform(new(C) AddINode(src_offset, slow_offset)); - Node* dest_off_plus = _gvn.transform(new(C) AddINode(dest_offset, slow_offset)); - Node* length_minus = _gvn.transform(new(C) SubINode(copy_length, slow_offset)); + Node* src_off_plus = _gvn.transform(new AddINode(src_offset, slow_offset)); + Node* dest_off_plus = _gvn.transform(new AddINode(dest_offset, slow_offset)); + Node* length_minus = _gvn.transform(new SubINode(copy_length, slow_offset)); // Tweak the node variables to adjust the code produced below: src_offset = src_off_plus; @@ -5435,10 +5430,10 @@ LibraryCallKit::generate_clear_array(const TypePtr* adr_type, int end_round = (-1 << scale) & (BytesPerLong - 1); Node* end = ConvI2X(slice_len); if (scale != 0) - end = _gvn.transform(new(C) LShiftXNode(end, intcon(scale) )); + end = _gvn.transform(new LShiftXNode(end, intcon(scale) )); end_base += end_round; - end = _gvn.transform(new(C) AddXNode(end, MakeConX(end_base))); - end = _gvn.transform(new(C) AndXNode(end, MakeConX(~end_round))); + end = _gvn.transform(new AddXNode(end, MakeConX(end_base))); + end = _gvn.transform(new AndXNode(end, MakeConX(~end_round))); mem = ClearArrayNode::clear_memory(control(), mem, dest, start_con, end, &_gvn); } else if (start_con < 0 && dest_size != top()) { @@ -5447,8 +5442,8 @@ LibraryCallKit::generate_clear_array(const TypePtr* adr_type, Node* start = slice_idx; start = ConvI2X(start); if (scale != 0) - start = _gvn.transform(new(C) LShiftXNode( start, intcon(scale) )); - start = _gvn.transform(new(C) AddXNode(start, MakeConX(abase))); + start = _gvn.transform(new LShiftXNode( start, intcon(scale) )); + start = _gvn.transform(new AddXNode(start, MakeConX(abase))); if ((bump_bit | clear_low) != 0) { int to_clear = (bump_bit | clear_low); // Align up mod 8, then store a jint zero unconditionally @@ -5459,14 +5454,14 @@ LibraryCallKit::generate_clear_array(const TypePtr* adr_type, assert((abase & to_clear) == 0, "array base must be long-aligned"); } else { // Bump 'start' up to (or past) the next jint boundary: - start = _gvn.transform(new(C) AddXNode(start, MakeConX(bump_bit))); + start = _gvn.transform(new AddXNode(start, MakeConX(bump_bit))); assert((abase & clear_low) == 0, "array base must be int-aligned"); } // Round bumped 'start' down to jlong boundary in body of array. - start = _gvn.transform(new(C) AndXNode(start, MakeConX(~to_clear))); + start = _gvn.transform(new AndXNode(start, MakeConX(~to_clear))); if (bump_bit != 0) { // Store a zero to the immediately preceding jint: - Node* x1 = _gvn.transform(new(C) AddXNode(start, MakeConX(-bump_bit))); + Node* x1 = _gvn.transform(new AddXNode(start, MakeConX(-bump_bit))); Node* p1 = basic_plus_adr(dest, x1); mem = StoreNode::make(_gvn, control(), mem, p1, adr_type, intcon(0), T_INT, MemNode::unordered); mem = _gvn.transform(mem); @@ -5533,8 +5528,8 @@ LibraryCallKit::generate_block_arraycopy(const TypePtr* adr_type, Node* sptr = basic_plus_adr(src, src_off); Node* dptr = basic_plus_adr(dest, dest_off); Node* countx = dest_size; - countx = _gvn.transform(new (C) SubXNode(countx, MakeConX(dest_off))); - countx = _gvn.transform(new (C) URShiftXNode(countx, intcon(LogBytesPerLong))); + countx = _gvn.transform(new SubXNode(countx, MakeConX(dest_off))); + countx = _gvn.transform(new URShiftXNode(countx, intcon(LogBytesPerLong))); bool disjoint_bases = true; // since alloc != NULL generate_unchecked_arraycopy(adr_type, T_LONG, disjoint_bases, @@ -5584,7 +5579,7 @@ LibraryCallKit::generate_checkcast_arraycopy(const TypePtr* adr_type, // super_check_offset, for the desired klass. int sco_offset = in_bytes(Klass::super_check_offset_offset()); Node* p3 = basic_plus_adr(dest_elem_klass, sco_offset); - Node* n3 = new(C) LoadINode(NULL, memory(p3), p3, _gvn.type(p3)->is_ptr(), TypeInt::INT, MemNode::unordered); + Node* n3 = new LoadINode(NULL, memory(p3), p3, _gvn.type(p3)->is_ptr(), TypeInt::INT, MemNode::unordered); Node* check_offset = ConvI2X(_gvn.transform(n3)); Node* check_value = dest_elem_klass; @@ -5602,7 +5597,7 @@ LibraryCallKit::generate_checkcast_arraycopy(const TypePtr* adr_type, check_offset XTOP, check_value); - return _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms)); + return _gvn.transform(new ProjNode(call, TypeFunc::Parms)); } @@ -5624,7 +5619,7 @@ LibraryCallKit::generate_generic_arraycopy(const TypePtr* adr_type, copyfunc_addr, "generic_arraycopy", adr_type, src, src_offset, dest, dest_offset, copy_length); - return _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms)); + return _gvn.transform(new ProjNode(call, TypeFunc::Parms)); } // Helper function; generates the fast out-of-line call to an arraycopy stub. @@ -5691,9 +5686,9 @@ bool LibraryCallKit::inline_encodeISOArray() { // 'dst_start' points to dst array + scaled offset const TypeAryPtr* mtype = TypeAryPtr::BYTES; - Node* enc = new (C) EncodeISOArrayNode(control(), memory(mtype), src_start, dst_start, length); + Node* enc = new EncodeISOArrayNode(control(), memory(mtype), src_start, dst_start, length); enc = _gvn.transform(enc); - Node* res_mem = _gvn.transform(new (C) SCMemProjNode(enc)); + Node* res_mem = _gvn.transform(new SCMemProjNode(enc)); set_memory(res_mem, mtype); set_result(enc); return true; @@ -5718,18 +5713,18 @@ bool LibraryCallKit::inline_updateCRC32() { */ Node* M1 = intcon(-1); - crc = _gvn.transform(new (C) XorINode(crc, M1)); - Node* result = _gvn.transform(new (C) XorINode(crc, b)); - result = _gvn.transform(new (C) AndINode(result, intcon(0xFF))); + crc = _gvn.transform(new XorINode(crc, M1)); + Node* result = _gvn.transform(new XorINode(crc, b)); + result = _gvn.transform(new AndINode(result, intcon(0xFF))); Node* base = makecon(TypeRawPtr::make(StubRoutines::crc_table_addr())); - Node* offset = _gvn.transform(new (C) LShiftINode(result, intcon(0x2))); + Node* offset = _gvn.transform(new LShiftINode(result, intcon(0x2))); Node* adr = basic_plus_adr(top(), base, ConvI2X(offset)); result = make_load(control(), adr, TypeInt::INT, T_INT, MemNode::unordered); - crc = _gvn.transform(new (C) URShiftINode(crc, intcon(8))); - result = _gvn.transform(new (C) XorINode(crc, result)); - result = _gvn.transform(new (C) XorINode(result, M1)); + crc = _gvn.transform(new URShiftINode(crc, intcon(8))); + result = _gvn.transform(new XorINode(crc, result)); + result = _gvn.transform(new XorINode(result, M1)); set_result(result); return true; } @@ -5773,7 +5768,7 @@ bool LibraryCallKit::inline_updateBytesCRC32() { Node* call = make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::updateBytesCRC32_Type(), stubAddr, stubName, TypePtr::BOTTOM, crc, src_start, length); - Node* result = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms)); + Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms)); set_result(result); return true; } @@ -5792,7 +5787,7 @@ bool LibraryCallKit::inline_updateByteBufferCRC32() { Node* length = argument(4); // type: int src = ConvL2X(src); // adjust Java long to machine word - Node* base = _gvn.transform(new (C) CastX2PNode(src)); + Node* base = _gvn.transform(new CastX2PNode(src)); offset = ConvI2X(offset); // 'src_start' points to src array + scaled offset @@ -5805,7 +5800,7 @@ bool LibraryCallKit::inline_updateByteBufferCRC32() { Node* call = make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::updateBytesCRC32_Type(), stubAddr, stubName, TypePtr::BOTTOM, crc, src_start, length); - Node* result = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms)); + Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms)); set_result(result); return true; } @@ -6005,7 +6000,7 @@ bool LibraryCallKit::inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id) { ciInstanceKlass* instklass_AESCrypt = klass_AESCrypt->as_instance_klass(); const TypeKlassPtr* aklass = TypeKlassPtr::make(instklass_AESCrypt); const TypeOopPtr* xtype = aklass->as_instance_type(); - Node* aescrypt_object = new(C) CheckCastPPNode(control(), embeddedCipherObj, xtype); + Node* aescrypt_object = new CheckCastPPNode(control(), embeddedCipherObj, xtype); aescrypt_object = _gvn.transform(aescrypt_object); // we need to get the start of the aescrypt_object's expanded key array @@ -6038,7 +6033,7 @@ bool LibraryCallKit::inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id) { } // return cipher length (int) - Node* retvalue = _gvn.transform(new (C) ProjNode(cbcCrypt, TypeFunc::Parms)); + Node* retvalue = _gvn.transform(new ProjNode(cbcCrypt, TypeFunc::Parms)); set_result(retvalue); return true; } @@ -6102,8 +6097,8 @@ Node* LibraryCallKit::inline_cipherBlockChaining_AESCrypt_predicate(bool decrypt ciInstanceKlass* instklass_AESCrypt = klass_AESCrypt->as_instance_klass(); Node* instof = gen_instanceof(embeddedCipherObj, makecon(TypeKlassPtr::make(instklass_AESCrypt))); - Node* cmp_instof = _gvn.transform(new (C) CmpINode(instof, intcon(1))); - Node* bool_instof = _gvn.transform(new (C) BoolNode(cmp_instof, BoolTest::ne)); + Node* cmp_instof = _gvn.transform(new CmpINode(instof, intcon(1))); + Node* bool_instof = _gvn.transform(new BoolNode(cmp_instof, BoolTest::ne)); Node* instof_false = generate_guard(bool_instof, NULL, PROB_MIN); @@ -6114,12 +6109,12 @@ Node* LibraryCallKit::inline_cipherBlockChaining_AESCrypt_predicate(bool decrypt // for decryption, we need to add a further check to avoid // taking the intrinsic path when cipher and plain are the same // see the original java code for why. - RegionNode* region = new(C) RegionNode(3); + RegionNode* region = new RegionNode(3); region->init_req(1, instof_false); Node* src = argument(1); Node* dest = argument(4); - Node* cmp_src_dest = _gvn.transform(new (C) CmpPNode(src, dest)); - Node* bool_src_dest = _gvn.transform(new (C) BoolNode(cmp_src_dest, BoolTest::eq)); + Node* cmp_src_dest = _gvn.transform(new CmpPNode(src, dest)); + Node* bool_src_dest = _gvn.transform(new BoolNode(cmp_src_dest, BoolTest::eq)); Node* src_dest_conjoint = generate_guard(bool_src_dest, NULL, PROB_MIN); region->init_req(2, src_dest_conjoint); diff --git a/hotspot/src/share/vm/opto/loopPredicate.cpp b/hotspot/src/share/vm/opto/loopPredicate.cpp index aeb3ffad0d5..4f2ddd3d068 100644 --- a/hotspot/src/share/vm/opto/loopPredicate.cpp +++ b/hotspot/src/share/vm/opto/loopPredicate.cpp @@ -104,7 +104,7 @@ ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node* assert(rgn->is_Call(), "must be call uct"); CallNode* call = rgn->as_Call(); IdealLoopTree* loop = get_loop(call); - rgn = new (C) RegionNode(1); + rgn = new RegionNode(1); rgn->add_req(uncommon_proj); register_control(rgn, loop, uncommon_proj); _igvn.hash_delete(call); @@ -130,8 +130,8 @@ ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node* IfNode *new_iff = iff->clone()->as_If(); new_iff->set_req(0, entry); register_control(new_iff, lp, entry); - Node *if_cont = new (C) IfTrueNode(new_iff); - Node *if_uct = new (C) IfFalseNode(new_iff); + Node *if_cont = new IfTrueNode(new_iff); + Node *if_uct = new IfFalseNode(new_iff); if (cont_proj->is_IfFalse()) { // Swap Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp; @@ -191,7 +191,7 @@ ProjNode* PhaseIterGVN::create_new_if_for_predicate(ProjNode* cont_proj, Node* n if (!rgn->is_Region()) { // create a region to guard the call assert(rgn->is_Call(), "must be call uct"); CallNode* call = rgn->as_Call(); - rgn = new (C) RegionNode(1); + rgn = new RegionNode(1); register_new_node_with_optimizer(rgn); rgn->add_req(uncommon_proj); hash_delete(call); @@ -208,8 +208,8 @@ ProjNode* PhaseIterGVN::create_new_if_for_predicate(ProjNode* cont_proj, Node* n new_iff->set_req(0, new_entry); register_new_node_with_optimizer(new_iff); - Node *if_cont = new (C) IfTrueNode(new_iff); - Node *if_uct = new (C) IfFalseNode(new_iff); + Node *if_cont = new IfTrueNode(new_iff); + Node *if_uct = new IfFalseNode(new_iff); if (cont_proj->is_IfFalse()) { // Swap Node* tmp = if_uct; if_uct = if_cont; if_cont = tmp; @@ -254,10 +254,10 @@ ProjNode* PhaseIdealLoop::clone_predicate(ProjNode* predicate_proj, Node* new_en // Match original condition since predicate's projections could be swapped. assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); - Node* opq = new (igvn->C) Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1)); + Node* opq = new Opaque1Node(igvn->C, predicate_proj->in(0)->in(1)->in(1)->in(1)); igvn->C->add_predicate_opaq(opq); - Node* bol = new (igvn->C) Conv2BNode(opq); + Node* bol = new Conv2BNode(opq); if (loop_phase != NULL) { loop_phase->register_new_node(opq, ctrl); loop_phase->register_new_node(bol, ctrl); @@ -605,11 +605,11 @@ BoolNode* PhaseIdealLoop::rc_predicate(IdealLoopTree *loop, Node* ctrl, // Calculate exact limit here. // Note, counted loop's test is '<' or '>'. limit = exact_limit(loop); - max_idx_expr = new (C) SubINode(limit, stride); + max_idx_expr = new SubINode(limit, stride); register_new_node(max_idx_expr, ctrl); if (TraceLoopPredicate) predString->print("(limit - stride) "); } else { - max_idx_expr = new (C) SubINode(limit, stride); + max_idx_expr = new SubINode(limit, stride); register_new_node(max_idx_expr, ctrl); if (TraceLoopPredicate) predString->print("(limit - stride) "); } @@ -619,22 +619,22 @@ BoolNode* PhaseIdealLoop::rc_predicate(IdealLoopTree *loop, Node* ctrl, if (scale != 1) { ConNode* con_scale = _igvn.intcon(scale); - max_idx_expr = new (C) MulINode(max_idx_expr, con_scale); + max_idx_expr = new MulINode(max_idx_expr, con_scale); register_new_node(max_idx_expr, ctrl); if (TraceLoopPredicate) predString->print("* %d ", scale); } if (offset && (!offset->is_Con() || offset->get_int() != 0)){ - max_idx_expr = new (C) AddINode(max_idx_expr, offset); + max_idx_expr = new AddINode(max_idx_expr, offset); register_new_node(max_idx_expr, ctrl); if (TraceLoopPredicate) if (offset->is_Con()) predString->print("+ %d ", offset->get_int()); else predString->print("+ offset "); } - CmpUNode* cmp = new (C) CmpUNode(max_idx_expr, range); + CmpUNode* cmp = new CmpUNode(max_idx_expr, range); register_new_node(cmp, ctrl); - BoolNode* bol = new (C) BoolNode(cmp, BoolTest::lt); + BoolNode* bol = new BoolNode(cmp, BoolTest::lt); register_new_node(bol, ctrl); if (TraceLoopPredicate) { @@ -750,7 +750,7 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) { // Negate test if necessary bool negated = false; if (proj->_con != predicate_proj->_con) { - new_predicate_bol = new (C) BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate()); + new_predicate_bol = new BoolNode(new_predicate_bol->in(1), new_predicate_bol->_test.negate()); register_new_node(new_predicate_bol, ctrl); negated = true; } diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index 0893981abac..73ec0617370 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -227,24 +227,24 @@ Node* IdealLoopTree::reassociate_add_sub(Node* n1, PhaseIdealLoop *phase) { if (neg_inv1) { Node *zero = phase->_igvn.intcon(0); phase->set_ctrl(zero, phase->C->root()); - n_inv1 = new (phase->C) SubINode(zero, inv1); + n_inv1 = new SubINode(zero, inv1); phase->register_new_node(n_inv1, inv1_c); } else { n_inv1 = inv1; } Node* inv; if (neg_inv2) { - inv = new (phase->C) SubINode(n_inv1, inv2); + inv = new SubINode(n_inv1, inv2); } else { - inv = new (phase->C) AddINode(n_inv1, inv2); + inv = new AddINode(n_inv1, inv2); } phase->register_new_node(inv, phase->get_early_ctrl(inv)); Node* addx; if (neg_x) { - addx = new (phase->C) SubINode(inv, x); + addx = new SubINode(inv, x); } else { - addx = new (phase->C) AddINode(x, inv); + addx = new AddINode(x, inv); } phase->register_new_node(addx, phase->get_ctrl(x)); phase->_igvn.replace_node(n1, addx); @@ -953,7 +953,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ post_end->_prob = PROB_FAIR; // Build the main-loop normal exit. - IfFalseNode *new_main_exit = new (C) IfFalseNode(main_end); + IfFalseNode *new_main_exit = new IfFalseNode(main_end); _igvn.register_new_node_with_optimizer( new_main_exit ); set_idom(new_main_exit, main_end, dd_main_exit ); set_loop(new_main_exit, loop->_parent); @@ -963,15 +963,15 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ // (the main-loop trip-counter exit value) because we will be changing // the exit value (via unrolling) so we cannot constant-fold away the zero // trip guard until all unrolling is done. - Node *zer_opaq = new (C) Opaque1Node(C, incr); - Node *zer_cmp = new (C) CmpINode( zer_opaq, limit ); - Node *zer_bol = new (C) BoolNode( zer_cmp, b_test ); + Node *zer_opaq = new Opaque1Node(C, incr); + Node *zer_cmp = new CmpINode( zer_opaq, limit ); + Node *zer_bol = new BoolNode( zer_cmp, b_test ); register_new_node( zer_opaq, new_main_exit ); register_new_node( zer_cmp , new_main_exit ); register_new_node( zer_bol , new_main_exit ); // Build the IfNode - IfNode *zer_iff = new (C) IfNode( new_main_exit, zer_bol, PROB_FAIR, COUNT_UNKNOWN ); + IfNode *zer_iff = new IfNode( new_main_exit, zer_bol, PROB_FAIR, COUNT_UNKNOWN ); _igvn.register_new_node_with_optimizer( zer_iff ); set_idom(zer_iff, new_main_exit, dd_main_exit); set_loop(zer_iff, loop->_parent); @@ -981,7 +981,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ set_idom(main_exit, zer_iff, dd_main_exit); set_idom(main_exit->unique_out(), zer_iff, dd_main_exit); // Make the true-path, must enter the post loop - Node *zer_taken = new (C) IfTrueNode( zer_iff ); + Node *zer_taken = new IfTrueNode( zer_iff ); _igvn.register_new_node_with_optimizer( zer_taken ); set_idom(zer_taken, zer_iff, dd_main_exit); set_loop(zer_taken, loop->_parent); @@ -1029,7 +1029,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ // Find the pre-loop normal exit. Node* pre_exit = pre_end->proj_out(false); assert( pre_exit->Opcode() == Op_IfFalse, "" ); - IfFalseNode *new_pre_exit = new (C) IfFalseNode(pre_end); + IfFalseNode *new_pre_exit = new IfFalseNode(pre_end); _igvn.register_new_node_with_optimizer( new_pre_exit ); set_idom(new_pre_exit, pre_end, dd_main_head); set_loop(new_pre_exit, loop->_parent); @@ -1038,15 +1038,15 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ // pre-loop, the main-loop may not execute at all. Later in life this // zero-trip guard will become the minimum-trip guard when we unroll // the main-loop. - Node *min_opaq = new (C) Opaque1Node(C, limit); - Node *min_cmp = new (C) CmpINode( pre_incr, min_opaq ); - Node *min_bol = new (C) BoolNode( min_cmp, b_test ); + Node *min_opaq = new Opaque1Node(C, limit); + Node *min_cmp = new CmpINode( pre_incr, min_opaq ); + Node *min_bol = new BoolNode( min_cmp, b_test ); register_new_node( min_opaq, new_pre_exit ); register_new_node( min_cmp , new_pre_exit ); register_new_node( min_bol , new_pre_exit ); // Build the IfNode (assume the main-loop is executed always). - IfNode *min_iff = new (C) IfNode( new_pre_exit, min_bol, PROB_ALWAYS, COUNT_UNKNOWN ); + IfNode *min_iff = new IfNode( new_pre_exit, min_bol, PROB_ALWAYS, COUNT_UNKNOWN ); _igvn.register_new_node_with_optimizer( min_iff ); set_idom(min_iff, new_pre_exit, dd_main_head); set_loop(min_iff, loop->_parent); @@ -1057,7 +1057,7 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ set_idom(pre_exit, min_iff, dd_main_head); set_idom(pre_exit->unique_out(), min_iff, dd_main_head); // Make the true-path, must enter the main loop - Node *min_taken = new (C) IfTrueNode( min_iff ); + Node *min_taken = new IfTrueNode( min_iff ); _igvn.register_new_node_with_optimizer( min_taken ); set_idom(min_taken, min_iff, dd_main_head); set_loop(min_taken, loop->_parent); @@ -1087,11 +1087,11 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ // RCE and alignment may change this later. Node *cmp_end = pre_end->cmp_node(); assert( cmp_end->in(2) == limit, "" ); - Node *pre_limit = new (C) AddINode( init, stride ); + Node *pre_limit = new AddINode( init, stride ); // Save the original loop limit in this Opaque1 node for // use by range check elimination. - Node *pre_opaq = new (C) Opaque1Node(C, pre_limit, limit); + Node *pre_opaq = new Opaque1Node(C, pre_limit, limit); register_new_node( pre_limit, pre_head->in(0) ); register_new_node( pre_opaq , pre_head->in(0) ); @@ -1116,19 +1116,19 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ BoolTest::mask new_test = (main_end->stride_con() > 0) ? BoolTest::lt : BoolTest::gt; // Modify pre loop end condition Node* pre_bol = pre_end->in(CountedLoopEndNode::TestValue)->as_Bool(); - BoolNode* new_bol0 = new (C) BoolNode(pre_bol->in(1), new_test); + BoolNode* new_bol0 = new BoolNode(pre_bol->in(1), new_test); register_new_node( new_bol0, pre_head->in(0) ); _igvn.hash_delete(pre_end); pre_end->set_req(CountedLoopEndNode::TestValue, new_bol0); // Modify main loop guard condition assert(min_iff->in(CountedLoopEndNode::TestValue) == min_bol, "guard okay"); - BoolNode* new_bol1 = new (C) BoolNode(min_bol->in(1), new_test); + BoolNode* new_bol1 = new BoolNode(min_bol->in(1), new_test); register_new_node( new_bol1, new_pre_exit ); _igvn.hash_delete(min_iff); min_iff->set_req(CountedLoopEndNode::TestValue, new_bol1); // Modify main loop end condition BoolNode* main_bol = main_end->in(CountedLoopEndNode::TestValue)->as_Bool(); - BoolNode* new_bol2 = new (C) BoolNode(main_bol->in(1), new_test); + BoolNode* new_bol2 = new BoolNode(main_bol->in(1), new_test); register_new_node( new_bol2, main_end->in(CountedLoopEndNode::TestControl) ); _igvn.hash_delete(main_end); main_end->set_req(CountedLoopEndNode::TestValue, new_bol2); @@ -1279,13 +1279,13 @@ void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool ad // zero trip guard limit will be different from loop limit. assert(has_ctrl(opaq), "should have it"); Node* opaq_ctrl = get_ctrl(opaq); - limit = new (C) Opaque2Node( C, limit ); + limit = new Opaque2Node( C, limit ); register_new_node( limit, opaq_ctrl ); } if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) || stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) { // No underflow. - new_limit = new (C) SubINode(limit, stride); + new_limit = new SubINode(limit, stride); } else { // (limit - stride) may underflow. // Clamp the adjustment value with MININT or MAXINT: @@ -1315,18 +1315,18 @@ void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool ad old_limit = bol->in(1)->in(1); // Adjust previous adjusted limit. adj_limit = limit->in(CMoveNode::IfFalse); - adj_limit = new (C) SubINode(adj_limit, stride); + adj_limit = new SubINode(adj_limit, stride); } else { old_limit = limit; - adj_limit = new (C) SubINode(limit, stride); + adj_limit = new SubINode(limit, stride); } assert(old_limit != NULL && adj_limit != NULL, ""); register_new_node( adj_limit, ctrl ); // adjust amount - Node* adj_cmp = new (C) CmpINode(old_limit, adj_limit); + Node* adj_cmp = new CmpINode(old_limit, adj_limit); register_new_node( adj_cmp, ctrl ); - Node* adj_bool = new (C) BoolNode(adj_cmp, bt); + Node* adj_bool = new BoolNode(adj_cmp, bt); register_new_node( adj_bool, ctrl ); - new_limit = new (C) CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT); + new_limit = new CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT); } register_new_node(new_limit, ctrl); } @@ -1388,24 +1388,24 @@ void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool ad // CountedLoop this is exact (stride divides limit-init exactly). // We are going to double the loop body, so we want to knock off any // odd iteration: (trip_cnt & ~1). Then back compute a new limit. - Node *span = new (C) SubINode( limit, init ); + Node *span = new SubINode( limit, init ); register_new_node( span, ctrl ); - Node *trip = new (C) DivINode( 0, span, stride ); + Node *trip = new DivINode( 0, span, stride ); register_new_node( trip, ctrl ); Node *mtwo = _igvn.intcon(-2); set_ctrl(mtwo, C->root()); - Node *rond = new (C) AndINode( trip, mtwo ); + Node *rond = new AndINode( trip, mtwo ); register_new_node( rond, ctrl ); - Node *spn2 = new (C) MulINode( rond, stride ); + Node *spn2 = new MulINode( rond, stride ); register_new_node( spn2, ctrl ); - new_limit = new (C) AddINode( spn2, init ); + new_limit = new AddINode( spn2, init ); register_new_node( new_limit, ctrl ); // Hammer in the new limit Node *ctrl2 = loop_end->in(0); - Node *cmp2 = new (C) CmpINode( loop_head->incr(), new_limit ); + Node *cmp2 = new CmpINode( loop_head->incr(), new_limit ); register_new_node( cmp2, ctrl2 ); - Node *bol2 = new (C) BoolNode( cmp2, loop_end->test_trip() ); + Node *bol2 = new BoolNode( cmp2, loop_end->test_trip() ); register_new_node( bol2, ctrl2 ); _igvn.hash_delete(loop_end); loop_end->set_req(CountedLoopEndNode::TestValue, bol2); @@ -1511,15 +1511,15 @@ bool IdealLoopTree::dominates_backedge(Node* ctrl) { // Helper function for add_constraint(). Node* PhaseIdealLoop::adjust_limit(int stride_con, Node * scale, Node *offset, Node *rc_limit, Node *loop_limit, Node *pre_ctrl) { // Compute "I :: (limit-offset)/scale" - Node *con = new (C) SubINode(rc_limit, offset); + Node *con = new SubINode(rc_limit, offset); register_new_node(con, pre_ctrl); - Node *X = new (C) DivINode(0, con, scale); + Node *X = new DivINode(0, con, scale); register_new_node(X, pre_ctrl); // Adjust loop limit loop_limit = (stride_con > 0) - ? (Node*)(new (C) MinINode(loop_limit, X)) - : (Node*)(new (C) MaxINode(loop_limit, X)); + ? (Node*)(new MinINode(loop_limit, X)) + : (Node*)(new MaxINode(loop_limit, X)); register_new_node(loop_limit, pre_ctrl); return loop_limit; } @@ -1580,9 +1580,9 @@ void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset // to avoid problem with scale == -1 (min_int/(-1) == min_int). Node* shift = _igvn.intcon(31); set_ctrl(shift, C->root()); - Node* sign = new (C) RShiftINode(offset, shift); + Node* sign = new RShiftINode(offset, shift); register_new_node(sign, pre_ctrl); - offset = new (C) AndINode(offset, sign); + offset = new AndINode(offset, sign); register_new_node(offset, pre_ctrl); } else { assert(low_limit->get_int() == 0, "wrong low limit for range check"); @@ -1615,7 +1615,7 @@ void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset Node *one = _igvn.intcon(1); set_ctrl(one, C->root()); - Node *plus_one = new (C) AddINode(offset, one); + Node *plus_one = new AddINode(offset, one); register_new_node( plus_one, pre_ctrl ); // Pass (-stride) to indicate pre_loop_cond = NOT(main_loop_cond); *pre_limit = adjust_limit((-stride_con), scale, plus_one, upper_limit, *pre_limit, pre_ctrl); @@ -1633,9 +1633,9 @@ void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset // to avoid problem with scale == -1 (min_int/(-1) == min_int). Node* shift = _igvn.intcon(31); set_ctrl(shift, C->root()); - Node* sign = new (C) RShiftINode(plus_one, shift); + Node* sign = new RShiftINode(plus_one, shift); register_new_node(sign, pre_ctrl); - plus_one = new (C) AndINode(plus_one, sign); + plus_one = new AndINode(plus_one, sign); register_new_node(plus_one, pre_ctrl); } else { assert(low_limit->get_int() == 0, "wrong low limit for range check"); @@ -1718,7 +1718,7 @@ bool PhaseIdealLoop::is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, p_offset != NULL ? &offset2 : NULL, depth+1)) { if (p_offset != NULL) { Node *ctrl_off2 = get_ctrl(offset2); - Node* offset = new (C) AddINode(offset2, exp->in(2)); + Node* offset = new AddINode(offset2, exp->in(2)); register_new_node(offset, ctrl_off2); *p_offset = offset; } @@ -1731,7 +1731,7 @@ bool PhaseIdealLoop::is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node *zero = _igvn.intcon(0); set_ctrl(zero, C->root()); Node *ctrl_off = get_ctrl(exp->in(2)); - Node* offset = new (C) SubINode(zero, exp->in(2)); + Node* offset = new SubINode(zero, exp->in(2)); register_new_node(offset, ctrl_off); *p_offset = offset; } @@ -1934,15 +1934,15 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) { case BoolTest::ge: // Convert (I*scale+offset) >= Limit to (I*(-scale)+(-offset)) <= -Limit scale_con = -scale_con; - offset = new (C) SubINode( zero, offset ); + offset = new SubINode( zero, offset ); register_new_node( offset, pre_ctrl ); - limit = new (C) SubINode( zero, limit ); + limit = new SubINode( zero, limit ); register_new_node( limit, pre_ctrl ); // Fall into LE case case BoolTest::le: if (b_test._test != BoolTest::gt) { // Convert X <= Y to X < Y+1 - limit = new (C) AddINode( limit, one ); + limit = new AddINode( limit, one ); register_new_node( limit, pre_ctrl ); } // Fall into LT case @@ -1993,8 +1993,8 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) { // Update loop limits if (conditional_rc) { - pre_limit = (stride_con > 0) ? (Node*)new (C) MinINode(pre_limit, orig_limit) - : (Node*)new (C) MaxINode(pre_limit, orig_limit); + pre_limit = (stride_con > 0) ? (Node*)new MinINode(pre_limit, orig_limit) + : (Node*)new MaxINode(pre_limit, orig_limit); register_new_node(pre_limit, pre_ctrl); } _igvn.hash_delete(pre_opaq); @@ -2009,16 +2009,16 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) { Node *ctrl = get_ctrl(main_limit); Node *stride = cl->stride(); Node *init = cl->init_trip(); - Node *span = new (C) SubINode(main_limit,init); + Node *span = new SubINode(main_limit,init); register_new_node(span,ctrl); Node *rndup = _igvn.intcon(stride_con + ((stride_con>0)?-1:1)); - Node *add = new (C) AddINode(span,rndup); + Node *add = new AddINode(span,rndup); register_new_node(add,ctrl); - Node *div = new (C) DivINode(0,add,stride); + Node *div = new DivINode(0,add,stride); register_new_node(div,ctrl); - Node *mul = new (C) MulINode(div,stride); + Node *mul = new MulINode(div,stride); register_new_node(mul,ctrl); - Node *newlim = new (C) AddINode(mul,init); + Node *newlim = new AddINode(mul,init); register_new_node(newlim,ctrl); main_limit = newlim; } @@ -2189,7 +2189,7 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) { } // Note: the final value after increment should not overflow since // counted loop has limit check predicate. - Node *final = new (phase->C) SubINode( exact_limit, cl->stride() ); + Node *final = new SubINode( exact_limit, cl->stride() ); phase->register_new_node(final,cl->in(LoopNode::EntryControl)); phase->_igvn.replace_node(phi,final); phase->C->set_major_progress(); @@ -2676,20 +2676,20 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) { // Build an expression for the beginning of the copy region Node* index = head->init_trip(); #ifdef _LP64 - index = new (C) ConvI2LNode(index); + index = new ConvI2LNode(index); _igvn.register_new_node_with_optimizer(index); #endif if (shift != NULL) { // byte arrays don't require a shift but others do. - index = new (C) LShiftXNode(index, shift->in(2)); + index = new LShiftXNode(index, shift->in(2)); _igvn.register_new_node_with_optimizer(index); } - index = new (C) AddPNode(base, base, index); + index = new AddPNode(base, base, index); _igvn.register_new_node_with_optimizer(index); - Node* from = new (C) AddPNode(base, index, offset); + Node* from = new AddPNode(base, index, offset); _igvn.register_new_node_with_optimizer(from); // Compute the number of elements to copy - Node* len = new (C) SubINode(head->limit(), head->init_trip()); + Node* len = new SubINode(head->limit(), head->init_trip()); _igvn.register_new_node_with_optimizer(len); BasicType t = store->as_Mem()->memory_type(); @@ -2706,17 +2706,17 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) { // Convert float/double to int/long for fill routines if (t == T_FLOAT) { - store_value = new (C) MoveF2INode(store_value); + store_value = new MoveF2INode(store_value); _igvn.register_new_node_with_optimizer(store_value); } else if (t == T_DOUBLE) { - store_value = new (C) MoveD2LNode(store_value); + store_value = new MoveD2LNode(store_value); _igvn.register_new_node_with_optimizer(store_value); } if (CCallingConventionRequiresIntsAsLongs && // See StubRoutines::select_fill_function for types. FLOAT has been converted to INT. (t == T_FLOAT || t == T_INT || is_subword_type(t))) { - store_value = new (C) ConvI2LNode(store_value); + store_value = new ConvI2LNode(store_value); _igvn.register_new_node_with_optimizer(store_value); } @@ -2724,8 +2724,8 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) { Node* result_ctrl; Node* result_mem; const TypeFunc* call_type = OptoRuntime::array_fill_Type(); - CallLeafNode *call = new (C) CallLeafNoFPNode(call_type, fill, - fill_name, TypeAryPtr::get_array_body_type(t)); + CallLeafNode *call = new CallLeafNoFPNode(call_type, fill, + fill_name, TypeAryPtr::get_array_body_type(t)); uint cnt = 0; call->init_req(TypeFunc::Parms + cnt++, from); call->init_req(TypeFunc::Parms + cnt++, store_value); @@ -2733,7 +2733,7 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) { call->init_req(TypeFunc::Parms + cnt++, C->top()); } #ifdef _LP64 - len = new (C) ConvI2LNode(len); + len = new ConvI2LNode(len); _igvn.register_new_node_with_optimizer(len); #endif call->init_req(TypeFunc::Parms + cnt++, len); @@ -2746,9 +2746,9 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) { call->init_req(TypeFunc::ReturnAdr, C->start()->proj_out(TypeFunc::ReturnAdr)); call->init_req(TypeFunc::FramePtr, C->start()->proj_out(TypeFunc::FramePtr)); _igvn.register_new_node_with_optimizer(call); - result_ctrl = new (C) ProjNode(call,TypeFunc::Control); + result_ctrl = new ProjNode(call,TypeFunc::Control); _igvn.register_new_node_with_optimizer(result_ctrl); - result_mem = new (C) ProjNode(call,TypeFunc::Memory); + result_mem = new ProjNode(call,TypeFunc::Memory); _igvn.register_new_node_with_optimizer(result_mem); /* Disable following optimization until proper fix (add missing checks). diff --git a/hotspot/src/share/vm/opto/loopUnswitch.cpp b/hotspot/src/share/vm/opto/loopUnswitch.cpp index 06e17664efe..43f2008f2aa 100644 --- a/hotspot/src/share/vm/opto/loopUnswitch.cpp +++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp @@ -225,15 +225,15 @@ ProjNode* PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree *loop, Node *cont = _igvn.intcon(1); set_ctrl(cont, C->root()); - Node* opq = new (C) Opaque1Node(C, cont); + Node* opq = new Opaque1Node(C, cont); register_node(opq, outer_loop, entry, dom_depth(entry)); - Node *bol = new (C) Conv2BNode(opq); + Node *bol = new Conv2BNode(opq); register_node(bol, outer_loop, entry, dom_depth(entry)); - IfNode* iff = new (C) IfNode(entry, bol, PROB_MAX, COUNT_UNKNOWN); + IfNode* iff = new IfNode(entry, bol, PROB_MAX, COUNT_UNKNOWN); register_node(iff, outer_loop, entry, dom_depth(entry)); - ProjNode* iffast = new (C) IfTrueNode(iff); + ProjNode* iffast = new IfTrueNode(iff); register_node(iffast, outer_loop, iff, dom_depth(iff)); - ProjNode* ifslow = new (C) IfFalseNode(iff); + ProjNode* ifslow = new IfFalseNode(iff); register_node(ifslow, outer_loop, iff, dom_depth(iff)); // Clone the loop body. The clone becomes the fast loop. The diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp index f11583a25b2..5ee44d084bd 100644 --- a/hotspot/src/share/vm/opto/loopnode.cpp +++ b/hotspot/src/share/vm/opto/loopnode.cpp @@ -443,7 +443,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { assert(x->Opcode() == Op_Loop, "regular loops only"); C->print_method(PHASE_BEFORE_CLOOPS, 3); - Node *hook = new (C) Node(6); + Node *hook = new Node(6); if (LoopLimitCheck) { @@ -506,11 +506,11 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { Node* bol; if (stride_con > 0) { - cmp_limit = new (C) CmpINode(limit, _igvn.intcon(max_jint - stride_m)); - bol = new (C) BoolNode(cmp_limit, BoolTest::le); + cmp_limit = new CmpINode(limit, _igvn.intcon(max_jint - stride_m)); + bol = new BoolNode(cmp_limit, BoolTest::le); } else { - cmp_limit = new (C) CmpINode(limit, _igvn.intcon(min_jint - stride_m)); - bol = new (C) BoolNode(cmp_limit, BoolTest::ge); + cmp_limit = new CmpINode(limit, _igvn.intcon(min_jint - stride_m)); + bol = new BoolNode(cmp_limit, BoolTest::ge); } cmp_limit = _igvn.register_new_node_with_optimizer(cmp_limit); bol = _igvn.register_new_node_with_optimizer(bol); @@ -547,7 +547,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { // is converted to // i = init; do {} while(++i < limit+1); // - limit = gvn->transform(new (C) AddINode(limit, stride)); + limit = gvn->transform(new AddINode(limit, stride)); } // Now we need to canonicalize loop condition. @@ -566,7 +566,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { // we can convert 'i <= limit' to 'i < limit+1' since stride != 0. // Node* one = (stride_con > 0) ? gvn->intcon( 1) : gvn->intcon(-1); - limit = gvn->transform(new (C) AddINode(limit, one)); + limit = gvn->transform(new AddINode(limit, one)); if (bt == BoolTest::le) bt = BoolTest::lt; else if (bt == BoolTest::ge) @@ -582,7 +582,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { // can directly point to the phi; in this case adjust the compare so that // it points to the incr by adjusting the limit. if (cmp->in(1) == phi || cmp->in(2) == phi) - limit = gvn->transform(new (C) AddINode(limit,stride)); + limit = gvn->transform(new AddINode(limit,stride)); // trip-count for +-tive stride should be: (limit - init_trip + stride - 1)/stride. // Final value for iterator should be: trip_count * stride + init_trip. @@ -595,16 +595,16 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { ShouldNotReachHere(); case BoolTest::ne: // Ahh, the case we desire if (stride_con == 1) - trip_count = gvn->transform(new (C) SubINode(limit,init_trip)); + trip_count = gvn->transform(new SubINode(limit,init_trip)); else if (stride_con == -1) - trip_count = gvn->transform(new (C) SubINode(init_trip,limit)); + trip_count = gvn->transform(new SubINode(init_trip,limit)); else ShouldNotReachHere(); set_subtree_ctrl(trip_count); //_loop.map(trip_count->_idx,loop(limit)); break; case BoolTest::le: // Maybe convert to '<' case - limit = gvn->transform(new (C) AddINode(limit,one_p)); + limit = gvn->transform(new AddINode(limit,one_p)); set_subtree_ctrl( limit ); hook->init_req(4, limit); @@ -615,26 +615,26 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { case BoolTest::lt: { // Maybe convert to '!=' case if (stride_con < 0) // Count down loop rolls through MAXINT ShouldNotReachHere(); - Node *range = gvn->transform(new (C) SubINode(limit,init_trip)); + Node *range = gvn->transform(new SubINode(limit,init_trip)); set_subtree_ctrl( range ); hook->init_req(0, range); - Node *bias = gvn->transform(new (C) AddINode(range,stride)); + Node *bias = gvn->transform(new AddINode(range,stride)); set_subtree_ctrl( bias ); hook->init_req(1, bias); - Node *bias1 = gvn->transform(new (C) AddINode(bias,one_m)); + Node *bias1 = gvn->transform(new AddINode(bias,one_m)); set_subtree_ctrl( bias1 ); hook->init_req(2, bias1); - trip_count = gvn->transform(new (C) DivINode(0,bias1,stride)); + trip_count = gvn->transform(new DivINode(0,bias1,stride)); set_subtree_ctrl( trip_count ); hook->init_req(3, trip_count); break; } case BoolTest::ge: // Maybe convert to '>' case - limit = gvn->transform(new (C) AddINode(limit,one_m)); + limit = gvn->transform(new AddINode(limit,one_m)); set_subtree_ctrl( limit ); hook->init_req(4 ,limit); @@ -645,30 +645,30 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { case BoolTest::gt: { // Maybe convert to '!=' case if (stride_con > 0) // count up loop rolls through MININT ShouldNotReachHere(); - Node *range = gvn->transform(new (C) SubINode(limit,init_trip)); + Node *range = gvn->transform(new SubINode(limit,init_trip)); set_subtree_ctrl( range ); hook->init_req(0, range); - Node *bias = gvn->transform(new (C) AddINode(range,stride)); + Node *bias = gvn->transform(new AddINode(range,stride)); set_subtree_ctrl( bias ); hook->init_req(1, bias); - Node *bias1 = gvn->transform(new (C) AddINode(bias,one_p)); + Node *bias1 = gvn->transform(new AddINode(bias,one_p)); set_subtree_ctrl( bias1 ); hook->init_req(2, bias1); - trip_count = gvn->transform(new (C) DivINode(0,bias1,stride)); + trip_count = gvn->transform(new DivINode(0,bias1,stride)); set_subtree_ctrl( trip_count ); hook->init_req(3, trip_count); break; } } // switch( bt ) - Node *span = gvn->transform(new (C) MulINode(trip_count,stride)); + Node *span = gvn->transform(new MulINode(trip_count,stride)); set_subtree_ctrl( span ); hook->init_req(5, span); - limit = gvn->transform(new (C) AddINode(span,init_trip)); + limit = gvn->transform(new AddINode(span,init_trip)); set_subtree_ctrl( limit ); } // LoopLimitCheck @@ -717,7 +717,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { set_ctrl(test, iff->in(0)); // Replace the old IfNode with a new LoopEndNode - Node *lex = _igvn.register_new_node_with_optimizer(new (C) CountedLoopEndNode( iff->in(0), test, cl_prob, iff->as_If()->_fcnt )); + Node *lex = _igvn.register_new_node_with_optimizer(new CountedLoopEndNode( iff->in(0), test, cl_prob, iff->as_If()->_fcnt )); IfNode *le = lex->as_If(); uint dd = dom_depth(iff); set_idom(le, le->in(0), dd); // Update dominance for loop exit @@ -728,8 +728,8 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { // Need to swap loop-exit and loop-back control? if (iftrue_op == Op_IfFalse) { - Node *ift2=_igvn.register_new_node_with_optimizer(new (C) IfTrueNode (le)); - Node *iff2=_igvn.register_new_node_with_optimizer(new (C) IfFalseNode(le)); + Node *ift2=_igvn.register_new_node_with_optimizer(new IfTrueNode (le)); + Node *iff2=_igvn.register_new_node_with_optimizer(new IfFalseNode(le)); loop->_tail = back_control = ift2; set_loop(ift2, loop); @@ -755,7 +755,7 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { lazy_replace( iff, le ); // fix 'get_ctrl' // Now setup a new CountedLoopNode to replace the existing LoopNode - CountedLoopNode *l = new (C) CountedLoopNode(init_control, back_control); + CountedLoopNode *l = new CountedLoopNode(init_control, back_control); l->set_unswitch_count(x->as_Loop()->unswitch_count()); // Preserve // The following assert is approximately true, and defines the intention // of can_be_counted_loop. It fails, however, because phase->type @@ -829,7 +829,7 @@ Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) { limit = _igvn.intcon(final_int); } else { // Create new LoopLimit node to get exact limit (final iv value). - limit = new (C) LoopLimitNode(C, cl->init_trip(), cl->limit(), cl->stride()); + limit = new LoopLimitNode(C, cl->init_trip(), cl->limit(), cl->stride()); register_new_node(limit, cl->in(LoopNode::EntryControl)); } assert(limit != NULL, "sanity"); @@ -946,11 +946,11 @@ Node *LoopLimitNode::Ideal(PhaseGVN *phase, bool can_reshape) { if (range <= max) { // Convert to integer expression if it is not overflow. Node* stride_m = phase->intcon(stride_con - (stride_con > 0 ? 1 : -1)); - Node *range = phase->transform(new (phase->C) SubINode(in(Limit), in(Init))); - Node *bias = phase->transform(new (phase->C) AddINode(range, stride_m)); - Node *trip = phase->transform(new (phase->C) DivINode(0, bias, in(Stride))); - Node *span = phase->transform(new (phase->C) MulINode(trip, in(Stride))); - return new (phase->C) AddINode(span, in(Init)); // exact limit + Node *range = phase->transform(new SubINode(in(Limit), in(Init))); + Node *bias = phase->transform(new AddINode(range, stride_m)); + Node *trip = phase->transform(new DivINode(0, bias, in(Stride))); + Node *span = phase->transform(new MulINode(trip, in(Stride))); + return new AddINode(span, in(Init)); // exact limit } if (is_power_of_2(stride_p) || // divisor is 2^n @@ -958,13 +958,13 @@ Node *LoopLimitNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Convert to long expression to avoid integer overflow // and let igvn optimizer convert this division. // - Node* init = phase->transform( new (phase->C) ConvI2LNode(in(Init))); - Node* limit = phase->transform( new (phase->C) ConvI2LNode(in(Limit))); + Node* init = phase->transform( new ConvI2LNode(in(Init))); + Node* limit = phase->transform( new ConvI2LNode(in(Limit))); Node* stride = phase->longcon(stride_con); Node* stride_m = phase->longcon(stride_con - (stride_con > 0 ? 1 : -1)); - Node *range = phase->transform(new (phase->C) SubLNode(limit, init)); - Node *bias = phase->transform(new (phase->C) AddLNode(range, stride_m)); + Node *range = phase->transform(new SubLNode(limit, init)); + Node *bias = phase->transform(new AddLNode(range, stride_m)); Node *span; if (stride_con > 0 && is_power_of_2(stride_p)) { // bias >= 0 if stride >0, so if stride is 2^n we can use &(-stride) @@ -975,14 +975,14 @@ Node *LoopLimitNode::Ideal(PhaseGVN *phase, bool can_reshape) { // only RCE predicate where exact limit is used and the predicate // will simply fail forcing recompilation. Node* neg_stride = phase->longcon(-stride_con); - span = phase->transform(new (phase->C) AndLNode(bias, neg_stride)); + span = phase->transform(new AndLNode(bias, neg_stride)); } else { - Node *trip = phase->transform(new (phase->C) DivLNode(0, bias, stride)); - span = phase->transform(new (phase->C) MulLNode(trip, stride)); + Node *trip = phase->transform(new DivLNode(0, bias, stride)); + span = phase->transform(new MulLNode(trip, stride)); } // Convert back to int - Node *span_int = phase->transform(new (phase->C) ConvL2INode(span)); - return new (phase->C) AddINode(span_int, in(Init)); // exact limit + Node *span_int = phase->transform(new ConvL2INode(span)); + return new AddINode(span_int, in(Init)); // exact limit } return NULL; // No progress @@ -1188,7 +1188,7 @@ void IdealLoopTree::split_fall_in( PhaseIdealLoop *phase, int fall_in_cnt ) { uint i; // Make a new RegionNode to be the landing pad. - Node *landing_pad = new (phase->C) RegionNode( fall_in_cnt+1 ); + Node *landing_pad = new RegionNode( fall_in_cnt+1 ); phase->set_loop(landing_pad,_parent); // Gather all the fall-in control paths into the landing pad uint icnt = fall_in_cnt; @@ -1274,7 +1274,7 @@ void IdealLoopTree::split_outer_loop( PhaseIdealLoop *phase ) { // Make a LoopNode for the outermost loop. Node *ctl = _head->in(LoopNode::EntryControl); - Node *outer = new (phase->C) LoopNode( ctl, _head->in(outer_idx) ); + Node *outer = new LoopNode( ctl, _head->in(outer_idx) ); outer = igvn.register_new_node_with_optimizer(outer, _head); phase->set_created_loop_node(); @@ -1388,7 +1388,7 @@ void IdealLoopTree::merge_many_backedges( PhaseIdealLoop *phase ) { Node *hot_tail = NULL; // Make a Region for the merge point - Node *r = new (phase->C) RegionNode(1); + Node *r = new RegionNode(1); for( i = 2; i < _head->req(); i++ ) { if( i != hot_idx ) r->add_req( _head->in(i) ); @@ -1407,7 +1407,7 @@ void IdealLoopTree::merge_many_backedges( PhaseIdealLoop *phase ) { PhiNode* n = out->as_Phi(); igvn.hash_delete(n); // Delete from hash before hacking edges Node *hot_phi = NULL; - Node *phi = new (phase->C) PhiNode(r, n->type(), n->adr_type()); + Node *phi = new PhiNode(r, n->type(), n->adr_type()); // Check all inputs for the ones to peel out uint j = 1; for( uint i = 2; i < n->req(); i++ ) { @@ -1529,7 +1529,7 @@ bool IdealLoopTree::beautify_loops( PhaseIdealLoop *phase ) { } else if (!_head->is_Loop() && !_irreducible) { // Make a new LoopNode to replace the old loop head - Node *l = new (phase->C) LoopNode( _head->in(1), _head->in(2) ); + Node *l = new LoopNode( _head->in(1), _head->in(2) ); l = igvn.register_new_node_with_optimizer(l, _head); phase->set_created_loop_node(); // Go ahead and replace _head @@ -1771,16 +1771,16 @@ void PhaseIdealLoop::replace_parallel_iv(IdealLoopTree *loop) { // It is scaled by the 'ratio_con'. Node* ratio = _igvn.intcon(ratio_con); set_ctrl(ratio, C->root()); - Node* ratio_init = new (C) MulINode(init, ratio); + Node* ratio_init = new MulINode(init, ratio); _igvn.register_new_node_with_optimizer(ratio_init, init); set_early_ctrl(ratio_init); - Node* diff = new (C) SubINode(init2, ratio_init); + Node* diff = new SubINode(init2, ratio_init); _igvn.register_new_node_with_optimizer(diff, init2); set_early_ctrl(diff); - Node* ratio_idx = new (C) MulINode(phi, ratio); + Node* ratio_idx = new MulINode(phi, ratio); _igvn.register_new_node_with_optimizer(ratio_idx, phi); set_ctrl(ratio_idx, cl); - Node* add = new (C) AddINode(ratio_idx, diff); + Node* add = new AddINode(ratio_idx, diff); _igvn.register_new_node_with_optimizer(add); set_ctrl(add, cl); _igvn.replace_node( phi2, add ); @@ -2888,10 +2888,10 @@ int PhaseIdealLoop::build_loop_tree_impl( Node *n, int pre_order ) { if (!_verify_only) { // Insert the NeverBranch between 'm' and it's control user. - NeverBranchNode *iff = new (C) NeverBranchNode( m ); + NeverBranchNode *iff = new NeverBranchNode( m ); _igvn.register_new_node_with_optimizer(iff); set_loop(iff, l); - Node *if_t = new (C) CProjNode( iff, 0 ); + Node *if_t = new CProjNode( iff, 0 ); _igvn.register_new_node_with_optimizer(if_t); set_loop(if_t, l); @@ -2907,16 +2907,16 @@ int PhaseIdealLoop::build_loop_tree_impl( Node *n, int pre_order ) { cfg->set_req( k, if_t ); // Now point to NeverBranch // Now create the never-taken loop exit - Node *if_f = new (C) CProjNode( iff, 1 ); + Node *if_f = new CProjNode( iff, 1 ); _igvn.register_new_node_with_optimizer(if_f); set_loop(if_f, l); // Find frame ptr for Halt. Relies on the optimizer // V-N'ing. Easier and quicker than searching through // the program structure. - Node *frame = new (C) ParmNode( C->start(), TypeFunc::FramePtr ); + Node *frame = new ParmNode( C->start(), TypeFunc::FramePtr ); _igvn.register_new_node_with_optimizer(frame); // Halt & Catch Fire - Node *halt = new (C) HaltNode( if_f, frame ); + Node *halt = new HaltNode( if_f, frame ); _igvn.register_new_node_with_optimizer(halt); set_loop(halt, l); C->root()->add_req(halt); diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp index 67a6d703cc0..7b722674391 100644 --- a/hotspot/src/share/vm/opto/loopopts.cpp +++ b/hotspot/src/share/vm/opto/loopopts.cpp @@ -56,7 +56,7 @@ Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *region, int policy ) { int iid = t_oop->instance_id(); int index = C->get_alias_index(t_oop); int offset = t_oop->offset(); - phi = new (C) PhiNode(region, type, NULL, iid, index, offset); + phi = new PhiNode(region, type, NULL, iid, index, offset); } else { phi = PhiNode::make_blank(region, n); } @@ -363,9 +363,9 @@ Node *PhaseIdealLoop::remix_address_expressions( Node *n ) { _igvn.type( add->in(1) ) != TypeInt::ZERO ) { Node *zero = _igvn.intcon(0); set_ctrl(zero, C->root()); - Node *neg = new (C) SubINode( _igvn.intcon(0), add->in(2) ); + Node *neg = new SubINode( _igvn.intcon(0), add->in(2) ); register_new_node( neg, get_ctrl(add->in(2) ) ); - add = new (C) AddINode( add->in(1), neg ); + add = new AddINode( add->in(1), neg ); register_new_node( add, add_ctrl ); } if( add->Opcode() != Op_AddI ) return NULL; @@ -391,14 +391,14 @@ Node *PhaseIdealLoop::remix_address_expressions( Node *n ) { return NULL; // No invariant part of the add? // Yes! Reshape address expression! - Node *inv_scale = new (C) LShiftINode( add_invar, scale ); + Node *inv_scale = new LShiftINode( add_invar, scale ); Node *inv_scale_ctrl = dom_depth(add_invar_ctrl) > dom_depth(scale_ctrl) ? add_invar_ctrl : scale_ctrl; register_new_node( inv_scale, inv_scale_ctrl ); - Node *var_scale = new (C) LShiftINode( add_var, scale ); + Node *var_scale = new LShiftINode( add_var, scale ); register_new_node( var_scale, n_ctrl ); - Node *var_add = new (C) AddINode( var_scale, inv_scale ); + Node *var_add = new AddINode( var_scale, inv_scale ); register_new_node( var_add, n_ctrl ); _igvn.replace_node( n, var_add ); return var_add; @@ -430,10 +430,10 @@ Node *PhaseIdealLoop::remix_address_expressions( Node *n ) { IdealLoopTree *n23_loop = get_loop( n23_ctrl ); if( n22loop != n_loop && n22loop->is_member(n_loop) && n23_loop == n_loop ) { - Node *add1 = new (C) AddPNode( n->in(1), n->in(2)->in(2), n->in(3) ); + Node *add1 = new AddPNode( n->in(1), n->in(2)->in(2), n->in(3) ); // Stuff new AddP in the loop preheader register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) ); - Node *add2 = new (C) AddPNode( n->in(1), add1, n->in(2)->in(3) ); + Node *add2 = new AddPNode( n->in(1), add1, n->in(2)->in(3) ); register_new_node( add2, n_ctrl ); _igvn.replace_node( n, add2 ); return add2; @@ -451,10 +451,10 @@ Node *PhaseIdealLoop::remix_address_expressions( Node *n ) { Node *tmp = V; V = I; I = tmp; } if( !is_member(n_loop,get_ctrl(I)) ) { - Node *add1 = new (C) AddPNode( n->in(1), n->in(2), I ); + Node *add1 = new AddPNode( n->in(1), n->in(2), I ); // Stuff new AddP in the loop preheader register_new_node( add1, n_loop->_head->in(LoopNode::EntryControl) ); - Node *add2 = new (C) AddPNode( n->in(1), add1, V ); + Node *add2 = new AddPNode( n->in(1), add1, V ); register_new_node( add2, n_ctrl ); _igvn.replace_node( n, add2 ); return add2; @@ -1104,8 +1104,8 @@ BoolNode *PhaseIdealLoop::clone_iff( PhiNode *phi, IdealLoopTree *loop ) { Node *sample_cmp = sample_bool->in(1); // Make Phis to merge the Cmp's inputs. - PhiNode *phi1 = new (C) PhiNode( phi->in(0), Type::TOP ); - PhiNode *phi2 = new (C) PhiNode( phi->in(0), Type::TOP ); + PhiNode *phi1 = new PhiNode( phi->in(0), Type::TOP ); + PhiNode *phi2 = new PhiNode( phi->in(0), Type::TOP ); for( i = 1; i < phi->req(); i++ ) { Node *n1 = phi->in(i)->in(1)->in(1); Node *n2 = phi->in(i)->in(1)->in(2); @@ -1172,8 +1172,8 @@ CmpNode *PhaseIdealLoop::clone_bool( PhiNode *phi, IdealLoopTree *loop ) { Node *sample_cmp = phi->in(1); // Make Phis to merge the Cmp's inputs. - PhiNode *phi1 = new (C) PhiNode( phi->in(0), Type::TOP ); - PhiNode *phi2 = new (C) PhiNode( phi->in(0), Type::TOP ); + PhiNode *phi1 = new PhiNode( phi->in(0), Type::TOP ); + PhiNode *phi2 = new PhiNode( phi->in(0), Type::TOP ); for( uint j = 1; j < phi->req(); j++ ) { Node *cmp_top = phi->in(j); // Inputs are all Cmp or TOP Node *n1, *n2; @@ -1337,7 +1337,7 @@ void PhaseIdealLoop::clone_loop( IdealLoopTree *loop, Node_List &old_new, int dd // We need a Region to merge the exit from the peeled body and the // exit from the old loop body. - RegionNode *r = new (C) RegionNode(3); + RegionNode *r = new RegionNode(3); // Map the old use to the new merge point old_new.map( use->_idx, r ); uint dd_r = MIN2(dom_depth(newuse),dom_depth(use)); @@ -1684,13 +1684,13 @@ ProjNode* PhaseIdealLoop::insert_if_before_proj(Node* left, bool Signed, BoolTes ProjNode* proj2 = proj_clone(proj, iff); register_node(proj2, loop, iff, ddepth); - Node* cmp = Signed ? (Node*) new (C)CmpINode(left, right) : (Node*) new (C)CmpUNode(left, right); + Node* cmp = Signed ? (Node*) new CmpINode(left, right) : (Node*) new CmpUNode(left, right); register_node(cmp, loop, proj2, ddepth); - BoolNode* bol = new (C)BoolNode(cmp, relop); + BoolNode* bol = new BoolNode(cmp, relop); register_node(bol, loop, proj2, ddepth); - IfNode* new_if = new (C)IfNode(proj2, bol, iff->_prob, iff->_fcnt); + IfNode* new_if = new IfNode(proj2, bol, iff->_prob, iff->_fcnt); register_node(new_if, loop, proj2, ddepth); proj->set_req(0, new_if); // reattach @@ -1742,11 +1742,11 @@ RegionNode* PhaseIdealLoop::insert_region_before_proj(ProjNode* proj) { ProjNode* proj2 = proj_clone(proj, iff); register_node(proj2, loop, iff, ddepth); - RegionNode* reg = new (C)RegionNode(2); + RegionNode* reg = new RegionNode(2); reg->set_req(1, proj2); register_node(reg, loop, iff, ddepth); - IfNode* dum_if = new (C)IfNode(reg, short_circuit_if(NULL, proj), iff->_prob, iff->_fcnt); + IfNode* dum_if = new IfNode(reg, short_circuit_if(NULL, proj), iff->_prob, iff->_fcnt); register_node(dum_if, loop, reg, ddepth); proj->set_req(0, dum_if); // reattach @@ -2569,7 +2569,7 @@ bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) { // Create new loop head for new phis and to hang // the nodes being moved (sinked) from the peel region. - LoopNode* new_head = new (C) LoopNode(last_peel, last_peel); + LoopNode* new_head = new LoopNode(last_peel, last_peel); new_head->set_unswitch_count(head->unswitch_count()); // Preserve _igvn.register_new_node_with_optimizer(new_head); assert(first_not_peeled->in(0) == last_peel, "last_peel <- first_not_peeled"); @@ -2769,11 +2769,11 @@ void PhaseIdealLoop::reorg_offsets(IdealLoopTree *loop) { if (dom_lca(exit, u_ctrl) != exit) continue; // Hit! Refactor use to use the post-incremented tripcounter. // Compute a post-increment tripcounter. - Node *opaq = new (C) Opaque2Node( C, cle->incr() ); + Node *opaq = new Opaque2Node( C, cle->incr() ); register_new_node( opaq, u_ctrl ); Node *neg_stride = _igvn.intcon(-cle->stride_con()); set_ctrl(neg_stride, C->root()); - Node *post = new (C) AddINode( opaq, neg_stride); + Node *post = new AddINode( opaq, neg_stride); register_new_node( post, u_ctrl ); _igvn.rehash_node_delayed(use); for (uint j = 1; j < use->req(); j++) { diff --git a/hotspot/src/share/vm/opto/machnode.hpp b/hotspot/src/share/vm/opto/machnode.hpp index 8d42093ac31..1e2f22e9ef7 100644 --- a/hotspot/src/share/vm/opto/machnode.hpp +++ b/hotspot/src/share/vm/opto/machnode.hpp @@ -60,7 +60,10 @@ class State; class MachOper : public ResourceObj { public: // Allocate right next to the MachNodes in the same arena - void *operator new( size_t x, Compile* C ) throw() { return C->node_arena()->Amalloc_D(x); } + void *operator new(size_t x) throw() { + Compile* C = Compile::current(); + return C->node_arena()->Amalloc_D(x); + } // Opcode virtual uint opcode() const = 0; diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index afaa4e858d4..5b1f4397642 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -108,20 +108,20 @@ void PhaseMacroExpand::copy_call_debug_info(CallNode *oldcall, CallNode * newcal Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path) { Node* cmp; if (mask != 0) { - Node* and_node = transform_later(new (C) AndXNode(word, MakeConX(mask))); - cmp = transform_later(new (C) CmpXNode(and_node, MakeConX(bits))); + Node* and_node = transform_later(new AndXNode(word, MakeConX(mask))); + cmp = transform_later(new CmpXNode(and_node, MakeConX(bits))); } else { cmp = word; } - Node* bol = transform_later(new (C) BoolNode(cmp, BoolTest::ne)); - IfNode* iff = new (C) IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN ); + Node* bol = transform_later(new BoolNode(cmp, BoolTest::ne)); + IfNode* iff = new IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN ); transform_later(iff); // Fast path taken. - Node *fast_taken = transform_later( new (C) IfFalseNode(iff) ); + Node *fast_taken = transform_later(new IfFalseNode(iff)); // Fast path not-taken, i.e. slow path - Node *slow_taken = transform_later( new (C) IfTrueNode(iff) ); + Node *slow_taken = transform_later(new IfTrueNode(iff)); if (return_fast_path) { region->init_req(edge, slow_taken); // Capture slow-control @@ -147,8 +147,8 @@ CallNode* PhaseMacroExpand::make_slow_call(CallNode *oldcall, const TypeFunc* sl // Slow-path call CallNode *call = leaf_name - ? (CallNode*)new (C) CallLeafNode ( slow_call_type, slow_call, leaf_name, TypeRawPtr::BOTTOM ) - : (CallNode*)new (C) CallStaticJavaNode( slow_call_type, slow_call, OptoRuntime::stub_name(slow_call), oldcall->jvms()->bci(), TypeRawPtr::BOTTOM ); + ? (CallNode*)new CallLeafNode ( slow_call_type, slow_call, leaf_name, TypeRawPtr::BOTTOM ) + : (CallNode*)new CallStaticJavaNode( slow_call_type, slow_call, OptoRuntime::stub_name(slow_call), oldcall->jvms()->bci(), TypeRawPtr::BOTTOM ); // Slow path call has no side-effects, uses few values copy_predefined_input_for_runtime_call(slow_path, oldcall, call ); @@ -423,7 +423,7 @@ Node *PhaseMacroExpand::value_from_mem_phi(Node *mem, BasicType ft, const Type * GrowableArray values(length, length, NULL, false); // create a new Phi for the value - PhiNode *phi = new (C) PhiNode(mem->in(0), phi_type, NULL, instance_id, alias_idx, offset); + PhiNode *phi = new PhiNode(mem->in(0), phi_type, NULL, instance_id, alias_idx, offset); transform_later(phi); value_phis->push(phi, mem->_idx); @@ -735,7 +735,7 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray req() - sfpt->jvms()->scloff()); - SafePointScalarObjectNode* sobj = new (C) SafePointScalarObjectNode(res_type, + SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type, #ifdef ASSERT alloc, #endif @@ -843,7 +843,7 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray is_EncodeP()) { field_val = field_val->in(1); } else { - field_val = transform_later(new (C) DecodeNNode(field_val, field_val->get_ptr_type())); + field_val = transform_later(new DecodeNNode(field_val, field_val->get_ptr_type())); } } sfpt->add_req(field_val); @@ -1069,7 +1069,7 @@ bool PhaseMacroExpand::eliminate_boxing_node(CallStaticJavaNode *boxing) { //---------------------------set_eden_pointers------------------------- void PhaseMacroExpand::set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr) { if (UseTLAB) { // Private allocation: load from TLS - Node* thread = transform_later(new (C) ThreadLocalNode()); + Node* thread = transform_later(new ThreadLocalNode()); int tlab_top_offset = in_bytes(JavaThread::tlab_top_offset()); int tlab_end_offset = in_bytes(JavaThread::tlab_end_offset()); eden_top_adr = basic_plus_adr(top()/*not oop*/, thread, tlab_top_offset); @@ -1205,18 +1205,18 @@ void PhaseMacroExpand::expand_allocate_common( assert (initial_slow_test == NULL || !always_slow, "arguments must be consistent"); // generate the initial test if necessary if (initial_slow_test != NULL ) { - slow_region = new (C) RegionNode(3); + slow_region = new RegionNode(3); // Now make the initial failure test. Usually a too-big test but // might be a TRUE for finalizers or a fancy class check for // newInstance0. - IfNode *toobig_iff = new (C) IfNode(ctrl, initial_slow_test, PROB_MIN, COUNT_UNKNOWN); + IfNode *toobig_iff = new IfNode(ctrl, initial_slow_test, PROB_MIN, COUNT_UNKNOWN); transform_later(toobig_iff); // Plug the failing-too-big test into the slow-path region - Node *toobig_true = new (C) IfTrueNode( toobig_iff ); + Node *toobig_true = new IfTrueNode( toobig_iff ); transform_later(toobig_true); slow_region ->init_req( too_big_or_final_path, toobig_true ); - toobig_false = new (C) IfFalseNode( toobig_iff ); + toobig_false = new IfFalseNode( toobig_iff ); transform_later(toobig_false); } else { // No initial test, just fall into next case toobig_false = ctrl; @@ -1249,10 +1249,10 @@ void PhaseMacroExpand::expand_allocate_common( Node *eden_end = make_load(ctrl, mem, eden_end_adr, 0, TypeRawPtr::BOTTOM, T_ADDRESS); // allocate the Region and Phi nodes for the result - result_region = new (C) RegionNode(3); - result_phi_rawmem = new (C) PhiNode(result_region, Type::MEMORY, TypeRawPtr::BOTTOM); - result_phi_rawoop = new (C) PhiNode(result_region, TypeRawPtr::BOTTOM); - result_phi_i_o = new (C) PhiNode(result_region, Type::ABIO); // I/O is used for Prefetch + result_region = new RegionNode(3); + result_phi_rawmem = new PhiNode(result_region, Type::MEMORY, TypeRawPtr::BOTTOM); + result_phi_rawoop = new PhiNode(result_region, TypeRawPtr::BOTTOM); + result_phi_i_o = new PhiNode(result_region, Type::ABIO); // I/O is used for Prefetch // We need a Region for the loop-back contended case. enum { fall_in_path = 1, contended_loopback_path = 2 }; @@ -1262,8 +1262,8 @@ void PhaseMacroExpand::expand_allocate_common( contended_region = toobig_false; contended_phi_rawmem = mem; } else { - contended_region = new (C) RegionNode(3); - contended_phi_rawmem = new (C) PhiNode(contended_region, Type::MEMORY, TypeRawPtr::BOTTOM); + contended_region = new RegionNode(3); + contended_phi_rawmem = new PhiNode(contended_region, Type::MEMORY, TypeRawPtr::BOTTOM); // Now handle the passing-too-big test. We fall into the contended // loop-back merge point. contended_region ->init_req(fall_in_path, toobig_false); @@ -1275,23 +1275,23 @@ void PhaseMacroExpand::expand_allocate_common( // Load(-locked) the heap top. // See note above concerning the control input when using a TLAB Node *old_eden_top = UseTLAB - ? new (C) LoadPNode (ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered) - : new (C) LoadPLockedNode(contended_region, contended_phi_rawmem, eden_top_adr, MemNode::acquire); + ? new LoadPNode (ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered) + : new LoadPLockedNode(contended_region, contended_phi_rawmem, eden_top_adr, MemNode::acquire); transform_later(old_eden_top); // Add to heap top to get a new heap top - Node *new_eden_top = new (C) AddPNode(top(), old_eden_top, size_in_bytes); + Node *new_eden_top = new AddPNode(top(), old_eden_top, size_in_bytes); transform_later(new_eden_top); // Check for needing a GC; compare against heap end - Node *needgc_cmp = new (C) CmpPNode(new_eden_top, eden_end); + Node *needgc_cmp = new CmpPNode(new_eden_top, eden_end); transform_later(needgc_cmp); - Node *needgc_bol = new (C) BoolNode(needgc_cmp, BoolTest::ge); + Node *needgc_bol = new BoolNode(needgc_cmp, BoolTest::ge); transform_later(needgc_bol); - IfNode *needgc_iff = new (C) IfNode(contended_region, needgc_bol, PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN); + IfNode *needgc_iff = new IfNode(contended_region, needgc_bol, PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN); transform_later(needgc_iff); // Plug the failing-heap-space-need-gc test into the slow-path region - Node *needgc_true = new (C) IfTrueNode(needgc_iff); + Node *needgc_true = new IfTrueNode(needgc_iff); transform_later(needgc_true); if (initial_slow_test) { slow_region->init_req(need_gc_path, needgc_true); @@ -1302,7 +1302,7 @@ void PhaseMacroExpand::expand_allocate_common( slow_region = needgc_true; } // No need for a GC. Setup for the Store-Conditional - Node *needgc_false = new (C) IfFalseNode(needgc_iff); + Node *needgc_false = new IfFalseNode(needgc_iff); transform_later(needgc_false); // Grab regular I/O before optional prefetch may change it. @@ -1322,37 +1322,37 @@ void PhaseMacroExpand::expand_allocate_common( // memory state. if (UseTLAB) { Node* store_eden_top = - new (C) StorePNode(needgc_false, contended_phi_rawmem, eden_top_adr, + new StorePNode(needgc_false, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, new_eden_top, MemNode::unordered); transform_later(store_eden_top); fast_oop_ctrl = needgc_false; // No contention, so this is the fast path fast_oop_rawmem = store_eden_top; } else { Node* store_eden_top = - new (C) StorePConditionalNode(needgc_false, contended_phi_rawmem, eden_top_adr, + new StorePConditionalNode(needgc_false, contended_phi_rawmem, eden_top_adr, new_eden_top, fast_oop/*old_eden_top*/); transform_later(store_eden_top); - Node *contention_check = new (C) BoolNode(store_eden_top, BoolTest::ne); + Node *contention_check = new BoolNode(store_eden_top, BoolTest::ne); transform_later(contention_check); - store_eden_top = new (C) SCMemProjNode(store_eden_top); + store_eden_top = new SCMemProjNode(store_eden_top); transform_later(store_eden_top); // If not using TLABs, check to see if there was contention. - IfNode *contention_iff = new (C) IfNode (needgc_false, contention_check, PROB_MIN, COUNT_UNKNOWN); + IfNode *contention_iff = new IfNode (needgc_false, contention_check, PROB_MIN, COUNT_UNKNOWN); transform_later(contention_iff); - Node *contention_true = new (C) IfTrueNode(contention_iff); + Node *contention_true = new IfTrueNode(contention_iff); transform_later(contention_true); // If contention, loopback and try again. contended_region->init_req(contended_loopback_path, contention_true); contended_phi_rawmem->init_req(contended_loopback_path, store_eden_top); // Fast-path succeeded with no contention! - Node *contention_false = new (C) IfFalseNode(contention_iff); + Node *contention_false = new IfFalseNode(contention_iff); transform_later(contention_false); fast_oop_ctrl = contention_false; // Bump total allocated bytes for this thread - Node* thread = new (C) ThreadLocalNode(); + Node* thread = new ThreadLocalNode(); transform_later(thread); Node* alloc_bytes_adr = basic_plus_adr(top()/*not oop*/, thread, in_bytes(JavaThread::allocated_bytes_offset())); @@ -1361,10 +1361,10 @@ void PhaseMacroExpand::expand_allocate_common( #ifdef _LP64 Node* alloc_size = size_in_bytes; #else - Node* alloc_size = new (C) ConvI2LNode(size_in_bytes); + Node* alloc_size = new ConvI2LNode(size_in_bytes); transform_later(alloc_size); #endif - Node* new_alloc_bytes = new (C) AddLNode(alloc_bytes, alloc_size); + Node* new_alloc_bytes = new AddLNode(alloc_bytes, alloc_size); transform_later(new_alloc_bytes); fast_oop_rawmem = make_store(fast_oop_ctrl, store_eden_top, alloc_bytes_adr, 0, new_alloc_bytes, T_LONG); @@ -1391,9 +1391,9 @@ void PhaseMacroExpand::expand_allocate_common( mb->init_req(TypeFunc::Memory, fast_oop_rawmem); mb->init_req(TypeFunc::Control, fast_oop_ctrl); - fast_oop_ctrl = new (C) ProjNode(mb,TypeFunc::Control); + fast_oop_ctrl = new ProjNode(mb,TypeFunc::Control); transform_later(fast_oop_ctrl); - fast_oop_rawmem = new (C) ProjNode(mb,TypeFunc::Memory); + fast_oop_rawmem = new ProjNode(mb,TypeFunc::Memory); transform_later(fast_oop_rawmem); } else { // Add the MemBarStoreStore after the InitializeNode so that @@ -1407,9 +1407,9 @@ void PhaseMacroExpand::expand_allocate_common( MemBarNode* mb = MemBarNode::make(C, Op_MemBarStoreStore, Compile::AliasIdxBot); transform_later(mb); - Node* ctrl = new (C) ProjNode(init,TypeFunc::Control); + Node* ctrl = new ProjNode(init,TypeFunc::Control); transform_later(ctrl); - Node* mem = new (C) ProjNode(init,TypeFunc::Memory); + Node* mem = new ProjNode(init,TypeFunc::Memory); transform_later(mem); // The MemBarStoreStore depends on control and memory coming @@ -1417,9 +1417,9 @@ void PhaseMacroExpand::expand_allocate_common( mb->init_req(TypeFunc::Memory, mem); mb->init_req(TypeFunc::Control, ctrl); - ctrl = new (C) ProjNode(mb,TypeFunc::Control); + ctrl = new ProjNode(mb,TypeFunc::Control); transform_later(ctrl); - mem = new (C) ProjNode(mb,TypeFunc::Memory); + mem = new ProjNode(mb,TypeFunc::Memory); transform_later(mem); // All nodes that depended on the InitializeNode for control @@ -1433,13 +1433,13 @@ void PhaseMacroExpand::expand_allocate_common( if (C->env()->dtrace_extended_probes()) { // Slow-path call int size = TypeFunc::Parms + 2; - CallLeafNode *call = new (C) CallLeafNode(OptoRuntime::dtrace_object_alloc_Type(), - CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc_base), - "dtrace_object_alloc", - TypeRawPtr::BOTTOM); + CallLeafNode *call = new CallLeafNode(OptoRuntime::dtrace_object_alloc_Type(), + CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc_base), + "dtrace_object_alloc", + TypeRawPtr::BOTTOM); // Get base of thread-local storage area - Node* thread = new (C) ThreadLocalNode(); + Node* thread = new ThreadLocalNode(); transform_later(thread); call->init_req(TypeFunc::Parms+0, thread); @@ -1450,9 +1450,9 @@ void PhaseMacroExpand::expand_allocate_common( call->init_req(TypeFunc::ReturnAdr, alloc->in(TypeFunc::ReturnAdr)); call->init_req(TypeFunc::FramePtr, alloc->in(TypeFunc::FramePtr)); transform_later(call); - fast_oop_ctrl = new (C) ProjNode(call,TypeFunc::Control); + fast_oop_ctrl = new ProjNode(call,TypeFunc::Control); transform_later(fast_oop_ctrl); - fast_oop_rawmem = new (C) ProjNode(call,TypeFunc::Memory); + fast_oop_rawmem = new ProjNode(call,TypeFunc::Memory); transform_later(fast_oop_rawmem); } @@ -1467,7 +1467,7 @@ void PhaseMacroExpand::expand_allocate_common( } // Generate slow-path call - CallNode *call = new (C) CallStaticJavaNode(slow_call_type, slow_call_address, + CallNode *call = new CallStaticJavaNode(slow_call_type, slow_call_address, OptoRuntime::stub_name(slow_call_address), alloc->jvms()->bci(), TypePtr::BOTTOM); @@ -1524,7 +1524,7 @@ void PhaseMacroExpand::expand_allocate_common( // _memproj_catchall so we end up with a call that has only 1 memory projection. if (_memproj_catchall != NULL ) { if (_memproj_fallthrough == NULL) { - _memproj_fallthrough = new (C) ProjNode(call, TypeFunc::Memory); + _memproj_fallthrough = new ProjNode(call, TypeFunc::Memory); transform_later(_memproj_fallthrough); } for (DUIterator_Fast imax, i = _memproj_catchall->fast_outs(imax); i < imax; i++) { @@ -1556,7 +1556,7 @@ void PhaseMacroExpand::expand_allocate_common( // _ioproj_catchall so we end up with a call that has only 1 i_o projection. if (_ioproj_catchall != NULL ) { if (_ioproj_fallthrough == NULL) { - _ioproj_fallthrough = new (C) ProjNode(call, TypeFunc::I_O); + _ioproj_fallthrough = new ProjNode(call, TypeFunc::I_O); transform_later(_ioproj_fallthrough); } for (DUIterator_Fast imax, i = _ioproj_catchall->fast_outs(imax); i < imax; i++) { @@ -1690,47 +1690,47 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false, // As an allocation hits the watermark, we will prefetch starting // at a "distance" away from watermark. - Node *pf_region = new (C) RegionNode(3); - Node *pf_phi_rawmem = new (C) PhiNode( pf_region, Type::MEMORY, + Node *pf_region = new RegionNode(3); + Node *pf_phi_rawmem = new PhiNode( pf_region, Type::MEMORY, TypeRawPtr::BOTTOM ); // I/O is used for Prefetch - Node *pf_phi_abio = new (C) PhiNode( pf_region, Type::ABIO ); + Node *pf_phi_abio = new PhiNode( pf_region, Type::ABIO ); - Node *thread = new (C) ThreadLocalNode(); + Node *thread = new ThreadLocalNode(); transform_later(thread); - Node *eden_pf_adr = new (C) AddPNode( top()/*not oop*/, thread, + Node *eden_pf_adr = new AddPNode( top()/*not oop*/, thread, _igvn.MakeConX(in_bytes(JavaThread::tlab_pf_top_offset())) ); transform_later(eden_pf_adr); - Node *old_pf_wm = new (C) LoadPNode(needgc_false, + Node *old_pf_wm = new LoadPNode(needgc_false, contended_phi_rawmem, eden_pf_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered); transform_later(old_pf_wm); // check against new_eden_top - Node *need_pf_cmp = new (C) CmpPNode( new_eden_top, old_pf_wm ); + Node *need_pf_cmp = new CmpPNode( new_eden_top, old_pf_wm ); transform_later(need_pf_cmp); - Node *need_pf_bol = new (C) BoolNode( need_pf_cmp, BoolTest::ge ); + Node *need_pf_bol = new BoolNode( need_pf_cmp, BoolTest::ge ); transform_later(need_pf_bol); - IfNode *need_pf_iff = new (C) IfNode( needgc_false, need_pf_bol, + IfNode *need_pf_iff = new IfNode( needgc_false, need_pf_bol, PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN ); transform_later(need_pf_iff); // true node, add prefetchdistance - Node *need_pf_true = new (C) IfTrueNode( need_pf_iff ); + Node *need_pf_true = new IfTrueNode( need_pf_iff ); transform_later(need_pf_true); - Node *need_pf_false = new (C) IfFalseNode( need_pf_iff ); + Node *need_pf_false = new IfFalseNode( need_pf_iff ); transform_later(need_pf_false); - Node *new_pf_wmt = new (C) AddPNode( top(), old_pf_wm, + Node *new_pf_wmt = new AddPNode( top(), old_pf_wm, _igvn.MakeConX(AllocatePrefetchDistance) ); transform_later(new_pf_wmt ); new_pf_wmt->set_req(0, need_pf_true); - Node *store_new_wmt = new (C) StorePNode(need_pf_true, + Node *store_new_wmt = new StorePNode(need_pf_true, contended_phi_rawmem, eden_pf_adr, TypeRawPtr::BOTTOM, new_pf_wmt, MemNode::unordered); @@ -1746,10 +1746,10 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false, uint distance = 0; for ( uint i = 0; i < lines; i++ ) { - prefetch_adr = new (C) AddPNode( old_pf_wm, new_pf_wmt, + prefetch_adr = new AddPNode( old_pf_wm, new_pf_wmt, _igvn.MakeConX(distance) ); transform_later(prefetch_adr); - prefetch = new (C) PrefetchAllocationNode( i_o, prefetch_adr ); + prefetch = new PrefetchAllocationNode( i_o, prefetch_adr ); transform_later(prefetch); distance += step_size; i_o = prefetch; @@ -1772,8 +1772,8 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false, } else if( UseTLAB && AllocatePrefetchStyle == 3 ) { // Insert a prefetch for each allocation. // This code is used for Sparc with BIS. - Node *pf_region = new (C) RegionNode(3); - Node *pf_phi_rawmem = new (C) PhiNode( pf_region, Type::MEMORY, + Node *pf_region = new RegionNode(3); + Node *pf_phi_rawmem = new PhiNode( pf_region, Type::MEMORY, TypeRawPtr::BOTTOM ); // Generate several prefetch instructions. @@ -1782,29 +1782,29 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false, uint distance = AllocatePrefetchDistance; // Next cache address. - Node *cache_adr = new (C) AddPNode(old_eden_top, old_eden_top, + Node *cache_adr = new AddPNode(old_eden_top, old_eden_top, _igvn.MakeConX(distance)); transform_later(cache_adr); - cache_adr = new (C) CastP2XNode(needgc_false, cache_adr); + cache_adr = new CastP2XNode(needgc_false, cache_adr); transform_later(cache_adr); Node* mask = _igvn.MakeConX(~(intptr_t)(step_size-1)); - cache_adr = new (C) AndXNode(cache_adr, mask); + cache_adr = new AndXNode(cache_adr, mask); transform_later(cache_adr); - cache_adr = new (C) CastX2PNode(cache_adr); + cache_adr = new CastX2PNode(cache_adr); transform_later(cache_adr); // Prefetch - Node *prefetch = new (C) PrefetchAllocationNode( contended_phi_rawmem, cache_adr ); + Node *prefetch = new PrefetchAllocationNode( contended_phi_rawmem, cache_adr ); prefetch->set_req(0, needgc_false); transform_later(prefetch); contended_phi_rawmem = prefetch; Node *prefetch_adr; distance = step_size; for ( uint i = 1; i < lines; i++ ) { - prefetch_adr = new (C) AddPNode( cache_adr, cache_adr, + prefetch_adr = new AddPNode( cache_adr, cache_adr, _igvn.MakeConX(distance) ); transform_later(prefetch_adr); - prefetch = new (C) PrefetchAllocationNode( contended_phi_rawmem, prefetch_adr ); + prefetch = new PrefetchAllocationNode( contended_phi_rawmem, prefetch_adr ); transform_later(prefetch); distance += step_size; contended_phi_rawmem = prefetch; @@ -1818,10 +1818,10 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false, uint step_size = AllocatePrefetchStepSize; uint distance = AllocatePrefetchDistance; for ( uint i = 0; i < lines; i++ ) { - prefetch_adr = new (C) AddPNode( old_eden_top, new_eden_top, + prefetch_adr = new AddPNode( old_eden_top, new_eden_top, _igvn.MakeConX(distance) ); transform_later(prefetch_adr); - prefetch = new (C) PrefetchAllocationNode( i_o, prefetch_adr ); + prefetch = new PrefetchAllocationNode( i_o, prefetch_adr ); // Do not let it float too high, since if eden_top == eden_end, // both might be null. if( i == 0 ) { // Set control for first prefetch, next follows it @@ -2170,12 +2170,12 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { * } */ - region = new (C) RegionNode(5); + region = new RegionNode(5); // create a Phi for the memory state - mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); + mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); - Node* fast_lock_region = new (C) RegionNode(3); - Node* fast_lock_mem_phi = new (C) PhiNode( fast_lock_region, Type::MEMORY, TypeRawPtr::BOTTOM); + Node* fast_lock_region = new RegionNode(3); + Node* fast_lock_mem_phi = new PhiNode( fast_lock_region, Type::MEMORY, TypeRawPtr::BOTTOM); // First, check mark word for the biased lock pattern. Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); @@ -2205,10 +2205,10 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { } Node *proto_node = make_load(ctrl, mem, klass_node, in_bytes(Klass::prototype_header_offset()), TypeX_X, TypeX_X->basic_type()); - Node* thread = transform_later(new (C) ThreadLocalNode()); - Node* cast_thread = transform_later(new (C) CastP2XNode(ctrl, thread)); - Node* o_node = transform_later(new (C) OrXNode(cast_thread, proto_node)); - Node* x_node = transform_later(new (C) XorXNode(o_node, mark_node)); + Node* thread = transform_later(new ThreadLocalNode()); + Node* cast_thread = transform_later(new CastP2XNode(ctrl, thread)); + Node* o_node = transform_later(new OrXNode(cast_thread, proto_node)); + Node* x_node = transform_later(new XorXNode(o_node, mark_node)); // Get slow path - mark word does NOT match the value. Node* not_biased_ctrl = opt_bits_test(ctrl, region, 3, x_node, @@ -2231,17 +2231,17 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { // We are going to try to reset the mark of this object to the prototype // value and fall through to the CAS-based locking scheme. Node* adr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes()); - Node* cas = new (C) StoreXConditionalNode(not_biased_ctrl, mem, adr, - proto_node, mark_node); + Node* cas = new StoreXConditionalNode(not_biased_ctrl, mem, adr, + proto_node, mark_node); transform_later(cas); - Node* proj = transform_later( new (C) SCMemProjNode(cas)); + Node* proj = transform_later(new SCMemProjNode(cas)); fast_lock_mem_phi->init_req(2, proj); // Second, check epoch bits. - Node* rebiased_region = new (C) RegionNode(3); - Node* old_phi = new (C) PhiNode( rebiased_region, TypeX_X); - Node* new_phi = new (C) PhiNode( rebiased_region, TypeX_X); + Node* rebiased_region = new RegionNode(3); + Node* old_phi = new PhiNode( rebiased_region, TypeX_X); + Node* new_phi = new PhiNode( rebiased_region, TypeX_X); // Get slow path - mark word does NOT match epoch bits. Node* epoch_ctrl = opt_bits_test(ctrl, rebiased_region, 1, x_node, @@ -2258,9 +2258,9 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { Node* cmask = MakeConX(markOopDesc::biased_lock_mask_in_place | markOopDesc::age_mask_in_place | markOopDesc::epoch_mask_in_place); - Node* old = transform_later(new (C) AndXNode(mark_node, cmask)); - cast_thread = transform_later(new (C) CastP2XNode(ctrl, thread)); - Node* new_mark = transform_later(new (C) OrXNode(cast_thread, old)); + Node* old = transform_later(new AndXNode(mark_node, cmask)); + cast_thread = transform_later(new CastP2XNode(ctrl, thread)); + Node* new_mark = transform_later(new OrXNode(cast_thread, old)); old_phi->init_req(1, old); new_phi->init_req(1, new_mark); @@ -2270,10 +2270,9 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { // Try to acquire the bias of the object using an atomic operation. // If this fails we will go in to the runtime to revoke the object's bias. - cas = new (C) StoreXConditionalNode(rebiased_region, mem, adr, - new_phi, old_phi); + cas = new StoreXConditionalNode(rebiased_region, mem, adr, new_phi, old_phi); transform_later(cas); - proj = transform_later( new (C) SCMemProjNode(cas)); + proj = transform_later(new SCMemProjNode(cas)); // Get slow path - Failed to CAS. not_biased_ctrl = opt_bits_test(rebiased_region, region, 4, cas, 0, 0); @@ -2281,8 +2280,8 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { // region->in(4) is set to fast path - the object is rebiased to the current thread. // Failed to CAS. - slow_path = new (C) RegionNode(3); - Node *slow_mem = new (C) PhiNode( slow_path, Type::MEMORY, TypeRawPtr::BOTTOM); + slow_path = new RegionNode(3); + Node *slow_mem = new PhiNode( slow_path, Type::MEMORY, TypeRawPtr::BOTTOM); slow_path->init_req(1, not_biased_ctrl); // Capture slow-control slow_mem->init_req(1, proj); @@ -2306,9 +2305,9 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { lock->set_req(TypeFunc::Memory, slow_mem); } else { - region = new (C) RegionNode(3); + region = new RegionNode(3); // create a Phi for the memory state - mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); + mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); // Optimize test; set region slot 2 slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0); @@ -2339,7 +2338,7 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { transform_later(region); _igvn.replace_node(_fallthroughproj, region); - Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) ); + Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory)); mem_phi->init_req(1, memproj ); transform_later(mem_phi); _igvn.replace_node(_memproj_fallthrough, mem_phi); @@ -2364,9 +2363,9 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) { if (UseOptoBiasInlining) { // Check for biased locking unlock case, which is a no-op. // See the full description in MacroAssembler::biased_locking_exit(). - region = new (C) RegionNode(4); + region = new RegionNode(4); // create a Phi for the memory state - mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); + mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); mem_phi->init_req(3, mem); Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); @@ -2374,12 +2373,12 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) { markOopDesc::biased_lock_mask_in_place, markOopDesc::biased_lock_pattern); } else { - region = new (C) RegionNode(3); + region = new RegionNode(3); // create a Phi for the memory state - mem_phi = new (C) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); + mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); } - FastUnlockNode *funlock = new (C) FastUnlockNode( ctrl, obj, box ); + FastUnlockNode *funlock = new FastUnlockNode( ctrl, obj, box ); funlock = transform_later( funlock )->as_FastUnlock(); // Optimize test; set region slot 2 Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0); @@ -2404,7 +2403,7 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) { transform_later(region); _igvn.replace_node(_fallthroughproj, region); - Node *memproj = transform_later( new(C) ProjNode(call, TypeFunc::Memory) ); + Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory) ); mem_phi->init_req(1, memproj ); mem_phi->init_req(2, mem); transform_later(mem_phi); diff --git a/hotspot/src/share/vm/opto/macro.hpp b/hotspot/src/share/vm/opto/macro.hpp index 0efe988ab17..5cefbb1c063 100644 --- a/hotspot/src/share/vm/opto/macro.hpp +++ b/hotspot/src/share/vm/opto/macro.hpp @@ -52,7 +52,7 @@ private: return basic_plus_adr(base, base, offset); } Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) { - Node* adr = new (C) AddPNode(base, ptr, offset); + Node* adr = new AddPNode(base, ptr, offset); return transform_later(adr); } Node* transform_later(Node* n) { diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index 7cdf630e1dc..2b2f11f9b4e 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -751,7 +751,7 @@ void Matcher::Fixup_Save_On_Entry( ) { tail_call_rms[tail_call_edge_cnt].Insert(OptoReg::Name(i+1)); tail_jump_rms[tail_jump_edge_cnt].Insert(OptoReg::Name(i+1)); halt_rms [ halt_edge_cnt].Insert(OptoReg::Name(i+1)); - mproj = new (C) MachProjNode( start, proj_cnt, ret_rms[ret_edge_cnt], Op_RegD ); + mproj = new MachProjNode( start, proj_cnt, ret_rms[ret_edge_cnt], Op_RegD ); proj_cnt += 2; // Skip 2 for doubles } else if( (i&1) == 1 && // Else check for high half of double @@ -777,7 +777,7 @@ void Matcher::Fixup_Save_On_Entry( ) { tail_call_rms[tail_call_edge_cnt].Insert(OptoReg::Name(i+1)); tail_jump_rms[tail_jump_edge_cnt].Insert(OptoReg::Name(i+1)); halt_rms [ halt_edge_cnt].Insert(OptoReg::Name(i+1)); - mproj = new (C) MachProjNode( start, proj_cnt, ret_rms[ret_edge_cnt], Op_RegL ); + mproj = new MachProjNode( start, proj_cnt, ret_rms[ret_edge_cnt], Op_RegL ); proj_cnt += 2; // Skip 2 for longs } else if( (i&1) == 1 && // Else check for high half of long @@ -792,7 +792,7 @@ void Matcher::Fixup_Save_On_Entry( ) { mproj = C->top(); } else { // Make a projection for it off the Start - mproj = new (C) MachProjNode( start, proj_cnt++, ret_rms[ret_edge_cnt], _register_save_type[i] ); + mproj = new MachProjNode( start, proj_cnt++, ret_rms[ret_edge_cnt], _register_save_type[i] ); } ret_edge_cnt ++; @@ -845,13 +845,13 @@ void Matcher::init_spill_mask( Node *ret ) { // Compute generic short-offset Loads #ifdef _LP64 - MachNode *spillCP = match_tree(new (C) LoadNNode(NULL,mem,fp,atp,TypeInstPtr::BOTTOM,MemNode::unordered)); + MachNode *spillCP = match_tree(new LoadNNode(NULL,mem,fp,atp,TypeInstPtr::BOTTOM,MemNode::unordered)); #endif - MachNode *spillI = match_tree(new (C) LoadINode(NULL,mem,fp,atp,TypeInt::INT,MemNode::unordered)); - MachNode *spillL = match_tree(new (C) LoadLNode(NULL,mem,fp,atp,TypeLong::LONG,MemNode::unordered,false)); - MachNode *spillF = match_tree(new (C) LoadFNode(NULL,mem,fp,atp,Type::FLOAT,MemNode::unordered)); - MachNode *spillD = match_tree(new (C) LoadDNode(NULL,mem,fp,atp,Type::DOUBLE,MemNode::unordered)); - MachNode *spillP = match_tree(new (C) LoadPNode(NULL,mem,fp,atp,TypeInstPtr::BOTTOM,MemNode::unordered)); + MachNode *spillI = match_tree(new LoadINode(NULL,mem,fp,atp,TypeInt::INT,MemNode::unordered)); + MachNode *spillL = match_tree(new LoadLNode(NULL,mem,fp,atp,TypeLong::LONG,MemNode::unordered,false)); + MachNode *spillF = match_tree(new LoadFNode(NULL,mem,fp,atp,Type::FLOAT,MemNode::unordered)); + MachNode *spillD = match_tree(new LoadDNode(NULL,mem,fp,atp,Type::DOUBLE,MemNode::unordered)); + MachNode *spillP = match_tree(new LoadPNode(NULL,mem,fp,atp,TypeInstPtr::BOTTOM,MemNode::unordered)); assert(spillI != NULL && spillL != NULL && spillF != NULL && spillD != NULL && spillP != NULL, ""); // Get the ADLC notion of the right regmask, for each basic type. @@ -867,19 +867,19 @@ void Matcher::init_spill_mask( Node *ret ) { // Vector regmasks. if (Matcher::vector_size_supported(T_BYTE,4)) { TypeVect::VECTS = TypeVect::make(T_BYTE, 4); - MachNode *spillVectS = match_tree(new (C) LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTS)); + MachNode *spillVectS = match_tree(new LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTS)); idealreg2regmask[Op_VecS] = &spillVectS->out_RegMask(); } if (Matcher::vector_size_supported(T_FLOAT,2)) { - MachNode *spillVectD = match_tree(new (C) LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTD)); + MachNode *spillVectD = match_tree(new LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTD)); idealreg2regmask[Op_VecD] = &spillVectD->out_RegMask(); } if (Matcher::vector_size_supported(T_FLOAT,4)) { - MachNode *spillVectX = match_tree(new (C) LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTX)); + MachNode *spillVectX = match_tree(new LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTX)); idealreg2regmask[Op_VecX] = &spillVectX->out_RegMask(); } if (Matcher::vector_size_supported(T_FLOAT,8)) { - MachNode *spillVectY = match_tree(new (C) LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTY)); + MachNode *spillVectY = match_tree(new LoadVectorNode(NULL,mem,fp,atp,TypeVect::VECTY)); idealreg2regmask[Op_VecY] = &spillVectY->out_RegMask(); } } @@ -1319,7 +1319,7 @@ MachNode *Matcher::match_sfpt( SafePointNode *sfpt ) { // is excluded on the max-per-method basis, debug info cannot land in // this killed area. uint r_cnt = mcall->tf()->range()->cnt(); - MachProjNode *proj = new (C) MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj ); + MachProjNode *proj = new MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj ); if (!RegMask::can_represent_arg(OptoReg::Name(out_arg_limit_per_call-1))) { C->record_method_not_compilable_all_tiers("unsupported outgoing calling sequence"); } else { @@ -2274,7 +2274,7 @@ void Matcher::find_shared( Node *n ) { case Op_CompareAndSwapN: { // Convert trinary to binary-tree Node *newval = n->in(MemNode::ValueIn ); Node *oldval = n->in(LoadStoreConditionalNode::ExpectedIn); - Node *pair = new (C) BinaryNode( oldval, newval ); + Node *pair = new BinaryNode( oldval, newval ); n->set_req(MemNode::ValueIn,pair); n->del_req(LoadStoreConditionalNode::ExpectedIn); break; @@ -2289,22 +2289,22 @@ void Matcher::find_shared( Node *n ) { // we could move this code up next to the graph reshaping for IfNodes // or vice-versa, but I do not want to debug this for Ladybird. // 10/2/2000 CNC. - Node *pair1 = new (C) BinaryNode(n->in(1),n->in(1)->in(1)); + Node *pair1 = new BinaryNode(n->in(1),n->in(1)->in(1)); n->set_req(1,pair1); - Node *pair2 = new (C) BinaryNode(n->in(2),n->in(3)); + Node *pair2 = new BinaryNode(n->in(2),n->in(3)); n->set_req(2,pair2); n->del_req(3); break; } case Op_LoopLimit: { - Node *pair1 = new (C) BinaryNode(n->in(1),n->in(2)); + Node *pair1 = new BinaryNode(n->in(1),n->in(2)); n->set_req(1,pair1); n->set_req(2,n->in(3)); n->del_req(3); break; } case Op_StrEquals: { - Node *pair1 = new (C) BinaryNode(n->in(2),n->in(3)); + Node *pair1 = new BinaryNode(n->in(2),n->in(3)); n->set_req(2,pair1); n->set_req(3,n->in(4)); n->del_req(4); @@ -2312,9 +2312,9 @@ void Matcher::find_shared( Node *n ) { } case Op_StrComp: case Op_StrIndexOf: { - Node *pair1 = new (C) BinaryNode(n->in(2),n->in(3)); + Node *pair1 = new BinaryNode(n->in(2),n->in(3)); n->set_req(2,pair1); - Node *pair2 = new (C) BinaryNode(n->in(4),n->in(5)); + Node *pair2 = new BinaryNode(n->in(4),n->in(5)); n->set_req(3,pair2); n->del_req(5); n->del_req(4); @@ -2322,7 +2322,7 @@ void Matcher::find_shared( Node *n ) { } case Op_EncodeISOArray: { // Restructure into a binary tree for Matching. - Node* pair = new (C) BinaryNode(n->in(3), n->in(4)); + Node* pair = new BinaryNode(n->in(3), n->in(4)); n->set_req(3, pair); n->del_req(4); break; diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index 1d908c5b577..1c4d2bd773e 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -908,25 +908,25 @@ Node *LoadNode::make(PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const TypeP rt->isa_oopptr() || is_immutable_value(adr), "raw memory operations should have control edge"); switch (bt) { - case T_BOOLEAN: return new (C) LoadUBNode(ctl, mem, adr, adr_type, rt->is_int(), mo); - case T_BYTE: return new (C) LoadBNode (ctl, mem, adr, adr_type, rt->is_int(), mo); - case T_INT: return new (C) LoadINode (ctl, mem, adr, adr_type, rt->is_int(), mo); - case T_CHAR: return new (C) LoadUSNode(ctl, mem, adr, adr_type, rt->is_int(), mo); - case T_SHORT: return new (C) LoadSNode (ctl, mem, adr, adr_type, rt->is_int(), mo); - case T_LONG: return new (C) LoadLNode (ctl, mem, adr, adr_type, rt->is_long(), mo); - case T_FLOAT: return new (C) LoadFNode (ctl, mem, adr, adr_type, rt, mo); - case T_DOUBLE: return new (C) LoadDNode (ctl, mem, adr, adr_type, rt, mo); - case T_ADDRESS: return new (C) LoadPNode (ctl, mem, adr, adr_type, rt->is_ptr(), mo); + case T_BOOLEAN: return new LoadUBNode(ctl, mem, adr, adr_type, rt->is_int(), mo); + case T_BYTE: return new LoadBNode (ctl, mem, adr, adr_type, rt->is_int(), mo); + case T_INT: return new LoadINode (ctl, mem, adr, adr_type, rt->is_int(), mo); + case T_CHAR: return new LoadUSNode(ctl, mem, adr, adr_type, rt->is_int(), mo); + case T_SHORT: return new LoadSNode (ctl, mem, adr, adr_type, rt->is_int(), mo); + case T_LONG: return new LoadLNode (ctl, mem, adr, adr_type, rt->is_long(), mo); + case T_FLOAT: return new LoadFNode (ctl, mem, adr, adr_type, rt, mo); + case T_DOUBLE: return new LoadDNode (ctl, mem, adr, adr_type, rt, mo); + case T_ADDRESS: return new LoadPNode (ctl, mem, adr, adr_type, rt->is_ptr(), mo); case T_OBJECT: #ifdef _LP64 if (adr->bottom_type()->is_ptr_to_narrowoop()) { - Node* load = gvn.transform(new (C) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop(), mo)); - return new (C) DecodeNNode(load, load->bottom_type()->make_ptr()); + Node* load = gvn.transform(new LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop(), mo)); + return new DecodeNNode(load, load->bottom_type()->make_ptr()); } else #endif { assert(!adr->bottom_type()->is_ptr_to_narrowoop() && !adr->bottom_type()->is_ptr_to_narrowklass(), "should have got back a narrow oop"); - return new (C) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr(), mo); + return new LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr(), mo); } } ShouldNotReachHere(); @@ -935,12 +935,12 @@ Node *LoadNode::make(PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const TypeP LoadLNode* LoadLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt, MemOrd mo) { bool require_atomic = true; - return new (C) LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), mo, require_atomic); + return new LoadLNode(ctl, mem, adr, adr_type, rt->is_long(), mo, require_atomic); } LoadDNode* LoadDNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, const Type* rt, MemOrd mo) { bool require_atomic = true; - return new (C) LoadDNode(ctl, mem, adr, adr_type, rt, mo, require_atomic); + return new LoadDNode(ctl, mem, adr, adr_type, rt, mo, require_atomic); } @@ -1228,33 +1228,33 @@ Node* LoadNode::eliminate_autobox(PhaseGVN* phase) { // Add up all the offsets making of the address of the load Node* result = elements[0]; for (int i = 1; i < count; i++) { - result = phase->transform(new (phase->C) AddXNode(result, elements[i])); + result = phase->transform(new AddXNode(result, elements[i])); } // Remove the constant offset from the address and then - result = phase->transform(new (phase->C) AddXNode(result, phase->MakeConX(-(int)offset))); + result = phase->transform(new AddXNode(result, phase->MakeConX(-(int)offset))); // remove the scaling of the offset to recover the original index. if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) { // Peel the shift off directly but wrap it in a dummy node // since Ideal can't return existing nodes - result = new (phase->C) RShiftXNode(result->in(1), phase->intcon(0)); + result = new RShiftXNode(result->in(1), phase->intcon(0)); } else if (result->is_Add() && result->in(2)->is_Con() && result->in(1)->Opcode() == Op_LShiftX && result->in(1)->in(2) == phase->intcon(shift)) { // We can't do general optimization: ((X<> Z ==> X + (Y>>Z) // but for boxing cache access we know that X<C) RShiftXNode(result->in(2), phase->intcon(shift)); - result = new (phase->C) AddXNode(result->in(1)->in(1), phase->transform(add_con)); + Node* add_con = new RShiftXNode(result->in(2), phase->intcon(shift)); + result = new AddXNode(result->in(1)->in(1), phase->transform(add_con)); } else { - result = new (phase->C) RShiftXNode(result, phase->intcon(shift)); + result = new RShiftXNode(result, phase->intcon(shift)); } #ifdef _LP64 if (bt != T_LONG) { - result = new (phase->C) ConvL2INode(phase->transform(result)); + result = new ConvL2INode(phase->transform(result)); } #else if (bt == T_LONG) { - result = new (phase->C) ConvI2LNode(phase->transform(result)); + result = new ConvI2LNode(phase->transform(result)); } #endif return result; @@ -1385,7 +1385,7 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) { this_iid = base->_idx; } PhaseIterGVN* igvn = phase->is_IterGVN(); - Node* phi = new (C) PhiNode(region, this_type, NULL, this_iid, this_index, this_offset); + Node* phi = new PhiNode(region, this_type, NULL, this_iid, this_index, this_offset); for (uint i = 1; i < region->req(); i++) { Node* x; Node* the_clone = NULL; @@ -1408,7 +1408,7 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) { } if (base_is_phi && (base->in(0) == region)) { Node* base_x = base->in(i); // Clone address for loads from boxed objects. - Node* adr_x = phase->transform(new (C) AddPNode(base_x,base_x,address->in(AddPNode::Offset))); + Node* adr_x = phase->transform(new AddPNode(base_x,base_x,address->in(AddPNode::Offset))); x->set_req(Address, adr_x); } } @@ -1897,8 +1897,8 @@ Node *LoadBNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* mem = in(MemNode::Memory); Node* value = can_see_stored_value(mem,phase); if( value && !phase->type(value)->higher_equal( _type ) ) { - Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(24)) ); - return new (phase->C) RShiftINode(result, phase->intcon(24)); + Node *result = phase->transform( new LShiftINode(value, phase->intcon(24)) ); + return new RShiftINode(result, phase->intcon(24)); } // Identity call will handle the case where truncation is not needed. return LoadNode::Ideal(phase, can_reshape); @@ -1929,7 +1929,7 @@ Node* LoadUBNode::Ideal(PhaseGVN* phase, bool can_reshape) { Node* mem = in(MemNode::Memory); Node* value = can_see_stored_value(mem, phase); if (value && !phase->type(value)->higher_equal(_type)) - return new (phase->C) AndINode(value, phase->intcon(0xFF)); + return new AndINode(value, phase->intcon(0xFF)); // Identity call will handle the case where truncation is not needed. return LoadNode::Ideal(phase, can_reshape); } @@ -1959,7 +1959,7 @@ Node *LoadUSNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* mem = in(MemNode::Memory); Node* value = can_see_stored_value(mem,phase); if( value && !phase->type(value)->higher_equal( _type ) ) - return new (phase->C) AndINode(value,phase->intcon(0xFFFF)); + return new AndINode(value,phase->intcon(0xFFFF)); // Identity call will handle the case where truncation is not needed. return LoadNode::Ideal(phase, can_reshape); } @@ -1989,8 +1989,8 @@ Node *LoadSNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* mem = in(MemNode::Memory); Node* value = can_see_stored_value(mem,phase); if( value && !phase->type(value)->higher_equal( _type ) ) { - Node *result = phase->transform( new (phase->C) LShiftINode(value, phase->intcon(16)) ); - return new (phase->C) RShiftINode(result, phase->intcon(16)); + Node *result = phase->transform( new LShiftINode(value, phase->intcon(16)) ); + return new RShiftINode(result, phase->intcon(16)); } // Identity call will handle the case where truncation is not needed. return LoadNode::Ideal(phase, can_reshape); @@ -2022,12 +2022,12 @@ Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* a #ifdef _LP64 if (adr_type->is_ptr_to_narrowklass()) { assert(UseCompressedClassPointers, "no compressed klasses"); - Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowklass(), MemNode::unordered)); - return new (C) DecodeNKlassNode(load_klass, load_klass->bottom_type()->make_ptr()); + Node* load_klass = gvn.transform(new LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowklass(), MemNode::unordered)); + return new DecodeNKlassNode(load_klass, load_klass->bottom_type()->make_ptr()); } #endif assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop"); - return new (C) LoadKlassNode(ctl, mem, adr, at, tk, MemNode::unordered); + return new LoadKlassNode(ctl, mem, adr, at, tk, MemNode::unordered); } //------------------------------Value------------------------------------------ @@ -2255,7 +2255,7 @@ Node* LoadNKlassNode::Identity( PhaseTransform *phase ) { if( t->isa_narrowklass()) return x; assert (!t->isa_narrowoop(), "no narrow oop here"); - return phase->transform(new (phase->C) EncodePKlassNode(x, t->make_narrowklass())); + return phase->transform(new EncodePKlassNode(x, t->make_narrowklass())); } //------------------------------Value----------------------------------------- @@ -2350,29 +2350,29 @@ StoreNode* StoreNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const switch (bt) { case T_BOOLEAN: - case T_BYTE: return new (C) StoreBNode(ctl, mem, adr, adr_type, val, mo); - case T_INT: return new (C) StoreINode(ctl, mem, adr, adr_type, val, mo); + case T_BYTE: return new StoreBNode(ctl, mem, adr, adr_type, val, mo); + case T_INT: return new StoreINode(ctl, mem, adr, adr_type, val, mo); case T_CHAR: - case T_SHORT: return new (C) StoreCNode(ctl, mem, adr, adr_type, val, mo); - case T_LONG: return new (C) StoreLNode(ctl, mem, adr, adr_type, val, mo); - case T_FLOAT: return new (C) StoreFNode(ctl, mem, adr, adr_type, val, mo); - case T_DOUBLE: return new (C) StoreDNode(ctl, mem, adr, adr_type, val, mo); + case T_SHORT: return new StoreCNode(ctl, mem, adr, adr_type, val, mo); + case T_LONG: return new StoreLNode(ctl, mem, adr, adr_type, val, mo); + case T_FLOAT: return new StoreFNode(ctl, mem, adr, adr_type, val, mo); + case T_DOUBLE: return new StoreDNode(ctl, mem, adr, adr_type, val, mo); case T_METADATA: case T_ADDRESS: case T_OBJECT: #ifdef _LP64 if (adr->bottom_type()->is_ptr_to_narrowoop()) { - val = gvn.transform(new (C) EncodePNode(val, val->bottom_type()->make_narrowoop())); - return new (C) StoreNNode(ctl, mem, adr, adr_type, val, mo); + val = gvn.transform(new EncodePNode(val, val->bottom_type()->make_narrowoop())); + return new StoreNNode(ctl, mem, adr, adr_type, val, mo); } else if (adr->bottom_type()->is_ptr_to_narrowklass() || (UseCompressedClassPointers && val->bottom_type()->isa_klassptr() && adr->bottom_type()->isa_rawptr())) { - val = gvn.transform(new (C) EncodePKlassNode(val, val->bottom_type()->make_narrowklass())); - return new (C) StoreNKlassNode(ctl, mem, adr, adr_type, val, mo); + val = gvn.transform(new EncodePKlassNode(val, val->bottom_type()->make_narrowklass())); + return new StoreNKlassNode(ctl, mem, adr, adr_type, val, mo); } #endif { - return new (C) StorePNode(ctl, mem, adr, adr_type, val, mo); + return new StorePNode(ctl, mem, adr, adr_type, val, mo); } } ShouldNotReachHere(); @@ -2381,12 +2381,12 @@ StoreNode* StoreNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const StoreLNode* StoreLNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo) { bool require_atomic = true; - return new (C) StoreLNode(ctl, mem, adr, adr_type, val, mo, require_atomic); + return new StoreLNode(ctl, mem, adr, adr_type, val, mo, require_atomic); } StoreDNode* StoreDNode::make_atomic(Compile *C, Node* ctl, Node* mem, Node* adr, const TypePtr* adr_type, Node* val, MemOrd mo) { bool require_atomic = true; - return new (C) StoreDNode(ctl, mem, adr, adr_type, val, mo, require_atomic); + return new StoreDNode(ctl, mem, adr, adr_type, val, mo, require_atomic); } @@ -2779,12 +2779,12 @@ Node *ClearArrayNode::Ideal(PhaseGVN *phase, bool can_reshape){ Node *zero = phase->makecon(TypeLong::ZERO); Node *off = phase->MakeConX(BytesPerLong); - mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero,MemNode::unordered,false); + mem = new StoreLNode(in(0),mem,adr,atp,zero,MemNode::unordered,false); count--; while( count-- ) { mem = phase->transform(mem); - adr = phase->transform(new (phase->C) AddPNode(base,adr,off)); - mem = new (phase->C) StoreLNode(in(0),mem,adr,atp,zero,MemNode::unordered,false); + adr = phase->transform(new AddPNode(base,adr,off)); + mem = new StoreLNode(in(0),mem,adr,atp,zero,MemNode::unordered,false); } return mem; } @@ -2825,7 +2825,7 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, int unit = BytesPerLong; if ((offset % unit) != 0) { - Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(offset)); + Node* adr = new AddPNode(dest, dest, phase->MakeConX(offset)); adr = phase->transform(adr); const TypePtr* atp = TypeRawPtr::BOTTOM; mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT, MemNode::unordered); @@ -2855,14 +2855,14 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, // Scale to the unit required by the CPU: if (!Matcher::init_array_count_is_in_bytes) { Node* shift = phase->intcon(exact_log2(unit)); - zbase = phase->transform( new(C) URShiftXNode(zbase, shift) ); - zend = phase->transform( new(C) URShiftXNode(zend, shift) ); + zbase = phase->transform(new URShiftXNode(zbase, shift) ); + zend = phase->transform(new URShiftXNode(zend, shift) ); } // Bulk clear double-words - Node* zsize = phase->transform( new(C) SubXNode(zend, zbase) ); - Node* adr = phase->transform( new(C) AddPNode(dest, dest, start_offset) ); - mem = new (C) ClearArrayNode(ctl, mem, zsize, adr); + Node* zsize = phase->transform(new SubXNode(zend, zbase) ); + Node* adr = phase->transform(new AddPNode(dest, dest, start_offset) ); + mem = new ClearArrayNode(ctl, mem, zsize, adr); return phase->transform(mem); } @@ -2886,7 +2886,7 @@ Node* ClearArrayNode::clear_memory(Node* ctl, Node* mem, Node* dest, start_offset, phase->MakeConX(done_offset), phase); } if (done_offset < end_offset) { // emit the final 32-bit store - Node* adr = new (C) AddPNode(dest, dest, phase->MakeConX(done_offset)); + Node* adr = new AddPNode(dest, dest, phase->MakeConX(done_offset)); adr = phase->transform(adr); const TypePtr* atp = TypeRawPtr::BOTTOM; mem = StoreNode::make(*phase, ctl, mem, adr, atp, phase->zerocon(T_INT), T_INT, MemNode::unordered); @@ -2920,16 +2920,16 @@ uint MemBarNode::cmp( const Node &n ) const { //------------------------------make------------------------------------------- MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) { switch (opcode) { - case Op_MemBarAcquire: return new(C) MemBarAcquireNode(C, atp, pn); - case Op_LoadFence: return new(C) LoadFenceNode(C, atp, pn); - case Op_MemBarRelease: return new(C) MemBarReleaseNode(C, atp, pn); - case Op_StoreFence: return new(C) StoreFenceNode(C, atp, pn); - case Op_MemBarAcquireLock: return new(C) MemBarAcquireLockNode(C, atp, pn); - case Op_MemBarReleaseLock: return new(C) MemBarReleaseLockNode(C, atp, pn); - case Op_MemBarVolatile: return new(C) MemBarVolatileNode(C, atp, pn); - case Op_MemBarCPUOrder: return new(C) MemBarCPUOrderNode(C, atp, pn); - case Op_Initialize: return new(C) InitializeNode(C, atp, pn); - case Op_MemBarStoreStore: return new(C) MemBarStoreStoreNode(C, atp, pn); + case Op_MemBarAcquire: return new MemBarAcquireNode(C, atp, pn); + case Op_LoadFence: return new LoadFenceNode(C, atp, pn); + case Op_MemBarRelease: return new MemBarReleaseNode(C, atp, pn); + case Op_StoreFence: return new StoreFenceNode(C, atp, pn); + case Op_MemBarAcquireLock: return new MemBarAcquireLockNode(C, atp, pn); + case Op_MemBarReleaseLock: return new MemBarReleaseLockNode(C, atp, pn); + case Op_MemBarVolatile: return new MemBarVolatileNode(C, atp, pn); + case Op_MemBarCPUOrder: return new MemBarCPUOrderNode(C, atp, pn); + case Op_Initialize: return new InitializeNode(C, atp, pn); + case Op_MemBarStoreStore: return new MemBarStoreStoreNode(C, atp, pn); default: ShouldNotReachHere(); return NULL; } } @@ -2992,7 +2992,7 @@ Node *MemBarNode::Ideal(PhaseGVN *phase, bool can_reshape) { igvn->replace_node(proj_out(TypeFunc::Control), in(TypeFunc::Control)); // Must return either the original node (now dead) or a new node // (Do not return a top here, since that would break the uniqueness of top.) - return new (phase->C) ConINode(TypeInt::ZERO); + return new ConINode(TypeInt::ZERO); } } return NULL; @@ -3012,7 +3012,7 @@ Node *MemBarNode::match( const ProjNode *proj, const Matcher *m ) { switch (proj->_con) { case TypeFunc::Control: case TypeFunc::Memory: - return new (m->C) MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); + return new MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); } ShouldNotReachHere(); return NULL; @@ -3438,7 +3438,7 @@ Node* InitializeNode::make_raw_address(intptr_t offset, Node* addr = in(RawAddress); if (offset != 0) { Compile* C = phase->C; - addr = phase->transform( new (C) AddPNode(C->top(), addr, + addr = phase->transform( new AddPNode(C->top(), addr, phase->MakeConX(offset)) ); } return addr; @@ -4127,7 +4127,7 @@ MergeMemNode::MergeMemNode(Node *new_base) : Node(1+Compile::AliasIdxRaw) { // Make a new, untransformed MergeMem with the same base as 'mem'. // If mem is itself a MergeMem, populate the result with the same edges. MergeMemNode* MergeMemNode::make(Compile* C, Node* mem) { - return new(C) MergeMemNode(mem); + return new MergeMemNode(mem); } //------------------------------cmp-------------------------------------------- diff --git a/hotspot/src/share/vm/opto/movenode.cpp b/hotspot/src/share/vm/opto/movenode.cpp index bf2a83712c1..b7e32deb2e4 100644 --- a/hotspot/src/share/vm/opto/movenode.cpp +++ b/hotspot/src/share/vm/opto/movenode.cpp @@ -160,13 +160,13 @@ const Type *CMoveNode::Value( PhaseTransform *phase ) const { // from the inputs we do not need to specify it here. CMoveNode *CMoveNode::make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t ) { switch( t->basic_type() ) { - case T_INT: return new (C) CMoveINode( bol, left, right, t->is_int() ); - case T_FLOAT: return new (C) CMoveFNode( bol, left, right, t ); - case T_DOUBLE: return new (C) CMoveDNode( bol, left, right, t ); - case T_LONG: return new (C) CMoveLNode( bol, left, right, t->is_long() ); - case T_OBJECT: return new (C) CMovePNode( c, bol, left, right, t->is_oopptr() ); - case T_ADDRESS: return new (C) CMovePNode( c, bol, left, right, t->is_ptr() ); - case T_NARROWOOP: return new (C) CMoveNNode( c, bol, left, right, t ); + case T_INT: return new CMoveINode( bol, left, right, t->is_int() ); + case T_FLOAT: return new CMoveFNode( bol, left, right, t ); + case T_DOUBLE: return new CMoveDNode( bol, left, right, t ); + case T_LONG: return new CMoveLNode( bol, left, right, t->is_long() ); + case T_OBJECT: return new CMovePNode( c, bol, left, right, t->is_oopptr() ); + case T_ADDRESS: return new CMovePNode( c, bol, left, right, t->is_ptr() ); + case T_NARROWOOP: return new CMoveNNode( c, bol, left, right, t ); default: ShouldNotReachHere(); return NULL; @@ -233,9 +233,9 @@ Node *CMoveINode::Ideal(PhaseGVN *phase, bool can_reshape) { #ifndef PRODUCT if( PrintOpto ) tty->print_cr("CMOV to I2B"); #endif - Node *n = new (phase->C) Conv2BNode( cmp->in(1) ); + Node *n = new Conv2BNode( cmp->in(1) ); if( flip ) - n = new (phase->C) XorINode( phase->transform(n), phase->intcon(1) ); + n = new XorINode( phase->transform(n), phase->intcon(1) ); return n; } @@ -289,9 +289,9 @@ Node *CMoveFNode::Ideal(PhaseGVN *phase, bool can_reshape) { sub->in(2) != X || phase->type(sub->in(1)) != TypeF::ZERO ) return NULL; - Node *abs = new (phase->C) AbsFNode( X ); + Node *abs = new AbsFNode( X ); if( flip ) - abs = new (phase->C) SubFNode(sub->in(1), phase->transform(abs)); + abs = new SubFNode(sub->in(1), phase->transform(abs)); return abs; } @@ -345,9 +345,9 @@ Node *CMoveDNode::Ideal(PhaseGVN *phase, bool can_reshape) { sub->in(2) != X || phase->type(sub->in(1)) != TypeD::ZERO ) return NULL; - Node *abs = new (phase->C) AbsDNode( X ); + Node *abs = new AbsDNode( X ); if( flip ) - abs = new (phase->C) SubDNode(sub->in(1), phase->transform(abs)); + abs = new SubDNode(sub->in(1), phase->transform(abs)); return abs; } diff --git a/hotspot/src/share/vm/opto/mulnode.cpp b/hotspot/src/share/vm/opto/mulnode.cpp index 056d8c5043a..1406f8364a6 100644 --- a/hotspot/src/share/vm/opto/mulnode.cpp +++ b/hotspot/src/share/vm/opto/mulnode.cpp @@ -199,22 +199,22 @@ Node *MulINode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *res = NULL; jint bit1 = con & -con; // Extract low bit if( bit1 == con ) { // Found a power of 2? - res = new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(bit1)) ); + res = new LShiftINode( in(1), phase->intcon(log2_intptr(bit1)) ); } else { // Check for constant with 2 bits set jint bit2 = con-bit1; bit2 = bit2 & -bit2; // Extract 2nd bit if( bit2 + bit1 == con ) { // Found all bits in con? - Node *n1 = phase->transform( new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(bit1)) ) ); - Node *n2 = phase->transform( new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(bit2)) ) ); - res = new (phase->C) AddINode( n2, n1 ); + Node *n1 = phase->transform( new LShiftINode( in(1), phase->intcon(log2_intptr(bit1)) ) ); + Node *n2 = phase->transform( new LShiftINode( in(1), phase->intcon(log2_intptr(bit2)) ) ); + res = new AddINode( n2, n1 ); } else if (is_power_of_2(con+1)) { // Sleezy: power-of-2 -1. Next time be generic. jint temp = (jint) (con + 1); - Node *n1 = phase->transform( new (phase->C) LShiftINode( in(1), phase->intcon(log2_intptr(temp)) ) ); - res = new (phase->C) SubINode( n1, in(1) ); + Node *n1 = phase->transform( new LShiftINode( in(1), phase->intcon(log2_intptr(temp)) ) ); + res = new SubINode( n1, in(1) ); } else { return MulNode::Ideal(phase, can_reshape); } @@ -222,7 +222,7 @@ Node *MulINode::Ideal(PhaseGVN *phase, bool can_reshape) { if( sign_flip ) { // Need to negate result? res = phase->transform(res);// Transform, before making the zero con - res = new (phase->C) SubINode(phase->intcon(0),res); + res = new SubINode(phase->intcon(0),res); } return res; // Return final result @@ -295,22 +295,22 @@ Node *MulLNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *res = NULL; jlong bit1 = con & -con; // Extract low bit if( bit1 == con ) { // Found a power of 2? - res = new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(bit1)) ); + res = new LShiftLNode( in(1), phase->intcon(log2_long(bit1)) ); } else { // Check for constant with 2 bits set jlong bit2 = con-bit1; bit2 = bit2 & -bit2; // Extract 2nd bit if( bit2 + bit1 == con ) { // Found all bits in con? - Node *n1 = phase->transform( new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(bit1)) ) ); - Node *n2 = phase->transform( new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(bit2)) ) ); - res = new (phase->C) AddLNode( n2, n1 ); + Node *n1 = phase->transform( new LShiftLNode( in(1), phase->intcon(log2_long(bit1)) ) ); + Node *n2 = phase->transform( new LShiftLNode( in(1), phase->intcon(log2_long(bit2)) ) ); + res = new AddLNode( n2, n1 ); } else if (is_power_of_2_long(con+1)) { // Sleezy: power-of-2 -1. Next time be generic. jlong temp = (jlong) (con + 1); - Node *n1 = phase->transform( new (phase->C) LShiftLNode( in(1), phase->intcon(log2_long(temp)) ) ); - res = new (phase->C) SubLNode( n1, in(1) ); + Node *n1 = phase->transform( new LShiftLNode( in(1), phase->intcon(log2_long(temp)) ) ); + res = new SubLNode( n1, in(1) ); } else { return MulNode::Ideal(phase, can_reshape); } @@ -318,7 +318,7 @@ Node *MulLNode::Ideal(PhaseGVN *phase, bool can_reshape) { if( sign_flip ) { // Need to negate result? res = phase->transform(res);// Transform, before making the zero con - res = new (phase->C) SubLNode(phase->longcon(0),res); + res = new SubLNode(phase->longcon(0),res); } return res; // Return final result @@ -477,31 +477,31 @@ Node *AndINode::Ideal(PhaseGVN *phase, bool can_reshape) { // Masking bits off of a Character? Hi bits are already zero. if( lop == Op_LoadUS && (mask & 0xFFFF0000) ) // Can we make a smaller mask? - return new (phase->C) AndINode(load,phase->intcon(mask&0xFFFF)); + return new AndINode(load,phase->intcon(mask&0xFFFF)); // Masking bits off of a Short? Loading a Character does some masking if (can_reshape && load->outcnt() == 1 && load->unique_out() == this) { if (lop == Op_LoadS && (mask & 0xFFFF0000) == 0 ) { - Node *ldus = new (phase->C) LoadUSNode(load->in(MemNode::Control), - load->in(MemNode::Memory), - load->in(MemNode::Address), - load->adr_type(), - TypeInt::CHAR, MemNode::unordered); + Node *ldus = new LoadUSNode(load->in(MemNode::Control), + load->in(MemNode::Memory), + load->in(MemNode::Address), + load->adr_type(), + TypeInt::CHAR, MemNode::unordered); ldus = phase->transform(ldus); - return new (phase->C) AndINode(ldus, phase->intcon(mask & 0xFFFF)); + return new AndINode(ldus, phase->intcon(mask & 0xFFFF)); } // Masking sign bits off of a Byte? Do an unsigned byte load plus // an and. if (lop == Op_LoadB && (mask & 0xFFFFFF00) == 0) { - Node* ldub = new (phase->C) LoadUBNode(load->in(MemNode::Control), - load->in(MemNode::Memory), - load->in(MemNode::Address), - load->adr_type(), - TypeInt::UBYTE, MemNode::unordered); + Node* ldub = new LoadUBNode(load->in(MemNode::Control), + load->in(MemNode::Memory), + load->in(MemNode::Address), + load->adr_type(), + TypeInt::UBYTE, MemNode::unordered); ldub = phase->transform(ldub); - return new (phase->C) AndINode(ldub, phase->intcon(mask)); + return new AndINode(ldub, phase->intcon(mask)); } } @@ -516,8 +516,8 @@ Node *AndINode::Ideal(PhaseGVN *phase, bool can_reshape) { // bits survive. NO sign-extension bits survive the maskings. if( (sign_bits_mask & mask) == 0 ) { // Use zero-fill shift instead - Node *zshift = phase->transform(new (phase->C) URShiftINode(load->in(1),load->in(2))); - return new (phase->C) AndINode( zshift, in(2) ); + Node *zshift = phase->transform(new URShiftINode(load->in(1),load->in(2))); + return new AndINode( zshift, in(2) ); } } } @@ -527,7 +527,7 @@ Node *AndINode::Ideal(PhaseGVN *phase, bool can_reshape) { // plus 1) and the mask is of the low order bit. Skip the negate. if( lop == Op_SubI && mask == 1 && load->in(1) && phase->type(load->in(1)) == TypeInt::ZERO ) - return new (phase->C) AndINode( load->in(2), in(2) ); + return new AndINode( load->in(2), in(2) ); return MulNode::Ideal(phase, can_reshape); } @@ -611,9 +611,9 @@ Node *AndLNode::Ideal(PhaseGVN *phase, bool can_reshape) { // value. This check includes UI2L masks (0x00000000FFFFFFFF) which // would be optimized away later in Identity. if (op == Op_ConvI2L && (mask & CONST64(0xFFFFFFFF80000000)) == 0) { - Node* andi = new (phase->C) AndINode(in1->in(1), phase->intcon(mask)); + Node* andi = new AndINode(in1->in(1), phase->intcon(mask)); andi = phase->transform(andi); - return new (phase->C) ConvI2LNode(andi); + return new ConvI2LNode(andi); } // Masking off sign bits? Dont make them! @@ -627,8 +627,8 @@ Node *AndLNode::Ideal(PhaseGVN *phase, bool can_reshape) { // bits survive. NO sign-extension bits survive the maskings. if( (sign_bits_mask & mask) == 0 ) { // Use zero-fill shift instead - Node *zshift = phase->transform(new (phase->C) URShiftLNode(in1->in(1), in1->in(2))); - return new (phase->C) AndLNode(zshift, in(2)); + Node *zshift = phase->transform(new URShiftLNode(in1->in(1), in1->in(2))); + return new AndLNode(zshift, in(2)); } } } @@ -666,9 +666,9 @@ Node *LShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) { // and 'i2b' patterns which typically fold into 'StoreC/StoreB'. if( con < 16 ) { // Compute X << con0 - Node *lsh = phase->transform( new (phase->C) LShiftINode( add1->in(1), in(2) ) ); + Node *lsh = phase->transform( new LShiftINode( add1->in(1), in(2) ) ); // Compute X<C) AddINode( lsh, phase->intcon(t12->get_con() << con)); + return new AddINode( lsh, phase->intcon(t12->get_con() << con)); } } } @@ -677,7 +677,7 @@ Node *LShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) { if( (add1_op == Op_RShiftI || add1_op == Op_URShiftI ) && add1->in(2) == in(2) ) // Convert to "(x & -(1<C) AndINode(add1->in(1),phase->intcon( -(1<in(1),phase->intcon( -(1<>c0) & Y)<in(2) == in(2) ) { // Convert to "(x & (Y<transform( new (phase->C) LShiftINode( add1->in(2), in(2) ) ); - return new (phase->C) AndINode( add2->in(1), y_sh ); + Node *y_sh = phase->transform( new LShiftINode( add1->in(2), in(2) ) ); + return new AndINode( add2->in(1), y_sh ); } } @@ -696,7 +696,7 @@ Node *LShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) { const jint bits_mask = right_n_bits(BitsPerJavaInteger-con); if( add1_op == Op_AndI && phase->type(add1->in(2)) == TypeInt::make( bits_mask ) ) - return new (phase->C) LShiftINode( add1->in(1), in(2) ); + return new LShiftINode( add1->in(1), in(2) ); return NULL; } @@ -776,9 +776,9 @@ Node *LShiftLNode::Ideal(PhaseGVN *phase, bool can_reshape) { const TypeLong *t12 = phase->type(add1->in(2))->isa_long(); if( t12 && t12->is_con() ){ // Left input is an add of a con? // Compute X << con0 - Node *lsh = phase->transform( new (phase->C) LShiftLNode( add1->in(1), in(2) ) ); + Node *lsh = phase->transform( new LShiftLNode( add1->in(1), in(2) ) ); // Compute X<C) AddLNode( lsh, phase->longcon(t12->get_con() << con)); + return new AddLNode( lsh, phase->longcon(t12->get_con() << con)); } } @@ -786,7 +786,7 @@ Node *LShiftLNode::Ideal(PhaseGVN *phase, bool can_reshape) { if( (add1_op == Op_RShiftL || add1_op == Op_URShiftL ) && add1->in(2) == in(2) ) // Convert to "(x & -(1<C) AndLNode(add1->in(1),phase->longcon( -(CONST64(1)<in(1),phase->longcon( -(CONST64(1)<>c0) & Y)<in(2) == in(2) ) { // Convert to "(x & (Y<transform( new (phase->C) LShiftLNode( add1->in(2), in(2) ) ); - return new (phase->C) AndLNode( add2->in(1), y_sh ); + Node *y_sh = phase->transform( new LShiftLNode( add1->in(2), in(2) ) ); + return new AndLNode( add2->in(1), y_sh ); } } @@ -805,7 +805,7 @@ Node *LShiftLNode::Ideal(PhaseGVN *phase, bool can_reshape) { const jlong bits_mask = ((jlong)CONST64(1) << (jlong)(BitsPerJavaLong - con)) - CONST64(1); if( add1_op == Op_AndL && phase->type(add1->in(2)) == TypeLong::make( bits_mask ) ) - return new (phase->C) LShiftLNode( add1->in(1), in(2) ); + return new LShiftLNode( add1->in(1), in(2) ); return NULL; } @@ -907,8 +907,8 @@ Node *RShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *x = mask->in(1); jint maskbits = t3->get_con(); // Convert to "(x >> shift) & (mask >> shift)" - Node *shr_nomask = phase->transform( new (phase->C) RShiftINode(mask->in(1), in(2)) ); - return new (phase->C) AndINode(shr_nomask, phase->intcon( maskbits >> shift)); + Node *shr_nomask = phase->transform( new RShiftINode(mask->in(1), in(2)) ); + return new AndINode(shr_nomask, phase->intcon( maskbits >> shift)); } // Check for "(short[i] <<16)>>16" which simply sign-extends @@ -933,11 +933,11 @@ Node *RShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) { ld->Opcode() == Op_LoadUS && ld->outcnt() == 1 && ld->unique_out() == shl) // Replace zero-extension-load with sign-extension-load - return new (phase->C) LoadSNode( ld->in(MemNode::Control), - ld->in(MemNode::Memory), - ld->in(MemNode::Address), - ld->adr_type(), TypeInt::SHORT, - MemNode::unordered); + return new LoadSNode( ld->in(MemNode::Control), + ld->in(MemNode::Memory), + ld->in(MemNode::Address), + ld->adr_type(), TypeInt::SHORT, + MemNode::unordered); } // Check for "(byte[i] <<24)>>24" which simply sign-extends @@ -1119,7 +1119,7 @@ Node *URShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) { const int con2 = t12->get_con() & 31; // Shift count is always masked const int con3 = con+con2; if( con3 < 32 ) // Only merge shifts if total is < 32 - return new (phase->C) URShiftINode( in(1)->in(1), phase->intcon(con3) ); + return new URShiftINode( in(1)->in(1), phase->intcon(con3) ); } } @@ -1132,9 +1132,9 @@ Node *URShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *lshl = add->in(1); if( lshl->Opcode() == Op_LShiftI && phase->type(lshl->in(2)) == t2 ) { - Node *y_z = phase->transform( new (phase->C) URShiftINode(add->in(2),in(2)) ); - Node *sum = phase->transform( new (phase->C) AddINode( lshl->in(1), y_z ) ); - return new (phase->C) AndINode( sum, phase->intcon(mask) ); + Node *y_z = phase->transform( new URShiftINode(add->in(2),in(2)) ); + Node *sum = phase->transform( new AddINode( lshl->in(1), y_z ) ); + return new AndINode( sum, phase->intcon(mask) ); } } @@ -1147,8 +1147,8 @@ Node *URShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) { if( t3 && t3->is_con() ) { // Right input is a constant jint mask2 = t3->get_con(); mask2 >>= con; // *signed* shift downward (high-order zeroes do not help) - Node *newshr = phase->transform( new (phase->C) URShiftINode(andi->in(1), in(2)) ); - return new (phase->C) AndINode(newshr, phase->intcon(mask2)); + Node *newshr = phase->transform( new URShiftINode(andi->in(1), in(2)) ); + return new AndINode(newshr, phase->intcon(mask2)); // The negative values are easier to materialize than positive ones. // A typical case from address arithmetic is ((x & ~15) >> 4). // It's better to change that to ((x >> 4) & ~0) versus @@ -1160,7 +1160,7 @@ Node *URShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *shl = in(1); if( in1_op == Op_LShiftI && phase->type(shl->in(2)) == t2 ) - return new (phase->C) AndINode( shl->in(1), phase->intcon(mask) ); + return new AndINode( shl->in(1), phase->intcon(mask) ); return NULL; } @@ -1265,9 +1265,9 @@ Node *URShiftLNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *lshl = add->in(1); if( lshl->Opcode() == Op_LShiftL && phase->type(lshl->in(2)) == t2 ) { - Node *y_z = phase->transform( new (phase->C) URShiftLNode(add->in(2),in(2)) ); - Node *sum = phase->transform( new (phase->C) AddLNode( lshl->in(1), y_z ) ); - return new (phase->C) AndLNode( sum, phase->longcon(mask) ); + Node *y_z = phase->transform( new URShiftLNode(add->in(2),in(2)) ); + Node *sum = phase->transform( new AddLNode( lshl->in(1), y_z ) ); + return new AndLNode( sum, phase->longcon(mask) ); } } @@ -1280,8 +1280,8 @@ Node *URShiftLNode::Ideal(PhaseGVN *phase, bool can_reshape) { if( t3 && t3->is_con() ) { // Right input is a constant jlong mask2 = t3->get_con(); mask2 >>= con; // *signed* shift downward (high-order zeroes do not help) - Node *newshr = phase->transform( new (phase->C) URShiftLNode(andi->in(1), in(2)) ); - return new (phase->C) AndLNode(newshr, phase->longcon(mask2)); + Node *newshr = phase->transform( new URShiftLNode(andi->in(1), in(2)) ); + return new AndLNode(newshr, phase->longcon(mask2)); } } @@ -1289,7 +1289,7 @@ Node *URShiftLNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *shl = in(1); if( shl->Opcode() == Op_LShiftL && phase->type(shl->in(2)) == t2 ) - return new (phase->C) AndLNode( shl->in(1), phase->longcon(mask) ); + return new AndLNode( shl->in(1), phase->longcon(mask) ); return NULL; } diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index cec7f0d517b..c52ac9895ab 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -274,23 +274,6 @@ void DUIterator_Last::verify_step(uint num_edges) { // The value NULL is reserved for the top node only. #define NO_OUT_ARRAY ((Node**)-1) -// This funny expression handshakes with Node::operator new -// to pull Compile::current out of the new node's _out field, -// and then calls a subroutine which manages most field -// initializations. The only one which is tricky is the -// _idx field, which is const, and so must be initialized -// by a return value, not an assignment. -// -// (Aren't you thankful that Java finals don't require so many tricks?) -#define IDX_INIT(req) this->Init((req), (Compile*) this->_out) -#ifdef _MSC_VER // the IDX_INIT hack falls foul of warning C4355 -#pragma warning( disable:4355 ) // 'this' : used in base member initializer list -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma GCC diagnostic ignored "-Wuninitialized" -#endif - // Out-of-line code from node constructors. // Executed only when extra debug info. is being passed around. static void init_node_notes(Compile* C, int idx, Node_Notes* nn) { @@ -298,8 +281,8 @@ static void init_node_notes(Compile* C, int idx, Node_Notes* nn) { } // Shared initialization code. -inline int Node::Init(int req, Compile* C) { - assert(Compile::current() == C, "must use operator new(Compile*)"); +inline int Node::Init(int req) { + Compile* C = Compile::current(); int idx = C->next_unique(); // Allocate memory for the necessary number of edges. @@ -328,7 +311,7 @@ inline int Node::Init(int req, Compile* C) { //------------------------------Node------------------------------------------- // Create a Node, with a given number of required edges. Node::Node(uint req) - : _idx(IDX_INIT(req)) + : _idx(Init(req)) { assert( req < (uint)(MaxNodeLimit - NodeLimitFudgeFactor), "Input limit exceeded" ); debug_only( verify_construction() ); @@ -347,7 +330,7 @@ Node::Node(uint req) //------------------------------Node------------------------------------------- Node::Node(Node *n0) - : _idx(IDX_INIT(1)) + : _idx(Init(1)) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); @@ -359,7 +342,7 @@ Node::Node(Node *n0) //------------------------------Node------------------------------------------- Node::Node(Node *n0, Node *n1) - : _idx(IDX_INIT(2)) + : _idx(Init(2)) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); @@ -373,7 +356,7 @@ Node::Node(Node *n0, Node *n1) //------------------------------Node------------------------------------------- Node::Node(Node *n0, Node *n1, Node *n2) - : _idx(IDX_INIT(3)) + : _idx(Init(3)) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); @@ -389,7 +372,7 @@ Node::Node(Node *n0, Node *n1, Node *n2) //------------------------------Node------------------------------------------- Node::Node(Node *n0, Node *n1, Node *n2, Node *n3) - : _idx(IDX_INIT(4)) + : _idx(Init(4)) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); @@ -407,7 +390,7 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3) //------------------------------Node------------------------------------------- Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, Node *n4) - : _idx(IDX_INIT(5)) + : _idx(Init(5)) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); @@ -428,7 +411,7 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, Node *n4) //------------------------------Node------------------------------------------- Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, Node *n4, Node *n5) - : _idx(IDX_INIT(6)) + : _idx(Init(6)) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); @@ -451,7 +434,7 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, //------------------------------Node------------------------------------------- Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, Node *n4, Node *n5, Node *n6) - : _idx(IDX_INIT(7)) + : _idx(Init(7)) { debug_only( verify_construction() ); NOT_PRODUCT(nodes_created++); @@ -1066,15 +1049,15 @@ const Type *Node::Value( PhaseTransform * ) const { // set_req(2, phase->intcon(7)); // return this; // Example: reshape "X*4" into "X<<2" -// return new (C) LShiftINode(in(1), phase->intcon(2)); +// return new LShiftINode(in(1), phase->intcon(2)); // // You must call 'phase->transform(X)' on any new Nodes X you make, except // for the returned root node. Example: reshape "X*31" with "(X<<5)-X". -// Node *shift=phase->transform(new(C)LShiftINode(in(1),phase->intcon(5))); -// return new (C) AddINode(shift, in(1)); +// Node *shift=phase->transform(new LShiftINode(in(1),phase->intcon(5))); +// return new AddINode(shift, in(1)); // // When making a Node for a constant use 'phase->makecon' or 'phase->intcon'. -// These forms are faster than 'phase->transform(new (C) ConNode())' and Do +// These forms are faster than 'phase->transform(new ConNode())' and Do // The Right Thing with def-use info. // // You cannot bury the 'this' Node inside of a graph reshape. If the reshaped diff --git a/hotspot/src/share/vm/opto/node.hpp b/hotspot/src/share/vm/opto/node.hpp index 67db16f154b..5bb9c6873d7 100644 --- a/hotspot/src/share/vm/opto/node.hpp +++ b/hotspot/src/share/vm/opto/node.hpp @@ -208,14 +208,12 @@ public: // field is a local cache of a value defined in some "program fragment" for // which these Nodes are just a part of. - // New Operator that takes a Compile pointer, this will eventually - // be the "new" New operator. - inline void* operator new( size_t x, Compile* C) throw() { + inline void* operator new(size_t x) throw() { + Compile* C = Compile::current(); Node* n = (Node*)C->node_arena()->Amalloc_D(x); #ifdef ASSERT n->_in = (Node**)n; // magic cookie for assertion check #endif - n->_out = (Node**)C; return (void*)n; } @@ -259,7 +257,7 @@ private: // Puts initial values in all Node fields except _idx. // Returns the initial value for _idx, which cannot // be initialized by assignment. - inline int Init(int req, Compile* C); + inline int Init(int req); //----------------- input edge handling protected: diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index d47912f208c..be29ce452f8 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -67,7 +67,7 @@ void Compile::Output() { const StartNode *start = entry->head()->as_Start(); // Replace StartNode with prolog - MachPrologNode *prolog = new (this) MachPrologNode(); + MachPrologNode *prolog = new MachPrologNode(); entry->map_node(prolog, 0); _cfg->map_node_to_block(prolog, entry); _cfg->unmap_node_from_block(start); // start is no longer in any block @@ -77,12 +77,12 @@ void Compile::Output() { if( is_osr_compilation() ) { if( PoisonOSREntry ) { // TODO: Should use a ShouldNotReachHereNode... - _cfg->insert( broot, 0, new (this) MachBreakpointNode() ); + _cfg->insert( broot, 0, new MachBreakpointNode() ); } } else { if( _method && !_method->flags().is_static() ) { // Insert unvalidated entry point - _cfg->insert( broot, 0, new (this) MachUEPNode() ); + _cfg->insert( broot, 0, new MachUEPNode() ); } } @@ -98,7 +98,7 @@ void Compile::Output() { ) { // checking for _method means that OptoBreakpoint does not apply to // runtime stubs or frame converters - _cfg->insert( entry, 1, new (this) MachBreakpointNode() ); + _cfg->insert( entry, 1, new MachBreakpointNode() ); } // Insert epilogs before every return @@ -107,7 +107,7 @@ void Compile::Output() { if (!block->is_connector() && block->non_connector_successor(0) == _cfg->get_root_block()) { // Found a program exit point? Node* m = block->end(); if (m->is_Mach() && m->as_Mach()->ideal_Opcode() != Op_Halt) { - MachEpilogNode* epilog = new (this) MachEpilogNode(m->as_Mach()->ideal_Opcode() == Op_Return); + MachEpilogNode* epilog = new MachEpilogNode(m->as_Mach()->ideal_Opcode() == Op_Return); block->add_inst(epilog); _cfg->map_node_to_block(epilog, block); } @@ -268,7 +268,7 @@ void Compile::Insert_zap_nodes() { Node* Compile::call_zap_node(MachSafePointNode* node_to_check, int block_no) { const TypeFunc *tf = OptoRuntime::zap_dead_locals_Type(); CallStaticJavaNode* ideal_node = - new (this) CallStaticJavaNode( tf, + new CallStaticJavaNode( tf, OptoRuntime::zap_dead_locals_stub(_method->flags().is_native()), "call zap dead locals stub", 0, TypePtr::BOTTOM); // We need to copy the OopMap from the site we're zapping at. @@ -368,7 +368,7 @@ void Compile::shorten_branches(uint* blk_starts, int& code_size, int& reloc_size // Step one, perform a pessimistic sizing pass. uint last_call_adr = max_juint; uint last_avoid_back_to_back_adr = max_juint; - uint nop_size = (new (this) MachNopNode())->size(_regalloc); + uint nop_size = (new MachNopNode())->size(_regalloc); for (uint i = 0; i < nblocks; i++) { // For all blocks Block* block = _cfg->get_block(i); @@ -1201,7 +1201,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { uint *call_returns = NEW_RESOURCE_ARRAY(uint, nblocks+1); uint return_offset = 0; - int nop_size = (new (this) MachNopNode())->size(_regalloc); + int nop_size = (new MachNopNode())->size(_regalloc); int previous_offset = 0; int current_offset = 0; @@ -1327,7 +1327,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { if(padding > 0) { assert((padding % nop_size) == 0, "padding is not a multiple of NOP size"); int nops_cnt = padding / nop_size; - MachNode *nop = new (this) MachNopNode(nops_cnt); + MachNode *nop = new MachNopNode(nops_cnt); block->insert_node(nop, j++); last_inst++; _cfg->map_node_to_block(nop, block); @@ -1413,7 +1413,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { assert((br_size - new_size) >= (int)nop_size, "short_branch size should be smaller"); // Insert padding between avoid_back_to_back branches. if (needs_padding && replacement->avoid_back_to_back(MachNode::AVOID_BEFORE)) { - MachNode *nop = new (this) MachNopNode(); + MachNode *nop = new MachNopNode(); block->insert_node(nop, j++); _cfg->map_node_to_block(nop, block); last_inst++; @@ -1573,7 +1573,7 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { Block *nb = _cfg->get_block(i + 1); int padding = nb->alignment_padding(current_offset); if( padding > 0 ) { - MachNode *nop = new (this) MachNopNode(padding / nop_size); + MachNode *nop = new MachNopNode(padding / nop_size); block->insert_node(nop, block->number_of_nodes()); _cfg->map_node_to_block(nop, block); nop->emit(*cb, _regalloc); @@ -1786,7 +1786,7 @@ Scheduling::Scheduling(Arena *arena, Compile &compile) #endif { // Create a MachNopNode - _nop = new (&compile) MachNopNode(); + _nop = new MachNopNode(); // Now that the nops are in the array, save the count // (but allow entries for the nops) @@ -2688,7 +2688,7 @@ void Scheduling::anti_do_def( Block *b, Node *def, OptoReg::Name def_reg, int is if ( _pinch_free_list.size() > 0) { pinch = _pinch_free_list.pop(); } else { - pinch = new (_cfg->C) Node(1); // Pinch point to-be + pinch = new Node(1); // Pinch point to-be } if (pinch->_idx >= _regalloc->node_regs_max_index()) { _cfg->C->record_method_not_compilable("too many D-U pinch points"); diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp index 6fea7130786..838c9b08d7b 100644 --- a/hotspot/src/share/vm/opto/parse1.cpp +++ b/hotspot/src/share/vm/opto/parse1.cpp @@ -109,10 +109,10 @@ Node *Parse::fetch_interpreter_state(int index, // doubles on Sparc. Intel can handle them just fine directly. Node *l; switch (bt) { // Signature is flattened - case T_INT: l = new (C) LoadINode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInt::INT, MemNode::unordered); break; - case T_FLOAT: l = new (C) LoadFNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::FLOAT, MemNode::unordered); break; - case T_ADDRESS: l = new (C) LoadPNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered); break; - case T_OBJECT: l = new (C) LoadPNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInstPtr::BOTTOM, MemNode::unordered); break; + case T_INT: l = new LoadINode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInt::INT, MemNode::unordered); break; + case T_FLOAT: l = new LoadFNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::FLOAT, MemNode::unordered); break; + case T_ADDRESS: l = new LoadPNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM, MemNode::unordered); break; + case T_OBJECT: l = new LoadPNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInstPtr::BOTTOM, MemNode::unordered); break; case T_LONG: case T_DOUBLE: { // Since arguments are in reverse order, the argument address 'adr' @@ -120,12 +120,12 @@ Node *Parse::fetch_interpreter_state(int index, adr = basic_plus_adr(local_addrs_base, local_addrs, -(index+1)*wordSize); if (Matcher::misaligned_doubles_ok) { l = (bt == T_DOUBLE) - ? (Node*)new (C) LoadDNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::DOUBLE, MemNode::unordered) - : (Node*)new (C) LoadLNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeLong::LONG, MemNode::unordered); + ? (Node*)new LoadDNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::DOUBLE, MemNode::unordered) + : (Node*)new LoadLNode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeLong::LONG, MemNode::unordered); } else { l = (bt == T_DOUBLE) - ? (Node*)new (C) LoadD_unalignedNode(ctl, mem, adr, TypeRawPtr::BOTTOM, MemNode::unordered) - : (Node*)new (C) LoadL_unalignedNode(ctl, mem, adr, TypeRawPtr::BOTTOM, MemNode::unordered); + ? (Node*)new LoadD_unalignedNode(ctl, mem, adr, TypeRawPtr::BOTTOM, MemNode::unordered) + : (Node*)new LoadL_unalignedNode(ctl, mem, adr, TypeRawPtr::BOTTOM, MemNode::unordered); } break; } @@ -149,11 +149,11 @@ Node* Parse::check_interpreter_type(Node* l, const Type* type, if (type == TypePtr::NULL_PTR || (tp != NULL && !tp->klass()->is_loaded())) { // Value must be null, not a real oop. - Node* chk = _gvn.transform( new (C) CmpPNode(l, null()) ); - Node* tst = _gvn.transform( new (C) BoolNode(chk, BoolTest::eq) ); + Node* chk = _gvn.transform( new CmpPNode(l, null()) ); + Node* tst = _gvn.transform( new BoolNode(chk, BoolTest::eq) ); IfNode* iff = create_and_map_if(control(), tst, PROB_MAX, COUNT_UNKNOWN); - set_control(_gvn.transform( new (C) IfTrueNode(iff) )); - Node* bad_type = _gvn.transform( new (C) IfFalseNode(iff) ); + set_control(_gvn.transform( new IfTrueNode(iff) )); + Node* bad_type = _gvn.transform( new IfFalseNode(iff) ); bad_type_exit->control()->add_req(bad_type); l = null(); } @@ -220,7 +220,7 @@ void Parse::load_interpreter_state(Node* osr_buf) { Node *monitors_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals+mcnt*2-1)*wordSize); for (index = 0; index < mcnt; index++) { // Make a BoxLockNode for the monitor. - Node *box = _gvn.transform(new (C) BoxLockNode(next_monitor())); + Node *box = _gvn.transform(new BoxLockNode(next_monitor())); // Displaced headers and locked objects are interleaved in the @@ -235,7 +235,7 @@ void Parse::load_interpreter_state(Node* osr_buf) { // Build a bogus FastLockNode (no code will be generated) and push the // monitor into our debug info. - const FastLockNode *flock = _gvn.transform(new (C) FastLockNode( 0, lock_object, box ))->as_FastLock(); + const FastLockNode *flock = _gvn.transform(new FastLockNode( 0, lock_object, box ))->as_FastLock(); map()->push_monitor(flock); // If the lock is our method synchronization lock, tuck it away in @@ -325,7 +325,7 @@ void Parse::load_interpreter_state(Node* osr_buf) { // Now that the interpreter state is loaded, make sure it will match // at execution time what the compiler is expecting now: SafePointNode* bad_type_exit = clone_map(); - bad_type_exit->set_control(new (C) RegionNode(1)); + bad_type_exit->set_control(new RegionNode(1)); assert(osr_block->flow()->jsrs()->size() == 0, "should be no jsrs live at osr point"); for (index = 0; index < max_locals; index++) { @@ -661,7 +661,7 @@ void Parse::do_all_blocks() { add_predicate(); // Add new region for back branches. int edges = block->pred_count() - block->preds_parsed() + 1; // +1 for original region - RegionNode *r = new (C) RegionNode(edges+1); + RegionNode *r = new RegionNode(edges+1); _gvn.set_type(r, Type::CONTROL); record_for_igvn(r); r->init_req(edges, control()); @@ -728,14 +728,14 @@ void Parse::build_exits() { _exits.clean_stack(_exits.sp()); _exits.sync_jvms(); - RegionNode* region = new (C) RegionNode(1); + RegionNode* region = new RegionNode(1); record_for_igvn(region); gvn().set_type_bottom(region); _exits.set_control(region); // Note: iophi and memphi are not transformed until do_exits. - Node* iophi = new (C) PhiNode(region, Type::ABIO); - Node* memphi = new (C) PhiNode(region, Type::MEMORY, TypePtr::BOTTOM); + Node* iophi = new PhiNode(region, Type::ABIO); + Node* memphi = new PhiNode(region, Type::MEMORY, TypePtr::BOTTOM); gvn().set_type_bottom(iophi); gvn().set_type_bottom(memphi); _exits.set_i_o(iophi); @@ -752,7 +752,7 @@ void Parse::build_exits() { ret_type = TypeOopPtr::BOTTOM; } int ret_size = type2size[ret_type->basic_type()]; - Node* ret_phi = new (C) PhiNode(region, ret_type); + Node* ret_phi = new PhiNode(region, ret_type); gvn().set_type_bottom(ret_phi); _exits.ensure_stack(ret_size); assert((int)(tf()->range()->cnt() - TypeFunc::Parms) == ret_size, "good tf range"); @@ -770,7 +770,7 @@ JVMState* Compile::build_start_state(StartNode* start, const TypeFunc* tf) { int arg_size = tf->domain()->cnt(); int max_size = MAX2(arg_size, (int)tf->range()->cnt()); JVMState* jvms = new (this) JVMState(max_size - TypeFunc::Parms); - SafePointNode* map = new (this) SafePointNode(max_size, NULL); + SafePointNode* map = new SafePointNode(max_size, NULL); record_for_igvn(map); assert(arg_size == TypeFunc::Parms + (is_osr_compilation() ? 1 : method()->arg_size()), "correct arg_size"); Node_Notes* old_nn = default_node_notes(); @@ -784,7 +784,7 @@ JVMState* Compile::build_start_state(StartNode* start, const TypeFunc* tf) { } uint i; for (i = 0; i < (uint)arg_size; i++) { - Node* parm = initial_gvn()->transform(new (this) ParmNode(start, i)); + Node* parm = initial_gvn()->transform(new ParmNode(start, i)); map->init_req(i, parm); // Record all these guys for later GVN. record_for_igvn(parm); @@ -815,7 +815,7 @@ Node_Notes* Parse::make_node_notes(Node_Notes* caller_nn) { //--------------------------return_values-------------------------------------- void Compile::return_values(JVMState* jvms) { GraphKit kit(jvms); - Node* ret = new (this) ReturnNode(TypeFunc::Parms, + Node* ret = new ReturnNode(TypeFunc::Parms, kit.control(), kit.i_o(), kit.reset_memory(), @@ -843,7 +843,7 @@ void Compile::rethrow_exceptions(JVMState* jvms) { // Load my combined exception state into the kit, with all phis transformed: SafePointNode* ex_map = kit.combine_and_pop_all_exception_states(); Node* ex_oop = kit.use_exception_state(ex_map); - RethrowNode* exit = new (this) RethrowNode(kit.control(), + RethrowNode* exit = new RethrowNode(kit.control(), kit.i_o(), kit.reset_memory(), kit.frameptr(), kit.returnadr(), // like a return but with exception input @@ -1065,7 +1065,7 @@ SafePointNode* Parse::create_entry_map() { // Create an initial safepoint to hold JVM state during parsing JVMState* jvms = new (C) JVMState(method(), _caller->has_method() ? _caller : NULL); - set_map(new (C) SafePointNode(len, jvms)); + set_map(new SafePointNode(len, jvms)); jvms->set_map(map()); record_for_igvn(map()); assert(jvms->endoff() == len, "correct jvms sizing"); @@ -1578,7 +1578,7 @@ void Parse::merge_common(Parse::Block* target, int pnum) { // later lazily. int edges = target->pred_count(); if (edges < pnum) edges = pnum; // might be a new path! - RegionNode *r = new (C) RegionNode(edges+1); + RegionNode *r = new RegionNode(edges+1); gvn().set_type(r, Type::CONTROL); record_for_igvn(r); // zap all inputs to NULL for debugging (done in Node(uint) constructor) @@ -1973,19 +1973,19 @@ void Parse::call_register_finalizer() { Node* access_flags_addr = basic_plus_adr(klass, klass, in_bytes(Klass::access_flags_offset())); Node* access_flags = make_load(NULL, access_flags_addr, TypeInt::INT, T_INT, MemNode::unordered); - Node* mask = _gvn.transform(new (C) AndINode(access_flags, intcon(JVM_ACC_HAS_FINALIZER))); - Node* check = _gvn.transform(new (C) CmpINode(mask, intcon(0))); - Node* test = _gvn.transform(new (C) BoolNode(check, BoolTest::ne)); + Node* mask = _gvn.transform(new AndINode(access_flags, intcon(JVM_ACC_HAS_FINALIZER))); + Node* check = _gvn.transform(new CmpINode(mask, intcon(0))); + Node* test = _gvn.transform(new BoolNode(check, BoolTest::ne)); IfNode* iff = create_and_map_if(control(), test, PROB_MAX, COUNT_UNKNOWN); - RegionNode* result_rgn = new (C) RegionNode(3); + RegionNode* result_rgn = new RegionNode(3); record_for_igvn(result_rgn); - Node *skip_register = _gvn.transform(new (C) IfFalseNode(iff)); + Node *skip_register = _gvn.transform(new IfFalseNode(iff)); result_rgn->init_req(1, skip_register); - Node *needs_register = _gvn.transform(new (C) IfTrueNode(iff)); + Node *needs_register = _gvn.transform(new IfTrueNode(iff)); set_control(needs_register); if (stopped()) { // There is no slow path. @@ -2039,9 +2039,9 @@ void Parse::rtm_deopt() { // or with ProfileRTM (cmp->in(2)) otherwise so that // the check will fold. Node* profile_state = makecon(TypeInt::make(ProfileRTM)); - Node* opq = _gvn.transform( new (C) Opaque3Node(C, rtm_state, Opaque3Node::RTM_OPT) ); - Node* chk = _gvn.transform( new (C) CmpINode(opq, profile_state) ); - Node* tst = _gvn.transform( new (C) BoolNode(chk, BoolTest::eq) ); + Node* opq = _gvn.transform( new Opaque3Node(C, rtm_state, Opaque3Node::RTM_OPT) ); + Node* chk = _gvn.transform( new CmpINode(opq, profile_state) ); + Node* tst = _gvn.transform( new BoolNode(chk, BoolTest::eq) ); // Branch to failure if state was changed { BuildCutout unless(this, tst, PROB_ALWAYS); uncommon_trap(Deoptimization::Reason_rtm_state_change, @@ -2066,10 +2066,10 @@ void Parse::decrement_age() { Node* mc_adr = makecon(adr_type); Node* cnt_adr = basic_plus_adr(mc_adr, mc_adr, in_bytes(MethodCounters::nmethod_age_offset())); Node* cnt = make_load(control(), cnt_adr, TypeInt::INT, T_INT, adr_type, MemNode::unordered); - Node* decr = _gvn.transform(new (C) SubINode(cnt, makecon(TypeInt::ONE))); + Node* decr = _gvn.transform(new SubINode(cnt, makecon(TypeInt::ONE))); store_to_memory(control(), cnt_adr, decr, T_INT, adr_type, MemNode::unordered); - Node *chk = _gvn.transform(new (C) CmpINode(decr, makecon(TypeInt::ZERO))); - Node* tst = _gvn.transform(new (C) BoolNode(chk, BoolTest::gt)); + Node *chk = _gvn.transform(new CmpINode(decr, makecon(TypeInt::ZERO))); + Node* tst = _gvn.transform(new BoolNode(chk, BoolTest::gt)); { BuildCutout unless(this, tst, PROB_ALWAYS); uncommon_trap(Deoptimization::Reason_tenured, Deoptimization::Action_make_not_entrant); @@ -2124,7 +2124,7 @@ void Parse::return_current(Node* value) { // sharpen the type eagerly; this eases certain assert checking if (tp->higher_equal(TypeInstPtr::NOTNULL)) tr = tr->join_speculative(TypeInstPtr::NOTNULL)->is_instptr(); - value = _gvn.transform(new (C) CheckCastPPNode(0,value,tr)); + value = _gvn.transform(new CheckCastPPNode(0,value,tr)); } } phi->add_req(value); @@ -2159,7 +2159,7 @@ void Parse::add_safepoint() { kill_dead_locals(); // Clone the JVM State - SafePointNode *sfpnt = new (C) SafePointNode(parms, NULL); + SafePointNode *sfpnt = new SafePointNode(parms, NULL); // Capture memory state BEFORE a SafePoint. Since we can block at a // SafePoint we need our GC state to be safe; i.e. we need all our current diff --git a/hotspot/src/share/vm/opto/parse2.cpp b/hotspot/src/share/vm/opto/parse2.cpp index 1f085a0223b..b1c42244641 100644 --- a/hotspot/src/share/vm/opto/parse2.cpp +++ b/hotspot/src/share/vm/opto/parse2.cpp @@ -130,9 +130,9 @@ Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) { Node* len = load_array_length(ary); // Test length vs index (standard trick using unsigned compare) - Node* chk = _gvn.transform( new (C) CmpUNode(idx, len) ); + Node* chk = _gvn.transform( new CmpUNode(idx, len) ); BoolTest::mask btest = BoolTest::lt; - tst = _gvn.transform( new (C) BoolNode(chk, btest) ); + tst = _gvn.transform( new BoolNode(chk, btest) ); } // Branch to failure if out of bounds { BuildCutout unless(this, tst, PROB_MAX); @@ -168,15 +168,15 @@ Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) { // returns IfNode IfNode* Parse::jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask) { - Node *cmp = _gvn.transform( new (C) CmpINode( a, b)); // two cases: shiftcount > 32 and shiftcount <= 32 - Node *tst = _gvn.transform( new (C) BoolNode( cmp, mask)); + Node *cmp = _gvn.transform( new CmpINode( a, b)); // two cases: shiftcount > 32 and shiftcount <= 32 + Node *tst = _gvn.transform( new BoolNode( cmp, mask)); IfNode *iff = create_and_map_if( control(), tst, ((mask == BoolTest::eq) ? PROB_STATIC_INFREQUENT : PROB_FAIR), COUNT_UNKNOWN ); return iff; } // return Region node Node* Parse::jump_if_join(Node* iffalse, Node* iftrue) { - Node *region = new (C) RegionNode(3); // 2 results + Node *region = new RegionNode(3); // 2 results record_for_igvn(region); region->init_req(1, iffalse); region->init_req(2, iftrue ); @@ -191,28 +191,28 @@ Node* Parse::jump_if_join(Node* iffalse, Node* iftrue) { void Parse::jump_if_true_fork(IfNode *iff, int dest_bci_if_true, int prof_table_index) { // True branch, use existing map info { PreserveJVMState pjvms(this); - Node *iftrue = _gvn.transform( new (C) IfTrueNode (iff) ); + Node *iftrue = _gvn.transform( new IfTrueNode (iff) ); set_control( iftrue ); profile_switch_case(prof_table_index); merge_new_path(dest_bci_if_true); } // False branch - Node *iffalse = _gvn.transform( new (C) IfFalseNode(iff) ); + Node *iffalse = _gvn.transform( new IfFalseNode(iff) ); set_control( iffalse ); } void Parse::jump_if_false_fork(IfNode *iff, int dest_bci_if_true, int prof_table_index) { // True branch, use existing map info { PreserveJVMState pjvms(this); - Node *iffalse = _gvn.transform( new (C) IfFalseNode (iff) ); + Node *iffalse = _gvn.transform( new IfFalseNode (iff) ); set_control( iffalse ); profile_switch_case(prof_table_index); merge_new_path(dest_bci_if_true); } // False branch - Node *iftrue = _gvn.transform( new (C) IfTrueNode(iff) ); + Node *iftrue = _gvn.transform( new IfTrueNode(iff) ); set_control( iftrue ); } @@ -440,14 +440,14 @@ bool Parse::create_jump_tables(Node* key_val, SwitchRange* lo, SwitchRange* hi) // Normalize table lookups to zero int lowval = lo->lo(); - key_val = _gvn.transform( new (C) SubINode(key_val, _gvn.intcon(lowval)) ); + key_val = _gvn.transform( new SubINode(key_val, _gvn.intcon(lowval)) ); // Generate a guard to protect against input keyvals that aren't // in the switch domain. if (needs_guard) { Node* size = _gvn.intcon(num_cases); - Node* cmp = _gvn.transform( new (C) CmpUNode(key_val, size) ); - Node* tst = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ge) ); + Node* cmp = _gvn.transform( new CmpUNode(key_val, size) ); + Node* tst = _gvn.transform( new BoolNode(cmp, BoolTest::ge) ); IfNode* iff = create_and_map_if( control(), tst, PROB_FAIR, COUNT_UNKNOWN); jump_if_true_fork(iff, default_dest, NullTableIndex); } @@ -460,21 +460,21 @@ bool Parse::create_jump_tables(Node* key_val, SwitchRange* lo, SwitchRange* hi) // Clean the 32-bit int into a real 64-bit offset. // Otherwise, the jint value 0 might turn into an offset of 0x0800000000. const TypeLong* lkeytype = TypeLong::make(CONST64(0), num_cases-1, Type::WidenMin); - key_val = _gvn.transform( new (C) ConvI2LNode(key_val, lkeytype) ); + key_val = _gvn.transform( new ConvI2LNode(key_val, lkeytype) ); #endif // Shift the value by wordsize so we have an index into the table, rather // than a switch value Node *shiftWord = _gvn.MakeConX(wordSize); - key_val = _gvn.transform( new (C) MulXNode( key_val, shiftWord)); + key_val = _gvn.transform( new MulXNode( key_val, shiftWord)); // Create the JumpNode - Node* jtn = _gvn.transform( new (C) JumpNode(control(), key_val, num_cases) ); + Node* jtn = _gvn.transform( new JumpNode(control(), key_val, num_cases) ); // These are the switch destinations hanging off the jumpnode int i = 0; for (SwitchRange* r = lo; r <= hi; r++) { for (int64_t j = r->lo(); j <= r->hi(); j++, i++) { - Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), (int)(j - lowval))); + Node* input = _gvn.transform(new JumpProjNode(jtn, i, r->dest(), (int)(j - lowval))); { PreserveJVMState pjvms(this); set_control(input); @@ -575,8 +575,8 @@ void Parse::jump_switch_ranges(Node* key_val, SwitchRange *lo, SwitchRange *hi, // two comparisons of same values--should enable 1 test for 2 branches // Use BoolTest::le instead of BoolTest::gt IfNode *iff_le = jump_if_fork_int(key_val, test_val, BoolTest::le); - Node *iftrue = _gvn.transform( new (C) IfTrueNode(iff_le) ); - Node *iffalse = _gvn.transform( new (C) IfFalseNode(iff_le) ); + Node *iftrue = _gvn.transform( new IfTrueNode(iff_le) ); + Node *iffalse = _gvn.transform( new IfFalseNode(iff_le) ); { PreserveJVMState pjvms(this); set_control(iffalse); jump_switch_ranges(key_val, mid+1, hi, switch_depth+1); @@ -592,8 +592,8 @@ void Parse::jump_switch_ranges(Node* key_val, SwitchRange *lo, SwitchRange *hi, if (mid == hi) { jump_if_true_fork(iff_ge, mid->dest(), mid->table_index()); } else { - Node *iftrue = _gvn.transform( new (C) IfTrueNode(iff_ge) ); - Node *iffalse = _gvn.transform( new (C) IfFalseNode(iff_ge) ); + Node *iftrue = _gvn.transform( new IfTrueNode(iff_ge) ); + Node *iffalse = _gvn.transform( new IfFalseNode(iff_ge) ); { PreserveJVMState pjvms(this); set_control(iftrue); jump_switch_ranges(key_val, mid, hi, switch_depth+1); @@ -648,7 +648,7 @@ void Parse::modf() { CAST_FROM_FN_PTR(address, SharedRuntime::frem), "frem", NULL, //no memory effects f1, f2); - Node* res = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms + 0)); + Node* res = _gvn.transform(new ProjNode(c, TypeFunc::Parms + 0)); push(res); } @@ -660,10 +660,10 @@ void Parse::modd() { CAST_FROM_FN_PTR(address, SharedRuntime::drem), "drem", NULL, //no memory effects d1, top(), d2, top()); - Node* res_d = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms + 0)); + Node* res_d = _gvn.transform(new ProjNode(c, TypeFunc::Parms + 0)); #ifdef ASSERT - Node* res_top = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms + 1)); + Node* res_top = _gvn.transform(new ProjNode(c, TypeFunc::Parms + 1)); assert(res_top == top(), "second value must be top"); #endif @@ -677,7 +677,7 @@ void Parse::l2f() { CAST_FROM_FN_PTR(address, SharedRuntime::l2f), "l2f", NULL, //no memory effects f1, f2); - Node* res = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms + 0)); + Node* res = _gvn.transform(new ProjNode(c, TypeFunc::Parms + 0)); push(res); } @@ -704,17 +704,17 @@ void Parse::do_irem() { // Sigh, must handle negative dividends Node *zero = _gvn.intcon(0); IfNode *ifff = jump_if_fork_int(a, zero, BoolTest::lt); - Node *iff = _gvn.transform( new (C) IfFalseNode(ifff) ); - Node *ift = _gvn.transform( new (C) IfTrueNode (ifff) ); + Node *iff = _gvn.transform( new IfFalseNode(ifff) ); + Node *ift = _gvn.transform( new IfTrueNode (ifff) ); Node *reg = jump_if_join(ift, iff); Node *phi = PhiNode::make(reg, NULL, TypeInt::INT); // Negative path; negate/and/negate - Node *neg = _gvn.transform( new (C) SubINode(zero, a) ); - Node *andn= _gvn.transform( new (C) AndINode(neg, mask) ); - Node *negn= _gvn.transform( new (C) SubINode(zero, andn) ); + Node *neg = _gvn.transform( new SubINode(zero, a) ); + Node *andn= _gvn.transform( new AndINode(neg, mask) ); + Node *negn= _gvn.transform( new SubINode(zero, andn) ); phi->init_req(1, negn); // Fast positive case - Node *andx = _gvn.transform( new (C) AndINode(a, mask) ); + Node *andx = _gvn.transform( new AndINode(a, mask) ); phi->init_req(2, andx); // Push the merge push( _gvn.transform(phi) ); @@ -723,7 +723,7 @@ void Parse::do_irem() { } } // Default case - push( _gvn.transform( new (C) ModINode(control(),a,b) ) ); + push( _gvn.transform( new ModINode(control(),a,b) ) ); } // Handle jsr and jsr_w bytecode @@ -1000,7 +1000,7 @@ void Parse::do_ifnull(BoolTest::mask btest, Node *c) { explicit_null_checks_inserted++; // Generate real control flow - Node *tst = _gvn.transform( new (C) BoolNode( c, btest ) ); + Node *tst = _gvn.transform( new BoolNode( c, btest ) ); // Sanity check the probability value assert(prob > 0.0f,"Bad probability in Parser"); @@ -1009,7 +1009,7 @@ void Parse::do_ifnull(BoolTest::mask btest, Node *c) { assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser"); // True branch { PreserveJVMState pjvms(this); - Node* iftrue = _gvn.transform( new (C) IfTrueNode (iff) ); + Node* iftrue = _gvn.transform( new IfTrueNode (iff) ); set_control(iftrue); if (stopped()) { // Path is dead? @@ -1029,7 +1029,7 @@ void Parse::do_ifnull(BoolTest::mask btest, Node *c) { } // False branch - Node* iffalse = _gvn.transform( new (C) IfFalseNode(iff) ); + Node* iffalse = _gvn.transform( new IfFalseNode(iff) ); set_control(iffalse); if (stopped()) { // Path is dead? @@ -1092,7 +1092,7 @@ void Parse::do_if(BoolTest::mask btest, Node* c) { } assert(btest != BoolTest::eq, "!= is the only canonical exact test"); - Node* tst0 = new (C) BoolNode(c, btest); + Node* tst0 = new BoolNode(c, btest); Node* tst = _gvn.transform(tst0); BoolTest::mask taken_btest = BoolTest::illegal; BoolTest::mask untaken_btest = BoolTest::illegal; @@ -1123,8 +1123,8 @@ void Parse::do_if(BoolTest::mask btest, Node* c) { float true_prob = (taken_if_true ? prob : untaken_prob); IfNode* iff = create_and_map_if(control(), tst, true_prob, cnt); assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser"); - Node* taken_branch = new (C) IfTrueNode(iff); - Node* untaken_branch = new (C) IfFalseNode(iff); + Node* taken_branch = new IfTrueNode(iff); + Node* untaken_branch = new IfFalseNode(iff); if (!taken_if_true) { // Finish conversion to canonical form Node* tmp = taken_branch; taken_branch = untaken_branch; @@ -1288,7 +1288,7 @@ void Parse::sharpen_type_after_if(BoolTest::mask btest, JVMState* jvms = this->jvms(); if (obj_in_map >= 0 && (jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) { - TypeNode* ccast = new (C) CheckCastPPNode(control(), obj, tboth); + TypeNode* ccast = new CheckCastPPNode(control(), obj, tboth); const Type* tcc = ccast->as_Type()->type(); assert(tcc != obj_type && tcc->higher_equal(obj_type), "must improve"); // Delay transform() call to allow recovery of pre-cast value @@ -1323,10 +1323,10 @@ void Parse::sharpen_type_after_if(BoolTest::mask btest, const Type* tboth = tcon->join_speculative(tval); if (tboth == tval) break; // Nothing to gain. if (tcon->isa_int()) { - ccast = new (C) CastIINode(val, tboth); + ccast = new CastIINode(val, tboth); } else if (tcon == TypePtr::NULL_PTR) { // Cast to null, but keep the pointer identity temporarily live. - ccast = new (C) CastPPNode(val, tboth); + ccast = new CastPPNode(val, tboth); } else { const TypeF* tf = tcon->isa_float_constant(); const TypeD* td = tcon->isa_double_constant(); @@ -1792,59 +1792,59 @@ void Parse::do_one_bytecode() { if (stopped()) return; b = pop(); a = pop(); - push( _gvn.transform( new (C) DivINode(control(),a,b) ) ); + push( _gvn.transform( new DivINode(control(),a,b) ) ); break; case Bytecodes::_imul: b = pop(); a = pop(); - push( _gvn.transform( new (C) MulINode(a,b) ) ); + push( _gvn.transform( new MulINode(a,b) ) ); break; case Bytecodes::_iadd: b = pop(); a = pop(); - push( _gvn.transform( new (C) AddINode(a,b) ) ); + push( _gvn.transform( new AddINode(a,b) ) ); break; case Bytecodes::_ineg: a = pop(); - push( _gvn.transform( new (C) SubINode(_gvn.intcon(0),a)) ); + push( _gvn.transform( new SubINode(_gvn.intcon(0),a)) ); break; case Bytecodes::_isub: b = pop(); a = pop(); - push( _gvn.transform( new (C) SubINode(a,b) ) ); + push( _gvn.transform( new SubINode(a,b) ) ); break; case Bytecodes::_iand: b = pop(); a = pop(); - push( _gvn.transform( new (C) AndINode(a,b) ) ); + push( _gvn.transform( new AndINode(a,b) ) ); break; case Bytecodes::_ior: b = pop(); a = pop(); - push( _gvn.transform( new (C) OrINode(a,b) ) ); + push( _gvn.transform( new OrINode(a,b) ) ); break; case Bytecodes::_ixor: b = pop(); a = pop(); - push( _gvn.transform( new (C) XorINode(a,b) ) ); + push( _gvn.transform( new XorINode(a,b) ) ); break; case Bytecodes::_ishl: b = pop(); a = pop(); - push( _gvn.transform( new (C) LShiftINode(a,b) ) ); + push( _gvn.transform( new LShiftINode(a,b) ) ); break; case Bytecodes::_ishr: b = pop(); a = pop(); - push( _gvn.transform( new (C) RShiftINode(a,b) ) ); + push( _gvn.transform( new RShiftINode(a,b) ) ); break; case Bytecodes::_iushr: b = pop(); a = pop(); - push( _gvn.transform( new (C) URShiftINode(a,b) ) ); + push( _gvn.transform( new URShiftINode(a,b) ) ); break; case Bytecodes::_fneg: a = pop(); - b = _gvn.transform(new (C) NegFNode (a)); + b = _gvn.transform(new NegFNode (a)); push(b); break; case Bytecodes::_fsub: b = pop(); a = pop(); - c = _gvn.transform( new (C) SubFNode(a,b) ); + c = _gvn.transform( new SubFNode(a,b) ); d = precision_rounding(c); push( d ); break; @@ -1852,7 +1852,7 @@ void Parse::do_one_bytecode() { case Bytecodes::_fadd: b = pop(); a = pop(); - c = _gvn.transform( new (C) AddFNode(a,b) ); + c = _gvn.transform( new AddFNode(a,b) ); d = precision_rounding(c); push( d ); break; @@ -1860,7 +1860,7 @@ void Parse::do_one_bytecode() { case Bytecodes::_fmul: b = pop(); a = pop(); - c = _gvn.transform( new (C) MulFNode(a,b) ); + c = _gvn.transform( new MulFNode(a,b) ); d = precision_rounding(c); push( d ); break; @@ -1868,7 +1868,7 @@ void Parse::do_one_bytecode() { case Bytecodes::_fdiv: b = pop(); a = pop(); - c = _gvn.transform( new (C) DivFNode(0,a,b) ); + c = _gvn.transform( new DivFNode(0,a,b) ); d = precision_rounding(c); push( d ); break; @@ -1878,7 +1878,7 @@ void Parse::do_one_bytecode() { // Generate a ModF node. b = pop(); a = pop(); - c = _gvn.transform( new (C) ModFNode(0,a,b) ); + c = _gvn.transform( new ModFNode(0,a,b) ); d = precision_rounding(c); push( d ); } @@ -1891,7 +1891,7 @@ void Parse::do_one_bytecode() { case Bytecodes::_fcmpl: b = pop(); a = pop(); - c = _gvn.transform( new (C) CmpF3Node( a, b)); + c = _gvn.transform( new CmpF3Node( a, b)); push(c); break; case Bytecodes::_fcmpg: @@ -1903,40 +1903,40 @@ void Parse::do_one_bytecode() { // as well by using CmpF3 which implements unordered-lesser instead of // unordered-greater semantics. Finally, commute the result bits. Result // is same as using a CmpF3Greater except we did it with CmpF3 alone. - c = _gvn.transform( new (C) CmpF3Node( b, a)); - c = _gvn.transform( new (C) SubINode(_gvn.intcon(0),c) ); + c = _gvn.transform( new CmpF3Node( b, a)); + c = _gvn.transform( new SubINode(_gvn.intcon(0),c) ); push(c); break; case Bytecodes::_f2i: a = pop(); - push(_gvn.transform(new (C) ConvF2INode(a))); + push(_gvn.transform(new ConvF2INode(a))); break; case Bytecodes::_d2i: a = pop_pair(); - b = _gvn.transform(new (C) ConvD2INode(a)); + b = _gvn.transform(new ConvD2INode(a)); push( b ); break; case Bytecodes::_f2d: a = pop(); - b = _gvn.transform( new (C) ConvF2DNode(a)); + b = _gvn.transform( new ConvF2DNode(a)); push_pair( b ); break; case Bytecodes::_d2f: a = pop_pair(); - b = _gvn.transform( new (C) ConvD2FNode(a)); + b = _gvn.transform( new ConvD2FNode(a)); // This breaks _227_mtrt (speed & correctness) and _222_mpegaudio (speed) - //b = _gvn.transform(new (C) RoundFloatNode(0, b) ); + //b = _gvn.transform(new RoundFloatNode(0, b) ); push( b ); break; case Bytecodes::_l2f: if (Matcher::convL2FSupported()) { a = pop_pair(); - b = _gvn.transform( new (C) ConvL2FNode(a)); + b = _gvn.transform( new ConvL2FNode(a)); // For i486.ad, FILD doesn't restrict precision to 24 or 53 bits. // Rather than storing the result into an FP register then pushing // out to memory to round, the machine instruction that implements @@ -1951,7 +1951,7 @@ void Parse::do_one_bytecode() { case Bytecodes::_l2d: a = pop_pair(); - b = _gvn.transform( new (C) ConvL2DNode(a)); + b = _gvn.transform( new ConvL2DNode(a)); // For i486.ad, rounding is always necessary (see _l2f above). // c = dprecision_rounding(b); c = _gvn.transform(b); @@ -1960,20 +1960,20 @@ void Parse::do_one_bytecode() { case Bytecodes::_f2l: a = pop(); - b = _gvn.transform( new (C) ConvF2LNode(a)); + b = _gvn.transform( new ConvF2LNode(a)); push_pair(b); break; case Bytecodes::_d2l: a = pop_pair(); - b = _gvn.transform( new (C) ConvD2LNode(a)); + b = _gvn.transform( new ConvD2LNode(a)); push_pair(b); break; case Bytecodes::_dsub: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) SubDNode(a,b) ); + c = _gvn.transform( new SubDNode(a,b) ); d = dprecision_rounding(c); push_pair( d ); break; @@ -1981,7 +1981,7 @@ void Parse::do_one_bytecode() { case Bytecodes::_dadd: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) AddDNode(a,b) ); + c = _gvn.transform( new AddDNode(a,b) ); d = dprecision_rounding(c); push_pair( d ); break; @@ -1989,7 +1989,7 @@ void Parse::do_one_bytecode() { case Bytecodes::_dmul: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) MulDNode(a,b) ); + c = _gvn.transform( new MulDNode(a,b) ); d = dprecision_rounding(c); push_pair( d ); break; @@ -1997,14 +1997,14 @@ void Parse::do_one_bytecode() { case Bytecodes::_ddiv: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) DivDNode(0,a,b) ); + c = _gvn.transform( new DivDNode(0,a,b) ); d = dprecision_rounding(c); push_pair( d ); break; case Bytecodes::_dneg: a = pop_pair(); - b = _gvn.transform(new (C) NegDNode (a)); + b = _gvn.transform(new NegDNode (a)); push_pair(b); break; @@ -2015,7 +2015,7 @@ void Parse::do_one_bytecode() { a = pop_pair(); // a % b - c = _gvn.transform( new (C) ModDNode(0,a,b) ); + c = _gvn.transform( new ModDNode(0,a,b) ); d = dprecision_rounding(c); push_pair( d ); } @@ -2028,7 +2028,7 @@ void Parse::do_one_bytecode() { case Bytecodes::_dcmpl: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) CmpD3Node( a, b)); + c = _gvn.transform( new CmpD3Node( a, b)); push(c); break; @@ -2041,8 +2041,8 @@ void Parse::do_one_bytecode() { // unordered-lesser instead of unordered-greater semantics. // Finally, negate the result bits. Result is same as using a // CmpD3Greater except we did it with CmpD3 alone. - c = _gvn.transform( new (C) CmpD3Node( b, a)); - c = _gvn.transform( new (C) SubINode(_gvn.intcon(0),c) ); + c = _gvn.transform( new CmpD3Node( b, a)); + c = _gvn.transform( new SubINode(_gvn.intcon(0),c) ); push(c); break; @@ -2051,44 +2051,44 @@ void Parse::do_one_bytecode() { case Bytecodes::_land: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) AndLNode(a,b) ); + c = _gvn.transform( new AndLNode(a,b) ); push_pair(c); break; case Bytecodes::_lor: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) OrLNode(a,b) ); + c = _gvn.transform( new OrLNode(a,b) ); push_pair(c); break; case Bytecodes::_lxor: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) XorLNode(a,b) ); + c = _gvn.transform( new XorLNode(a,b) ); push_pair(c); break; case Bytecodes::_lshl: b = pop(); // the shift count a = pop_pair(); // value to be shifted - c = _gvn.transform( new (C) LShiftLNode(a,b) ); + c = _gvn.transform( new LShiftLNode(a,b) ); push_pair(c); break; case Bytecodes::_lshr: b = pop(); // the shift count a = pop_pair(); // value to be shifted - c = _gvn.transform( new (C) RShiftLNode(a,b) ); + c = _gvn.transform( new RShiftLNode(a,b) ); push_pair(c); break; case Bytecodes::_lushr: b = pop(); // the shift count a = pop_pair(); // value to be shifted - c = _gvn.transform( new (C) URShiftLNode(a,b) ); + c = _gvn.transform( new URShiftLNode(a,b) ); push_pair(c); break; case Bytecodes::_lmul: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) MulLNode(a,b) ); + c = _gvn.transform( new MulLNode(a,b) ); push_pair(c); break; @@ -2100,7 +2100,7 @@ void Parse::do_one_bytecode() { if (stopped()) return; b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) ModLNode(control(),a,b) ); + c = _gvn.transform( new ModLNode(control(),a,b) ); push_pair(c); break; @@ -2112,20 +2112,20 @@ void Parse::do_one_bytecode() { if (stopped()) return; b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) DivLNode(control(),a,b) ); + c = _gvn.transform( new DivLNode(control(),a,b) ); push_pair(c); break; case Bytecodes::_ladd: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) AddLNode(a,b) ); + c = _gvn.transform( new AddLNode(a,b) ); push_pair(c); break; case Bytecodes::_lsub: b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) SubLNode(a,b) ); + c = _gvn.transform( new SubLNode(a,b) ); push_pair(c); break; case Bytecodes::_lcmp: @@ -2156,58 +2156,58 @@ void Parse::do_one_bytecode() { } b = pop_pair(); a = pop_pair(); - c = _gvn.transform( new (C) CmpL3Node( a, b )); + c = _gvn.transform( new CmpL3Node( a, b )); push(c); break; case Bytecodes::_lneg: a = pop_pair(); - b = _gvn.transform( new (C) SubLNode(longcon(0),a)); + b = _gvn.transform( new SubLNode(longcon(0),a)); push_pair(b); break; case Bytecodes::_l2i: a = pop_pair(); - push( _gvn.transform( new (C) ConvL2INode(a))); + push( _gvn.transform( new ConvL2INode(a))); break; case Bytecodes::_i2l: a = pop(); - b = _gvn.transform( new (C) ConvI2LNode(a)); + b = _gvn.transform( new ConvI2LNode(a)); push_pair(b); break; case Bytecodes::_i2b: // Sign extend a = pop(); - a = _gvn.transform( new (C) LShiftINode(a,_gvn.intcon(24)) ); - a = _gvn.transform( new (C) RShiftINode(a,_gvn.intcon(24)) ); + a = _gvn.transform( new LShiftINode(a,_gvn.intcon(24)) ); + a = _gvn.transform( new RShiftINode(a,_gvn.intcon(24)) ); push( a ); break; case Bytecodes::_i2s: a = pop(); - a = _gvn.transform( new (C) LShiftINode(a,_gvn.intcon(16)) ); - a = _gvn.transform( new (C) RShiftINode(a,_gvn.intcon(16)) ); + a = _gvn.transform( new LShiftINode(a,_gvn.intcon(16)) ); + a = _gvn.transform( new RShiftINode(a,_gvn.intcon(16)) ); push( a ); break; case Bytecodes::_i2c: a = pop(); - push( _gvn.transform( new (C) AndINode(a,_gvn.intcon(0xFFFF)) ) ); + push( _gvn.transform( new AndINode(a,_gvn.intcon(0xFFFF)) ) ); break; case Bytecodes::_i2f: a = pop(); - b = _gvn.transform( new (C) ConvI2FNode(a) ) ; + b = _gvn.transform( new ConvI2FNode(a) ) ; c = precision_rounding(b); push (b); break; case Bytecodes::_i2d: a = pop(); - b = _gvn.transform( new (C) ConvI2DNode(a)); + b = _gvn.transform( new ConvI2DNode(a)); push_pair(b); break; case Bytecodes::_iinc: // Increment local i = iter().get_index(); // Get local index - set_local( i, _gvn.transform( new (C) AddINode( _gvn.intcon(iter().get_iinc_con()), local(i) ) ) ); + set_local( i, _gvn.transform( new AddINode( _gvn.intcon(iter().get_iinc_con()), local(i) ) ) ); break; // Exit points of synchronized methods must have an unlock node @@ -2287,7 +2287,7 @@ void Parse::do_one_bytecode() { assert(null_ctl->is_top(), "no null control here"); dec_sp(1); } - c = _gvn.transform( new (C) CmpPNode(b, a) ); + c = _gvn.transform( new CmpPNode(b, a) ); do_ifnull(btest, c); break; @@ -2298,7 +2298,7 @@ void Parse::do_one_bytecode() { maybe_add_safepoint(iter().get_dest()); a = pop(); b = pop(); - c = _gvn.transform( new (C) CmpPNode(b, a) ); + c = _gvn.transform( new CmpPNode(b, a) ); c = optimize_cmp_with_klass(c); do_if(btest, c); break; @@ -2314,7 +2314,7 @@ void Parse::do_one_bytecode() { maybe_add_safepoint(iter().get_dest()); a = _gvn.intcon(0); b = pop(); - c = _gvn.transform( new (C) CmpINode(b, a) ); + c = _gvn.transform( new CmpINode(b, a) ); do_if(btest, c); break; @@ -2329,7 +2329,7 @@ void Parse::do_one_bytecode() { maybe_add_safepoint(iter().get_dest()); a = pop(); b = pop(); - c = _gvn.transform( new (C) CmpINode( b, a ) ); + c = _gvn.transform( new CmpINode( b, a ) ); do_if(btest, c); break; diff --git a/hotspot/src/share/vm/opto/parse3.cpp b/hotspot/src/share/vm/opto/parse3.cpp index b76eec74073..0f07506774e 100644 --- a/hotspot/src/share/vm/opto/parse3.cpp +++ b/hotspot/src/share/vm/opto/parse3.cpp @@ -552,7 +552,7 @@ void Parse::do_multianewarray() { } make_slow_call_ex(c, env()->Throwable_klass(), false); - Node* res = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms)); + Node* res = _gvn.transform(new ProjNode(c, TypeFunc::Parms)); const Type* type = TypeOopPtr::make_from_klass_raw(array_klass); @@ -566,7 +566,7 @@ void Parse::do_multianewarray() { // We cannot sharpen the nested sub-arrays, since the top level is mutable. - Node* cast = _gvn.transform( new (C) CheckCastPPNode(control(), res, type) ); + Node* cast = _gvn.transform( new CheckCastPPNode(control(), res, type) ); push(cast); // Possible improvements: diff --git a/hotspot/src/share/vm/opto/parseHelper.cpp b/hotspot/src/share/vm/opto/parseHelper.cpp index 729a038d873..45d627d2500 100644 --- a/hotspot/src/share/vm/opto/parseHelper.cpp +++ b/hotspot/src/share/vm/opto/parseHelper.cpp @@ -43,7 +43,7 @@ void GraphKit::make_dtrace_method_entry_exit(ciMethod* method, bool is_entry) { const char *call_name = is_entry ? "dtrace_method_entry" : "dtrace_method_exit"; // Get base of thread-local storage area - Node* thread = _gvn.transform( new (C) ThreadLocalNode() ); + Node* thread = _gvn.transform( new ThreadLocalNode() ); // Get method const TypePtr* method_type = TypeMetadataPtr::make(method); @@ -175,8 +175,8 @@ void Parse::array_store_check() { // Make a constant out of the inexact array klass const TypeKlassPtr *extak = tak->cast_to_exactness(true)->is_klassptr(); Node* con = makecon(extak); - Node* cmp = _gvn.transform(new (C) CmpPNode( array_klass, con )); - Node* bol = _gvn.transform(new (C) BoolNode( cmp, BoolTest::eq )); + Node* cmp = _gvn.transform(new CmpPNode( array_klass, con )); + Node* bol = _gvn.transform(new BoolNode( cmp, BoolTest::eq )); Node* ctrl= control(); { BuildCutout unless(this, bol, PROB_MAX); uncommon_trap(Deoptimization::Reason_array_check, @@ -215,8 +215,8 @@ void Parse::emit_guard_for_new(ciInstanceKlass* klass) { // if (klass->_init_thread != current_thread || // klass->_init_state != being_initialized) // uncommon_trap - Node* cur_thread = _gvn.transform( new (C) ThreadLocalNode() ); - Node* merge = new (C) RegionNode(3); + Node* cur_thread = _gvn.transform( new ThreadLocalNode() ); + Node* merge = new RegionNode(3); _gvn.set_type(merge, Type::CONTROL); Node* kls = makecon(TypeKlassPtr::make(klass)); @@ -327,9 +327,9 @@ void Parse::test_counter_against_threshold(Node* cnt, int limit) { // Test invocation count vs threshold Node *threshold = makecon(TypeInt::make(limit)); - Node *chk = _gvn.transform( new (C) CmpUNode( cnt, threshold) ); + Node *chk = _gvn.transform( new CmpUNode( cnt, threshold) ); BoolTest::mask btest = BoolTest::lt; - Node *tst = _gvn.transform( new (C) BoolNode( chk, btest) ); + Node *tst = _gvn.transform( new BoolNode( chk, btest) ); // Branch to failure if threshold exceeded { BuildCutout unless(this, tst, PROB_ALWAYS); uncommon_trap(Deoptimization::Reason_age, @@ -359,7 +359,7 @@ void Parse::increment_and_test_invocation_counter(int limit) { test_counter_against_threshold(cnt, limit); // Add one to the counter and store - Node* incr = _gvn.transform(new (C) AddINode(cnt, _gvn.intcon(1))); + Node* incr = _gvn.transform(new AddINode(cnt, _gvn.intcon(1))); store_to_memory(ctrl, adr_iic_node, incr, T_INT, adr_type, MemNode::unordered); } @@ -380,8 +380,8 @@ Node* Parse::method_data_addressing(ciMethodData* md, ciProfileData* data, ByteS if (stride != 0) { Node* str = _gvn.MakeConX(stride); - Node* scale = _gvn.transform( new (C) MulXNode( idx, str ) ); - ptr = _gvn.transform( new (C) AddPNode( mdo, ptr, scale ) ); + Node* scale = _gvn.transform( new MulXNode( idx, str ) ); + ptr = _gvn.transform( new AddPNode( mdo, ptr, scale ) ); } return ptr; @@ -393,7 +393,7 @@ void Parse::increment_md_counter_at(ciMethodData* md, ciProfileData* data, ByteS const TypePtr* adr_type = _gvn.type(adr_node)->is_ptr(); Node* cnt = make_load(NULL, adr_node, TypeInt::INT, T_INT, adr_type, MemNode::unordered); - Node* incr = _gvn.transform(new (C) AddINode(cnt, _gvn.intcon(DataLayout::counter_increment))); + Node* incr = _gvn.transform(new AddINode(cnt, _gvn.intcon(DataLayout::counter_increment))); store_to_memory(NULL, adr_node, incr, T_INT, adr_type, MemNode::unordered); } @@ -413,7 +413,7 @@ void Parse::set_md_flag_at(ciMethodData* md, ciProfileData* data, int flag_const const TypePtr* adr_type = _gvn.type(adr_node)->is_ptr(); Node* flags = make_load(NULL, adr_node, TypeInt::BYTE, T_BYTE, adr_type, MemNode::unordered); - Node* incr = _gvn.transform(new (C) OrINode(flags, _gvn.intcon(flag_constant))); + Node* incr = _gvn.transform(new OrINode(flags, _gvn.intcon(flag_constant))); store_to_memory(NULL, adr_node, incr, T_BYTE, adr_type, MemNode::unordered); } diff --git a/hotspot/src/share/vm/opto/phaseX.cpp b/hotspot/src/share/vm/opto/phaseX.cpp index 4635342e678..5b2771e83ef 100644 --- a/hotspot/src/share/vm/opto/phaseX.cpp +++ b/hotspot/src/share/vm/opto/phaseX.cpp @@ -47,7 +47,7 @@ NodeHash::NodeHash(uint est_max_size) : _total_insert_probes(0), _total_inserts(0), _insert_probes(0), _grows(0) { // _sentinel must be in the current node space - _sentinel = new (Compile::current()) ProjNode(NULL, TypeFunc::Control); + _sentinel = new ProjNode(NULL, TypeFunc::Control); memset(_table,0,sizeof(Node*)*_max); } @@ -62,7 +62,7 @@ NodeHash::NodeHash(Arena *arena, uint est_max_size) : _total_insert_probes(0), _total_inserts(0), _insert_probes(0), _grows(0) { // _sentinel must be in the current node space - _sentinel = new (Compile::current()) ProjNode(NULL, TypeFunc::Control); + _sentinel = new ProjNode(NULL, TypeFunc::Control); memset(_table,0,sizeof(Node*)*_max); } @@ -1309,7 +1309,7 @@ void PhaseIterGVN::subsume_node( Node *old, Node *nn ) { } // Smash all inputs to 'old', isolating him completely - Node *temp = new (C) Node(1); + Node *temp = new Node(1); temp->init_req(0,nn); // Add a use to nn to prevent him from dying remove_dead_node( old ); temp->del_req(0); // Yank bogus edge diff --git a/hotspot/src/share/vm/opto/reg_split.cpp b/hotspot/src/share/vm/opto/reg_split.cpp index 7ec346bc6a9..7c47b4c0065 100644 --- a/hotspot/src/share/vm/opto/reg_split.cpp +++ b/hotspot/src/share/vm/opto/reg_split.cpp @@ -93,7 +93,7 @@ Node *PhaseChaitin::get_spillcopy_wide(MachSpillCopyNode::SpillType spill_type, // Here we assume a trip through memory is required. w_i_mask = &C->FIRST_STACK_mask(); } - return new (C) MachSpillCopyNode(spill_type, def, *w_i_mask, *w_o_mask ); + return new MachSpillCopyNode(spill_type, def, *w_i_mask, *w_o_mask ); } //------------------------------insert_proj------------------------------------ @@ -663,7 +663,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { // create a new phi node and insert it into the block // type is taken from left over pointer to a predecessor assert(n3,"No non-NULL reaching DEF for a Phi"); - phi = new (C) PhiNode(b->head(), n3->bottom_type()); + phi = new PhiNode(b->head(), n3->bottom_type()); // initialize the Reaches entry for this LRG Reachblock[slidx] = phi; @@ -1075,7 +1075,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { // First Split-UP to move value into Register uint def_ideal = def->ideal_reg(); const RegMask* tmp_rm = Matcher::idealreg2regmask[def_ideal]; - Node *spill = new (C) MachSpillCopyNode(MachSpillCopyNode::MemToReg, def, dmask, *tmp_rm); + Node *spill = new MachSpillCopyNode(MachSpillCopyNode::MemToReg, def, dmask, *tmp_rm); insert_proj( b, insidx, spill, maxlrg ); // Then Split-DOWN as if previous Split was DEF maxlrg = split_USE(MachSpillCopyNode::RegToMem, spill,b,n,inpidx,maxlrg,false,false, splits,slidx); @@ -1229,7 +1229,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) { if (C->check_node_count(NodeLimitFudgeFactor, out_of_nodes)) { // Check when generating nodes return 0; } - Node *spill = new (C) MachSpillCopyNode(MachSpillCopyNode::MemToReg, use,use_rm,def_rm); + Node *spill = new MachSpillCopyNode(MachSpillCopyNode::MemToReg, use,use_rm,def_rm); n->set_req(copyidx,spill); n->as_MachSpillCopy()->set_in_RegMask(def_rm); // Put the spill just before the copy diff --git a/hotspot/src/share/vm/opto/split_if.cpp b/hotspot/src/share/vm/opto/split_if.cpp index 9b99313f2ac..40a762b03a3 100644 --- a/hotspot/src/share/vm/opto/split_if.cpp +++ b/hotspot/src/share/vm/opto/split_if.cpp @@ -35,7 +35,7 @@ Node *PhaseIdealLoop::split_thru_region( Node *n, Node *region ) { uint wins = 0; assert( n->is_CFG(), "" ); assert( region->is_Region(), "" ); - Node *r = new (C) RegionNode( region->req() ); + Node *r = new RegionNode( region->req() ); IdealLoopTree *loop = get_loop( n ); for( uint i = 1; i < region->req(); i++ ) { Node *x = n->clone(); diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp index b00bb881faa..fcca4684833 100644 --- a/hotspot/src/share/vm/opto/stringopts.cpp +++ b/hotspot/src/share/vm/opto/stringopts.cpp @@ -70,7 +70,7 @@ class StringConcat : public ResourceObj { _multiple(false), _string_alloc(NULL), _stringopts(stringopts) { - _arguments = new (_stringopts->C) Node(1); + _arguments = new Node(1); _arguments->del_req(0); } @@ -228,8 +228,8 @@ class StringConcat : public ResourceObj { const TypeFunc* call_type = OptoRuntime::uncommon_trap_Type(); const TypePtr* no_memory_effects = NULL; Compile* C = _stringopts->C; - CallStaticJavaNode* call = new (C) CallStaticJavaNode(call_type, call_addr, "uncommon_trap", - jvms->bci(), no_memory_effects); + CallStaticJavaNode* call = new CallStaticJavaNode(call_type, call_addr, "uncommon_trap", + jvms->bci(), no_memory_effects); for (int e = 0; e < TypeFunc::Parms; e++) { call->init_req(e, uct->in(e)); } @@ -1127,9 +1127,9 @@ Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) { } Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) { - RegionNode *final_merge = new (C) RegionNode(3); + RegionNode *final_merge = new RegionNode(3); kit.gvn().set_type(final_merge, Type::CONTROL); - Node* final_size = new (C) PhiNode(final_merge, TypeInt::INT); + Node* final_size = new PhiNode(final_merge, TypeInt::INT); kit.gvn().set_type(final_size, TypeInt::INT); IfNode* iff = kit.create_and_map_if(kit.control(), @@ -1146,11 +1146,11 @@ Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) { } else { // int size = (i < 0) ? stringSize(-i) + 1 : stringSize(i); - RegionNode *r = new (C) RegionNode(3); + RegionNode *r = new RegionNode(3); kit.gvn().set_type(r, Type::CONTROL); - Node *phi = new (C) PhiNode(r, TypeInt::INT); + Node *phi = new PhiNode(r, TypeInt::INT); kit.gvn().set_type(phi, TypeInt::INT); - Node *size = new (C) PhiNode(r, TypeInt::INT); + Node *size = new PhiNode(r, TypeInt::INT); kit.gvn().set_type(size, TypeInt::INT); Node* chk = __ CmpI(arg, __ intcon(0)); Node* p = __ Bool(chk, BoolTest::lt); @@ -1175,11 +1175,11 @@ Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) { // Add loop predicate first. kit.add_predicate(); - RegionNode *loop = new (C) RegionNode(3); + RegionNode *loop = new RegionNode(3); loop->init_req(1, kit.control()); kit.gvn().set_type(loop, Type::CONTROL); - Node *index = new (C) PhiNode(loop, TypeInt::INT); + Node *index = new PhiNode(loop, TypeInt::INT); index->init_req(1, __ intcon(0)); kit.gvn().set_type(index, TypeInt::INT); kit.set_control(loop); @@ -1212,7 +1212,7 @@ Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) { } void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, Node* start, Node* end) { - RegionNode *final_merge = new (C) RegionNode(4); + RegionNode *final_merge = new RegionNode(4); kit.gvn().set_type(final_merge, Type::CONTROL); Node *final_mem = PhiNode::make(final_merge, kit.memory(char_adr_idx), Type::MEMORY, TypeAryPtr::CHARS); kit.gvn().set_type(final_mem, Type::MEMORY); @@ -1262,11 +1262,11 @@ void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, N __ Bool(__ CmpI(arg, __ intcon(0)), BoolTest::lt), PROB_FAIR, COUNT_UNKNOWN); - RegionNode *merge = new (C) RegionNode(3); + RegionNode *merge = new RegionNode(3); kit.gvn().set_type(merge, Type::CONTROL); - i = new (C) PhiNode(merge, TypeInt::INT); + i = new PhiNode(merge, TypeInt::INT); kit.gvn().set_type(i, TypeInt::INT); - sign = new (C) PhiNode(merge, TypeInt::INT); + sign = new PhiNode(merge, TypeInt::INT); kit.gvn().set_type(sign, TypeInt::INT); merge->init_req(1, __ IfTrue(iff)); @@ -1295,10 +1295,10 @@ void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, N // Add loop predicate first. kit.add_predicate(); - RegionNode *head = new (C) RegionNode(3); + RegionNode *head = new RegionNode(3); head->init_req(1, kit.control()); kit.gvn().set_type(head, Type::CONTROL); - Node *i_phi = new (C) PhiNode(head, TypeInt::INT); + Node *i_phi = new PhiNode(head, TypeInt::INT); i_phi->init_req(1, i); kit.gvn().set_type(i_phi, TypeInt::INT); charPos = PhiNode::make(head, charPos); @@ -1420,7 +1420,7 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) { // as a shim for the insertion of the new code. JVMState* jvms = sc->begin()->jvms()->clone_shallow(C); uint size = sc->begin()->req(); - SafePointNode* map = new (C) SafePointNode(size, jvms); + SafePointNode* map = new SafePointNode(size, jvms); // copy the control and memory state from the final call into our // new starting state. This allows any preceeding tests to feed @@ -1465,12 +1465,12 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) { // Create a region for the overflow checks to merge into. int args = MAX2(sc->num_arguments(), 1); - RegionNode* overflow = new (C) RegionNode(args); + RegionNode* overflow = new RegionNode(args); kit.gvn().set_type(overflow, Type::CONTROL); // Create a hook node to hold onto the individual sizes since they // are need for the copying phase. - Node* string_sizes = new (C) Node(args); + Node* string_sizes = new Node(args); Node* length = __ intcon(0); for (int argi = 0; argi < sc->num_arguments(); argi++) { @@ -1514,9 +1514,9 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) { } else if (!type->higher_equal(TypeInstPtr::NOTNULL)) { // s = s != null ? s : "null"; // length = length + (s.count - s.offset); - RegionNode *r = new (C) RegionNode(3); + RegionNode *r = new RegionNode(3); kit.gvn().set_type(r, Type::CONTROL); - Node *phi = new (C) PhiNode(r, type); + Node *phi = new PhiNode(r, type); kit.gvn().set_type(phi, phi->bottom_type()); Node* p = __ Bool(__ CmpP(arg, kit.null()), BoolTest::ne); IfNode* iff = kit.create_and_map_if(kit.control(), p, PROB_MIN, COUNT_UNKNOWN); diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp index ae41bee47ae..e5f24b6ca6c 100644 --- a/hotspot/src/share/vm/opto/subnode.cpp +++ b/hotspot/src/share/vm/opto/subnode.cpp @@ -159,7 +159,7 @@ Node *SubINode::Ideal(PhaseGVN *phase, bool can_reshape){ if( t2->base() == Type::Int ){ // Might be bottom or top... const TypeInt *i = t2->is_int(); if( i->is_con() ) - return new (phase->C) AddINode(in1, phase->intcon(-i->get_con())); + return new AddINode(in1, phase->intcon(-i->get_con())); } // Convert "(x+c0) - y" into (x-y) + c0" @@ -168,8 +168,8 @@ Node *SubINode::Ideal(PhaseGVN *phase, bool can_reshape){ if( op1 == Op_AddI && ok_to_convert(in1, in2) ) { const Type *tadd = phase->type( in1->in(2) ); if( tadd->singleton() && tadd != Type::TOP ) { - Node *sub2 = phase->transform( new (phase->C) SubINode( in1->in(1), in2 )); - return new (phase->C) AddINode( sub2, in1->in(2) ); + Node *sub2 = phase->transform( new SubINode( in1->in(1), in2 )); + return new AddINode( sub2, in1->in(2) ); } } @@ -181,9 +181,9 @@ Node *SubINode::Ideal(PhaseGVN *phase, bool can_reshape){ Node* in22 = in2->in(2); const TypeInt* tcon = phase->type(in22)->isa_int(); if (tcon != NULL && tcon->is_con()) { - Node* sub2 = phase->transform( new (phase->C) SubINode(in1, in21) ); + Node* sub2 = phase->transform( new SubINode(in1, in21) ); Node* neg_c0 = phase->intcon(- tcon->get_con()); - return new (phase->C) AddINode(sub2, neg_c0); + return new AddINode(sub2, neg_c0); } } @@ -201,47 +201,47 @@ Node *SubINode::Ideal(PhaseGVN *phase, bool can_reshape){ // Convert "x - (x+y)" into "-y" if( op2 == Op_AddI && phase->eqv( in1, in2->in(1) ) ) - return new (phase->C) SubINode( phase->intcon(0),in2->in(2)); + return new SubINode( phase->intcon(0),in2->in(2)); // Convert "(x-y) - x" into "-y" if( op1 == Op_SubI && phase->eqv( in1->in(1), in2 ) ) - return new (phase->C) SubINode( phase->intcon(0),in1->in(2)); + return new SubINode( phase->intcon(0),in1->in(2)); // Convert "x - (y+x)" into "-y" if( op2 == Op_AddI && phase->eqv( in1, in2->in(2) ) ) - return new (phase->C) SubINode( phase->intcon(0),in2->in(1)); + return new SubINode( phase->intcon(0),in2->in(1)); // Convert "0 - (x-y)" into "y-x" if( t1 == TypeInt::ZERO && op2 == Op_SubI ) - return new (phase->C) SubINode( in2->in(2), in2->in(1) ); + return new SubINode( in2->in(2), in2->in(1) ); // Convert "0 - (x+con)" into "-con-x" jint con; if( t1 == TypeInt::ZERO && op2 == Op_AddI && (con = in2->in(2)->find_int_con(0)) != 0 ) - return new (phase->C) SubINode( phase->intcon(-con), in2->in(1) ); + return new SubINode( phase->intcon(-con), in2->in(1) ); // Convert "(X+A) - (X+B)" into "A - B" if( op1 == Op_AddI && op2 == Op_AddI && in1->in(1) == in2->in(1) ) - return new (phase->C) SubINode( in1->in(2), in2->in(2) ); + return new SubINode( in1->in(2), in2->in(2) ); // Convert "(A+X) - (B+X)" into "A - B" if( op1 == Op_AddI && op2 == Op_AddI && in1->in(2) == in2->in(2) ) - return new (phase->C) SubINode( in1->in(1), in2->in(1) ); + return new SubINode( in1->in(1), in2->in(1) ); // Convert "(A+X) - (X+B)" into "A - B" if( op1 == Op_AddI && op2 == Op_AddI && in1->in(2) == in2->in(1) ) - return new (phase->C) SubINode( in1->in(1), in2->in(2) ); + return new SubINode( in1->in(1), in2->in(2) ); // Convert "(X+A) - (B+X)" into "A - B" if( op1 == Op_AddI && op2 == Op_AddI && in1->in(1) == in2->in(2) ) - return new (phase->C) SubINode( in1->in(2), in2->in(1) ); + return new SubINode( in1->in(2), in2->in(1) ); // Convert "A-(B-C)" into (A+C)-B", since add is commutative and generally // nicer to optimize than subtract. if( op2 == Op_SubI && in2->outcnt() == 1) { - Node *add1 = phase->transform( new (phase->C) AddINode( in1, in2->in(2) ) ); - return new (phase->C) SubINode( add1, in2->in(1) ); + Node *add1 = phase->transform( new AddINode( in1, in2->in(2) ) ); + return new SubINode( add1, in2->in(1) ); } return NULL; @@ -288,7 +288,7 @@ Node *SubLNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Convert "x-c0" into "x+ -c0". if( i && // Might be bottom or top... i->is_con() ) - return new (phase->C) AddLNode(in1, phase->longcon(-i->get_con())); + return new AddLNode(in1, phase->longcon(-i->get_con())); // Convert "(x+c0) - y" into (x-y) + c0" // Do not collapse (x+c0)-y if "+" is a loop increment or @@ -297,8 +297,8 @@ Node *SubLNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node *in11 = in1->in(1); const Type *tadd = phase->type( in1->in(2) ); if( tadd->singleton() && tadd != Type::TOP ) { - Node *sub2 = phase->transform( new (phase->C) SubLNode( in11, in2 )); - return new (phase->C) AddLNode( sub2, in1->in(2) ); + Node *sub2 = phase->transform( new SubLNode( in11, in2 )); + return new AddLNode( sub2, in1->in(2) ); } } @@ -309,9 +309,9 @@ Node *SubLNode::Ideal(PhaseGVN *phase, bool can_reshape) { Node* in22 = in2->in(2); const TypeLong* tcon = phase->type(in22)->isa_long(); if (tcon != NULL && tcon->is_con()) { - Node* sub2 = phase->transform( new (phase->C) SubLNode(in1, in21) ); + Node* sub2 = phase->transform( new SubLNode(in1, in21) ); Node* neg_c0 = phase->longcon(- tcon->get_con()); - return new (phase->C) AddLNode(sub2, neg_c0); + return new AddLNode(sub2, neg_c0); } } @@ -329,28 +329,28 @@ Node *SubLNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Convert "x - (x+y)" into "-y" if( op2 == Op_AddL && phase->eqv( in1, in2->in(1) ) ) - return new (phase->C) SubLNode( phase->makecon(TypeLong::ZERO), in2->in(2)); + return new SubLNode( phase->makecon(TypeLong::ZERO), in2->in(2)); // Convert "x - (y+x)" into "-y" if( op2 == Op_AddL && phase->eqv( in1, in2->in(2) ) ) - return new (phase->C) SubLNode( phase->makecon(TypeLong::ZERO),in2->in(1)); + return new SubLNode( phase->makecon(TypeLong::ZERO),in2->in(1)); // Convert "0 - (x-y)" into "y-x" if( phase->type( in1 ) == TypeLong::ZERO && op2 == Op_SubL ) - return new (phase->C) SubLNode( in2->in(2), in2->in(1) ); + return new SubLNode( in2->in(2), in2->in(1) ); // Convert "(X+A) - (X+B)" into "A - B" if( op1 == Op_AddL && op2 == Op_AddL && in1->in(1) == in2->in(1) ) - return new (phase->C) SubLNode( in1->in(2), in2->in(2) ); + return new SubLNode( in1->in(2), in2->in(2) ); // Convert "(A+X) - (B+X)" into "A - B" if( op1 == Op_AddL && op2 == Op_AddL && in1->in(2) == in2->in(2) ) - return new (phase->C) SubLNode( in1->in(1), in2->in(1) ); + return new SubLNode( in1->in(1), in2->in(1) ); // Convert "A-(B-C)" into (A+C)-B" if( op2 == Op_SubL && in2->outcnt() == 1) { - Node *add1 = phase->transform( new (phase->C) AddLNode( in1, in2->in(2) ) ); - return new (phase->C) SubLNode( add1, in2->in(1) ); + Node *add1 = phase->transform( new AddLNode( in1, in2->in(2) ) ); + return new SubLNode( add1, in2->in(1) ); } return NULL; @@ -417,7 +417,7 @@ Node *SubFNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Convert "x - (x+y)" into "-y" if( in(2)->is_Add() && phase->eqv(in(1),in(2)->in(1) ) ) - return new (phase->C) SubFNode( phase->makecon(TypeF::ZERO),in(2)->in(2)); + return new SubFNode( phase->makecon(TypeF::ZERO),in(2)->in(2)); } // Cannot replace 0.0-X with -X because a 'fsub' bytecode computes @@ -460,7 +460,7 @@ Node *SubDNode::Ideal(PhaseGVN *phase, bool can_reshape){ // Convert "x - (x+y)" into "-y" if( in(2)->is_Add() && phase->eqv(in(1),in(2)->in(1) ) ) - return new (phase->C) SubDNode( phase->makecon(TypeD::ZERO),in(2)->in(2)); + return new SubDNode( phase->makecon(TypeD::ZERO),in(2)->in(2)); } // Cannot replace 0.0-X with -X because a 'dsub' bytecode computes @@ -666,11 +666,11 @@ Node *CmpINode::Ideal( PhaseGVN *phase, bool can_reshape ) { if (phase->type(in(2))->higher_equal(TypeInt::ZERO)) { switch (in(1)->Opcode()) { case Op_CmpL3: // Collapse a CmpL3/CmpI into a CmpL - return new (phase->C) CmpLNode(in(1)->in(1),in(1)->in(2)); + return new CmpLNode(in(1)->in(1),in(1)->in(2)); case Op_CmpF3: // Collapse a CmpF3/CmpI into a CmpF - return new (phase->C) CmpFNode(in(1)->in(1),in(1)->in(2)); + return new CmpFNode(in(1)->in(1),in(1)->in(2)); case Op_CmpD3: // Collapse a CmpD3/CmpI into a CmpD - return new (phase->C) CmpDNode(in(1)->in(1),in(1)->in(2)); + return new CmpDNode(in(1)->in(1),in(1)->in(2)); //case Op_SubI: // If (x - y) cannot overflow, then ((x - y) 0) // can be turned into (x y). @@ -1109,8 +1109,8 @@ Node *CmpDNode::Ideal(PhaseGVN *phase, bool can_reshape){ new_in2 = tmp; } CmpFNode *new_cmp = (Opcode() == Op_CmpD3) - ? new (phase->C) CmpF3Node( new_in1, new_in2 ) - : new (phase->C) CmpFNode ( new_in1, new_in2 ) ; + ? new CmpF3Node( new_in1, new_in2 ) + : new CmpFNode ( new_in1, new_in2 ) ; return new_cmp; // Changed to CmpFNode } // Testing value required the precision of a double @@ -1182,9 +1182,9 @@ Node* BoolNode::make_predicate(Node* test_value, PhaseGVN* phase) { // Else fall through. The CMove gets in the way of the test. // It should be the case that make_predicate(bol->as_int_value()) == bol. } - Node* cmp = new (C) CmpINode(test_value, phase->intcon(0)); + Node* cmp = new CmpINode(test_value, phase->intcon(0)); cmp = phase->transform(cmp); - Node* bol = new (C) BoolNode(cmp, BoolTest::ne); + Node* bol = new BoolNode(cmp, BoolTest::ne); return phase->transform(bol); } @@ -1200,7 +1200,7 @@ Node* BoolNode::as_int_value(PhaseGVN* phase) { //----------------------------------negate------------------------------------- BoolNode* BoolNode::negate(PhaseGVN* phase) { Compile* C = phase->C; - return new (C) BoolNode(in(1), _test.negate()); + return new BoolNode(in(1), _test.negate()); } @@ -1238,7 +1238,7 @@ Node *BoolNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Swap inputs to the clone cmp->swap_edges(1, 2); cmp = phase->transform( cmp ); - return new (phase->C) BoolNode( cmp, _test.commute() ); + return new BoolNode( cmp, _test.commute() ); } // Change "bool eq/ne (cmp (xor X 1) 0)" into "bool ne/eq (cmp X 0)". @@ -1255,8 +1255,8 @@ Node *BoolNode::Ideal(PhaseGVN *phase, bool can_reshape) { phase->type( j_xor->in(2) ) == TypeInt::ONE && (_test._test == BoolTest::eq || _test._test == BoolTest::ne) ) { - Node *ncmp = phase->transform(new (phase->C) CmpINode(j_xor->in(1),cmp2)); - return new (phase->C) BoolNode( ncmp, _test.negate() ); + Node *ncmp = phase->transform(new CmpINode(j_xor->in(1),cmp2)); + return new BoolNode( ncmp, _test.negate() ); } // Change "bool eq/ne (cmp (Conv2B X) 0)" into "bool eq/ne (cmp X 0)". @@ -1267,10 +1267,10 @@ Node *BoolNode::Ideal(PhaseGVN *phase, bool can_reshape) { (_test._test == BoolTest::eq || _test._test == BoolTest::ne) ) { Node *ncmp = phase->transform(phase->type(c2b->in(1))->isa_int() - ? (Node*)new (phase->C) CmpINode(c2b->in(1),cmp2) - : (Node*)new (phase->C) CmpPNode(c2b->in(1),phase->makecon(TypePtr::NULL_PTR)) + ? (Node*)new CmpINode(c2b->in(1),cmp2) + : (Node*)new CmpPNode(c2b->in(1),phase->makecon(TypePtr::NULL_PTR)) ); - return new (phase->C) BoolNode( ncmp, _test._test ); + return new BoolNode( ncmp, _test._test ); } // Comparing a SubI against a zero is equal to comparing the SubI @@ -1280,8 +1280,8 @@ Node *BoolNode::Ideal(PhaseGVN *phase, bool can_reshape) { (cop == Op_CmpI) && (cmp1->Opcode() == Op_SubI) && ( cmp2_type == TypeInt::ZERO ) ) { - Node *ncmp = phase->transform( new (phase->C) CmpINode(cmp1->in(1),cmp1->in(2))); - return new (phase->C) BoolNode( ncmp, _test._test ); + Node *ncmp = phase->transform( new CmpINode(cmp1->in(1),cmp1->in(2))); + return new BoolNode( ncmp, _test._test ); } // Change (-A vs 0) into (A vs 0) by commuting the test. Disallow in the @@ -1292,8 +1292,8 @@ Node *BoolNode::Ideal(PhaseGVN *phase, bool can_reshape) { cmp2_type == TypeInt::ZERO && phase->type( cmp1->in(1) ) == TypeInt::ZERO && phase->type( cmp1->in(2) )->higher_equal(TypeInt::SYMINT) ) { - Node *ncmp = phase->transform( new (phase->C) CmpINode(cmp1->in(2),cmp2)); - return new (phase->C) BoolNode( ncmp, _test.commute() ); + Node *ncmp = phase->transform( new CmpINode(cmp1->in(2),cmp2)); + return new BoolNode( ncmp, _test.commute() ); } // The transformation below is not valid for either signed or unsigned diff --git a/hotspot/src/share/vm/opto/superword.cpp b/hotspot/src/share/vm/opto/superword.cpp index 49a0dae9ece..72fabf9cc22 100644 --- a/hotspot/src/share/vm/opto/superword.cpp +++ b/hotspot/src/share/vm/opto/superword.cpp @@ -1456,7 +1456,7 @@ Node* SuperWord::vector_opd(Node_List* p, int opd_idx) { if (t == NULL || t->_lo < 0 || t->_hi > (int)mask) { cnt = ConNode::make(C, TypeInt::make(mask)); _igvn.register_new_node_with_optimizer(cnt); - cnt = new (C) AndINode(opd, cnt); + cnt = new AndINode(opd, cnt); _igvn.register_new_node_with_optimizer(cnt); _phase->set_ctrl(cnt, _phase->get_ctrl(opd)); } @@ -2067,42 +2067,42 @@ void SuperWord::align_initial_loop_index(MemNode* align_to_ref) { if (align_to_ref_p.invar() != NULL) { // incorporate any extra invariant piece producing (offset +/- invar) >>> log2(elt) Node* log2_elt = _igvn.intcon(exact_log2(elt_size)); - Node* aref = new (_phase->C) URShiftINode(align_to_ref_p.invar(), log2_elt); + Node* aref = new URShiftINode(align_to_ref_p.invar(), log2_elt); _igvn.register_new_node_with_optimizer(aref); _phase->set_ctrl(aref, pre_ctrl); if (align_to_ref_p.negate_invar()) { - e = new (_phase->C) SubINode(e, aref); + e = new SubINode(e, aref); } else { - e = new (_phase->C) AddINode(e, aref); + e = new AddINode(e, aref); } _igvn.register_new_node_with_optimizer(e); _phase->set_ctrl(e, pre_ctrl); } if (vw > ObjectAlignmentInBytes) { // incorporate base e +/- base && Mask >>> log2(elt) - Node* xbase = new(_phase->C) CastP2XNode(NULL, align_to_ref_p.base()); + Node* xbase = new CastP2XNode(NULL, align_to_ref_p.base()); _igvn.register_new_node_with_optimizer(xbase); #ifdef _LP64 - xbase = new (_phase->C) ConvL2INode(xbase); + xbase = new ConvL2INode(xbase); _igvn.register_new_node_with_optimizer(xbase); #endif Node* mask = _igvn.intcon(vw-1); - Node* masked_xbase = new (_phase->C) AndINode(xbase, mask); + Node* masked_xbase = new AndINode(xbase, mask); _igvn.register_new_node_with_optimizer(masked_xbase); Node* log2_elt = _igvn.intcon(exact_log2(elt_size)); - Node* bref = new (_phase->C) URShiftINode(masked_xbase, log2_elt); + Node* bref = new URShiftINode(masked_xbase, log2_elt); _igvn.register_new_node_with_optimizer(bref); _phase->set_ctrl(bref, pre_ctrl); - e = new (_phase->C) AddINode(e, bref); + e = new AddINode(e, bref); _igvn.register_new_node_with_optimizer(e); _phase->set_ctrl(e, pre_ctrl); } // compute e +/- lim0 if (scale < 0) { - e = new (_phase->C) SubINode(e, lim0); + e = new SubINode(e, lim0); } else { - e = new (_phase->C) AddINode(e, lim0); + e = new AddINode(e, lim0); } _igvn.register_new_node_with_optimizer(e); _phase->set_ctrl(e, pre_ctrl); @@ -2110,13 +2110,13 @@ void SuperWord::align_initial_loop_index(MemNode* align_to_ref) { if (stride * scale > 0) { // compute V - (e +/- lim0) Node* va = _igvn.intcon(v_align); - e = new (_phase->C) SubINode(va, e); + e = new SubINode(va, e); _igvn.register_new_node_with_optimizer(e); _phase->set_ctrl(e, pre_ctrl); } // compute N = (exp) % V Node* va_msk = _igvn.intcon(v_align - 1); - Node* N = new (_phase->C) AndINode(e, va_msk); + Node* N = new AndINode(e, va_msk); _igvn.register_new_node_with_optimizer(N); _phase->set_ctrl(N, pre_ctrl); @@ -2124,15 +2124,15 @@ void SuperWord::align_initial_loop_index(MemNode* align_to_ref) { // lim = lim0 + N Node* lim; if (stride < 0) { - lim = new (_phase->C) SubINode(lim0, N); + lim = new SubINode(lim0, N); } else { - lim = new (_phase->C) AddINode(lim0, N); + lim = new AddINode(lim0, N); } _igvn.register_new_node_with_optimizer(lim); _phase->set_ctrl(lim, pre_ctrl); Node* constrained = - (stride > 0) ? (Node*) new (_phase->C) MinINode(lim, orig_limit) - : (Node*) new (_phase->C) MaxINode(lim, orig_limit); + (stride > 0) ? (Node*) new MinINode(lim, orig_limit) + : (Node*) new MaxINode(lim, orig_limit); _igvn.register_new_node_with_optimizer(constrained); _phase->set_ctrl(constrained, pre_ctrl); _igvn.hash_delete(pre_opaq); diff --git a/hotspot/src/share/vm/opto/vectornode.cpp b/hotspot/src/share/vm/opto/vectornode.cpp index 9660d4ed818..21b51e5b524 100644 --- a/hotspot/src/share/vm/opto/vectornode.cpp +++ b/hotspot/src/share/vm/opto/vectornode.cpp @@ -252,46 +252,46 @@ VectorNode* VectorNode::make(Compile* C, int opc, Node* n1, Node* n2, uint vlen, guarantee(vopc > 0, err_msg_res("Vector for '%s' is not implemented", NodeClassNames[opc])); switch (vopc) { - case Op_AddVB: return new (C) AddVBNode(n1, n2, vt); - case Op_AddVS: return new (C) AddVSNode(n1, n2, vt); - case Op_AddVI: return new (C) AddVINode(n1, n2, vt); - case Op_AddVL: return new (C) AddVLNode(n1, n2, vt); - case Op_AddVF: return new (C) AddVFNode(n1, n2, vt); - case Op_AddVD: return new (C) AddVDNode(n1, n2, vt); + case Op_AddVB: return new AddVBNode(n1, n2, vt); + case Op_AddVS: return new AddVSNode(n1, n2, vt); + case Op_AddVI: return new AddVINode(n1, n2, vt); + case Op_AddVL: return new AddVLNode(n1, n2, vt); + case Op_AddVF: return new AddVFNode(n1, n2, vt); + case Op_AddVD: return new AddVDNode(n1, n2, vt); - case Op_SubVB: return new (C) SubVBNode(n1, n2, vt); - case Op_SubVS: return new (C) SubVSNode(n1, n2, vt); - case Op_SubVI: return new (C) SubVINode(n1, n2, vt); - case Op_SubVL: return new (C) SubVLNode(n1, n2, vt); - case Op_SubVF: return new (C) SubVFNode(n1, n2, vt); - case Op_SubVD: return new (C) SubVDNode(n1, n2, vt); + case Op_SubVB: return new SubVBNode(n1, n2, vt); + case Op_SubVS: return new SubVSNode(n1, n2, vt); + case Op_SubVI: return new SubVINode(n1, n2, vt); + case Op_SubVL: return new SubVLNode(n1, n2, vt); + case Op_SubVF: return new SubVFNode(n1, n2, vt); + case Op_SubVD: return new SubVDNode(n1, n2, vt); - case Op_MulVS: return new (C) MulVSNode(n1, n2, vt); - case Op_MulVI: return new (C) MulVINode(n1, n2, vt); - case Op_MulVF: return new (C) MulVFNode(n1, n2, vt); - case Op_MulVD: return new (C) MulVDNode(n1, n2, vt); + case Op_MulVS: return new MulVSNode(n1, n2, vt); + case Op_MulVI: return new MulVINode(n1, n2, vt); + case Op_MulVF: return new MulVFNode(n1, n2, vt); + case Op_MulVD: return new MulVDNode(n1, n2, vt); - case Op_DivVF: return new (C) DivVFNode(n1, n2, vt); - case Op_DivVD: return new (C) DivVDNode(n1, n2, vt); + case Op_DivVF: return new DivVFNode(n1, n2, vt); + case Op_DivVD: return new DivVDNode(n1, n2, vt); - case Op_LShiftVB: return new (C) LShiftVBNode(n1, n2, vt); - case Op_LShiftVS: return new (C) LShiftVSNode(n1, n2, vt); - case Op_LShiftVI: return new (C) LShiftVINode(n1, n2, vt); - case Op_LShiftVL: return new (C) LShiftVLNode(n1, n2, vt); + case Op_LShiftVB: return new LShiftVBNode(n1, n2, vt); + case Op_LShiftVS: return new LShiftVSNode(n1, n2, vt); + case Op_LShiftVI: return new LShiftVINode(n1, n2, vt); + case Op_LShiftVL: return new LShiftVLNode(n1, n2, vt); - case Op_RShiftVB: return new (C) RShiftVBNode(n1, n2, vt); - case Op_RShiftVS: return new (C) RShiftVSNode(n1, n2, vt); - case Op_RShiftVI: return new (C) RShiftVINode(n1, n2, vt); - case Op_RShiftVL: return new (C) RShiftVLNode(n1, n2, vt); + case Op_RShiftVB: return new RShiftVBNode(n1, n2, vt); + case Op_RShiftVS: return new RShiftVSNode(n1, n2, vt); + case Op_RShiftVI: return new RShiftVINode(n1, n2, vt); + case Op_RShiftVL: return new RShiftVLNode(n1, n2, vt); - case Op_URShiftVB: return new (C) URShiftVBNode(n1, n2, vt); - case Op_URShiftVS: return new (C) URShiftVSNode(n1, n2, vt); - case Op_URShiftVI: return new (C) URShiftVINode(n1, n2, vt); - case Op_URShiftVL: return new (C) URShiftVLNode(n1, n2, vt); + case Op_URShiftVB: return new URShiftVBNode(n1, n2, vt); + case Op_URShiftVS: return new URShiftVSNode(n1, n2, vt); + case Op_URShiftVI: return new URShiftVINode(n1, n2, vt); + case Op_URShiftVL: return new URShiftVLNode(n1, n2, vt); - case Op_AndV: return new (C) AndVNode(n1, n2, vt); - case Op_OrV: return new (C) OrVNode (n1, n2, vt); - case Op_XorV: return new (C) XorVNode(n1, n2, vt); + case Op_AndV: return new AndVNode(n1, n2, vt); + case Op_OrV: return new OrVNode (n1, n2, vt); + case Op_XorV: return new XorVNode(n1, n2, vt); } fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[vopc])); return NULL; @@ -306,18 +306,18 @@ VectorNode* VectorNode::scalar2vector(Compile* C, Node* s, uint vlen, const Type switch (bt) { case T_BOOLEAN: case T_BYTE: - return new (C) ReplicateBNode(s, vt); + return new ReplicateBNode(s, vt); case T_CHAR: case T_SHORT: - return new (C) ReplicateSNode(s, vt); + return new ReplicateSNode(s, vt); case T_INT: - return new (C) ReplicateINode(s, vt); + return new ReplicateINode(s, vt); case T_LONG: - return new (C) ReplicateLNode(s, vt); + return new ReplicateLNode(s, vt); case T_FLOAT: - return new (C) ReplicateFNode(s, vt); + return new ReplicateFNode(s, vt); case T_DOUBLE: - return new (C) ReplicateDNode(s, vt); + return new ReplicateDNode(s, vt); } fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); return NULL; @@ -330,12 +330,12 @@ VectorNode* VectorNode::shift_count(Compile* C, Node* shift, Node* cnt, uint vle switch (shift->Opcode()) { case Op_LShiftI: case Op_LShiftL: - return new (C) LShiftCntVNode(cnt, vt); + return new LShiftCntVNode(cnt, vt); case Op_RShiftI: case Op_RShiftL: case Op_URShiftI: case Op_URShiftL: - return new (C) RShiftCntVNode(cnt, vt); + return new RShiftCntVNode(cnt, vt); } fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[shift->Opcode()])); return NULL; @@ -347,18 +347,18 @@ PackNode* PackNode::make(Compile* C, Node* s, uint vlen, BasicType bt) { switch (bt) { case T_BOOLEAN: case T_BYTE: - return new (C) PackBNode(s, vt); + return new PackBNode(s, vt); case T_CHAR: case T_SHORT: - return new (C) PackSNode(s, vt); + return new PackSNode(s, vt); case T_INT: - return new (C) PackINode(s, vt); + return new PackINode(s, vt); case T_LONG: - return new (C) PackLNode(s, vt); + return new PackLNode(s, vt); case T_FLOAT: - return new (C) PackFNode(s, vt); + return new PackFNode(s, vt); case T_DOUBLE: - return new (C) PackDNode(s, vt); + return new PackDNode(s, vt); } fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); return NULL; @@ -383,18 +383,18 @@ PackNode* PackNode::binary_tree_pack(Compile* C, int lo, int hi) { switch (bt) { case T_BOOLEAN: case T_BYTE: - return new (C) PackSNode(n1, n2, TypeVect::make(T_SHORT, 2)); + return new PackSNode(n1, n2, TypeVect::make(T_SHORT, 2)); case T_CHAR: case T_SHORT: - return new (C) PackINode(n1, n2, TypeVect::make(T_INT, 2)); + return new PackINode(n1, n2, TypeVect::make(T_INT, 2)); case T_INT: - return new (C) PackLNode(n1, n2, TypeVect::make(T_LONG, 2)); + return new PackLNode(n1, n2, TypeVect::make(T_LONG, 2)); case T_LONG: - return new (C) Pack2LNode(n1, n2, TypeVect::make(T_LONG, 2)); + return new Pack2LNode(n1, n2, TypeVect::make(T_LONG, 2)); case T_FLOAT: - return new (C) PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2)); + return new PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2)); case T_DOUBLE: - return new (C) Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2)); + return new Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2)); } fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); } @@ -405,14 +405,14 @@ PackNode* PackNode::binary_tree_pack(Compile* C, int lo, int hi) { LoadVectorNode* LoadVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem, Node* adr, const TypePtr* atyp, uint vlen, BasicType bt) { const TypeVect* vt = TypeVect::make(bt, vlen); - return new (C) LoadVectorNode(ctl, mem, adr, atyp, vt); + return new LoadVectorNode(ctl, mem, adr, atyp, vt); } // Return the vector version of a scalar store node. StoreVectorNode* StoreVectorNode::make(Compile* C, int opc, Node* ctl, Node* mem, Node* adr, const TypePtr* atyp, Node* val, uint vlen) { - return new (C) StoreVectorNode(ctl, mem, adr, atyp, val); + return new StoreVectorNode(ctl, mem, adr, atyp, val); } // Extract a scalar element of vector. @@ -421,21 +421,21 @@ Node* ExtractNode::make(Compile* C, Node* v, uint position, BasicType bt) { ConINode* pos = ConINode::make(C, (int)position); switch (bt) { case T_BOOLEAN: - return new (C) ExtractUBNode(v, pos); + return new ExtractUBNode(v, pos); case T_BYTE: - return new (C) ExtractBNode(v, pos); + return new ExtractBNode(v, pos); case T_CHAR: - return new (C) ExtractCNode(v, pos); + return new ExtractCNode(v, pos); case T_SHORT: - return new (C) ExtractSNode(v, pos); + return new ExtractSNode(v, pos); case T_INT: - return new (C) ExtractINode(v, pos); + return new ExtractINode(v, pos); case T_LONG: - return new (C) ExtractLNode(v, pos); + return new ExtractLNode(v, pos); case T_FLOAT: - return new (C) ExtractFNode(v, pos); + return new ExtractFNode(v, pos); case T_DOUBLE: - return new (C) ExtractDNode(v, pos); + return new ExtractDNode(v, pos); } fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); return NULL; From bdb8050bbf0577ece28f6535d70f9d64b084f5f2 Mon Sep 17 00:00:00 2001 From: Roland Westrelin Date: Mon, 2 Jun 2014 10:01:15 +0200 Subject: [PATCH 08/56] 8043413: REGRESSION: Hotspot causes segmentation fault in jdk8ux, but not in jdk7ux Long series of lambda form calls trigger stack overflow in c2 Reviewed-by: kvn, vlivanov --- hotspot/src/share/vm/opto/bytecodeInfo.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp index 101d5f73325..c4ee166a20c 100644 --- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp +++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp @@ -361,11 +361,14 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, set_msg("not an accessor"); return false; } + + // Limit inlining depth in case inlining is forced or + // _max_inline_level was increased to compensate for lambda forms. + if (inline_level() > MaxForceInlineLevel) { + set_msg("MaxForceInlineLevel"); + return false; + } if (inline_level() > _max_inline_level) { - if (callee_method->force_inline() && inline_level() > MaxForceInlineLevel) { - set_msg("MaxForceInlineLevel"); - return false; - } if (!callee_method->force_inline() || !IncrementalInline) { set_msg("inlining too deep"); return false; From ddffd7c3f1f062aba5ad6261118a1d2ba209107d Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Mon, 2 Jun 2014 07:26:52 -1000 Subject: [PATCH 09/56] 8044496: 8034812 broke build with clang Remove superfluous clang-diagnostic-pop Reviewed-by: kvn, drchase --- hotspot/src/share/vm/opto/node.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index c52ac9895ab..7b5ffc48d64 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -456,10 +456,6 @@ Node::Node(Node *n0, Node *n1, Node *n2, Node *n3, _in[6] = n6; if (n6 != NULL) n6->add_out((Node *)this); } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - //------------------------------clone------------------------------------------ // Clone a Node. From 23d6ad76d7e661d74b297839eb31e74472c2fd29 Mon Sep 17 00:00:00 2001 From: David Chase Date: Mon, 2 Jun 2014 14:32:29 -0400 Subject: [PATCH 10/56] 8029381: assert(is_method_type()) failed: bad cast Access to method_type and appendix from constant pool (cpcache) needs to be guarded by is_f1_null() because of racy update/initialization. Reviewed-by: kvn, coleenp, jrose --- hotspot/src/share/vm/oops/cpCache.cpp | 4 ++-- hotspot/src/share/vm/oops/cpCache.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/oops/cpCache.cpp b/hotspot/src/share/vm/oops/cpCache.cpp index 527b771fd68..d601367ba99 100644 --- a/hotspot/src/share/vm/oops/cpCache.cpp +++ b/hotspot/src/share/vm/oops/cpCache.cpp @@ -407,7 +407,7 @@ Method* ConstantPoolCacheEntry::method_if_resolved(constantPoolHandle cpool) { oop ConstantPoolCacheEntry::appendix_if_resolved(constantPoolHandle cpool) { - if (is_f1_null() || !has_appendix()) + if (!has_appendix()) return NULL; const int ref_index = f2_as_index() + _indy_resolved_references_appendix_offset; objArrayOop resolved_references = cpool->resolved_references(); @@ -416,7 +416,7 @@ oop ConstantPoolCacheEntry::appendix_if_resolved(constantPoolHandle cpool) { oop ConstantPoolCacheEntry::method_type_if_resolved(constantPoolHandle cpool) { - if (is_f1_null() || !has_method_type()) + if (!has_method_type()) return NULL; const int ref_index = f2_as_index() + _indy_resolved_references_method_type_offset; objArrayOop resolved_references = cpool->resolved_references(); diff --git a/hotspot/src/share/vm/oops/cpCache.hpp b/hotspot/src/share/vm/oops/cpCache.hpp index ee3a664b352..debd09136c7 100644 --- a/hotspot/src/share/vm/oops/cpCache.hpp +++ b/hotspot/src/share/vm/oops/cpCache.hpp @@ -348,8 +348,8 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC { bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; } bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; } bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; } - bool has_appendix() const { return (_flags & (1 << has_appendix_shift)) != 0; } - bool has_method_type() const { return (_flags & (1 << has_method_type_shift)) != 0; } + bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; } + bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; } bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; } bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; } bool is_byte() const { return flag_state() == btos; } From e09b9cbc3ca2f4fc194e79e1c084998b1e798b4b Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Mon, 2 Jun 2014 15:48:34 -0700 Subject: [PATCH 11/56] 8044242: Remove dead NativeMovRegMemPatching class Reviewed-by: twisti, kvn --- hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp | 143 ------------------ hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp | 91 ----------- hotspot/src/cpu/x86/vm/nativeInst_x86.hpp | 12 -- 3 files changed, 246 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp index 3d2f531402c..2ec40f8fd0d 100644 --- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp @@ -690,149 +690,6 @@ void NativeMovRegMem::test() { // End code for unit testing implementation of NativeMovRegMem class -//-------------------------------------------------------------------------------- - - -void NativeMovRegMemPatching::copy_instruction_to(address new_instruction_address) { - Untested("copy_instruction_to"); - int instruction_size = next_instruction_address() - instruction_address(); - for (int i = 0; i < instruction_size; i += wordSize) { - *(long*)(new_instruction_address + i) = *(long*)(address(this) + i); - } -} - - -void NativeMovRegMemPatching::verify() { - NativeInstruction::verify(); - // make sure code pattern is actually a "ld" or "st" of some sort. - int i0 = long_at(0); - int op3 = inv_op3(i0); - - assert((int)nop_offset == (int)NativeMovConstReg::add_offset, "sethi size ok"); - - if (!(is_op(i0, Assembler::ldst_op) && - inv_immed(i0) && - 0 != (op3 < op3_ldst_int_limit - ? (1 << op3 ) & (op3_mask_ld | op3_mask_st) - : (1 << (op3 - op3_ldst_int_limit)) & (op3_mask_ldf | op3_mask_stf)))) { - int i1 = long_at(ldst_offset); - Register rd = inv_rd(i0); - - op3 = inv_op3(i1); - if (!is_op(i1, Assembler::ldst_op) && rd == inv_rs2(i1) && - 0 != (op3 < op3_ldst_int_limit - ? (1 << op3 ) & (op3_mask_ld | op3_mask_st) - : (1 << (op3 - op3_ldst_int_limit)) & (op3_mask_ldf | op3_mask_stf))) { - fatal("not a ld* or st* op"); - } - } -} - - -void NativeMovRegMemPatching::print() { - if (is_immediate()) { - tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + %d]", p2i(instruction_address()), offset()); - } else { - tty->print_cr(INTPTR_FORMAT ": mov reg, [reg + reg]", p2i(instruction_address())); - } -} - - -// Code for unit testing implementation of NativeMovRegMemPatching class -void NativeMovRegMemPatching::test() { -#ifdef ASSERT - ResourceMark rm; - CodeBuffer cb("test", 1000, 1000); - MacroAssembler* a = new MacroAssembler(&cb); - NativeMovRegMemPatching* nm; - uint idx = 0; - uint idx1; - int offsets[] = { - 0x0, - 0xffffffff, - 0x7fffffff, - 0x80000000, - 4096, - 4097, - 0x20, - 0x4000, - }; - - VM_Version::allow_all(); - - AddressLiteral al(0xffffffff, relocInfo::external_word_type); - a->ldsw( G5, al.low10(), G4); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->ldsw( G5, I3, G4 ); idx++; - a->ldsb( G5, al.low10(), G4); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->ldsb( G5, I3, G4 ); idx++; - a->ldsh( G5, al.low10(), G4); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->ldsh( G5, I3, G4 ); idx++; - a->lduw( G5, al.low10(), G4); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->lduw( G5, I3, G4 ); idx++; - a->ldub( G5, al.low10(), G4); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->ldub( G5, I3, G4 ); idx++; - a->lduh( G5, al.low10(), G4); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->lduh( G5, I3, G4 ); idx++; - a->ldx( G5, al.low10(), G4); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->ldx( G5, I3, G4 ); idx++; - a->ldd( G5, al.low10(), G4); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->ldd( G5, I3, G4 ); idx++; - a->ldf( FloatRegisterImpl::D, O2, -1, F14 ); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->ldf( FloatRegisterImpl::S, O0, I3, F15 ); idx++; - - a->stw( G5, G4, al.low10()); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->stw( G5, G4, I3 ); idx++; - a->stb( G5, G4, al.low10()); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->stb( G5, G4, I3 ); idx++; - a->sth( G5, G4, al.low10()); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->sth( G5, G4, I3 ); idx++; - a->stx( G5, G4, al.low10()); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->stx( G5, G4, I3 ); idx++; - a->std( G5, G4, al.low10()); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->std( G5, G4, I3 ); idx++; - a->stf( FloatRegisterImpl::S, F18, O2, -1 ); idx++; - a->sethi(al, I3); a->nop(); a->add(I3, al.low10(), I3); - a->stf( FloatRegisterImpl::S, F15, O0, I3 ); idx++; - - nm = nativeMovRegMemPatching_at( cb.insts_begin() ); - nm->print(); - nm->set_offset( low10(0) ); - nm->print(); - nm->add_offset_in_bytes( low10(0xbb) * wordSize ); - nm->print(); - - while (--idx) { - nm = nativeMovRegMemPatching_at( nm->next_instruction_address() ); - nm->print(); - for (idx1 = 0; idx1 < ARRAY_SIZE(offsets); idx1++) { - nm->set_offset( nm->is_immediate() ? low10(offsets[idx1]) : offsets[idx1] ); - assert(nm->offset() == (nm->is_immediate() ? low10(offsets[idx1]) : offsets[idx1]), - "check unit test"); - nm->print(); - } - nm->add_offset_in_bytes( low10(0xbb) * wordSize ); - nm->print(); - } - - VM_Version::revert(); -#endif // ASSERT -} -// End code for unit testing implementation of NativeMovRegMemPatching class - //-------------------------------------------------------------------------------- diff --git a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp index 29273e7fe61..698b448de9a 100644 --- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp @@ -38,7 +38,6 @@ // - - NativeMovConstReg // - - NativeMovConstRegPatching // - - NativeMovRegMem -// - - NativeMovRegMemPatching // - - NativeJump // - - NativeGeneralJump // - - NativeIllegalInstruction @@ -710,96 +709,6 @@ class NativeMovRegMem: public NativeInstruction { }; -// An interface for accessing/manipulating native memory ops -// ld* [reg + offset], reg -// st* reg, [reg + offset] -// sethi %hi(imm), reg; nop; add reg, %lo(imm), reg; ld* [reg1 + reg], reg2 -// sethi %hi(imm), reg; nop; add reg, %lo(imm), reg; st* reg2, [reg1 + reg] -// Ops covered: {lds,ldu,st}{w,b,h}, {ld,st}{d,x} -// -// Note that it is identical to NativeMovRegMem with the exception of a nop between the -// sethi and the add. The nop is required to be in the delay slot of the call instruction -// which overwrites the sethi during patching. -class NativeMovRegMemPatching; -inline NativeMovRegMemPatching* nativeMovRegMemPatching_at (address address); -class NativeMovRegMemPatching: public NativeInstruction { - public: - enum Sparc_specific_constants { - op3_mask_ld = 1 << Assembler::lduw_op3 | - 1 << Assembler::ldub_op3 | - 1 << Assembler::lduh_op3 | - 1 << Assembler::ldd_op3 | - 1 << Assembler::ldsw_op3 | - 1 << Assembler::ldsb_op3 | - 1 << Assembler::ldsh_op3 | - 1 << Assembler::ldx_op3, - op3_mask_st = 1 << Assembler::stw_op3 | - 1 << Assembler::stb_op3 | - 1 << Assembler::sth_op3 | - 1 << Assembler::std_op3 | - 1 << Assembler::stx_op3, - op3_ldst_int_limit = Assembler::ldf_op3, - op3_mask_ldf = 1 << (Assembler::ldf_op3 - op3_ldst_int_limit) | - 1 << (Assembler::lddf_op3 - op3_ldst_int_limit), - op3_mask_stf = 1 << (Assembler::stf_op3 - op3_ldst_int_limit) | - 1 << (Assembler::stdf_op3 - op3_ldst_int_limit), - - offset_width = 13, - sethi_offset = 0, -#ifdef _LP64 - nop_offset = 7 * BytesPerInstWord, -#else - nop_offset = 4, -#endif - add_offset = nop_offset + BytesPerInstWord, - ldst_offset = add_offset + BytesPerInstWord - }; - bool is_immediate() const { - // check if instruction is ld* [reg + offset], reg or st* reg, [reg + offset] - int i0 = long_at(0); - return (is_op(i0, Assembler::ldst_op)); - } - - address instruction_address() const { return addr_at(0); } - address next_instruction_address() const { - return addr_at(is_immediate()? 4 : 16); - } - int offset() const { - return is_immediate()? inv_simm(long_at(0), offset_width) : - nativeMovConstRegPatching_at(addr_at(0))->data(); - } - void set_offset(int x) { - if (is_immediate()) { - guarantee(fits_in_simm(x, offset_width), "data block offset overflow"); - set_long_at(0, set_simm(long_at(0), x, offset_width)); - } - else - nativeMovConstRegPatching_at(addr_at(0))->set_data(x); - } - - void add_offset_in_bytes(intptr_t radd_offset) { - set_offset (offset() + radd_offset); - } - - void copy_instruction_to(address new_instruction_address); - - void verify(); - void print (); - - // unit test stuff - static void test(); - - private: - friend inline NativeMovRegMemPatching* nativeMovRegMemPatching_at (address address) { - NativeMovRegMemPatching* test = (NativeMovRegMemPatching*)address; - #ifdef ASSERT - test->verify(); - #endif - return test; - } -}; - - // An interface for accessing/manipulating native jumps // jump_to addr // == sethi %hi22(addr), temp ; jumpl reg, %lo10(addr), G0 ; diff --git a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp index 470e971fe48..4a4de7116bd 100644 --- a/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp +++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.hpp @@ -327,18 +327,6 @@ inline NativeMovRegMem* nativeMovRegMem_at (address address) { return test; } -class NativeMovRegMemPatching: public NativeMovRegMem { - private: - friend NativeMovRegMemPatching* nativeMovRegMemPatching_at (address address) { - NativeMovRegMemPatching* test = (NativeMovRegMemPatching*)(address - instruction_offset); - #ifdef ASSERT - test->verify(); - #endif - return test; - } -}; - - // An interface for accessing/manipulating native leal instruction of form: // leal reg, [reg + offset] From f19a51053260b05f01d52cc3f6ecc4ab04b868d4 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 4 Jun 2014 00:25:21 +0400 Subject: [PATCH 12/56] 8044339: Update FilterSpuriousWakeups documentation. Review "Solaris only" vm options descriptions Reviewed-by: kvn, dholmes, iignatyev --- hotspot/src/os/aix/vm/os_aix.cpp | 6 ++---- hotspot/src/os/bsd/vm/os_bsd.cpp | 6 ++---- hotspot/src/os/linux/vm/os_linux.cpp | 6 ++---- hotspot/src/share/vm/runtime/globals.hpp | 8 ++++---- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp index 377ff89eacb..e9d57c580ce 100644 --- a/hotspot/src/os/aix/vm/os_aix.cpp +++ b/hotspot/src/os/aix/vm/os_aix.cpp @@ -4734,10 +4734,8 @@ int os::PlatformEvent::park(jlong millis) { // // Thread.interrupt and object.notify{All} both call Event::set. // That is, we treat thread.interrupt as a special case of notification. - // The underlying Solaris implementation, cond_timedwait, admits - // spurious/premature wakeups, but the JLS/JVM spec prevents the - // JVM from making those visible to Java code. As such, we must - // filter out spurious wakeups. We assume all ETIME returns are valid. + // We ignore spurious OS wakeups unless FilterSpuriousWakeups is false. + // We assume all ETIME returns are valid. // // TODO: properly differentiate simultaneous notify+interrupt. // In that case, we should propagate the notify to another waiter. diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index c8313235d0c..9d817380e3e 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -4299,10 +4299,8 @@ int os::PlatformEvent::park(jlong millis) { // // Thread.interrupt and object.notify{All} both call Event::set. // That is, we treat thread.interrupt as a special case of notification. - // The underlying Solaris implementation, cond_timedwait, admits - // spurious/premature wakeups, but the JLS/JVM spec prevents the - // JVM from making those visible to Java code. As such, we must - // filter out spurious wakeups. We assume all ETIME returns are valid. + // We ignore spurious OS wakeups unless FilterSpuriousWakeups is false. + // We assume all ETIME returns are valid. // // TODO: properly differentiate simultaneous notify+interrupt. // In that case, we should propagate the notify to another waiter. diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 7941edf59ce..89ffc72d972 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -5538,10 +5538,8 @@ int os::PlatformEvent::park(jlong millis) { // // Thread.interrupt and object.notify{All} both call Event::set. // That is, we treat thread.interrupt as a special case of notification. - // The underlying Solaris implementation, cond_timedwait, admits - // spurious/premature wakeups, but the JLS/JVM spec prevents the - // JVM from making those visible to Java code. As such, we must - // filter out spurious wakeups. We assume all ETIME returns are valid. + // We ignore spurious OS wakeups unless FilterSpuriousWakeups is false. + // We assume all ETIME returns are valid. // // TODO: properly differentiate simultaneous notify+interrupt. // In that case, we should propagate the notify to another waiter. diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index b0a342c1352..ec1c1805cee 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1097,7 +1097,7 @@ class CommandLineFlags { "Call loadClassInternal() rather than loadClass()") \ \ product_pd(bool, DontYieldALot, \ - "Throw away obvious excess yield calls (for Solaris only)") \ + "Throw away obvious excess yield calls") \ \ product_pd(bool, ConvertSleepToYield, \ "Convert sleep(0) to thread yield " \ @@ -1105,7 +1105,7 @@ class CommandLineFlags { \ product(bool, ConvertYieldToSleep, false, \ "Convert yield to a sleep of MinSleepInterval to simulate Win32 " \ - "behavior (Solaris only)") \ + "behavior") \ \ product(bool, UseBoundThreads, true, \ "Bind user level threads to kernel threads (for Solaris only)") \ @@ -1143,8 +1143,8 @@ class CommandLineFlags { "avoid NPTL-FUTEX hang pthread_cond_timedwait") \ \ product(bool, FilterSpuriousWakeups, true, \ - "Prevent spurious or premature wakeups from object.wait " \ - "(Solaris only)") \ + "When true prevents OS-level spurious, or premature, wakeups " \ + "from Object.wait (Ignored for Windows)") \ \ product(intx, NativeMonitorTimeout, -1, "(Unstable)") \ \ From baadb75921a034621e145a695bb585a8137f3a5f Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Tue, 3 Jun 2014 18:24:38 -0700 Subject: [PATCH 13/56] 8044735: Print format/argument warnings Reviewed-by: twisti, kvn --- hotspot/src/cpu/sparc/vm/debug_sparc.cpp | 22 +++++++++++-------- .../src/cpu/sparc/vm/methodHandles_sparc.cpp | 2 +- hotspot/src/cpu/sparc/vm/sparc.ad | 6 ++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/debug_sparc.cpp b/hotspot/src/cpu/sparc/vm/debug_sparc.cpp index 05b8de24361..8be1072fc65 100644 --- a/hotspot/src/cpu/sparc/vm/debug_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/debug_sparc.cpp @@ -42,20 +42,24 @@ void pd_ps(frame f) { intptr_t *pc = NULL; intptr_t *next_pc = NULL; int count = 0; - tty->print("register window backtrace from %#x:\n", sp); + tty->print_cr("register window backtrace from " INTPTR_FORMAT ":", p2i(sp)); while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) { pc = next_pc; next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()]; - tty->print("[%d] sp=%#x pc=", count, sp); + tty->print("[%d] sp=" INTPTR_FORMAT " pc=", count, p2i(sp)); findpc((intptr_t)pc); if (WizardMode && Verbose) { // print register window contents also - tty->print_cr(" L0..L7: {%#x %#x %#x %#x %#x %#x %#x %#x}", - sp[0+0],sp[0+1],sp[0+2],sp[0+3], - sp[0+4],sp[0+5],sp[0+6],sp[0+7]); - tty->print_cr(" I0..I7: {%#x %#x %#x %#x %#x %#x %#x %#x}", - sp[8+0],sp[8+1],sp[8+2],sp[8+3], - sp[8+4],sp[8+5],sp[8+6],sp[8+7]); + tty->print_cr(" L0..L7: {" + INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " + INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " ", + sp[0+0], sp[0+1], sp[0+2], sp[0+3], + sp[0+4], sp[0+5], sp[0+6], sp[0+7]); + tty->print_cr(" I0..I7: {" + INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " + INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " ", + sp[8+0], sp[8+1], sp[8+2], sp[8+3], + sp[8+4], sp[8+5], sp[8+6], sp[8+7]); // (and print stack frame contents too??) CodeBlob *b = CodeCache::find_blob((address) pc); @@ -74,7 +78,7 @@ void pd_ps(frame f) { count += 1; } if (sp != NULL) - tty->print("[%d] sp=%#x [bogus sp!]", count, sp); + tty->print("[%d] sp=" INTPTR_FORMAT " [bogus sp!]", count, p2i(sp)); } #endif // PRODUCT diff --git a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp index af6d6289644..af2e4e1e96c 100644 --- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp @@ -483,7 +483,7 @@ void trace_method_handle_stub(const char* adaptername, const char* mh_reg_name = has_mh ? "G3_mh" : "G3"; tty->print_cr("MH %s %s="INTPTR_FORMAT " saved_sp=" INTPTR_FORMAT " args=" INTPTR_FORMAT, adaptername, mh_reg_name, - (intptr_t) mh, saved_sp, args); + p2i(mh), p2i(saved_sp), p2i(args)); if (Verbose) { // dumping last frame with frame::describe diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index 23026eaabb1..ca1d7137db5 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -1206,10 +1206,10 @@ void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream *st ) const { } if (Assembler::is_simm13(-framesize)) { - st->print ("SAVE R_SP,-%d,R_SP",framesize); + st->print ("SAVE R_SP,-" SIZE_FORMAT ",R_SP",framesize); } else { - st->print_cr("SETHI R_SP,hi%%(-%d),R_G3",framesize); st->print("\t"); - st->print_cr("ADD R_G3,lo%%(-%d),R_G3",framesize); st->print("\t"); + st->print_cr("SETHI R_SP,hi%%(-" SIZE_FORMAT "),R_G3",framesize); st->print("\t"); + st->print_cr("ADD R_G3,lo%%(-" SIZE_FORMAT "),R_G3",framesize); st->print("\t"); st->print ("SAVE R_SP,R_G3,R_SP"); } From 09151477274d0d14aa2879087c1e29956c7fd5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rickard=20B=C3=A4ckman?= Date: Wed, 4 Jun 2014 10:01:28 +0200 Subject: [PATCH 14/56] 8031994: java/lang/Character/CheckProp test times out Reviewed-by: iveresov, roland --- .../cpu/sparc/vm/c1_LIRGenerator_sparc.cpp | 10 ++++------ .../src/cpu/x86/vm/c1_LIRGenerator_x86.cpp | 9 +++------ hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 2 +- hotspot/src/share/vm/c1/c1_Instruction.hpp | 6 ++++-- hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 20 +++++++++++++++---- hotspot/src/share/vm/c1/c1_LIRGenerator.hpp | 6 ++++-- 6 files changed, 32 insertions(+), 21 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp index 4c6f0de0010..e91142ee011 100644 --- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @@ -872,21 +872,19 @@ void LIRGenerator::do_Convert(Convert* x) { void LIRGenerator::do_NewInstance(NewInstance* x) { + print_if_not_loaded(x); + // This instruction can be deoptimized in the slow path : use // O0 as result register. const LIR_Opr reg = result_register_for(x->type()); -#ifndef PRODUCT - if (PrintNotLoaded && !x->klass()->is_loaded()) { - tty->print_cr(" ###class not loaded at new bci %d", x->printable_bci()); - } -#endif + CodeEmitInfo* info = state_for(x, x->state()); LIR_Opr tmp1 = FrameMap::G1_oop_opr; LIR_Opr tmp2 = FrameMap::G3_oop_opr; LIR_Opr tmp3 = FrameMap::G4_oop_opr; LIR_Opr tmp4 = FrameMap::O1_oop_opr; LIR_Opr klass_reg = FrameMap::G5_metadata_opr; - new_instance(reg, x->klass(), tmp1, tmp2, tmp3, tmp4, klass_reg, info); + new_instance(reg, x->klass(), x->is_unresolved(), tmp1, tmp2, tmp3, tmp4, klass_reg, info); LIR_Opr result = rlock_result(x); __ move(reg, result); } diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp index b4e8223e1f5..1ee690ea442 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @@ -1085,14 +1085,11 @@ void LIRGenerator::do_Convert(Convert* x) { void LIRGenerator::do_NewInstance(NewInstance* x) { -#ifndef PRODUCT - if (PrintNotLoaded && !x->klass()->is_loaded()) { - tty->print_cr(" ###class not loaded at new bci %d", x->printable_bci()); - } -#endif + print_if_not_loaded(x); + CodeEmitInfo* info = state_for(x, x->state()); LIR_Opr reg = result_register_for(x->type()); - new_instance(reg, x->klass(), + new_instance(reg, x->klass(), x->is_unresolved(), FrameMap::rcx_oop_opr, FrameMap::rdi_oop_opr, FrameMap::rsi_oop_opr, diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index ac62197debe..cada65e1a94 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -2054,7 +2054,7 @@ void GraphBuilder::new_instance(int klass_index) { bool will_link; ciKlass* klass = stream()->get_klass(will_link); assert(klass->is_instance_klass(), "must be an instance klass"); - NewInstance* new_instance = new NewInstance(klass->as_instance_klass(), state_before); + NewInstance* new_instance = new NewInstance(klass->as_instance_klass(), state_before, stream()->is_unresolved_klass()); _memory->new_instance(new_instance); apush(append_split(new_instance)); } diff --git a/hotspot/src/share/vm/c1/c1_Instruction.hpp b/hotspot/src/share/vm/c1/c1_Instruction.hpp index 19490bbc97b..3121088c9e6 100644 --- a/hotspot/src/share/vm/c1/c1_Instruction.hpp +++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp @@ -1291,16 +1291,18 @@ LEAF(Invoke, StateSplit) LEAF(NewInstance, StateSplit) private: ciInstanceKlass* _klass; + bool _is_unresolved; public: // creation - NewInstance(ciInstanceKlass* klass, ValueStack* state_before) + NewInstance(ciInstanceKlass* klass, ValueStack* state_before, bool is_unresolved) : StateSplit(instanceType, state_before) - , _klass(klass) + , _klass(klass), _is_unresolved(is_unresolved) {} // accessors ciInstanceKlass* klass() const { return _klass; } + bool is_unresolved() const { return _is_unresolved; } virtual bool needs_exception_state() const { return false; } diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index 4e4caaa26cb..bf0b6f2f1ea 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -466,8 +466,11 @@ CodeEmitInfo* LIRGenerator::state_for(Instruction* x) { } -void LIRGenerator::klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info) { - if (!obj->is_loaded() || PatchALot) { +void LIRGenerator::klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info, bool need_resolve) { + /* C2 relies on constant pool entries being resolved (ciTypeFlow), so if TieredCompilation + * is active and the class hasn't yet been resolved we need to emit a patch that resolves + * the class. */ + if ((TieredCompilation && need_resolve) || !obj->is_loaded() || PatchALot) { assert(info != NULL, "info must be set if class is not loaded"); __ klass2reg_patch(NULL, r, info); } else { @@ -660,9 +663,18 @@ void LIRGenerator::monitor_exit(LIR_Opr object, LIR_Opr lock, LIR_Opr new_hdr, L __ unlock_object(hdr, object, lock, scratch, slow_path); } +#ifndef PRODUCT +void LIRGenerator::print_if_not_loaded(const NewInstance* new_instance) { + if (PrintNotLoaded && !new_instance->klass()->is_loaded()) { + tty->print_cr(" ###class not loaded at new bci %d", new_instance->printable_bci()); + } else if (PrintNotLoaded && (TieredCompilation && new_instance->is_unresolved())) { + tty->print_cr(" ###class not resolved at new bci %d", new_instance->printable_bci()); + } +} +#endif -void LIRGenerator::new_instance(LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info) { - klass2reg_with_patching(klass_reg, klass, info); +void LIRGenerator::new_instance(LIR_Opr dst, ciInstanceKlass* klass, bool is_unresolved, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info) { + klass2reg_with_patching(klass_reg, klass, info, is_unresolved); // If klass is not loaded we do not know if the klass has finalizers: if (UseFastNewInstance && klass->is_loaded() && !Klass::layout_helper_needs_slow_path(klass->layout_helper())) { diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp index 13446a9ebe9..ba003e5851f 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp @@ -169,6 +169,8 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { return this; } + void print_if_not_loaded(const NewInstance* new_instance) PRODUCT_RETURN; + #ifdef ASSERT LIR_List* lir(const char * file, int line) const { _lir->set_file_and_line(file, line); @@ -307,7 +309,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes); - void klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info); + void klass2reg_with_patching(LIR_Opr r, ciMetadata* obj, CodeEmitInfo* info, bool need_resolve = false); // this loads the length and compares against the index void array_range_check (LIR_Opr array, LIR_Opr index, CodeEmitInfo* null_check_info, CodeEmitInfo* range_check_info); @@ -325,7 +327,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info); void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no); - void new_instance (LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info); + void new_instance (LIR_Opr dst, ciInstanceKlass* klass, bool is_unresolved, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info); // machine dependent void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info); From 8bd4b5624c6ece31d965259aadc290a24d44423a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rickard=20B=C3=A4ckman?= Date: Thu, 22 May 2014 13:42:44 +0200 Subject: [PATCH 15/56] 8030976: Untaken paths should be more vigorously pruned at highest optimization level Reviewed-by: roland, vlivanov --- hotspot/src/share/vm/oops/methodData.hpp | 2 +- hotspot/src/share/vm/opto/parse2.cpp | 75 ++----------------- .../src/share/vm/runtime/deoptimization.cpp | 1 + .../src/share/vm/runtime/deoptimization.hpp | 6 ++ hotspot/src/share/vm/runtime/vmStructs.cpp | 1 + 5 files changed, 14 insertions(+), 71 deletions(-) diff --git a/hotspot/src/share/vm/oops/methodData.hpp b/hotspot/src/share/vm/oops/methodData.hpp index be40bad175d..1c88ac55ffa 100644 --- a/hotspot/src/share/vm/oops/methodData.hpp +++ b/hotspot/src/share/vm/oops/methodData.hpp @@ -2053,7 +2053,7 @@ public: // Whole-method sticky bits and flags enum { - _trap_hist_limit = 20, // decoupled from Deoptimization::Reason_LIMIT + _trap_hist_limit = 21, // decoupled from Deoptimization::Reason_LIMIT _trap_hist_mask = max_jubyte, _extra_data_count = 4 // extra DataLayout headers, for trap history }; // Public flag values diff --git a/hotspot/src/share/vm/opto/parse2.cpp b/hotspot/src/share/vm/opto/parse2.cpp index b1c42244641..15826863ee5 100644 --- a/hotspot/src/share/vm/opto/parse2.cpp +++ b/hotspot/src/share/vm/opto/parse2.cpp @@ -897,53 +897,12 @@ bool Parse::seems_never_taken(float prob) { // if a path is never taken, its controlling comparison is // already acting in a stable fashion. If the comparison // seems stable, we will put an expensive uncommon trap -// on the untaken path. To be conservative, and to allow -// partially executed counted loops to be compiled fully, -// we will plant uncommon traps only after pointer comparisons. +// on the untaken path. bool Parse::seems_stable_comparison(BoolTest::mask btest, Node* cmp) { - for (int depth = 4; depth > 0; depth--) { - // The following switch can find CmpP here over half the time for - // dynamic language code rich with type tests. - // Code using counted loops or array manipulations (typical - // of benchmarks) will have many (>80%) CmpI instructions. - switch (cmp->Opcode()) { - case Op_CmpP: - // A never-taken null check looks like CmpP/BoolTest::eq. - // These certainly should be closed off as uncommon traps. - if (btest == BoolTest::eq) - return true; - // A never-failed type check looks like CmpP/BoolTest::ne. - // Let's put traps on those, too, so that we don't have to compile - // unused paths with indeterminate dynamic type information. - if (ProfileDynamicTypes) - return true; - return false; - - case Op_CmpI: - // A small minority (< 10%) of CmpP are masked as CmpI, - // as if by boolean conversion ((p == q? 1: 0) != 0). - // Detect that here, even if it hasn't optimized away yet. - // Specifically, this covers the 'instanceof' operator. - if (btest == BoolTest::ne || btest == BoolTest::eq) { - if (_gvn.type(cmp->in(2))->singleton() && - cmp->in(1)->is_Phi()) { - PhiNode* phi = cmp->in(1)->as_Phi(); - int true_path = phi->is_diamond_phi(); - if (true_path > 0 && - _gvn.type(phi->in(1))->singleton() && - _gvn.type(phi->in(2))->singleton()) { - // phi->region->if_proj->ifnode->bool->cmp - BoolNode* bol = phi->in(0)->in(1)->in(0)->in(1)->as_Bool(); - btest = bol->_test._test; - cmp = bol->in(1); - continue; - } - } - } - return false; - } + if (C->too_many_traps(method(), bci(), Deoptimization::Reason_unstable_if)) { + return false; } - return false; + return true; } //-------------------------------repush_if_args-------------------------------- @@ -1182,32 +1141,8 @@ void Parse::adjust_map_after_if(BoolTest::mask btest, Node* c, float prob, bool is_fallthrough = (path == successor_for_bci(iter().next_bci())); if (seems_never_taken(prob) && seems_stable_comparison(btest, c)) { - // If this might possibly turn into an implicit null check, - // and the null has never yet been seen, we need to generate - // an uncommon trap, so as to recompile instead of suffering - // with very slow branches. (We'll get the slow branches if - // the program ever changes phase and starts seeing nulls here.) - // - // We do not inspect for a null constant, since a node may - // optimize to 'null' later on. - // - // Null checks, and other tests which expect inequality, - // show btest == BoolTest::eq along the non-taken branch. - // On the other hand, type tests, must-be-null tests, - // and other tests which expect pointer equality, - // show btest == BoolTest::ne along the non-taken branch. - // We prune both types of branches if they look unused. repush_if_args(); - // We need to mark this branch as taken so that if we recompile we will - // see that it is possible. In the tiered system the interpreter doesn't - // do profiling and by the time we get to the lower tier from the interpreter - // the path may be cold again. Make sure it doesn't look untaken - if (is_fallthrough) { - profile_not_taken_branch(!ProfileInterpreter); - } else { - profile_taken_branch(iter().get_dest(), !ProfileInterpreter); - } - uncommon_trap(Deoptimization::Reason_unreached, + uncommon_trap(Deoptimization::Reason_unstable_if, Deoptimization::Action_reinterpret, NULL, (is_fallthrough ? "taken always" : "taken never")); diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp index e4b1292c6b6..b15664f4b52 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.cpp +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp @@ -1840,6 +1840,7 @@ const char* Deoptimization::_trap_reason_name[] = { "speculate_class_check", "speculate_null_check", "rtm_state_change", + "unstable_if", "tenured" }; const char* Deoptimization::_trap_action_name[] = { diff --git a/hotspot/src/share/vm/runtime/deoptimization.hpp b/hotspot/src/share/vm/runtime/deoptimization.hpp index 02daabccb98..ee461196bd0 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.hpp +++ b/hotspot/src/share/vm/runtime/deoptimization.hpp @@ -62,6 +62,10 @@ class Deoptimization : AllStatic { Reason_speculate_class_check, // saw unexpected object class from type speculation Reason_speculate_null_check, // saw unexpected null from type speculation Reason_rtm_state_change, // rtm state change detected + Reason_unstable_if, // a branch predicted always false was taken + + // Reason_tenured is counted separately, add normal counted Reasons above. + // Related to MethodData::_trap_hist_limit where Reason_tenured isn't included Reason_tenured, // age of the code has reached the limit Reason_LIMIT, // Note: Keep this enum in sync. with _trap_reason_name. @@ -319,6 +323,8 @@ class Deoptimization : AllStatic { return Reason_class_check; else if (reason == Reason_speculate_null_check) return Reason_null_check; + else if (reason == Reason_unstable_if) + return Reason_intrinsic; else return Reason_none; } diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 49f0b321011..1ae7ddf6681 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -2504,6 +2504,7 @@ typedef TwoOopHashtable SymbolTwoOopHashtable; declare_constant(Deoptimization::Reason_speculate_class_check) \ declare_constant(Deoptimization::Reason_speculate_null_check) \ declare_constant(Deoptimization::Reason_rtm_state_change) \ + declare_constant(Deoptimization::Reason_unstable_if) \ declare_constant(Deoptimization::Reason_tenured) \ declare_constant(Deoptimization::Reason_LIMIT) \ declare_constant(Deoptimization::Reason_RECORDED_LIMIT) \ From aeff8925b30d0532ee50b19e42b3ebc0c8ac4f68 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Thu, 5 Jun 2014 10:43:16 +0200 Subject: [PATCH 16/56] 8031389: On x86 C1 emits two relocations for polls C1 emits two poll_type relocations at safepoint polls because LIR_Assembler::safepoint_poll(..) adds a relocation and calls LIR_Assembler::add_debug_info_for_branch(..) which adds a relocation as well. The implementation of add_debug_info_for_branch(..) is changed to not emit a poll relocation. Reviewed-by: kvn, roland --- hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp | 5 +---- hotspot/src/share/vm/c1/c1_LIRAssembler.cpp | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp index 813cbf0fa03..0c733a7b1b9 100644 --- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp @@ -1612,13 +1612,10 @@ int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) { __ set((intptr_t)os::get_polling_page(), tmp->as_register()); if (info != NULL) { add_debug_info_for_branch(info); - } else { - __ relocate(relocInfo::poll_type); } - int offset = __ offset(); + __ relocate(relocInfo::poll_type); __ ld_ptr(tmp->as_register(), 0, G0); - return offset; } diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp index ef2b10623a4..5697e9046aa 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp @@ -336,7 +336,6 @@ void LIR_Assembler::check_no_unbound_labels() { void LIR_Assembler::add_debug_info_for_branch(CodeEmitInfo* info) { - _masm->code_section()->relocate(pc(), relocInfo::poll_type); int pc_offset = code_offset(); flush_debug_info(pc_offset); info->record_debug_info(compilation()->debug_info_recorder(), pc_offset); From cdd2105184ddc9df5d19605729ef7728f773a5e9 Mon Sep 17 00:00:00 2001 From: Nils Eliasson Date: Mon, 9 Jun 2014 10:32:49 +0200 Subject: [PATCH 17/56] 8040244: compiler/whitebox/IsMethodCompilableTest.java fails Prevent from running with Xcomp Reviewed-by: kvn, twisti --- hotspot/test/compiler/whitebox/IsMethodCompilableTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java index 88e5cd835e4..acede605a4f 100644 --- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java +++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java @@ -28,7 +28,7 @@ * @build IsMethodCompilableTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform - * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest + * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest * @summary testing of WB::isMethodCompilable() * @author igor.ignatyev@oracle.com */ From 075ea2546214161898cca9bee6ca8939ecdf4c88 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 9 Jun 2014 11:49:02 +0000 Subject: [PATCH 18/56] 8046226: assert(_thread == Thread::current()) failed: thread must be current w/ -XX:+TraceDeoptimization -XX:+Verbose Reviewed-by: twisti, dcubed, fparain --- hotspot/src/share/vm/runtime/vframe.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/runtime/vframe.cpp b/hotspot/src/share/vm/runtime/vframe.cpp index a32d03a7b21..79da635c443 100644 --- a/hotspot/src/share/vm/runtime/vframe.cpp +++ b/hotspot/src/share/vm/runtime/vframe.cpp @@ -274,7 +274,8 @@ StackValueCollection* interpretedVFrame::locals() const { // Get oopmap describing oops and int for current bci InterpreterOopMap oop_mask; if (TraceDeoptimization && Verbose) { - methodHandle m_h(thread(), method()); + // need the current JavaThread and not thread() + methodHandle m_h(Thread::current(), method()); OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask); } else { method()->mask_for(bci(), &oop_mask); @@ -335,7 +336,8 @@ StackValueCollection* interpretedVFrame::expressions() const { if (!method()->is_native()) { // Get oopmap describing oops and int for current bci if (TraceDeoptimization && Verbose) { - methodHandle m_h(method()); + // need the current JavaThread and not thread() + methodHandle m_h(Thread::current(), method()); OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask); } else { method()->mask_for(bci(), &oop_mask); From 7ab2a6410b9405b472bc80b2dc518f89f51bc4e1 Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Fri, 13 Jun 2014 14:30:41 +0100 Subject: [PATCH 19/56] 8046588: test for SO_FLOW_SLA availability does not check for EACCESS Reviewed-by: alanb, chegar --- .../native/java/net/ExtendedOptionsImpl.c | 6 ++++++ jdk/test/jdk/net/Sockets/Test.java | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/jdk/src/solaris/native/java/net/ExtendedOptionsImpl.c b/jdk/src/solaris/native/java/net/ExtendedOptionsImpl.c index 086ac9f9dc6..123c6575559 100644 --- a/jdk/src/solaris/native/java/net/ExtendedOptionsImpl.c +++ b/jdk/src/solaris/native/java/net/ExtendedOptionsImpl.c @@ -218,6 +218,9 @@ JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_setFlowOption if (errno == ENOPROTOOPT) { JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "unsupported socket option"); + } else if (errno == EACCES || errno == EPERM) { + NET_ERROR(env, JNU_JAVANETPKG "SocketException", + "Permission denied"); } else { NET_ERROR(env, JNU_JAVANETPKG "SocketException", "set option SO_FLOW_SLA failed"); @@ -251,6 +254,9 @@ JNIEXPORT void JNICALL Java_sun_net_ExtendedOptionsImpl_getFlowOption if (errno == ENOPROTOOPT) { JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "unsupported socket option"); + } else if (errno == EACCES || errno == EPERM) { + NET_ERROR(env, JNU_JAVANETPKG "SocketException", + "Permission denied"); } else { NET_ERROR(env, JNU_JAVANETPKG "SocketException", "set option SO_FLOW_SLA failed"); diff --git a/jdk/test/jdk/net/Sockets/Test.java b/jdk/test/jdk/net/Sockets/Test.java index da609bf7501..bf3758c5bae 100644 --- a/jdk/test/jdk/net/Sockets/Test.java +++ b/jdk/test/jdk/net/Sockets/Test.java @@ -30,8 +30,10 @@ */ import java.net.*; +import java.io.IOException; import java.nio.channels.*; import java.util.concurrent.*; +import java.util.Set; import jdk.net.*; public class Test { @@ -75,6 +77,13 @@ public class Test { DatagramSocket dg = new DatagramSocket(0); final int udp_port = dg.getLocalPort(); + // If option not available, end test + Set> options = dg.supportedOptions(); + if (!options.contains(ExtendedSocketOptions.SO_FLOW_SLA)) { + System.out.println("SO_FLOW_SLA not supported"); + return; + } + final Socket s = new Socket("127.0.0.1", tcp_port); final SocketChannel sc = SocketChannel.open(); sc.connect (new InetSocketAddress("127.0.0.1", tcp_port)); @@ -125,6 +134,13 @@ public class Test { if (success) { throw new RuntimeException("Test failed"); } - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + System.out.println (e); + } catch (IOException e) { + // Probably a permission error, but we're not + // going to check unless a specific permission exception + // is defined. + System.out.println (e); + } } } From 12e0fea90cb39d947b8df2d80c1722944132595f Mon Sep 17 00:00:00 2001 From: Katja Kantserova Date: Mon, 16 Jun 2014 11:03:54 +0200 Subject: [PATCH 20/56] 6545295: TEST BUG: The test HatHeapDump1Test uses wrong path in exec call Reviewed-by: sla --- jdk/test/sun/tools/jhat/HatHeapDump1Test.java | 71 ++++-- jdk/test/sun/tools/jhat/HatRun.java | 226 ------------------ 2 files changed, 54 insertions(+), 243 deletions(-) delete mode 100644 jdk/test/sun/tools/jhat/HatRun.java diff --git a/jdk/test/sun/tools/jhat/HatHeapDump1Test.java b/jdk/test/sun/tools/jhat/HatHeapDump1Test.java index f561bd19848..babd09d44db 100644 --- a/jdk/test/sun/tools/jhat/HatHeapDump1Test.java +++ b/jdk/test/sun/tools/jhat/HatHeapDump1Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -21,31 +21,68 @@ * questions. */ +import java.io.File; +import java.util.Arrays; -/* @test HatHeapDump1Test.java +import jdk.testlibrary.Asserts; +import jdk.testlibrary.JDKToolLauncher; +import jdk.testlibrary.OutputAnalyzer; +import jdk.testlibrary.ProcessTools; + +/* @test * @bug 5102009 - * @summary Test jhat - * - * @compile -g HelloWorld.java HatRun.java - * @build HatHeapDump1Test - * @run main HatHeapDump1Test HelloWorld + * @summary Sanity test of jhat functionality + * @library /lib/testlibrary + * @build jdk.testlibarary.* + * @compile -g HelloWorld.java + * @run main HatHeapDump1Test */ - public class HatHeapDump1Test { + private static final String TEST_CLASSES = System.getProperty("test.classes", "."); + public static void main(String args[]) throws Exception { - HatRun run; + String className = "HelloWorld"; + File dumpFile = new File(className + ".hdump"); - /* Run hprof and jhat */ - run = new HatRun("heap=dump", ""); - run.runit(args[0]); + // Generate a heap dump + ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder("-cp", + TEST_CLASSES, + "-Xcheck:jni", + "-Xverify:all", + "-agentlib:hprof=heap=dump,format=b,file=" + dumpFile.getAbsolutePath(), + className); + OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); + System.out.println(output.getOutput()); + output.shouldHaveExitValue(0); + output.shouldContain("Dumping Java heap ... done"); + Asserts.assertTrue(dumpFile.exists() && dumpFile.isFile(), "Invalid dump file " + dumpFile.getAbsolutePath()); - /* Make sure patterns in output look ok */ - if (run.output_contains("ERROR")) { - throw new RuntimeException("Test failed - ERROR seen in output"); + // Run jhat to analyze the heap dump + output = jhat("-debug", "2", dumpFile.getAbsolutePath()); + output.shouldHaveExitValue(0); + output.shouldContain("Snapshot resolved"); + output.shouldContain("-debug 2 was used"); + output.shouldNotContain("ERROR"); + + dumpFile.delete(); + } + + private static OutputAnalyzer jhat(String... toolArgs) throws Exception { + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhat"); + if (toolArgs != null) { + for (String toolArg : toolArgs) { + launcher.addToolArg(toolArg); + } } - /* Must be a pass. */ - System.out.println("Test passed - cleanly terminated"); + ProcessBuilder processBuilder = new ProcessBuilder(); + processBuilder.command(launcher.getCommand()); + System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", "")); + OutputAnalyzer output = new OutputAnalyzer(processBuilder.start()); + System.out.println(output.getOutput()); + + return output; } + } diff --git a/jdk/test/sun/tools/jhat/HatRun.java b/jdk/test/sun/tools/jhat/HatRun.java deleted file mode 100644 index 284083580ec..00000000000 --- a/jdk/test/sun/tools/jhat/HatRun.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - * 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. - */ - - -/* - * - * Support classes for running jhat tests - * - */ - -import java.io.InputStream; -import java.io.IOException; -import java.io.File; -import java.io.BufferedInputStream; -import java.io.PrintStream; - -/* - * Helper class to direct process output to a StringBuffer - */ -class MyInputStream implements Runnable { - private String name; - private BufferedInputStream in; - private StringBuffer buffer; - - /* Create MyInputStream that saves all output to a StringBuffer */ - MyInputStream(String name, InputStream in) { - this.name = name; - this.in = new BufferedInputStream(in); - buffer = new StringBuffer(4096); - Thread thr = new Thread(this); - thr.setDaemon(true); - thr.start(); - } - - /* Dump the buffer */ - void dump(PrintStream x) { - String str = buffer.toString(); - x.println(""); - x.println(str); - x.println(""); - } - - /* Check to see if a pattern is inside the output. */ - boolean contains(String pattern) { - String str = buffer.toString(); - return str.contains(pattern); - } - - /* Runs as a separate thread capturing all output in a StringBuffer */ - public void run() { - try { - byte b[] = new byte[100]; - for (;;) { - int n = in.read(b); - String str; - if (n < 0) { - break; - } - str = new String(b, 0, n); - buffer.append(str); - System.out.print(str); - } - } catch (IOException ioe) { /* skip */ } - } -} - -/* - * Main jhat run - */ -public class HatRun { - - private String all_hprof_options; - private String all_hat_options; - private String dumpfile; - private MyInputStream output; - private MyInputStream error; - - /* Create a Hat run process */ - public HatRun(String hprof_options, String hat_options) - { - all_hprof_options = hprof_options; - all_hat_options = hat_options; - } - - /* - * Execute a process with an -agentpath or -agentlib command option - */ - public void runit(String class_name) - { - runit(class_name, null); - } - - /* - * Execute a command. - */ - private void execute(String cmd[]) - { - /* Begin process */ - Process p; - String cmdLine = ""; - int i; - - for ( i = 0 ; i < cmd.length; i++ ) { - cmdLine += cmd[i]; - cmdLine += " "; - } - System.out.println("Starting: " + cmdLine); - - try { - p = Runtime.getRuntime().exec(cmd); - } catch ( IOException e ) { - throw new RuntimeException("Test failed - exec got IO exception"); - } - - /* Save process output in StringBuffers */ - output = new MyInputStream("Input Stream", p.getInputStream()); - error = new MyInputStream("Error Stream", p.getErrorStream()); - - /* Wait for process to complete, and if exit code is non-zero we fail */ - try { - int exitStatus; - exitStatus = p.waitFor(); - if ( exitStatus != 0) { - System.out.println("Exit code is " + exitStatus); - error.dump(System.out); - output.dump(System.out); - throw new RuntimeException("Test failed - " + - "exit return code non-zero " + - "(exitStatus==" + exitStatus + ")"); - } - } catch ( InterruptedException e ) { - throw new RuntimeException("Test failed - process interrupted"); - } - System.out.println("Completed: " + cmdLine); - } - - /* - * Execute a process with an -agentpath or -agentlib command option - * plus any set of other java options. - */ - public void runit(String class_name, String vm_options[]) - { - String jre_home = System.getProperty("java.home"); - String sdk_home = (jre_home.endsWith("jre") ? - (jre_home + File.separator + "..") : - jre_home ); - String cdir = System.getProperty("test.classes", "."); - String os_arch = System.getProperty("os.arch"); - String os_name = System.getProperty("os.name"); - String java = jre_home - + File.separator + "bin" - + File.separator + "java"; - String jhat = sdk_home + File.separator + "bin" - + File.separator + "jhat"; - /* Array of strings to be passed in for exec: - * 1. java - * 2. -Dtest.classes=. - * 3. -Xcheck:jni (Just because it finds bugs) - * 4. -Xverify:all (Make sure verification is on full blast) - * 5. -agent - * vm_options - * 6+i. classname - */ - int nvm_options = 0; - if ( vm_options != null ) nvm_options = vm_options.length; - String cmd[] = new String[1 + 7 + nvm_options]; - int i,j; - - i = 0; - cmd[i++] = java; - cmd[i++] = "-cp"; - cmd[i++] = cdir; - cmd[i++] = "-Dtest.classes=" + cdir; - cmd[i++] = "-Xcheck:jni"; - cmd[i++] = "-Xverify:all"; - dumpfile= cdir + File.separator + class_name + ".hdump"; - cmd[i++] = "-agentlib:hprof=" + all_hprof_options - + ",format=b,file=" + dumpfile; - /* Add any special VM options */ - for ( j = 0; j < nvm_options; j++ ) { - cmd[i++] = vm_options[j]; - } - /* Add classname */ - cmd[i++] = class_name; - - /* Execute process */ - execute(cmd); - - /* Run jhat */ - String jhat_cmd[] = new String[4]; - jhat_cmd[0] = jhat; - jhat_cmd[1] = "-debug"; - jhat_cmd[2] = "2"; - jhat_cmd[3] = dumpfile; - - /* Execute process */ - execute(jhat_cmd); - - } - - /* Does the pattern appear in the output of this process */ - public boolean output_contains(String pattern) - { - return output.contains(pattern) || error.contains(pattern); - } -} From a20967bfac8459744f796f0969cc549a0d568f90 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Mon, 16 Jun 2014 13:52:25 +0200 Subject: [PATCH 21/56] 8043939: Remove management-agent.jar Reviewed-by: alanb --- jdk/make/CreateJars.gmk | 9 --------- jdk/make/profile-includes.txt | 4 +--- .../build/tools/buildmetaindex/BuildMetaIndex.java | 1 - jdk/src/share/classes/sun/management/manifest | 3 --- 4 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 jdk/src/share/classes/sun/management/manifest diff --git a/jdk/make/CreateJars.gmk b/jdk/make/CreateJars.gmk index 9d79394539c..f1c5178d7c8 100644 --- a/jdk/make/CreateJars.gmk +++ b/jdk/make/CreateJars.gmk @@ -676,15 +676,6 @@ endif ########################################################################################## -# -# This is an empty jar (only contains manifest) and fits poorly into framework... -# create simple rule instead -# -$(IMAGES_OUTPUTDIR)/lib/management-agent.jar: $(JDK_TOPDIR)/src/share/classes/sun/management/manifest - $(JAR) cfm $@ $< - -########################################################################################## - # This file is imported from hotspot in Import.gmk. Copying it into images/lib so that # all jars can be found in one place when creating images in Images.gmk. It needs to be # done here so that clean targets can be simple and accurate. diff --git a/jdk/make/profile-includes.txt b/jdk/make/profile-includes.txt index f2ae4c1b31c..54e3126a03e 100644 --- a/jdk/make/profile-includes.txt +++ b/jdk/make/profile-includes.txt @@ -132,7 +132,6 @@ PROFILE_3_JRE_LIB_FILES := \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)prefs$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \ jvm.hprof.txt \ - management-agent.jar \ management/jmxremote.access \ management/jmxremote.password.template \ management/management.properties \ @@ -140,8 +139,7 @@ PROFILE_3_JRE_LIB_FILES := \ PROFILE_3_JRE_OTHER_FILES := -PROFILE_3_JRE_JAR_FILES := \ - management-agent.jar +PROFILE_3_JRE_JAR_FILES := FULL_JRE_BIN_FILES := \ diff --git a/jdk/make/src/classes/build/tools/buildmetaindex/BuildMetaIndex.java b/jdk/make/src/classes/build/tools/buildmetaindex/BuildMetaIndex.java index 631d437c39c..c39ee6fabc2 100644 --- a/jdk/make/src/classes/build/tools/buildmetaindex/BuildMetaIndex.java +++ b/jdk/make/src/classes/build/tools/buildmetaindex/BuildMetaIndex.java @@ -53,7 +53,6 @@ sun/ com/sun/net/ javax/ com/sun/security/ -# management-agent.jar ! rt.jar org/w3c/ com/sun/image/ diff --git a/jdk/src/share/classes/sun/management/manifest b/jdk/src/share/classes/sun/management/manifest deleted file mode 100644 index 1de62db37ce..00000000000 --- a/jdk/src/share/classes/sun/management/manifest +++ /dev/null @@ -1,3 +0,0 @@ -Premain-Class: sun.management.Agent -Agent-Class: sun.management.Agent - From d4988ce66f05d9894e725cb43322e6218843b859 Mon Sep 17 00:00:00 2001 From: Vinnie Ryan Date: Mon, 16 Jun 2014 13:40:49 +0100 Subject: [PATCH 22/56] 8036613: [parfait] JNI exception pending in jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c Reviewed-by: mullan --- .../native/sun/security/provider/WinCAPISeedGenerator.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c b/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c index 8d7f753aa58..d239f02143c 100644 --- a/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c +++ b/jdk/src/windows/native/sun/security/provider/WinCAPISeedGenerator.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -59,11 +59,16 @@ JNIEXPORT jboolean JNICALL Java_sun_security_provider_NativeSeedGenerator_native numBytes = (*env)->GetArrayLength(env, randArray); randBytes = (*env)->GetByteArrayElements(env, randArray, NULL); + if (randBytes == NULL) { + goto cleanup; + } + if (CryptGenRandom(hCryptProv, numBytes, randBytes)) { result = JNI_TRUE; } (*env)->ReleaseByteArrayElements(env, randArray, randBytes, 0); +cleanup: CryptReleaseContext(hCryptProv, 0); return result; From c201595a62689b1b793f454e30a5784e06651fd4 Mon Sep 17 00:00:00 2001 From: Dmitry Samersoff Date: Mon, 16 Jun 2014 07:25:11 -0700 Subject: [PATCH 23/56] 8041498: Remove npt library Get rid of npt library and move utf-related code to share/backend Reviewed-by: sla --- jdk/make/CompileDemos.gmk | 4 +- jdk/make/lib/CoreLibraries.gmk | 29 +- jdk/make/lib/ServiceabilityLibraries.gmk | 7 +- jdk/make/mapfiles/libnpt/mapfile-vers | 34 -- jdk/make/profile-includes.txt | 4 +- jdk/src/share/back/debugInit.c | 22 +- jdk/src/share/back/error_messages.c | 12 +- jdk/src/share/back/inStream.c | 10 +- jdk/src/share/back/outStream.c | 10 +- jdk/src/share/back/transport.c | 12 +- jdk/src/share/{npt/utf.c => back/utf_util.c} | 522 ++++++++++-------- .../npt/utf_md.h => share/back/utf_util.h} | 19 +- jdk/src/share/back/util.h | 8 +- jdk/src/share/demo/jvmti/hprof/hprof.h | 9 +- jdk/src/share/demo/jvmti/hprof/hprof_init.c | 30 +- jdk/src/share/npt/README.txt | 39 -- jdk/src/share/npt/npt.c | 90 --- jdk/src/share/npt/npt.h | 109 ---- jdk/src/share/npt/utf.h | 77 --- jdk/src/solaris/npt/npt_md.h | 69 --- jdk/src/solaris/npt/utf_md.c | 179 ------ jdk/src/solaris/npt/utf_md.h | 34 -- jdk/src/windows/npt/npt_md.h | 68 --- jdk/src/windows/npt/utf_md.c | 172 ------ 24 files changed, 322 insertions(+), 1247 deletions(-) delete mode 100644 jdk/make/mapfiles/libnpt/mapfile-vers rename jdk/src/share/{npt/utf.c => back/utf_util.c} (53%) rename jdk/src/{windows/npt/utf_md.h => share/back/utf_util.h} (65%) delete mode 100644 jdk/src/share/npt/README.txt delete mode 100644 jdk/src/share/npt/npt.c delete mode 100644 jdk/src/share/npt/npt.h delete mode 100644 jdk/src/share/npt/utf.h delete mode 100644 jdk/src/solaris/npt/npt_md.h delete mode 100644 jdk/src/solaris/npt/utf_md.c delete mode 100644 jdk/src/solaris/npt/utf_md.h delete mode 100644 jdk/src/windows/npt/npt_md.h delete mode 100644 jdk/src/windows/npt/utf_md.c diff --git a/jdk/make/CompileDemos.gmk b/jdk/make/CompileDemos.gmk index 6f80d632c49..2cdf72211e0 100644 --- a/jdk/make/CompileDemos.gmk +++ b/jdk/make/CompileDemos.gmk @@ -1,6 +1,5 @@ - # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -320,7 +319,6 @@ ifeq ($(OPENJDK_TARGET_OS), aix) endif $(eval $(call SetupJVMTIDemo,hprof, java_crw_demo, \ - -I$(JDK_TOPDIR)/src/share/npt -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \ $(BUILD_LIBHPROF_AIX_EXTRA_CFLAGS), C, \ -ldl, ws2_32.lib winmm.lib, -lsocket -lnsl, -lpthread, $(BUILD_LIBHPROF_AIX_EXTRA_SRC))) diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk index 66ef38ec94f..aa4d90c3e14 100644 --- a/jdk/make/lib/CoreLibraries.gmk +++ b/jdk/make/lib/CoreLibraries.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -526,30 +526,3 @@ else ifeq ($(OPENJDK_TARGET_OS), aix) BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a endif - -########################################################################################## - -$(eval $(call SetupNativeCompilation,BUILD_LIBNPT, \ - LIBRARY := npt, \ - OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ - SRC := $(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \ - LANG := C, \ - OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ - -I$(JDK_TOPDIR)/src/share/npt \ - -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \ - MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnpt/mapfile-vers, \ - LDFLAGS := $(LDFLAGS_JDKLIB) \ - $(call SET_SHARED_LIBRARY_ORIGIN), \ - LDFLAGS_macosx := -liconv, \ - LDFLAGS_SUFFIX_windows := -export:nptInitialize -export:nptTerminate, \ - LDFLAGS_SUFFIX_solaris := -lc, \ - VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ - RC_FLAGS := $(RC_FLAGS) \ - -D "JDK_FNAME=npt.dll" \ - -D "JDK_INTERNAL_NAME=npt" \ - -D "JDK_FTYPE=0x2L", \ - OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnpt, \ - DEBUG_SYMBOLS := true)) - -BUILD_LIBRARIES += $(BUILD_LIBNPT) diff --git a/jdk/make/lib/ServiceabilityLibraries.gmk b/jdk/make/lib/ServiceabilityLibraries.gmk index 550a3e722da..a39a2815904 100644 --- a/jdk/make/lib/ServiceabilityLibraries.gmk +++ b/jdk/make/lib/ServiceabilityLibraries.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 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 @@ -147,8 +147,6 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP, \ CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DJDWP_LOGGING \ -I$(JDK_TOPDIR)/src/share/transport/export \ -I$(JDK_TOPDIR)/src/share/back/export \ - -I$(JDK_TOPDIR)/src/share/npt \ - -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \ -I$(JDK_TOPDIR)/src/share/back \ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back \ -I$(JDK_OUTPUTDIR)/gensrc_jdwp_headers, \ @@ -158,6 +156,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP, \ LDFLAGS_SUFFIX_linux := $(LIBDL), \ LDFLAGS_SUFFIX_solaris := $(LIBDL) -lc, \ LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX), \ + LDFLAGS_SUFFIX_macosx := -liconv, \ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ RC_FLAGS := $(RC_FLAGS) \ -D "JDK_FNAME=jdwp.dll" \ @@ -340,8 +339,6 @@ BUILD_LIBRARIES += $(BUILD_LIBMANAGEMENT) BUILD_LIBHPROF_SRC := $(JDK_TOPDIR)/src/share/demo/jvmti/hprof $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/hprof BUILD_LIBHPROF_CFLAGS := -I$(JDK_TOPDIR)/src/share/demo/jvmti/hprof \ - -I$(JDK_TOPDIR)/src/share/npt \ - -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \ -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo ifeq ($(OPENJDK_TARGET_OS), aix) diff --git a/jdk/make/mapfiles/libnpt/mapfile-vers b/jdk/make/mapfiles/libnpt/mapfile-vers deleted file mode 100644 index d6c03e4a907..00000000000 --- a/jdk/make/mapfiles/libnpt/mapfile-vers +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 2004, 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 public interface. - -SUNWprivate_1.1 { - global: - nptInitialize; - nptTerminate; - local: - *; -}; diff --git a/jdk/make/profile-includes.txt b/jdk/make/profile-includes.txt index 54e3126a03e..2d013fc26fe 100644 --- a/jdk/make/profile-includes.txt +++ b/jdk/make/profile-includes.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 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 @@ -127,8 +127,6 @@ PROFILE_3_JRE_LIB_FILES := \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \ - $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt$(SHARED_LIBRARY_SUFFIX) \ - $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)prefs$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \ jvm.hprof.txt \ diff --git a/jdk/src/share/back/debugInit.c b/jdk/src/share/back/debugInit.c index 25ffbffc91a..7b44cad0b05 100644 --- a/jdk/src/share/back/debugInit.c +++ b/jdk/src/share/back/debugInit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -202,8 +202,6 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) jint jvmtiCompileTimeMajorVersion; jint jvmtiCompileTimeMinorVersion; jint jvmtiCompileTimeMicroVersion; - char *boot_path = NULL; - char npt_lib[MAXPATHLEN]; /* See if it's already loaded */ if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) { @@ -268,24 +266,6 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) forceExit(1); /* Kill entire process, no core dump wanted */ } - JVMTI_FUNC_PTR(gdata->jvmti, GetSystemProperty) - (gdata->jvmti, (const char *)"sun.boot.library.path", - &boot_path); - - dbgsysBuildLibName(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME); - /* Npt and Utf function init */ - NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL); - jvmtiDeallocate(boot_path); - if (gdata->npt == NULL) { - ERROR_MESSAGE(("JDWP: unable to initialize NPT library")); - return JNI_ERR; - } - gdata->npt->utf = (gdata->npt->utfInitialize)(NULL); - if (gdata->npt->utf == NULL) { - ERROR_MESSAGE(("JDWP: UTF function initialization failed")); - return JNI_ERR; - } - /* Parse input options */ if (!parseOptions(options)) { /* No message necessary, should have been printed out already */ diff --git a/jdk/src/share/back/error_messages.c b/jdk/src/share/back/error_messages.c index d6207965497..9c2fdd72927 100644 --- a/jdk/src/share/back/error_messages.c +++ b/jdk/src/share/back/error_messages.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -47,6 +47,7 @@ #include #include "util.h" +#include "utf_util.h" #include "proc_md.h" /* Maximim length of a message */ @@ -70,13 +71,8 @@ vprint_message(FILE *fp, const char *prefix, const char *suffix, len = (int)strlen((char*)utf8buf); /* Convert to platform encoding (ignore errors, dangerous area) */ - if (gdata->npt != NULL) { - (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf, - utf8buf, len, pbuf, MAX_MESSAGE_LEN); - } else { - /* May be called before NPT is initialized so don't fault */ - strncpy(pbuf, (char*)utf8buf, len); - } + (void)utf8ToPlatform(utf8buf, len, pbuf, MAX_MESSAGE_LEN); + (void)fprintf(fp, "%s%s%s", prefix, pbuf, suffix); } diff --git a/jdk/src/share/back/inStream.c b/jdk/src/share/back/inStream.c index 3c4d5b266d3..0e1ca3f18e4 100644 --- a/jdk/src/share/back/inStream.c +++ b/jdk/src/share/back/inStream.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -24,6 +24,7 @@ */ #include "util.h" +#include "utf_util.h" #include "stream.h" #include "inStream.h" #include "transport.h" @@ -379,15 +380,12 @@ inStream_readString(PacketInputStream *stream) string[length] = '\0'; /* This is Standard UTF-8, convert to Modified UTF-8 if necessary */ - new_length = (gdata->npt->utf8sToUtf8mLength) - (gdata->npt->utf, (jbyte*)string, length); + new_length = utf8sToUtf8mLength((jbyte*)string, length); if ( new_length != length ) { char *new_string; new_string = jvmtiAllocate(new_length+1); - (gdata->npt->utf8sToUtf8m) - (gdata->npt->utf, (jbyte*)string, length, - (jbyte*)new_string, new_length); + utf8sToUtf8m((jbyte*)string, length, (jbyte*)new_string, new_length); jvmtiDeallocate(string); return new_string; } diff --git a/jdk/src/share/back/outStream.c b/jdk/src/share/back/outStream.c index 93c55ba1d83..17edb14364a 100644 --- a/jdk/src/share/back/outStream.c +++ b/jdk/src/share/back/outStream.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -24,6 +24,7 @@ */ #include "util.h" +#include "utf_util.h" #include "stream.h" #include "outStream.h" #include "inStream.h" @@ -307,8 +308,7 @@ outStream_writeString(PacketOutputStream *stream, char *string) } else { jint new_length; - new_length = (gdata->npt->utf8mToUtf8sLength) - (gdata->npt->utf, (jbyte*)string, length); + new_length = utf8mToUtf8sLength((jbyte*)string, length); if ( new_length == length ) { (void)outStream_writeInt(stream, length); error = writeBytes(stream, (jbyte *)string, length); @@ -316,9 +316,7 @@ outStream_writeString(PacketOutputStream *stream, char *string) char *new_string; new_string = jvmtiAllocate(new_length+1); - (gdata->npt->utf8mToUtf8s) - (gdata->npt->utf, (jbyte*)string, length, - (jbyte*)new_string, new_length); + utf8mToUtf8s((jbyte*)string, length, (jbyte*)new_string, new_length); (void)outStream_writeInt(stream, new_length); error = writeBytes(stream, (jbyte *)new_string, new_length); jvmtiDeallocate(new_string); diff --git a/jdk/src/share/back/transport.c b/jdk/src/share/back/transport.c index 4a17118e89a..c05d39c4267 100644 --- a/jdk/src/share/back/transport.c +++ b/jdk/src/share/back/transport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -24,6 +24,7 @@ */ #include "util.h" +#include "utf_util.h" #include "transport.h" #include "debugLoop.h" #include "sys.h" @@ -65,8 +66,7 @@ printLastError(jdwpTransportEnv *t, jdwpTransportError err) len = (int)strlen(msg); maxlen = len+len/2+2; /* Should allow for plenty of room */ utf8msg = (jbyte*)jvmtiAllocate(maxlen+1); - (void)(gdata->npt->utf8FromPlatform)(gdata->npt->utf, - msg, len, utf8msg, maxlen); + (void)utf8FromPlatform(msg, len, utf8msg, maxlen); utf8msg[maxlen] = 0; } if (rv == JDWPTRANSPORT_ERROR_NONE) { @@ -110,8 +110,7 @@ loadTransportLibrary(const char *libdir, const char *name) int len; len = (int)strlen(libdir); - (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf, - (jbyte*)libdir, len, buf, (int)sizeof(buf)); + (void)utf8ToPlatform((jbyte*)libdir, len, buf, (int)sizeof(buf)); plibdir = buf; } @@ -392,8 +391,7 @@ launch(char *command, char *name, char *address) /* Convert commandLine from UTF-8 to platform encoding */ len = (int)strlen(commandLine); buf = jvmtiAllocate(len*3+3); - (void)(gdata->npt->utf8ToPlatform)(gdata->npt->utf, - (jbyte*)commandLine, len, buf, len*3+3); + (void)utf8ToPlatform((jbyte*)commandLine, len, buf, len*3+3); /* Exec commandLine */ rc = dbgsysExec(buf); diff --git a/jdk/src/share/npt/utf.c b/jdk/src/share/back/utf_util.c similarity index 53% rename from jdk/src/share/npt/utf.c rename to jdk/src/share/back/utf_util.c index a3b437d346d..38793dfd95a 100644 --- a/jdk/src/share/npt/utf.c +++ b/jdk/src/share/back/utf_util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -23,117 +23,25 @@ * questions. */ -/* Misc functions for conversion of Unicode and UTF-8 and platform encoding */ - -#include -#include #include -#include -#include #include #include "jni.h" -#include "utf.h" +#include "utf_util.h" -/* - * Error handler - */ -void -utfError(char *file, int line, char *message) -{ + +/* Error and assert macros */ +#define UTF_ERROR(m) utfError(__FILE__, __LINE__, m) +#define UTF_ASSERT(x) ( (x)==0 ? UTF_ERROR("ASSERT ERROR " #x) : (void)0 ) + +// Platform independed part + +static void utfError(char *file, int line, char *message) { (void)fprintf(stderr, "UTF ERROR [\"%s\":%d]: %s\n", file, line, message); abort(); } -/* - * Convert UTF-8 to UTF-16 - * Returns length or -1 if output overflows. - */ -int JNICALL -utf8ToUtf16(struct UtfInst *ui, jbyte *utf8, int len, unsigned short *output, int outputMaxLen) -{ - int outputLen; - int i; - - UTF_ASSERT(utf8); - UTF_ASSERT(len>=0); - UTF_ASSERT(output); - UTF_ASSERT(outputMaxLen>0); - - i = 0; - outputLen = 0; - while ( i= outputMaxLen ) { - return -1; - } - x = (unsigned char)utf8[i++]; - code = x; - if ( (x & 0xE0)==0xE0 ) { - y = (unsigned char)utf8[i++]; - z = (unsigned char)utf8[i++]; - code = ((x & 0xF)<<12) + ((y & 0x3F)<<6) + (z & 0x3F); - } else if ( (x & 0xC0)==0xC0 ) { - y = (unsigned char)utf8[i++]; - code = ((x & 0x1F)<<6) + (y & 0x3F); - } - output[outputLen++] = code; - } - return outputLen; -} - -/* - * Convert UTF-16 to UTF-8 Modified - * Returns length or -1 if output overflows. - */ -int JNICALL -utf16ToUtf8m(struct UtfInst *ui, unsigned short *utf16, int len, jbyte *output, int outputMaxLen) -{ - int i; - int outputLen; - - UTF_ASSERT(utf16); - UTF_ASSERT(len>=0); - UTF_ASSERT(output); - UTF_ASSERT(outputMaxLen>0); - - outputLen = 0; - for (i = 0; i < len; i++) { - unsigned code; - - code = utf16[i]; - if ( code >= 0x0001 && code <= 0x007F ) { - if ( outputLen + 1 >= outputMaxLen ) { - return -1; - } - output[outputLen++] = code; - } else if ( code == 0 || ( code >= 0x0080 && code <= 0x07FF ) ) { - if ( outputLen + 2 >= outputMaxLen ) { - return -1; - } - output[outputLen++] = ((code>>6) & 0x1F) | 0xC0; - output[outputLen++] = (code & 0x3F) | 0x80; - } else if ( code >= 0x0800 && code <= 0xFFFF ) { - if ( outputLen + 3 >= outputMaxLen ) { - return -1; - } - output[outputLen++] = ((code>>12) & 0x0F) | 0xE0; - output[outputLen++] = ((code>>6) & 0x3F) | 0x80; - output[outputLen++] = (code & 0x3F) | 0x80; - } - } - output[outputLen] = 0; - return outputLen; -} - -int JNICALL -utf16ToUtf8s(struct UtfInst *ui, unsigned short *utf16, int len, jbyte *output, int outputMaxLen) -{ - return -1; /* FIXUP */ -} - /* Determine length of this Standard UTF-8 in Modified UTF-8. * Validation is done of the basic UTF encoding rules, returns * length (no change) when errors are detected in the UTF encoding. @@ -141,56 +49,54 @@ utf16ToUtf8s(struct UtfInst *ui, unsigned short *utf16, int len, jbyte *output, * Note: Accepts Modified UTF-8 also, no verification on the * correctness of Standard UTF-8 is done. e,g, 0xC080 input is ok. */ -int JNICALL -utf8sToUtf8mLength(struct UtfInst *ui, jbyte *string, int length) -{ - int newLength; - int i; +int JNICALL utf8sToUtf8mLength(jbyte *string, int length) { + int newLength; + int i; - newLength = 0; - for ( i = 0 ; i < length ; i++ ) { - unsigned byte; + newLength = 0; + for ( i = 0 ; i < length ; i++ ) { + unsigned byte; - byte = (unsigned char)string[i]; - if ( (byte & 0x80) == 0 ) { /* 1byte encoding */ - newLength++; - if ( byte == 0 ) { - newLength++; /* We gain one byte in length on NULL bytes */ - } - } else if ( (byte & 0xE0) == 0xC0 ) { /* 2byte encoding */ - /* Check encoding of following bytes */ - if ( (i+1) >= length || (string[i+1] & 0xC0) != 0x80 ) { - break; /* Error condition */ - } - i++; /* Skip next byte */ - newLength += 2; - } else if ( (byte & 0xF0) == 0xE0 ) { /* 3byte encoding */ - /* Check encoding of following bytes */ - if ( (i+2) >= length || (string[i+1] & 0xC0) != 0x80 - || (string[i+2] & 0xC0) != 0x80 ) { - break; /* Error condition */ - } - i += 2; /* Skip next two bytes */ - newLength += 3; - } else if ( (byte & 0xF8) == 0xF0 ) { /* 4byte encoding */ - /* Check encoding of following bytes */ - if ( (i+3) >= length || (string[i+1] & 0xC0) != 0x80 - || (string[i+2] & 0xC0) != 0x80 - || (string[i+3] & 0xC0) != 0x80 ) { - break; /* Error condition */ - } - i += 3; /* Skip next 3 bytes */ - newLength += 6; /* 4byte encoding turns into 2 3byte ones */ - } else { - break; /* Error condition */ + byte = (unsigned char)string[i]; + if ( (byte & 0x80) == 0 ) { /* 1byte encoding */ + newLength++; + if ( byte == 0 ) { + newLength++; /* We gain one byte in length on NULL bytes */ + } + } else if ( (byte & 0xE0) == 0xC0 ) { /* 2byte encoding */ + /* Check encoding of following bytes */ + if ( (i+1) >= length || (string[i+1] & 0xC0) != 0x80 ) { + break; /* Error condition */ + } + i++; /* Skip next byte */ + newLength += 2; + } else if ( (byte & 0xF0) == 0xE0 ) { /* 3byte encoding */ + /* Check encoding of following bytes */ + if ( (i+2) >= length || (string[i+1] & 0xC0) != 0x80 + || (string[i+2] & 0xC0) != 0x80 ) { + break; /* Error condition */ } + i += 2; /* Skip next two bytes */ + newLength += 3; + } else if ( (byte & 0xF8) == 0xF0 ) { /* 4byte encoding */ + /* Check encoding of following bytes */ + if ( (i+3) >= length || (string[i+1] & 0xC0) != 0x80 + || (string[i+2] & 0xC0) != 0x80 + || (string[i+3] & 0xC0) != 0x80 ) { + break; /* Error condition */ + } + i += 3; /* Skip next 3 bytes */ + newLength += 6; /* 4byte encoding turns into 2 3byte ones */ + } else { + break; /* Error condition */ } - if ( i != length ) { - /* Error in finding new length, return old length so no conversion */ - /* FIXUP: ERROR_MESSAGE? */ - return length; - } - return newLength; + } + if ( i != length ) { + /* Error in finding new length, return old length so no conversion */ + /* FIXUP: ERROR_MESSAGE? */ + return length; + } + return newLength; } /* Convert Standard UTF-8 to Modified UTF-8. @@ -199,9 +105,7 @@ utf8sToUtf8mLength(struct UtfInst *ui, jbyte *string, int length) * Note: Accepts Modified UTF-8 also, no verification on the * correctness of Standard UTF-8 is done. e,g, 0xC080 input is ok. */ -void JNICALL -utf8sToUtf8m(struct UtfInst *ui, jbyte *string, int length, jbyte *newString, int newLength) -{ +void JNICALL utf8sToUtf8m(jbyte *string, int length, jbyte *newString, int newLength) { int i; int j; @@ -263,9 +167,7 @@ utf8sToUtf8m(struct UtfInst *ui, jbyte *string, int length, jbyte *newString, in * Note: No validation is made that this is indeed Modified UTF-8 coming in. * */ -int JNICALL -utf8mToUtf8sLength(struct UtfInst *ui, jbyte *string, int length) -{ +int JNICALL utf8mToUtf8sLength(jbyte *string, int length) { int newLength; int i; @@ -330,9 +232,7 @@ utf8mToUtf8sLength(struct UtfInst *ui, jbyte *string, int length) * Note: No validation is made that this is indeed Modified UTF-8 coming in. * */ -void JNICALL -utf8mToUtf8s(struct UtfInst *ui, jbyte *string, int length, jbyte *newString, int newLength) -{ +void JNICALL utf8mToUtf8s(jbyte *string, int length, jbyte *newString, int newLength) { int i; int j; @@ -394,107 +294,247 @@ utf8mToUtf8s(struct UtfInst *ui, jbyte *string, int length, jbyte *newString, in newString[j] = 0; } -/* ================================================================= */ +#ifdef _WIN32 +// Microsoft Windows specific part -#ifdef COMPILE_WITH_UTF_TEST /* Test program */ +#include -/* - * Convert any byte array into a printable string. - * Returns length or -1 if output overflows. - */ -static int -bytesToPrintable(struct UtfInst *ui, char *bytes, int len, char *output, int outputMaxLen) -{ - int outputLen; - int i; +static UINT getCodepage() { + LANGID langID; + LCID localeID; + TCHAR strCodePage[7]; // ANSI code page id - UTF_ASSERT(bytes); - UTF_ASSERT(len>=0); - UTF_ASSERT(output); - UTF_ASSERT(outputMaxLen>=0); + static UINT intCodePage = -1; - outputLen = 0; - for ( i=0; i= outputMaxLen ) { - return -1; - } - output[outputLen++] = (char)byte; - } else { - if ( outputLen + 4 >= outputMaxLen ) { - return -1; - } - (void)sprintf(output+outputLen,"\\x%02x",byte); - outputLen += 4; + if (intCodePage == -1) { + // Firts call, get codepage from the os + langID = LANGIDFROMLCID(GetUserDefaultLCID()); + localeID = MAKELCID(langID, SORT_DEFAULT); + if (GetLocaleInfo(localeID, LOCALE_IDEFAULTANSICODEPAGE, + strCodePage, sizeof(strCodePage)/sizeof(TCHAR)) > 0 ) { + intCodePage = atoi(strCodePage); + } + else { + intCodePage = GetACP(); } } - output[outputLen] = 0; - return outputLen; + + return intCodePage; } -static void -test(void) -{ - static char *strings[] = { - "characters", - "abcdefghijklmnopqrstuvwxyz", - "0123456789", - "!@#$%^&*()_+=-{}[]:;", - NULL }; - int i; - struct UtfInst *ui; +/* + * Get wide string (assumes len>0) + */ +static WCHAR* getWideString(UINT codePage, char* str, int len, int *pwlen) { + int wlen; + WCHAR* wstr; - ui = utfInitialize(NULL); + /* Convert the string to WIDE string */ + wlen = MultiByteToWideChar(codePage, 0, str, len, NULL, 0); + *pwlen = wlen; + if (wlen <= 0) { + UTF_ERROR(("Can't get WIDE string length")); + return NULL; + } + wstr = (WCHAR*)malloc(wlen * sizeof(WCHAR)); + if (wstr == NULL) { + UTF_ERROR(("Can't malloc() any space")); + return NULL; + } + if (MultiByteToWideChar(codePage, 0, str, len, wstr, wlen) == 0) { + UTF_ERROR(("Can't get WIDE string")); + return NULL; + } + return wstr; +} - i = 0; - while ( strings[i] != NULL ) { - char *str; - #define MAX 1024 - char buf0[MAX]; - char buf1[MAX]; - char buf2[MAX]; - unsigned short buf3[MAX]; - int len1; - int len2; - int len3; +/* + * Convert UTF-8 to a platform string + */ +int JNICALL utf8ToPlatform(jbyte *utf8, int len, char* output, int outputMaxLen) { + int wlen; + int plen; + WCHAR* wstr; + UINT codepage; - str = strings[i]; + UTF_ASSERT(utf8); + UTF_ASSERT(output); + UTF_ASSERT(outputMaxLen > len); - (void)bytesToPrintable(ui, str, (int)strlen(str), buf0, 1024); - - len1 = utf8FromPlatform(ui, str, (int)strlen(str), (jbyte*)buf1, 1024); - - UTF_ASSERT(len1==(int)strlen(str)); - - len3 = utf8ToUtf16(ui, (jbyte*)buf1, len1, (jchar*)buf3, 1024); - - UTF_ASSERT(len3==len1); - - len1 = utf16ToUtf8m(ui, (jchar*)buf3, len3, (jbyte*)buf1, 1024); - - UTF_ASSERT(len1==len3); - UTF_ASSERT(strcmp(str, buf1) == 0); - - len2 = utf8ToPlatform(ui, (jbyte*)buf1, len1, buf2, 1024); - - UTF_ASSERT(len2==len1); - UTF_ASSERT(strcmp(str, buf2) == 0); - - i++; + /* Zero length is ok, but we don't need to do much */ + if ( len == 0 ) { + output[0] = 0; + return 0; } - utfTerminate(ui, NULL); + /* Get WIDE string version (assumes len>0) */ + wstr = getWideString(CP_UTF8, (char*)utf8, len, &wlen); + if ( wstr == NULL ) { + // Can't allocate WIDE string + goto just_copy_bytes; + } + /* Convert WIDE string to MultiByte string */ + codepage = getCodepage(); + plen = WideCharToMultiByte(codepage, 0, wstr, wlen, + output, outputMaxLen, NULL, NULL); + free(wstr); + if (plen <= 0) { + // Can't convert WIDE string to multi-byte + goto just_copy_bytes; + } + output[plen] = '\0'; + return plen; + +just_copy_bytes: + (void)memcpy(output, utf8, len); + output[len] = 0; + return len; } -int -main(int argc, char **argv) -{ - test(); - return 0; +/* + * Convert Platform Encoding to UTF-8. + */ +int JNICALL utf8FromPlatform(char *str, int len, jbyte *output, int outputMaxLen) { + int wlen; + int plen; + WCHAR* wstr; + UINT codepage; + + UTF_ASSERT(str); + UTF_ASSERT(output); + UTF_ASSERT(outputMaxLen > len); + + /* Zero length is ok, but we don't need to do much */ + if ( len == 0 ) { + output[0] = 0; + return 0; + } + + /* Get WIDE string version (assumes len>0) */ + codepage = getCodepage(); + wstr = getWideString(codepage, str, len, &wlen); + if ( wstr == NULL ) { + goto just_copy_bytes; + } + + /* Convert WIDE string to UTF-8 string */ + plen = WideCharToMultiByte(CP_UTF8, 0, wstr, wlen, + (char*)output, outputMaxLen, NULL, NULL); + free(wstr); + if (plen <= 0) { + UTF_ERROR(("Can't convert WIDE string to multi-byte")); + goto just_copy_bytes; + } + output[plen] = '\0'; + return plen; + +just_copy_bytes: + (void)memcpy(output, str, len); + output[len] = 0; + return len; +} + + +#else +// *NIX specific part + +#include +#include +#include +#include + +typedef enum {TO_UTF8, FROM_UTF8} conv_direction; + +/* + * Do iconv() conversion. + * Returns length or -1 if output overflows. + */ +static int iconvConvert(conv_direction drn, char *bytes, size_t len, char *output, size_t outputMaxLen) { + + static char *codeset = 0; + iconv_t func; + size_t bytes_converted; + size_t inLeft, outLeft; + char *inbuf, *outbuf; + + UTF_ASSERT(bytes); + UTF_ASSERT(output); + UTF_ASSERT(outputMaxLen > len); + + /* Zero length is ok, but we don't need to do much */ + if ( len == 0 ) { + output[0] = 0; + return 0; + } + + if (codeset == NULL && codeset != (char *) -1) { + // locale is not initialized, do it now + if (setlocale(LC_ALL, "") != NULL) { + // nl_langinfo returns ANSI_X3.4-1968 by default + codeset = (char*)nl_langinfo(CODESET); + } + + if (codeset == NULL) { + // Not able to intialize process locale from platform one. + codeset = (char *) -1; + } + } + + if (codeset == (char *) -1) { + // There was an error during initialization, so just bail out + goto just_copy_bytes; + } + + func = (drn == TO_UTF8) ? iconv_open(codeset, "UTF-8") : iconv_open("UTF-8", codeset); + if (func == (iconv_t) -1) { + // Requested charset combination is not supported, conversion couldn't be done. + // make sure we will not try it again + codeset = (char *) -1; + goto just_copy_bytes; + } + + // perform conversion + inbuf = bytes; + outbuf = output; + inLeft = len; + outLeft = outputMaxLen; + + bytes_converted = iconv(func, (void*)&inbuf, &inLeft, &outbuf, &outLeft); + if (bytes_converted == (size_t) -1 || bytes_converted == 0 || inLeft != 0) { + // Input string is invalid, not able to convert entire string + // or some other iconv error happens. + iconv_close(func); + goto just_copy_bytes; + } + + iconv_close(func); + // Overwrite bytes_converted with value of actually stored bytes + bytes_converted = outputMaxLen-outLeft; + output[bytes_converted] = 0; + return bytes_converted; + + +just_copy_bytes: + (void)memcpy(output, bytes, len); + output[len] = 0; + return len; + } + +/* + * Convert UTF-8 to Platform Encoding. + * Returns length or -1 if output overflows. + */ +int JNICALL utf8ToPlatform(jbyte *utf8, int len, char *output, int outputMaxLen) { + return iconvConvert(FROM_UTF8, (char*)utf8, len, output, outputMaxLen); +} + +/* + * Convert Platform Encoding to UTF-8. + * Returns length or -1 if output overflows. + */ +int JNICALL utf8FromPlatform(char *str, int len, jbyte *output, int outputMaxLen) { + return iconvConvert(TO_UTF8, str, len, (char*) output, outputMaxLen); } #endif diff --git a/jdk/src/windows/npt/utf_md.h b/jdk/src/share/back/utf_util.h similarity index 65% rename from jdk/src/windows/npt/utf_md.h rename to jdk/src/share/back/utf_util.h index a34e2af92d1..0892150adc7 100644 --- a/jdk/src/windows/npt/utf_md.h +++ b/jdk/src/share/back/utf_util.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -23,11 +23,18 @@ * questions. */ -#ifndef _UTF_MD_H -#define _UTF_MD_H +#ifndef _utf_util_h_ +#define _utf_util_h_ -struct UtfInst { - unsigned int platformCodePage; -}; +#include "jni.h" + + +int JNICALL utf8sToUtf8mLength(jbyte *string, int length); +void JNICALL utf8sToUtf8m(jbyte *string, int length, jbyte *newString, int newLength); +int JNICALL utf8mToUtf8sLength(jbyte *string, int length); +void JNICALL utf8mToUtf8s(jbyte *string, int length, jbyte *newString, int newLength); + +int JNICALL utf8ToPlatform(jbyte *utf8, int len, char* output, int outputMaxLen); +int JNICALL utf8FromPlatform(char *str, int len, jbyte *output, int outputMaxLen); #endif diff --git a/jdk/src/share/back/util.h b/jdk/src/share/back/util.h index 0f9aa1cd802..4a08823a2aa 100644 --- a/jdk/src/share/back/util.h +++ b/jdk/src/share/back/util.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -53,9 +53,6 @@ #include "error_messages.h" #include "debugInit.h" -/* Get access to Native Platform Toolkit functions */ -#include "npt.h" - /* Definition of a CommonRef tracked by the backend for the frontend */ typedef struct RefNode { jlong seqNum; /* ID of reference, also key for hash table */ @@ -123,9 +120,6 @@ typedef struct { unsigned log_flags; - /* The Native Platform Toolkit access */ - NptEnv *npt; - /* Common References static data */ jrawMonitorID refLock; jlong nextSeqNum; diff --git a/jdk/src/share/demo/jvmti/hprof/hprof.h b/jdk/src/share/demo/jvmti/hprof/hprof.h index ec9fbf01870..696de3d3a26 100644 --- a/jdk/src/share/demo/jvmti/hprof/hprof.h +++ b/jdk/src/share/demo/jvmti/hprof/hprof.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -67,10 +67,6 @@ #include "classfile_constants.h" #include "jvm_md.h" -#ifndef SKIP_NPT -#include "npt.h" /* To get NptEnv for doing character conversions */ -#endif - /* Macros to extract the upper and lower 32 bits of a jlong */ #define jlong_high(a) ((jint)((a)>>32)) @@ -207,9 +203,6 @@ typedef struct { jvmtiEnv *jvmti; /* JVMTI env for this session */ JavaVM *jvm; /* JavaVM* for this session */ -#ifndef SKIP_NPT - NptEnv *npt; /* NptEnv* for this session, see npt.h */ -#endif jint cachedJvmtiVersion; /* JVMTI version number */ char *header; /* "JAVA PROFILE 1.0.[12]" */ diff --git a/jdk/src/share/demo/jvmti/hprof/hprof_init.c b/jdk/src/share/demo/jvmti/hprof/hprof_init.c index a05527861f1..6190e6a0ffa 100644 --- a/jdk/src/share/demo/jvmti/hprof/hprof_init.c +++ b/jdk/src/share/demo/jvmti/hprof/hprof_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -740,16 +740,11 @@ parse_options(char *command_line_options) } if ( gdata->utf8_output_filename != NULL ) { - /* UTF-8 to platform encoding (fill in gdata->output_filename) */ + // Don't attempt to convert output filename. + // If fileystem uses the same encoding as the rest of the OS it will work as is. ulen = (int)strlen(gdata->utf8_output_filename); gdata->output_filename = (char*)HPROF_MALLOC(ulen*3+3); -#ifdef SKIP_NPT (void)strcpy(gdata->output_filename, gdata->utf8_output_filename); -#else - (void)(gdata->npt->utf8ToPlatform) - (gdata->npt->utf, (jbyte*)gdata->utf8_output_filename, ulen, - gdata->output_filename, ulen*3+3); -#endif } /* By default we turn on gdata->alloc_sites and gdata->heap_dump */ @@ -1949,7 +1944,6 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { char *boot_path = NULL; - char npt_lib[JVM_MAXPATHLEN]; /* See if it's already loaded */ if ( gdata!=NULL && gdata->isLoaded==JNI_TRUE ) { @@ -1970,24 +1964,6 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved) /* Get the JVMTI environment */ getJvmti(); -#ifndef SKIP_NPT - getSystemProperty("sun.boot.library.path", &boot_path); - /* Load in NPT library for character conversions */ - md_build_library_name(npt_lib, sizeof(npt_lib), boot_path, NPT_LIBNAME); - if ( strlen(npt_lib) == 0 ) { - HPROF_ERROR(JNI_TRUE, "Could not find npt library"); - } - jvmtiDeallocate(boot_path); - NPT_INITIALIZE(npt_lib, &(gdata->npt), NPT_VERSION, NULL); - if ( gdata->npt == NULL ) { - HPROF_ERROR(JNI_TRUE, "Cannot load npt library"); - } - gdata->npt->utf = (gdata->npt->utfInitialize)(NULL); - if ( gdata->npt->utf == NULL ) { - HPROF_ERROR(JNI_TRUE, "Cannot initialize npt utf functions"); - } -#endif - /* Lock needed to protect debug_malloc() code, which is not MT safe */ #ifdef DEBUG gdata->debug_malloc_lock = createRawMonitor("HPROF debug_malloc lock"); diff --git a/jdk/src/share/npt/README.txt b/jdk/src/share/npt/README.txt deleted file mode 100644 index be3a5ed76b0..00000000000 --- a/jdk/src/share/npt/README.txt +++ /dev/null @@ -1,39 +0,0 @@ - -README: For NPT Library. ------------------------- - -To use this Native Platform Toolkit library, you need to add --Isrc/share/npt and -I/src/${platform}/npt (platform is solaris or windows) -to your compilation lines. - -To initialize/use the library: - - #include "npt.h" - - NptEnv *npt; - - NPT_INITIALIZE(&npt, NPT_VERSION, NULL); - if (npt == NULL) { - FATAL_ERROR_MESSAGE(("Unable to gain access to Npt library")); - } - - /* To use the npt utf functions, they require initialization */ - npt->utf = (npt->utfInitialize)(NULL); - if (npt->utf == NULL) { - FATAL_ERROR_MESSAGE(("Unable to gain access to Npt utf functions")); - } - - ... - - - /* After all uses is done, it can be terminated, however, if the - * process will be exiting anyway it isn't necessary, and if - * you have other threads running that might use these handles - * you will need to wait here until all those threads have terminated. - * So in general, termination can be a pain and slow your process - * termination down. - */ - (npt->utfTerminate)(npt->utf,NULL); - NPT_TERMINATE(&npt, NULL); - - diff --git a/jdk/src/share/npt/npt.c b/jdk/src/share/npt/npt.c deleted file mode 100644 index 08c68f5ecc8..00000000000 --- a/jdk/src/share/npt/npt.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -#include -#include -#include - -#include "jni.h" - -#include "npt.h" - -#include "utf.h" - -static int -version_check(char *version) -{ - if ( version==NULL || strcmp(version, NPT_VERSION)!=0 ) { - return 1; - } - return 0; -} - -JNIEXPORT void JNICALL -nptInitialize(NptEnv **pnpt, char *nptVersion, char *options) -{ - NptEnv *npt; - - (*pnpt) = NULL; - - if ( version_check(nptVersion) ) { - NPT_ERROR("NPT version doesn't match"); - return; - } - - npt = (NptEnv*)calloc(sizeof(NptEnv), 1); - if ( npt == NULL ) { - NPT_ERROR("Cannot allocate calloc space for NptEnv*"); - return; - } - - if ( options != NULL ) { - npt->options = strdup(options); - } - npt->utfInitialize = &utfInitialize; - npt->utfTerminate = &utfTerminate; - npt->utf8ToPlatform = &utf8ToPlatform; - npt->utf8FromPlatform = &utf8FromPlatform; - npt->utf8ToUtf16 = &utf8ToUtf16; - npt->utf16ToUtf8m = &utf16ToUtf8m; - npt->utf16ToUtf8s = &utf16ToUtf8s; - npt->utf8sToUtf8mLength = &utf8sToUtf8mLength; - npt->utf8sToUtf8m = &utf8sToUtf8m; - npt->utf8mToUtf8sLength = &utf8mToUtf8sLength; - npt->utf8mToUtf8s = &utf8mToUtf8s; - - (*pnpt) = npt; -} - -JNIEXPORT void JNICALL -nptTerminate(NptEnv* npt, char *options) -{ - - /* FIXUP: options? Check memory or something? */ - if ( npt->options != NULL ) { - (void)free(npt->options); - } - (void)free(npt); -} diff --git a/jdk/src/share/npt/npt.h b/jdk/src/share/npt/npt.h deleted file mode 100644 index a8d7e7e08da..00000000000 --- a/jdk/src/share/npt/npt.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2004, 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. - */ - -/* Native Platform Toolkit */ - -#ifndef _NPT_H -#define _NPT_H - -#define NPT_VERSION "0.0.0" - -#include - -#include "jni.h" - -#include "npt_md.h" -#include "utf.h" - -#define NPT_ERROR(s) { (void)fprintf(stderr, "NPT ERROR: %s\n", s); exit(1); } - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - - /* Used to save handle to our own dynamicly loaded library */ - void *libhandle; - - /* Copy of the options sent in at initialization */ - char *options; - - /* Can be used to save the UtfInst handle */ - struct UtfInst *utf; - - /* UTF interfaces, see utf.c */ - struct UtfInst* (JNICALL *utfInitialize) - (char *options); - void (JNICALL *utfTerminate) - (struct UtfInst *utf, char *options); - int (JNICALL *utf8ToPlatform) - (struct UtfInst *utf, jbyte *utf8, int len, - char *output, int outputMaxLen); - int (JNICALL *utf8FromPlatform) - (struct UtfInst *utf, char *str, int len, - jbyte *output, int outputMaxLen); - int (JNICALL *utf8ToUtf16) - (struct UtfInst *utf, jbyte *utf8, int len, - jchar *output, int outputMaxLen); - int (JNICALL *utf16ToUtf8m) - (struct UtfInst *utf, jchar *utf16, int len, - jbyte *output, int outputMaxLen); - int (JNICALL *utf16ToUtf8s) - (struct UtfInst *utf, jchar *utf16, int len, - jbyte *output, int outputMaxLen); - int (JNICALL *utf8sToUtf8mLength) - (struct UtfInst *utf, jbyte *string, int length); - void (JNICALL *utf8sToUtf8m) - (struct UtfInst *utf, jbyte *string, int length, - jbyte *newString, int newLength); - int (JNICALL *utf8mToUtf8sLength) - (struct UtfInst *utf, jbyte *string, int length); - void (JNICALL *utf8mToUtf8s) - (struct UtfInst *utf, jbyte *string, int length, - jbyte *newString, int newLength); - -} NptEnv; - -/* Typedefs for the only 2 'extern' functions in npt library: - * nptInitialize and nptTerminate - * See NPT_INITIALIZE() and NPT_TERMINATE() in npt_md.h. - */ - -JNIEXPORT void JNICALL nptInitialize - (NptEnv **pnpt, char *nptVersion, char *options); -typedef void (JNICALL *NptInitialize) - (NptEnv **pnpt, char *nptVersion, char *options); - -JNIEXPORT void JNICALL nptTerminate - (NptEnv* npt, char *options); -typedef void (JNICALL *NptTerminate) - (NptEnv* npt, char *options); - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif diff --git a/jdk/src/share/npt/utf.h b/jdk/src/share/npt/utf.h deleted file mode 100644 index 11eeb33d7a0..00000000000 --- a/jdk/src/share/npt/utf.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2004, 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. - */ - -/* Routines for various UTF conversions */ - -#ifndef _UTF_H -#define _UTF_H - -#include - -#include "jni.h" -#include "utf_md.h" - -/* Use THIS_FILE when it is available. */ -#ifndef THIS_FILE - #define THIS_FILE __FILE__ -#endif - -/* Error and assert macros */ -#define UTF_ERROR(m) utfError(THIS_FILE, __LINE__, m) -#define UTF_ASSERT(x) ( (x)==0 ? UTF_ERROR("ASSERT ERROR " #x) : (void)0 ) - -void utfError(char *file, int line, char *message); - -struct UtfInst* JNICALL utfInitialize - (char *options); -void JNICALL utfTerminate - (struct UtfInst *ui, char *options); -int JNICALL utf8ToPlatform - (struct UtfInst *ui, jbyte *utf8, - int len, char *output, int outputMaxLen); -int JNICALL utf8FromPlatform - (struct UtfInst *ui, char *str, int len, - jbyte *output, int outputMaxLen); -int JNICALL utf8ToUtf16 - (struct UtfInst *ui, jbyte *utf8, int len, - jchar *output, int outputMaxLen); -int JNICALL utf16ToUtf8m - (struct UtfInst *ui, jchar *utf16, int len, - jbyte *output, int outputMaxLen); -int JNICALL utf16ToUtf8s - (struct UtfInst *ui, jchar *utf16, int len, - jbyte *output, int outputMaxLen); -int JNICALL utf8sToUtf8mLength - (struct UtfInst *ui, jbyte *string, int length); -void JNICALL utf8sToUtf8m - (struct UtfInst *ui, jbyte *string, int length, - jbyte *new_string, int new_length); -int JNICALL utf8mToUtf8sLength - (struct UtfInst *ui, jbyte *string, int length); -void JNICALL utf8mToUtf8s - (struct UtfInst *ui, jbyte *string, int length, - jbyte *new_string, int new_length); - -#endif diff --git a/jdk/src/solaris/npt/npt_md.h b/jdk/src/solaris/npt/npt_md.h deleted file mode 100644 index 76d5b663c04..00000000000 --- a/jdk/src/solaris/npt/npt_md.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2004, 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. - */ - -/* Native Platform Toolkit */ - -#ifndef _NPT_MD_H -#define _NPT_MD_H - -#include -#include -#include -#include -#include - -#define NPT_LIBNAME "npt" - -#define NPT_INITIALIZE(path,pnpt,version,options) \ - { \ - void *_handle; \ - void *_sym; \ - \ - if ( (pnpt) == NULL ) NPT_ERROR("NptEnv* is NULL"); \ - *(pnpt) = NULL; \ - _handle = dlopen(path, RTLD_LAZY); \ - if ( _handle == NULL ) NPT_ERROR("Cannot open library"); \ - _sym = dlsym(_handle, "nptInitialize"); \ - if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize"); \ - ((NptInitialize)_sym)((pnpt), version, (options)); \ - if ( (*(pnpt)) == NULL ) NPT_ERROR("Cannot initialize NptEnv"); \ - (*(pnpt))->libhandle = _handle; \ - } - -#define NPT_TERMINATE(npt,options) \ - { \ - void *_handle; \ - void *_sym; \ - \ - if ( (npt) == NULL ) NPT_ERROR("NptEnv* is NULL"); \ - _handle = (npt)->libhandle; \ - _sym = dlsym(_handle, "nptTerminate"); \ - if ( _sym == NULL ) NPT_ERROR("Cannot find nptTerminate"); \ - ((NptTerminate)_sym)((npt), (options)); \ - if ( _handle != NULL ) (void)dlclose(_handle); \ - } - - -#endif diff --git a/jdk/src/solaris/npt/utf_md.c b/jdk/src/solaris/npt/utf_md.c deleted file mode 100644 index edd3bc69e1e..00000000000 --- a/jdk/src/solaris/npt/utf_md.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -#include -#include -#include -#include -#include -#include - -#include "utf.h" - -/* Global variables */ - -/* - * Initialize all utf processing. - */ -struct UtfInst *JNICALL -utfInitialize(char *options) -{ - struct UtfInst *ui; - char *codeset; - - ui = (struct UtfInst*)calloc(sizeof(struct UtfInst), 1); - ui->iconvToPlatform = (void *)-1; - ui->iconvFromPlatform = (void *)-1; - - /* Set the locale from the environment */ - (void)setlocale(LC_ALL, ""); - - /* Get the codeset name */ - codeset = (char*)nl_langinfo(CODESET); - if ( codeset == NULL || codeset[0] == 0 ) { - return ui; - } - - /* If we don't need this, skip it */ - if (strcmp(codeset, "UTF-8") == 0 || strcmp(codeset, "utf8") == 0 ) { - return ui; - } - - /* Open conversion descriptors */ - ui->iconvToPlatform = iconv_open(codeset, "UTF-8"); - if ( ui->iconvToPlatform == (void *)-1 ) { - UTF_ERROR("Failed to complete iconv_open() setup"); - } - ui->iconvFromPlatform = iconv_open("UTF-8", codeset); - if ( ui->iconvFromPlatform == (void *)-1 ) { - UTF_ERROR("Failed to complete iconv_open() setup"); - } - return ui; -} - -/* - * Terminate all utf processing - */ -void JNICALL -utfTerminate(struct UtfInst *ui, char *options) -{ - if ( ui->iconvFromPlatform != (void *)-1 ) { - (void)iconv_close(ui->iconvFromPlatform); - } - if ( ui->iconvToPlatform != (void *)-1 ) { - (void)iconv_close(ui->iconvToPlatform); - } - ui->iconvToPlatform = (void *)-1; - ui->iconvFromPlatform = (void *)-1; - (void)free(ui); -} - -/* - * Do iconv() conversion. - * Returns length or -1 if output overflows. - */ -static int -iconvConvert(iconv_t ic, char *bytes, int len, char *output, int outputMaxLen) -{ - int outputLen = 0; - - UTF_ASSERT(bytes); - UTF_ASSERT(len>=0); - UTF_ASSERT(output); - UTF_ASSERT(outputMaxLen>len); - - output[0] = 0; - outputLen = 0; - - if ( ic != (iconv_t)(void *)-1 ) { - int returnValue; - size_t inLeft; - size_t outLeft; - char *inbuf; - char *outbuf; - - inbuf = bytes; - outbuf = output; - inLeft = len; - outLeft = outputMaxLen; - returnValue = iconv(ic, (void*)&inbuf, &inLeft, &outbuf, &outLeft); - if ( returnValue >= 0 && inLeft==0 ) { - outputLen = outputMaxLen-outLeft; - output[outputLen] = 0; - return outputLen; - } - - /* Failed to do the conversion */ - return -1; - } - - /* Just copy bytes */ - outputLen = len; - (void)memcpy(output, bytes, len); - output[len] = 0; - return outputLen; -} - -/* - * Convert UTF-8 to Platform Encoding. - * Returns length or -1 if output overflows. - */ -int JNICALL -utf8ToPlatform(struct UtfInst*ui, jbyte *utf8, int len, char *output, int outputMaxLen) -{ - /* Negative length is an error */ - if ( len < 0 ) { - return -1; - } - - /* Zero length is ok, but we don't need to do much */ - if ( len == 0 ) { - output[0] = 0; - return 0; - } - - return iconvConvert(ui->iconvToPlatform, (char*)utf8, len, output, outputMaxLen); -} - -/* - * Convert Platform Encoding to UTF-8. - * Returns length or -1 if output overflows. - */ -int JNICALL -utf8FromPlatform(struct UtfInst*ui, char *str, int len, jbyte *output, int outputMaxLen) -{ - /* Negative length is an error */ - if ( len < 0 ) { - return -1; - } - - /* Zero length is ok, but we don't need to do much */ - if ( len == 0 ) { - output[0] = 0; - return 0; - } - - return iconvConvert(ui->iconvFromPlatform, str, len, (char*)output, outputMaxLen); -} diff --git a/jdk/src/solaris/npt/utf_md.h b/jdk/src/solaris/npt/utf_md.h deleted file mode 100644 index 25ca1c53dbe..00000000000 --- a/jdk/src/solaris/npt/utf_md.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -#ifndef _UTF_MD_H -#define _UTF_MD_H - -struct UtfInst { - void *iconvToPlatform; - void *iconvFromPlatform; -}; - -#endif diff --git a/jdk/src/windows/npt/npt_md.h b/jdk/src/windows/npt/npt_md.h deleted file mode 100644 index e4e5dc3ffe3..00000000000 --- a/jdk/src/windows/npt/npt_md.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2004, 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. - */ - -/* Native Platform Toolkit */ - -#ifndef _NPT_MD_H -#define _NPT_MD_H - -#include -#include -#include -#include - -#define NPT_LIBNAME "npt" - -#define NPT_INITIALIZE(path,pnpt,version,options) \ - { \ - void *_handle; \ - void *_sym; \ - \ - if ( (pnpt) == NULL ) NPT_ERROR("NptEnv* is NULL"); \ - *(pnpt) = NULL; \ - _handle = LoadLibrary(path); \ - if ( _handle == NULL ) NPT_ERROR("Cannot open library"); \ - _sym = GetProcAddress(_handle, "nptInitialize"); \ - if ( _sym == NULL ) NPT_ERROR("Cannot find nptInitialize"); \ - ((NptInitialize)_sym)((pnpt), version, (options)); \ - if ( *(pnpt) == NULL ) NPT_ERROR("Cannot initialize NptEnv"); \ - (*(pnpt))->libhandle = _handle; \ - } - -#define NPT_TERMINATE(npt,options) \ - { \ - void *_handle; \ - void *_sym; \ - \ - if ( (npt) == NULL ) NPT_ERROR("NptEnv* is NULL"); \ - _handle = (npt)->libhandle; \ - if ( _handle == NULL ) NPT_ERROR("npt->libhandle is NULL"); \ - _sym = GetProcAddress(_handle, "nptTerminate"); \ - if ( _sym == NULL ) NPT_ERROR("Cannot find nptTerminate"); \ - ((NptTerminate)_sym)((npt), (options)); \ - (void)FreeLibrary(_handle); \ - } - -#endif diff --git a/jdk/src/windows/npt/utf_md.c b/jdk/src/windows/npt/utf_md.c deleted file mode 100644 index 58de977a03d..00000000000 --- a/jdk/src/windows/npt/utf_md.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. - * 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. - */ - -#include "utf.h" - -#include -#include -#include - -/* - * Initialize all utf processing. - */ -struct UtfInst * JNICALL -utfInitialize(char *options) -{ - struct UtfInst *ui; - LANGID langID; - LCID localeID; - TCHAR strCodePage[7]; // ANSI code page id - - ui = (struct UtfInst*)calloc(sizeof(struct UtfInst), 1); - - /* - * Get the code page for this locale - */ - langID = LANGIDFROMLCID(GetUserDefaultLCID()); - localeID = MAKELCID(langID, SORT_DEFAULT); - if (GetLocaleInfo(localeID, LOCALE_IDEFAULTANSICODEPAGE, - strCodePage, sizeof(strCodePage)/sizeof(TCHAR)) > 0 ) { - ui->platformCodePage = atoi(strCodePage); - } else { - ui->platformCodePage = GetACP(); - } - return ui; -} - -/* - * Terminate all utf processing - */ -void JNICALL -utfTerminate(struct UtfInst *ui, char *options) -{ - (void)free(ui); -} - -/* - * Get wide string (assumes len>0) - */ -static WCHAR* -getWideString(UINT codePage, char* str, int len, int *pwlen) -{ - int wlen; - WCHAR* wstr; - - /* Convert the string to WIDE string */ - wlen = MultiByteToWideChar(codePage, 0, str, len, NULL, 0); - *pwlen = wlen; - if (wlen <= 0) { - UTF_ERROR(("Can't get WIDE string length")); - return NULL; - } - wstr = (WCHAR*)malloc(wlen * sizeof(WCHAR)); - if (wstr == NULL) { - UTF_ERROR(("Can't malloc() any space")); - return NULL; - } - if (MultiByteToWideChar(codePage, 0, str, len, wstr, wlen) == 0) { - UTF_ERROR(("Can't get WIDE string")); - return NULL; - } - return wstr; -} - -/* - * Convert UTF-8 to a platform string - */ -int JNICALL -utf8ToPlatform(struct UtfInst *ui, jbyte *utf8, int len, char* output, int outputMaxLen) -{ - int wlen; - int plen; - WCHAR* wstr; - - /* Negative length is an error */ - if ( len < 0 ) { - return -1; - } - - /* Zero length is ok, but we don't need to do much */ - if ( len == 0 ) { - output[0] = 0; - return 0; - } - - /* Get WIDE string version (assumes len>0) */ - wstr = getWideString(CP_UTF8, (char*)utf8, len, &wlen); - if ( wstr == NULL ) { - return -1; - } - - /* Convert WIDE string to MultiByte string */ - plen = WideCharToMultiByte(ui->platformCodePage, 0, wstr, wlen, - output, outputMaxLen, NULL, NULL); - free(wstr); - if (plen <= 0) { - UTF_ERROR(("Can't convert WIDE string to multi-byte")); - return -1; - } - output[plen] = '\0'; - return plen; -} - -/* - * Convert Platform Encoding to UTF-8. - */ -int JNICALL -utf8FromPlatform(struct UtfInst *ui, char *str, int len, jbyte *output, int outputMaxLen) -{ - int wlen; - int plen; - WCHAR* wstr; - - /* Negative length is an error */ - if ( len < 0 ) { - return -1; - } - - /* Zero length is ok, but we don't need to do much */ - if ( len == 0 ) { - output[0] = 0; - return 0; - } - - /* Get WIDE string version (assumes len>0) */ - wstr = getWideString(ui->platformCodePage, str, len, &wlen); - if ( wstr == NULL ) { - return -1; - } - - /* Convert WIDE string to UTF-8 string */ - plen = WideCharToMultiByte(CP_UTF8, 0, wstr, wlen, - (char*)output, outputMaxLen, NULL, NULL); - free(wstr); - if (plen <= 0) { - UTF_ERROR(("Can't convert WIDE string to multi-byte")); - return -1; - } - output[plen] = '\0'; - return plen; -} From 6886e2b8ba3c0b6efb5d2a2351f960a3ef2c72d6 Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Mon, 16 Jun 2014 08:09:30 -0700 Subject: [PATCH 24/56] 8046389: Add missing @since tag under javax.sql.** Reviewed-by: lancea --- jdk/src/share/classes/javax/sql/CommonDataSource.java | 1 + jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java | 2 ++ jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java | 1 + jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java | 1 + jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java | 1 + jdk/src/share/classes/javax/sql/rowset/JoinRowSet.java | 1 + jdk/src/share/classes/javax/sql/rowset/Joinable.java | 1 + jdk/src/share/classes/javax/sql/rowset/Predicate.java | 1 + jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java | 2 ++ jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java | 2 ++ jdk/src/share/classes/javax/sql/rowset/WebRowSet.java | 1 + .../share/classes/javax/sql/rowset/serial/SQLOutputImpl.java | 2 ++ jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java | 1 + jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java | 1 + jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java | 2 ++ .../share/classes/javax/sql/rowset/serial/SerialDatalink.java | 2 ++ .../share/classes/javax/sql/rowset/serial/SerialException.java | 1 + .../share/classes/javax/sql/rowset/serial/SerialJavaObject.java | 1 + jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java | 1 + jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java | 1 + jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java | 1 + .../classes/javax/sql/rowset/spi/SyncFactoryException.java | 1 + jdk/src/share/classes/javax/sql/rowset/spi/SyncProvider.java | 1 + .../classes/javax/sql/rowset/spi/SyncProviderException.java | 1 + jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java | 2 ++ .../share/classes/javax/sql/rowset/spi/TransactionalWriter.java | 2 ++ jdk/src/share/classes/javax/sql/rowset/spi/XmlReader.java | 2 ++ jdk/src/share/classes/javax/sql/rowset/spi/XmlWriter.java | 2 ++ 28 files changed, 38 insertions(+) diff --git a/jdk/src/share/classes/javax/sql/CommonDataSource.java b/jdk/src/share/classes/javax/sql/CommonDataSource.java index ac8728c2aca..9a63ddb0e1e 100644 --- a/jdk/src/share/classes/javax/sql/CommonDataSource.java +++ b/jdk/src/share/classes/javax/sql/CommonDataSource.java @@ -34,6 +34,7 @@ import java.util.logging.Logger; * Interface that defines the methods which are common between DataSource, * XADataSource and ConnectionPoolDataSource. * + * @since 1.6 */ public interface CommonDataSource { diff --git a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java index b8d9d8ea6e8..a7fdf01932a 100644 --- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java +++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java @@ -291,6 +291,8 @@ import javax.sql.rowset.serial.*; * extending class overrides and reimplements any BaseRowSet method and encounters * connectivity or underlying data source issues, that method may in addition throw an * SQLException object for that reason. +* +* @since 1.5 */ public abstract class BaseRowSet implements Serializable, Cloneable { diff --git a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java index eafbfb7059b..adb1b02771b 100644 --- a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java +++ b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java @@ -626,6 +626,7 @@ import javax.sql.rowset.spi.*; * * * @author Jonathan Bruce + * @since 1.5 */ public interface CachedRowSet extends RowSet, Joinable { diff --git a/jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java b/jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java index 7570ae48cf9..d03d6c68461 100644 --- a/jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java +++ b/jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java @@ -122,6 +122,7 @@ import java.math.*; * synchronized with the data source. * * @author Jonathan Bruce + * @since 1.5 */ public interface FilteredRowSet extends WebRowSet { diff --git a/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java b/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java index 2e760ebea99..e46f58aff58 100644 --- a/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java +++ b/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java @@ -118,6 +118,7 @@ import java.io.*; * requirements of connected and disconnected RowSet objects. * * @author Jonathan Bruce + * @since 1.5 */ public interface JdbcRowSet extends RowSet, Joinable { diff --git a/jdk/src/share/classes/javax/sql/rowset/JoinRowSet.java b/jdk/src/share/classes/javax/sql/rowset/JoinRowSet.java index 501a8eef87d..774ac31158b 100644 --- a/jdk/src/share/classes/javax/sql/rowset/JoinRowSet.java +++ b/jdk/src/share/classes/javax/sql/rowset/JoinRowSet.java @@ -217,6 +217,7 @@ import javax.sql.rowset.*; * This method creates a copy that can be persisted to the data source. * * + * @since 1.5 */ public interface JoinRowSet extends WebRowSet { diff --git a/jdk/src/share/classes/javax/sql/rowset/Joinable.java b/jdk/src/share/classes/javax/sql/rowset/Joinable.java index 15a5b77d673..d78b13de6c7 100644 --- a/jdk/src/share/classes/javax/sql/rowset/Joinable.java +++ b/jdk/src/share/classes/javax/sql/rowset/Joinable.java @@ -129,6 +129,7 @@ import java.sql.SQLException; * * @see JoinRowSet * @author Jonathan Bruce + * @since 1.5 */ public interface Joinable { diff --git a/jdk/src/share/classes/javax/sql/rowset/Predicate.java b/jdk/src/share/classes/javax/sql/rowset/Predicate.java index f9fec9e49c8..a3f674d454d 100644 --- a/jdk/src/share/classes/javax/sql/rowset/Predicate.java +++ b/jdk/src/share/classes/javax/sql/rowset/Predicate.java @@ -97,6 +97,7 @@ import java.sql.*; * applications that use both column identification conventions. * * @author Jonathan Bruce, Amit Handa + * @since 1.5 * */ diff --git a/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java b/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java index b71270a18dc..b15a4df9dac 100644 --- a/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java +++ b/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java @@ -48,6 +48,8 @@ import java.lang.reflect.*; * Therefore, any RowSetMetaDataImpl method that retrieves information * is defined as having unspecified behavior when it is called * before the RowSet object contains data. + * + * @since 1.5 */ public class RowSetMetaDataImpl implements RowSetMetaData, Serializable { diff --git a/jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java b/jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java index c110834c2cf..ecdc9ad1b3a 100644 --- a/jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java +++ b/jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java @@ -50,6 +50,8 @@ import java.sql.SQLException; * The inherited methods getMessage, getSQLState, * and getErrorCode retrieve information contained in a * RowSetWarning object. + * + * @since 1.5 */ public class RowSetWarning extends SQLException { diff --git a/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java b/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java index 8fc37500491..f588f007955 100644 --- a/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java +++ b/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java @@ -408,6 +408,7 @@ import org.xml.sax.*; * @see javax.sql.rowset.CachedRowSet * @see javax.sql.rowset.FilteredRowSet * @see javax.sql.rowset.JoinRowSet + * @since 1.5 */ public interface WebRowSet extends CachedRowSet { diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java b/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java index cf2824cfda9..136fff08d2a 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java @@ -52,6 +52,8 @@ import java.util.Vector; * to write data from the SQLData object to * the SQLOutputImpl output stream as the * representation of an SQL user-defined type. + * + * @since 1.5 */ public class SQLOutputImpl implements SQLOutput { diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java index 1e0e440bcef..5715ea0463f 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java @@ -56,6 +56,7 @@ import java.util.Arrays; * SerialArray is to be used by more than one thread then access to the * SerialArray should be controlled by appropriate synchronization. * + * @since 1.5 */ public class SerialArray implements Array, Serializable, Cloneable { diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java index 4c5a6b867a9..66652d2df85 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java @@ -58,6 +58,7 @@ import java.util.Arrays; * should be controlled by appropriate synchronization. * * @author Jonathan Bruce + * @since 1.5 */ public class SerialBlob implements Blob, Serializable, Cloneable { diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java index a2177b2c153..7f994f5c41e 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java @@ -49,7 +49,9 @@ import java.util.Arrays; *

A SerialClob is not safe for use by multiple concurrent threads. If a * SerialClob is to be used by more than one thread then access to the SerialClob * should be controlled by appropriate synchronization. + * * @author Jonathan Bruce + * @since 1.5 */ public class SerialClob implements Clob, Serializable, Cloneable { diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java index 221502a868c..422fd25cba8 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java @@ -48,6 +48,8 @@ import java.net.URL; * A SerialDatalink is not safe for use by multiple concurrent threads. If a * SerialDatalink is to be used by more than one thread then access to the * SerialDatalink should be controlled by appropriate synchronization. + * + * @since 1.5 */ public class SerialDatalink implements Serializable, Cloneable { diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialException.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialException.java index e2d0c11b84c..2429b176bb8 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialException.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialException.java @@ -32,6 +32,7 @@ import java.sql.SQLException; * SQL types such as BLOB, CLOB, STRUCT or ARRAY in * addition to SQL types such as DATALINK and JAVAOBJECT * + * @since 1.5 */ public class SerialException extends java.sql.SQLException { diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java index 71f8c340cf4..7578c41d963 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java @@ -54,6 +54,7 @@ import sun.reflect.misc.ReflectUtil; * SerialJavaObject should be controlled by appropriate synchronization. * * @author Jonathan Bruce + * @since 1.5 */ public class SerialJavaObject implements Serializable, Cloneable { diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java index 834fafe32b6..91d3dcd57a2 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java @@ -43,6 +43,7 @@ import java.util.*; * SerialRef is to be used by more than one thread then access to the SerialRef * should be controlled by appropriate synchronization. * + * @since 1.5 */ public class SerialRef implements Ref, Serializable, Cloneable { diff --git a/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java b/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java index 6eef84f3ef9..8937e3c48fc 100644 --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java @@ -57,6 +57,7 @@ import javax.sql.rowset.*; * SerialStruct is to be used by more than one thread then access to the * SerialStruct should be controlled by appropriate synchronization. * + * @since 1.5 */ public class SerialStruct implements Struct, Serializable, Cloneable { diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java index a4b757941da..586e19fb8c3 100644 --- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java +++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java @@ -200,6 +200,7 @@ import sun.reflect.misc.ReflectUtil; * @author Jonathan Bruce * @see javax.sql.rowset.spi.SyncProvider * @see javax.sql.rowset.spi.SyncFactoryException + * @since 1.5 */ public class SyncFactory { diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactoryException.java b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactoryException.java index c904c9eb5fc..31daba55880 100644 --- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactoryException.java +++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactoryException.java @@ -35,6 +35,7 @@ import java.sql.SQLException; * @author Jonathan Bruce * @see javax.sql.rowset.spi.SyncFactory * @see javax.sql.rowset.spi.SyncFactoryException + * @since 1.5 */ public class SyncFactoryException extends java.sql.SQLException { diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/SyncProvider.java b/jdk/src/share/classes/javax/sql/rowset/spi/SyncProvider.java index 6f1cc1620cb..14c605634bf 100644 --- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncProvider.java +++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncProvider.java @@ -209,6 +209,7 @@ import javax.sql.*; * @author Jonathan Bruce * @see javax.sql.rowset.spi.SyncFactory * @see javax.sql.rowset.spi.SyncFactoryException + * @since 1.5 */ public abstract class SyncProvider { diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/SyncProviderException.java b/jdk/src/share/classes/javax/sql/rowset/spi/SyncProviderException.java index 57f9930a678..795667ab8b7 100644 --- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncProviderException.java +++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncProviderException.java @@ -61,6 +61,7 @@ import javax.sql.rowset.*; * @see javax.sql.rowset.spi.SyncFactory * @see javax.sql.rowset.spi.SyncResolver * @see javax.sql.rowset.spi.SyncFactoryException + * @since 1.5 */ public class SyncProviderException extends java.sql.SQLException { diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java b/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java index 45fdfe02a53..4fee7df2f69 100644 --- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java +++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java @@ -231,7 +231,9 @@ import java.sql.SQLException; * } * } * } + * * @author Jonathan Bruce + * @since 1.5 */ public interface SyncResolver extends RowSet { diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/TransactionalWriter.java b/jdk/src/share/classes/javax/sql/rowset/spi/TransactionalWriter.java index fce96e85821..ae69b1e4ca6 100644 --- a/jdk/src/share/classes/javax/sql/rowset/spi/TransactionalWriter.java +++ b/jdk/src/share/classes/javax/sql/rowset/spi/TransactionalWriter.java @@ -44,6 +44,8 @@ import java.sql.Savepoint; * the CachedRowSet constant COMMIT_ON_ACCEPT_CHANGES * to false and use the commit and rollback * methods defined in this interface to manage transaction boundaries. + * + * @since 1.5 */ public interface TransactionalWriter extends RowSetWriter { diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/XmlReader.java b/jdk/src/share/classes/javax/sql/rowset/spi/XmlReader.java index 9aad9cc3ac3..ba0ee8c9dce 100644 --- a/jdk/src/share/classes/javax/sql/rowset/spi/XmlReader.java +++ b/jdk/src/share/classes/javax/sql/rowset/spi/XmlReader.java @@ -46,6 +46,8 @@ import javax.sql.rowset.*; * rowset's xmlReader field. When the WebRowSet * object's readXml method is invoked, it in turn invokes * its XML reader's readXML method. + * + * @since 1.5 */ public interface XmlReader extends RowSetReader { diff --git a/jdk/src/share/classes/javax/sql/rowset/spi/XmlWriter.java b/jdk/src/share/classes/javax/sql/rowset/spi/XmlWriter.java index 80ab78f6b77..79811d86d83 100644 --- a/jdk/src/share/classes/javax/sql/rowset/spi/XmlWriter.java +++ b/jdk/src/share/classes/javax/sql/rowset/spi/XmlWriter.java @@ -44,6 +44,8 @@ import javax.sql.rowset.*; * Writing a WebRowSet object includes printing the * rowset's data, metadata, and properties, all with the * appropriate XML tags. + * + * @since 1.5 */ public interface XmlWriter extends RowSetWriter { From ed271b0d5a72dc67601d07181512144f14894474 Mon Sep 17 00:00:00 2001 From: Otavio Goncalves de Santana Date: Mon, 16 Jun 2014 17:45:26 +0100 Subject: [PATCH 25/56] 8041679: Replace uses of StringBuffer with StringBuilder within core library classes Reviewed-by: psandoz, alanb, xuelei, dfuchs, jfranck, prr, serb, chegar --- .../imageio/plugins/gif/GIFImageReader.java | 2 +- .../sun/imageio/plugins/png/PNGMetadata.java | 2 +- .../java/swing/plaf/gtk/GTKFileChooserUI.java | 12 +- .../com/sun/java/swing/plaf/gtk/Metacity.java | 6 +- .../swing/plaf/motif/MotifFileChooserUI.java | 12 +- .../plaf/windows/WindowsFileChooserUI.java | 2 +- .../sun/java/util/jar/pack/BandStructure.java | 4 +- .../sun/java/util/jar/pack/ConstantPool.java | 2 +- .../com/sun/jmx/snmp/IPAcl/NetMaskImpl.java | 6 +- .../sun/jmx/snmp/IPAcl/ParseException.java | 2 +- .../com/sun/jmx/snmp/IPAcl/SnmpAcl.java | 4 +- .../com/sun/jmx/snmp/IPAcl/TokenMgrError.java | 2 +- .../classes/com/sun/jmx/snmp/SnmpMessage.java | 2 +- .../classes/com/sun/jmx/snmp/SnmpMsg.java | 14 +- .../classes/com/sun/jmx/snmp/SnmpOpaque.java | 2 +- .../com/sun/jmx/snmp/SnmpV3Message.java | 2 +- .../com/sun/jndi/cosnaming/CNNameParser.java | 4 +- .../com/sun/jndi/dns/DnsContextFactory.java | 8 +- .../classes/com/sun/jndi/dns/DnsName.java | 8 +- .../com/sun/jndi/dns/ResourceRecord.java | 12 +- .../classes/com/sun/jndi/ldap/ClientId.java | 2 +- .../com/sun/jndi/ldap/DigestClientId.java | 8 +- .../com/sun/jndi/ldap/LdapSchemaParser.java | 12 +- .../com/sun/jndi/ldap/ServiceLocator.java | 2 +- .../ldap/sasl/DefaultCallbackHandler.java | 2 +- .../sun/jndi/toolkit/dir/SearchFilter.java | 18 +-- .../com/sun/media/sound/SoftPerformer.java | 2 +- .../media/sound/WaveExtensibleFileReader.java | 2 +- .../xml/internal/security/utils/Base64.java | 2 +- .../com/sun/security/sasl/CramMD5Base.java | 2 +- .../com/sun/security/sasl/CramMD5Server.java | 18 +-- .../security/sasl/digest/DigestMD5Base.java | 4 +- .../security/sasl/digest/DigestMD5Server.java | 10 +- .../security/sasl/util/AbstractSaslImpl.java | 16 +- .../example/debug/bdi/ExceptionSpec.java | 6 +- .../example/debug/bdi/LineBreakpointSpec.java | 16 +- .../debug/bdi/MethodBreakpointSpec.java | 28 ++-- .../example/debug/expr/ExpressionParser.java | 2 +- .../example/debug/expr/ParseException.java | 4 +- .../example/debug/expr/TokenMgrError.java | 2 +- .../example/debug/gui/CommandInterpreter.java | 10 +- .../example/debug/gui/ContextManager.java | 2 +- .../tools/example/debug/gui/SourceModel.java | 2 +- .../example/debug/tty/BreakpointSpec.java | 24 +-- .../sun/tools/example/debug/tty/Commands.java | 48 +++--- .../com/sun/tools/example/debug/tty/Env.java | 8 +- .../com/sun/tools/example/debug/tty/TTY.java | 12 +- .../com/sun/tools/example/trace/Trace.java | 2 +- .../com/sun/tools/hat/internal/util/Misc.java | 20 +-- .../classes/com/sun/tools/jdi/FieldImpl.java | 10 +- .../com/sun/tools/jdi/JNITypeParser.java | 28 ++-- .../classes/com/sun/tools/jdi/MethodImpl.java | 2 +- .../com/sun/tools/jdi/ReferenceTypeImpl.java | 2 +- .../share/classes/com/sun/tools/jdi/SDE.java | 10 +- .../classes/com/sun/tools/jdi/TargetVM.java | 2 +- .../com/sun/tools/jdi/VirtualMachineImpl.java | 4 +- .../classes/java/beans/Introspector.java | 2 +- .../share/classes/java/beans/Statement.java | 2 +- .../classes/java/io/RandomAccessFile.java | 2 +- jdk/src/share/classes/java/net/IDN.java | 4 +- .../classes/java/net/SocketPermission.java | 2 +- jdk/src/share/classes/java/net/URI.java | 6 +- .../classes/java/net/URISyntaxException.java | 2 +- .../share/classes/java/net/URLDecoder.java | 2 +- .../share/classes/java/net/URLEncoder.java | 2 +- .../classes/java/net/URLStreamHandler.java | 2 +- .../java/nio/file/InvalidPathException.java | 2 +- jdk/src/share/classes/java/rmi/dgc/VMID.java | 12 +- .../classes/java/security/CodeSigner.java | 2 +- .../classes/java/security/Timestamp.java | 2 +- .../classes/java/security/cert/CertPath.java | 2 +- .../cert/CollectionCertStoreParameters.java | 2 +- .../cert/LDAPCertStoreParameters.java | 2 +- .../security/cert/PKIXBuilderParameters.java | 2 +- .../cert/PKIXCertPathBuilderResult.java | 2 +- .../cert/PKIXCertPathValidatorResult.java | 2 +- .../java/security/cert/PKIXParameters.java | 2 +- .../security/cert/PolicyQualifierInfo.java | 2 +- .../java/security/cert/TrustAnchor.java | 2 +- .../java/security/cert/X509CRLSelector.java | 2 +- .../java/security/cert/X509CertSelector.java | 2 +- .../classes/java/text/AttributedString.java | 6 +- .../share/classes/java/text/ChoiceFormat.java | 2 +- .../share/classes/java/util/Properties.java | 2 +- .../share/classes/java/util/prefs/Base64.java | 2 +- .../util/regex/PatternSyntaxException.java | 2 +- .../imageio/stream/ImageInputStreamImpl.java | 2 +- .../classes/javax/naming/BinaryRefAddr.java | 2 +- .../share/classes/javax/naming/NameImpl.java | 2 +- .../share/classes/javax/naming/RefAddr.java | 2 +- .../share/classes/javax/naming/Reference.java | 8 +- .../naming/directory/BasicAttribute.java | 2 +- .../share/classes/javax/print/MimeType.java | 4 +- .../print/attribute/ResolutionSyntax.java | 4 +- .../print/attribute/SetOfIntegerSyntax.java | 2 +- .../javax/print/attribute/Size2DSyntax.java | 4 +- .../auth/kerberos/KerberosTicket.java | 8 +- .../javax/sound/sampled/CompoundControl.java | 10 +- .../classes/javax/sound/sampled/DataLine.java | 14 +- .../classes/javax/swing/JColorChooser.java | 2 +- .../classes/javax/swing/MultiUIDefaults.java | 14 +- .../classes/javax/swing/RepaintManager.java | 2 +- .../javax/swing/event/TreeModelEvent.java | 22 +-- .../swing/plaf/basic/BasicFileChooserUI.java | 4 +- .../javax/swing/plaf/basic/BasicListUI.java | 16 +- .../javax/swing/plaf/basic/BasicTableUI.java | 22 +-- .../javax/swing/plaf/basic/BasicTreeUI.java | 16 +- .../swing/plaf/metal/MetalFileChooserUI.java | 12 +- .../javax/swing/plaf/nimbus/State.java | 30 ++-- .../swing/plaf/synth/ParsedSynthStyle.java | 4 +- .../swing/tree/DefaultTreeSelectionModel.java | 14 +- .../classes/javax/swing/tree/TreePath.java | 2 +- .../dsig/internal/dom/DOMExcC14NMethod.java | 2 +- .../classes/sun/applet/AppletViewer.java | 12 +- .../share/classes/sun/font/Decoration.java | 22 +-- .../sun/font/ExtendedTextSourceLabel.java | 38 ++--- .../classes/sun/font/StandardTextSource.java | 50 +++--- jdk/src/share/classes/sun/font/Type1Font.java | 2 +- .../classes/sun/java2d/opengl/OGLContext.java | 18 +-- .../share/classes/sun/java2d/pipe/Region.java | 2 +- .../java2d/pipe/hw/ContextCapabilities.java | 24 +-- .../sun/jvmstat/monitor/HostIdentifier.java | 2 +- .../sun/jvmstat/monitor/MonitoredHost.java | 2 +- .../sun/jvmstat/monitor/VmIdentifier.java | 2 +- .../share/classes/sun/management/Agent.java | 4 +- .../jvminstr/JvmThreadInstanceEntryImpl.java | 8 +- .../share/classes/sun/misc/MessageUtils.java | 2 +- jdk/src/share/classes/sun/misc/UUDecoder.java | 4 +- .../sun/net/TransferProtocolClient.java | 2 +- .../classes/sun/net/ftp/impl/FtpClient.java | 12 +- .../share/classes/sun/net/www/MimeEntry.java | 22 +-- .../classes/sun/net/www/http/HttpClient.java | 2 +- .../www/protocol/file/FileURLConnection.java | 8 +- .../protocol/http/DigestAuthentication.java | 2 +- .../sun/nio/ch/ServerSocketChannelImpl.java | 2 +- .../classes/sun/nio/ch/SocketChannelImpl.java | 2 +- .../share/classes/sun/print/PSPrinterJob.java | 2 +- .../sun/reflect/MethodAccessorGenerator.java | 12 +- .../classes/sun/rmi/server/Activation.java | 2 +- .../classes/sun/rmi/server/LoaderHandler.java | 2 +- .../share/classes/sun/rmi/server/Util.java | 2 +- .../classes/sun/security/acl/AclImpl.java | 2 +- .../sun/security/jgss/GSSCredentialImpl.java | 28 ++-- .../classes/sun/security/jgss/GSSHeader.java | 2 +- .../classes/sun/security/jgss/GSSToken.java | 2 +- .../sun/security/jgss/ProviderList.java | 12 +- .../sun/security/jgss/TokenTracker.java | 20 +-- .../sun/security/jgss/krb5/InitialToken.java | 10 +- .../sun/security/jgss/krb5/Krb5Context.java | 2 +- .../sun/security/jgss/wrapper/Krb5Util.java | 6 +- .../jgss/wrapper/NativeGSSContext.java | 8 +- .../sun/security/krb5/Credentials.java | 22 +-- .../sun/security/krb5/KrbException.java | 4 +- .../sun/security/krb5/PrincipalName.java | 8 +- .../security/krb5/internal/EncTicketPart.java | 2 +- .../security/krb5/internal/TicketFlags.java | 2 +- .../security/krb5/internal/crypto/EType.java | 2 +- .../krb5/internal/crypto/dk/DkCrypto.java | 2 +- .../krb5/internal/ktab/KeyTabEntry.java | 2 +- .../sun/security/pkcs/PKCS9Attribute.java | 26 ++-- .../sun/security/pkcs/PKCS9Attributes.java | 12 +- .../security/pkcs/SigningCertificateInfo.java | 24 +-- .../pkcs11/wrapper/CK_AES_CTR_PARAMS.java | 18 +-- .../sun/security/pkcs11/wrapper/CK_DATE.java | 16 +- .../wrapper/CK_ECDH1_DERIVE_PARAMS.java | 42 ++--- .../wrapper/CK_ECDH2_DERIVE_PARAMS.java | 74 ++++----- .../sun/security/pkcs11/wrapper/CK_INFO.java | 42 ++--- .../security/pkcs11/wrapper/CK_MECHANISM.java | 24 +-- .../pkcs11/wrapper/CK_MECHANISM_INFO.java | 30 ++-- .../pkcs11/wrapper/CK_PBE_PARAMS.java | 50 +++--- .../pkcs11/wrapper/CK_PKCS5_PBKD2_PARAMS.java | 58 +++---- .../wrapper/CK_RSA_PKCS_OAEP_PARAMS.java | 42 ++--- .../wrapper/CK_RSA_PKCS_PSS_PARAMS.java | 26 ++-- .../pkcs11/wrapper/CK_SESSION_INFO.java | 34 ++-- .../security/pkcs11/wrapper/CK_SLOT_INFO.java | 42 ++--- .../pkcs11/wrapper/CK_TOKEN_INFO.java | 146 +++++++++--------- .../wrapper/CK_X9_42_DH1_DERIVE_PARAMS.java | 42 ++--- .../wrapper/CK_X9_42_DH2_DERIVE_PARAMS.java | 74 ++++----- .../security/pkcs11/wrapper/Functions.java | 20 +-- .../sun/security/provider/AuthPolicyFile.java | 4 +- .../sun/security/provider/X509Factory.java | 4 +- .../sun/security/smartcardio/PCSC.java | 2 +- .../sun/security/ssl/HandshakeMessage.java | 8 +- .../sun/security/ssl/SSLSocketImpl.java | 2 +- .../sun/security/ssl/ServerNameExtension.java | 6 +- .../classes/sun/security/ssl/SessionId.java | 12 +- .../ssl/SignatureAlgorithmsExtension.java | 8 +- .../sun/security/tools/jarsigner/Main.java | 18 +-- .../sun/security/tools/keytool/Main.java | 4 +- .../security/tools/policytool/PolicyTool.java | 8 +- .../classes/sun/security/util/Debug.java | 16 +- .../security/util/ManifestEntryVerifier.java | 2 +- .../sun/security/util/ObjectIdentifier.java | 2 +- .../sun/security/util/PropertyExpander.java | 2 +- .../security/util/SignatureFileVerifier.java | 2 +- .../sun/security/x509/X509CRLImpl.java | 2 +- .../classes/sun/swing/SwingUtilities2.java | 2 +- .../swing/plaf/synth/DefaultSynthStyle.java | 36 ++--- .../plaf/synth/SynthFileChooserUIImpl.java | 12 +- .../classes/sun/text/normalizer/UTF16.java | 2 +- .../sun/tools/java/MemberDefinition.java | 14 +- .../classes/sun/tools/java/MethodSet.java | 12 +- .../classes/sun/tools/java/MethodType.java | 14 +- .../share/classes/sun/tools/java/Parser.java | 10 +- .../share/classes/sun/tools/java/Type.java | 12 +- .../classes/sun/tools/jconsole/Formatter.java | 12 +- .../sun/tools/jstatd/RemoteHostImpl.java | 2 +- .../sun/tools/native2ascii/N2AFilter.java | 2 +- .../sun/tools/serialver/SerialVer.java | 2 +- .../sun/tools/tree/FieldExpression.java | 10 +- .../share/classes/sun/tools/tree/Vset.java | 2 +- .../tracing/PrintStreamProviderFactory.java | 2 +- 212 files changed, 1124 insertions(+), 1124 deletions(-) diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java index 650fd313051..961f7a0682e 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java @@ -509,7 +509,7 @@ public class GIFImageReader extends ImageReader { byte[] signature = new byte[6]; stream.readFully(signature); - StringBuffer version = new StringBuffer(3); + StringBuilder version = new StringBuilder(3); version.append((char)signature[3]); version.append((char)signature[4]); version.append((char)signature[5]); diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java index 3ad3a8b6420..11018ec4015 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java @@ -900,7 +900,7 @@ public class PNGMetadata extends IIOMetadata implements Cloneable { if (times == 1) { return s; } - StringBuffer sb = new StringBuffer((s.length() + 1)*times - 1); + StringBuilder sb = new StringBuilder((s.length() + 1)*times - 1); sb.append(s); for (int i = 1; i < times; i++) { sb.append(" "); diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java index ddbdcded4b6..0a6bd6ae57f 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java @@ -169,23 +169,23 @@ class GTKFileChooserUI extends SynthFileChooserUI { result.add(typedInName); } - StringBuffer buf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); len = result.size(); // construct the resulting string for (int i=0; i 0) { - buf.append(" "); + sb.append(" "); } if (len > 1) { - buf.append("\""); + sb.append("\""); } - buf.append(result.get(i)); + sb.append(result.get(i)); if (len > 1) { - buf.append("\""); + sb.append("\""); } } - return buf.toString(); + return sb.toString(); } public void setFileName(String fileName) { diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java index 72167580a92..b0a811c3bbf 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java @@ -533,13 +533,13 @@ class Metacity implements SynthConstants { // Pending: verify character encoding spec for gconf Reader reader = new InputStreamReader(url.openStream(), "ISO-8859-1"); char[] buf = new char[1024]; - StringBuffer strBuf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); int n; while ((n = reader.read(buf)) >= 0) { - strBuf.append(buf, 0, n); + sb.append(buf, 0, n); } reader.close(); - String str = strBuf.toString(); + String str = sb.toString(); if (str != null) { String strLowerCase = str.toLowerCase(); int i = strLowerCase.indexOf(" 0) { - buf.append(" "); + sb.append(" "); } if (files.length > 1) { - buf.append("\""); + sb.append("\""); } - buf.append(fileNameString(files[i])); + sb.append(fileNameString(files[i])); if (files.length > 1) { - buf.append("\""); + sb.append("\""); } } - return buf.toString(); + return sb.toString(); } public MotifFileChooserUI(JFileChooser filechooser) { diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java index 0def92eba15..76a30a13c5a 100644 --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java @@ -690,7 +690,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI { } private String fileNameString(File[] files) { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); for (int i = 0; files != null && i < files.length; i++) { if (i > 0) { buf.append(" "); diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java index 1152aa73f0c..a7db9784946 100644 --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java @@ -628,7 +628,7 @@ class BandStructure { } if (metaCoding.length > 0 && (verbose > 2 || verbose > 1 && metaCoding.length > 1)) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < metaCoding.length; i++) { if (i == 1) sb.append(" /"); sb.append(" ").append(metaCoding[i] & 0xFF); @@ -756,7 +756,7 @@ class BandStructure { " size="+outputSize()+ irr+" coding="+bandCoding); if (metaCoding != noMetaCoding) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < metaCoding.length; i++) { if (i == 1) sb.append(" /"); sb.append(" ").append(metaCoding[i] & 0xFF); diff --git a/jdk/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java b/jdk/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java index fd17dea7fdd..e4c7d7d931d 100644 --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java @@ -1026,7 +1026,7 @@ class ConstantPool { } static String stringValueOf(MethodHandleEntry bsmRef, Entry[] argRefs) { - StringBuffer sb = new StringBuffer(bsmRef.stringValue()); + StringBuilder sb = new StringBuilder(bsmRef.stringValue()); // Arguments are formatted as "" instead of "[foo,bar,baz]". // This ensures there will be no confusion if "[,]" appear inside of names. char nextSep = '<'; diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/NetMaskImpl.java b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/NetMaskImpl.java index ac0fcc8b68c..9606c020266 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/NetMaskImpl.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/NetMaskImpl.java @@ -63,12 +63,12 @@ class NetMaskImpl extends PrincipalImpl implements Group, Serializable { if (SNMP_LOGGER.isLoggable(Level.FINEST)) { SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), "extractSubNet", "BINARY ARRAY :"); - StringBuffer buff = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for(int i =0; i < addrLength; i++) { - buff.append((b[i] &0xFF) +":"); + sb.append((b[i] & 0xFF) + ":"); } SNMP_LOGGER.logp(Level.FINEST, NetMaskImpl.class.getName(), - "extractSubNet", buff.toString()); + "extractSubNet", sb.toString()); } // 8 is a byte size. Common to any InetAddress (V4 or V6). diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/ParseException.java b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/ParseException.java index 7d7f3f7abba..78be1da103b 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/ParseException.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/ParseException.java @@ -170,7 +170,7 @@ class ParseException extends Exception { * string literal. */ protected String add_escapes(String str) { - StringBuffer retval = new StringBuffer(); + StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java index a8e43c5337e..1a3fb7cc0cf 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/SnmpAcl.java @@ -186,8 +186,8 @@ public class SnmpAcl implements InetAddressAcl, Serializable { public static String getDefaultAclFileName() { final String fileSeparator = System.getProperty("file.separator"); - final StringBuffer defaultAclName = - new StringBuffer(System.getProperty("java.home")). + final StringBuilder defaultAclName = + new StringBuilder(System.getProperty("java.home")). append(fileSeparator).append("lib").append(fileSeparator). append("snmp.acl"); return defaultAclName.toString(); diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java index 1a0eba110ab..b09c4530d83 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/IPAcl/TokenMgrError.java @@ -65,7 +65,7 @@ class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); + StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpMessage.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpMessage.java index 32685602ff0..ec4c87466c0 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpMessage.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpMessage.java @@ -347,7 +347,7 @@ public class SnmpMessage extends SnmpMsg implements SnmpDefinitions { * @return The string containing the dump. */ public String printMessage() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (community == null) { sb.append("Community: null") ; } diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpMsg.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpMsg.java index d72dc822c2e..cea4c744ad0 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpMsg.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpMsg.java @@ -181,22 +181,22 @@ public abstract class SnmpMsg implements SnmpDefinitions { * @return The string containing the dump. */ public static String dumpHexBuffer(byte [] b, int offset, int len) { - StringBuffer buf = new StringBuffer(len << 1) ; + StringBuilder sb = new StringBuilder(len << 1) ; int k = 1 ; int flen = offset + len ; for (int i = offset; i < flen ; i++) { int j = b[i] & 0xFF ; - buf.append(Character.forDigit((j >>> 4) , 16)) ; - buf.append(Character.forDigit((j & 0x0F), 16)) ; + sb.append(Character.forDigit((j >>> 4), 16)) ; + sb.append(Character.forDigit((j & 0x0F), 16)) ; k++ ; if (k%16 == 0) { - buf.append('\n') ; + sb.append('\n') ; k = 1 ; } else - buf.append(' ') ; + sb.append(' ') ; } - return buf.toString() ; + return sb.toString() ; } /** @@ -205,7 +205,7 @@ public abstract class SnmpMsg implements SnmpDefinitions { * @return The string containing the dump. */ public String printMessage() { - StringBuffer sb = new StringBuffer() ; + StringBuilder sb = new StringBuilder() ; sb.append("Version: ") ; sb.append(version) ; sb.append("\n") ; diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpOpaque.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpOpaque.java index afe948e1519..50bb8b8c9aa 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpOpaque.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpOpaque.java @@ -73,7 +73,7 @@ public class SnmpOpaque extends SnmpString { * @return The String representation of the value. */ public String toString() { - StringBuffer result = new StringBuffer() ; + StringBuilder result = new StringBuilder() ; for (int i = 0 ; i < value.length ; i++) { byte b = value[i] ; int n = (b >= 0) ? b : b + 256 ; diff --git a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpV3Message.java b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpV3Message.java index bcdcc3ed0a0..64288f14c61 100644 --- a/jdk/src/share/classes/com/sun/jmx/snmp/SnmpV3Message.java +++ b/jdk/src/share/classes/com/sun/jmx/snmp/SnmpV3Message.java @@ -478,7 +478,7 @@ public class SnmpV3Message extends SnmpMsg { * @return The string containing the dump. */ public String printMessage() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("msgId : " + msgId + "\n"); sb.append("msgMaxSize : " + msgMaxSize + "\n"); sb.append("msgFlags : " + msgFlags + "\n"); diff --git a/jdk/src/share/classes/com/sun/jndi/cosnaming/CNNameParser.java b/jdk/src/share/classes/com/sun/jndi/cosnaming/CNNameParser.java index 3b746528c3b..ebd0f05e65a 100644 --- a/jdk/src/share/classes/com/sun/jndi/cosnaming/CNNameParser.java +++ b/jdk/src/share/classes/com/sun/jndi/cosnaming/CNNameParser.java @@ -96,7 +96,7 @@ final public class CNNameParser implements NameParser { * Used by CNCtx.getNameInNamespace(), CNCompoundName.toString(). */ static String cosNameToInsString(NameComponent[] cname) { - StringBuffer str = new StringBuffer(); + StringBuilder str = new StringBuilder(); for ( int i = 0; i < cname.length; i++) { if ( i > 0) { str.append(compSeparator); @@ -254,7 +254,7 @@ final public class CNNameParser implements NameParser { } private static String stringifyComponent(NameComponent comp) { - StringBuffer one = new StringBuffer(escape(comp.id)); + StringBuilder one = new StringBuilder(escape(comp.id)); if (comp.kind != null && !comp.kind.equals("")) { one.append(kindSeparator + escape(comp.kind)); } diff --git a/jdk/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java b/jdk/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java index 587d9b236d5..b6ad2c15bfc 100644 --- a/jdk/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java +++ b/jdk/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java @@ -198,14 +198,14 @@ public class DnsContextFactory implements InitialContextFactory { } } - StringBuffer buf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < servers.length; i++) { if (i > 0) { - buf.append(' '); + sb.append(' '); } - buf.append("dns://").append(servers[i]).append(path); + sb.append("dns://").append(servers[i]).append(path); } - return buf.toString(); + return sb.toString(); } /* diff --git a/jdk/src/share/classes/com/sun/jndi/dns/DnsName.java b/jdk/src/share/classes/com/sun/jndi/dns/DnsName.java index d2f76added9..eb4a7fb96f4 100644 --- a/jdk/src/share/classes/com/sun/jndi/dns/DnsName.java +++ b/jdk/src/share/classes/com/sun/jndi/dns/DnsName.java @@ -415,7 +415,7 @@ public final class DnsName implements Name { */ private void parse(String name) throws InvalidNameException { - StringBuffer label = new StringBuffer(); // label being parsed + StringBuilder label = new StringBuilder(); // label being parsed for (int i = 0; i < name.length(); i++) { char c = name.charAt(i); @@ -564,15 +564,15 @@ public final class DnsName implements Name { * into account. See compareLabels(). */ private static String keyForLabel(String label) { - StringBuffer buf = new StringBuffer(label.length()); + StringBuilder sb = new StringBuilder(label.length()); for (int i = 0; i < label.length(); i++) { char c = label.charAt(i); if (c >= 'A' && c <= 'Z') { c += 'a' - 'A'; // to lower case } - buf.append(c); + sb.append(c); } - return buf.toString(); + return sb.toString(); } diff --git a/jdk/src/share/classes/com/sun/jndi/dns/ResourceRecord.java b/jdk/src/share/classes/com/sun/jndi/dns/ResourceRecord.java index 846135c45aa..c34bd680983 100644 --- a/jdk/src/share/classes/com/sun/jndi/dns/ResourceRecord.java +++ b/jdk/src/share/classes/com/sun/jndi/dns/ResourceRecord.java @@ -596,21 +596,21 @@ public class ResourceRecord { // If bestBase != -1, compress zeros in [bestBase, bestBase+bestLen) boolean compress = (bestBase != -1); - StringBuffer buf = new StringBuffer(40); + StringBuilder sb = new StringBuilder(40); if (bestBase == 0) { - buf.append(':'); + sb.append(':'); } for (int i = 0; i < 8; i++) { if (!compress || (i < bestBase) || (i >= bestBase + bestLen)) { - buf.append(Integer.toHexString(addr6[i])); + sb.append(Integer.toHexString(addr6[i])); if (i < 7) { - buf.append(':'); + sb.append(':'); } } else if (compress && (i == bestBase)) { // first compressed zero - buf.append(':'); + sb.append(':'); } } - return buf.toString(); + return sb.toString(); } } diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java b/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java index 9f75e8373e3..7a30c1c7beb 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/ClientId.java @@ -210,7 +210,7 @@ class ClientId { if (ctls == null) { return ""; } - StringBuffer str = new StringBuffer(); + StringBuilder str = new StringBuilder(); for (int i = 0; i < ctls.length; i++) { str.append(ctls[i].getID()); str.append(' '); diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/DigestClientId.java b/jdk/src/share/classes/com/sun/jndi/ldap/DigestClientId.java index b4f19d02b3b..e7078098cbd 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/DigestClientId.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/DigestClientId.java @@ -103,14 +103,14 @@ class DigestClientId extends SimpleClientId { public String toString() { if (propvals != null) { - StringBuffer buf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < propvals.length; i++) { - buf.append(':'); + sb.append(':'); if (propvals[i] != null) { - buf.append(propvals[i]); + sb.append(propvals[i]); } } - return super.toString() + buf.toString(); + return super.toString() + sb.toString(); } else { return super.toString(); } diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/LdapSchemaParser.java b/jdk/src/share/classes/com/sun/jndi/ldap/LdapSchemaParser.java index 7804314fc15..7fddd7799f5 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapSchemaParser.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/LdapSchemaParser.java @@ -767,7 +767,7 @@ final class LdapSchemaParser { final private String classDef2ObjectDesc(Attributes attrs) throws NamingException { - StringBuffer objectDesc = new StringBuffer("( "); + StringBuilder objectDesc = new StringBuilder("( "); Attribute attr = null; int count = 0; @@ -879,7 +879,7 @@ final class LdapSchemaParser { final private String attrDef2AttrDesc(Attributes attrs) throws NamingException { - StringBuffer attrDesc = new StringBuffer("( "); // opening parens + StringBuilder attrDesc = new StringBuilder("( "); // opening parens Attribute attr = null; int count = 0; @@ -1012,7 +1012,7 @@ final class LdapSchemaParser { final private String syntaxDef2SyntaxDesc(Attributes attrs) throws NamingException { - StringBuffer syntaxDesc = new StringBuffer("( "); // opening parens + StringBuilder syntaxDesc = new StringBuilder("( "); // opening parens Attribute attr = null; int count = 0; @@ -1068,7 +1068,7 @@ final class LdapSchemaParser { final private String matchRuleDef2MatchRuleDesc(Attributes attrs) throws NamingException { - StringBuffer matchRuleDesc = new StringBuffer("( "); // opening parens + StringBuilder matchRuleDesc = new StringBuilder("( "); // opening parens Attribute attr = null; int count = 0; @@ -1196,7 +1196,7 @@ final class LdapSchemaParser { // write QDList - StringBuffer qdList = new StringBuffer(attr.getID()); + StringBuilder qdList = new StringBuilder(attr.getID()); qdList.append(WHSP); qdList.append(OID_LIST_BEGIN); @@ -1233,7 +1233,7 @@ final class LdapSchemaParser { // write OID List - StringBuffer oidList = new StringBuffer(oidsAttr.getID()); + StringBuilder oidList = new StringBuilder(oidsAttr.getID()); oidList.append(WHSP); oidList.append(OID_LIST_BEGIN); diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java b/jdk/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java index 5bbd58da462..05df1bbd6b7 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/ServiceLocator.java @@ -68,7 +68,7 @@ class ServiceLocator { if (dn == null) { return null; } - StringBuffer domain = new StringBuffer(); + StringBuilder domain = new StringBuilder(); LdapName ldapName = new LdapName(dn); // process RDNs left-to-right diff --git a/jdk/src/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java b/jdk/src/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java index 3bea1cc403d..3e0098eaaa4 100644 --- a/jdk/src/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java +++ b/jdk/src/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java @@ -88,7 +88,7 @@ final class DefaultCallbackHandler implements CallbackHandler { } } if (selected == -1) { - StringBuffer allChoices = new StringBuffer(); + StringBuilder allChoices = new StringBuilder(); for (int j = 0; j < choices.length; j++) { allChoices.append(choices[j] + ","); } diff --git a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java index ffdc9b8279f..bdbf578cc24 100644 --- a/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java @@ -520,30 +520,30 @@ public class SearchFilter implements AttrFilter { str = (String)obj; } int len = str.length(); - StringBuffer buf = new StringBuffer(len); + StringBuilder sb = new StringBuilder(len); char ch; for (int i = 0; i < len; i++) { switch (ch=str.charAt(i)) { case '*': - buf.append("\\2a"); + sb.append("\\2a"); break; case '(': - buf.append("\\28"); + sb.append("\\28"); break; case ')': - buf.append("\\29"); + sb.append("\\29"); break; case '\\': - buf.append("\\5c"); + sb.append("\\5c"); break; case 0: - buf.append("\\00"); + sb.append("\\00"); break; default: - buf.append(ch); + sb.append(ch); } } - return buf.toString(); + return sb.toString(); } @@ -585,7 +585,7 @@ public class SearchFilter implements AttrFilter { int param; int where = 0, start = 0; - StringBuffer answer = new StringBuffer(expr.length()); + StringBuilder answer = new StringBuilder(expr.length()); while ((where = findUnescaped('{', expr, start)) >= 0) { int pstart = where + 1; // skip '{' diff --git a/jdk/src/share/classes/com/sun/media/sound/SoftPerformer.java b/jdk/src/share/classes/com/sun/media/sound/SoftPerformer.java index 905bdb3128e..5cd7c6eb92e 100644 --- a/jdk/src/share/classes/com/sun/media/sound/SoftPerformer.java +++ b/jdk/src/share/classes/com/sun/media/sound/SoftPerformer.java @@ -326,7 +326,7 @@ public final class SoftPerformer { private static KeySortComparator keySortComparator = new KeySortComparator(); private String extractKeys(ModelConnectionBlock conn) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (conn.getSources() != null) { sb.append("["); ModelSource[] srcs = conn.getSources(); diff --git a/jdk/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java b/jdk/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java index 827cef6a23a..ba46be6cf5a 100644 --- a/jdk/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java +++ b/jdk/src/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java @@ -162,7 +162,7 @@ public final class WaveExtensibleFileReader extends AudioFileReader { 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); private String decodeChannelMask(long channelmask) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); long m = 1; for (int i = 0; i < allchannelnames.length; i++) { if ((channelmask & m) != 0L) { diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java index db1f49eaee4..de822922b36 100644 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java @@ -257,7 +257,7 @@ public class Base64 { public static final byte[] decode(Element element) throws Base64DecodingException { Node sibling = element.getFirstChild(); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); while (sibling != null) { if (sibling.getNodeType() == Node.TEXT_NODE) { diff --git a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Base.java b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Base.java index 5d0309c60d0..4e51266f97b 100644 --- a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Base.java +++ b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Base.java @@ -195,7 +195,7 @@ abstract class CramMD5Base { digest = md5.digest(); // Get character representation of digest - StringBuffer digestString = new StringBuffer(); + StringBuilder digestString = new StringBuilder(); for (i = 0; i < digest.length; i++) { if ((digest[i] & 0x000000ff) < 0x10) { diff --git a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java index b87867b3ae7..94512f806dd 100644 --- a/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java +++ b/jdk/src/share/classes/com/sun/security/sasl/CramMD5Server.java @@ -117,15 +117,15 @@ final class CramMD5Server extends CramMD5Base implements SaslServer { long rand = random.nextLong(); long timestamp = System.currentTimeMillis(); - StringBuffer buf = new StringBuffer(); - buf.append('<'); - buf.append(rand); - buf.append('.'); - buf.append(timestamp); - buf.append('@'); - buf.append(fqdn); - buf.append('>'); - String challengeStr = buf.toString(); + StringBuilder sb = new StringBuilder(); + sb.append('<'); + sb.append(rand); + sb.append('.'); + sb.append(timestamp); + sb.append('@'); + sb.append(fqdn); + sb.append('>'); + String challengeStr = sb.toString(); logger.log(Level.FINE, "CRAMSRV01:Generated challenge: {0}", challengeStr); diff --git a/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java b/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java index 548bac7273b..37a261a6a2f 100644 --- a/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java +++ b/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java @@ -387,7 +387,7 @@ abstract class DigestMD5Base extends AbstractSaslImpl { protected byte[] binaryToHex(byte[] digest) throws UnsupportedEncodingException { - StringBuffer digestString = new StringBuffer(); + StringBuilder digestString = new StringBuilder(); for (int i = 0; i < digest.length; i ++) { if ((digest[i] & 0x000000ff) < 0x10) { @@ -598,7 +598,7 @@ abstract class DigestMD5Base extends AbstractSaslImpl { protected static String nonceCountToHex(int count) { String str = Integer.toHexString(count); - StringBuffer pad = new StringBuffer(); + StringBuilder pad = new StringBuilder(); if (str.length() < 8) { for (int i = 0; i < 8-str.length(); i ++) { diff --git a/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java b/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java index b722f0b36ba..449284258c3 100644 --- a/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java +++ b/jdk/src/share/classes/com/sun/security/sasl/digest/DigestMD5Server.java @@ -203,19 +203,19 @@ final class DigestMD5Server extends DigestMD5Base implements SaslServer { String supportedCiphers = null; if ((allQop&PRIVACY_PROTECTION) != 0) { myCiphers = getPlatformCiphers(); - StringBuffer buf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); // myCipher[i] is a byte that indicates whether CIPHER_TOKENS[i] // is supported for (int i = 0; i < CIPHER_TOKENS.length; i++) { if (myCiphers[i] != 0) { - if (buf.length() > 0) { - buf.append(','); + if (sb.length() > 0) { + sb.append(','); } - buf.append(CIPHER_TOKENS[i]); + sb.append(CIPHER_TOKENS[i]); } } - supportedCiphers = buf.toString(); + supportedCiphers = sb.toString(); } try { diff --git a/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java b/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java index c0df4bf960d..eb122e3bbb4 100644 --- a/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java +++ b/jdk/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java @@ -80,13 +80,13 @@ public abstract class AbstractSaslImpl { "SASLIMPL02:Preferred qop mask: {0}", new Byte(allQop)); if (qop.length > 0) { - StringBuffer qopbuf = new StringBuffer(); + StringBuilder str = new StringBuilder(); for (int i = 0; i < qop.length; i++) { - qopbuf.append(Byte.toString(qop[i])); - qopbuf.append(' '); + str.append(Byte.toString(qop[i])); + str.append(' '); } logger.logp(Level.FINE, myClassName, "constructor", - "SASLIMPL03:Preferred qops : {0}", qopbuf.toString()); + "SASLIMPL03:Preferred qops : {0}", str.toString()); } } @@ -95,13 +95,13 @@ public abstract class AbstractSaslImpl { logger.logp(Level.FINE, myClassName, "constructor", "SASLIMPL04:Preferred strength property: {0}", prop); if (logger.isLoggable(Level.FINE) && strength.length > 0) { - StringBuffer strbuf = new StringBuffer(); + StringBuilder str = new StringBuilder(); for (int i = 0; i < strength.length; i++) { - strbuf.append(Byte.toString(strength[i])); - strbuf.append(' '); + str.append(Byte.toString(strength[i])); + str.append(' '); } logger.logp(Level.FINE, myClassName, "constructor", - "SASLIMPL05:Cipher strengths: {0}", strbuf.toString()); + "SASLIMPL05:Cipher strengths: {0}", str.toString()); } // Max receive buffer size diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExceptionSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExceptionSpec.java index 489da6afc90..df87688152c 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExceptionSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/ExceptionSpec.java @@ -102,8 +102,8 @@ public class ExceptionSpec extends EventRequestSpec { @Override public String toString() { - StringBuffer buffer = new StringBuffer("exception catch "); - buffer.append(refSpec.toString()); - return buffer.toString(); + StringBuilder sb = new StringBuilder("exception catch "); + sb.append(refSpec.toString()); + return sb.toString(); } } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineBreakpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineBreakpointSpec.java index 0cfe97a75e2..f7d66ce2d52 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineBreakpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/LineBreakpointSpec.java @@ -118,13 +118,13 @@ public class LineBreakpointSpec extends BreakpointSpec { @Override public String toString() { - StringBuffer buffer = new StringBuffer("breakpoint "); - buffer.append(refSpec.toString()); - buffer.append(':'); - buffer.append(lineNumber); - buffer.append(" ("); - buffer.append(getStatusString()); - buffer.append(')'); - return buffer.toString(); + StringBuilder sb = new StringBuilder("breakpoint "); + sb.append(refSpec.toString()); + sb.append(':'); + sb.append(lineNumber); + sb.append(" ("); + sb.append(getStatusString()); + sb.append(')'); + return sb.toString(); } } diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodBreakpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodBreakpointSpec.java index 112d3a87f68..b414443faf7 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodBreakpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/bdi/MethodBreakpointSpec.java @@ -126,26 +126,26 @@ public class MethodBreakpointSpec extends BreakpointSpec { @Override public String toString() { - StringBuffer buffer = new StringBuffer("breakpoint "); - buffer.append(refSpec.toString()); - buffer.append('.'); - buffer.append(methodId); + StringBuilder sb = new StringBuilder("breakpoint "); + sb.append(refSpec.toString()); + sb.append('.'); + sb.append(methodId); if (methodArgs != null) { boolean first = true; - buffer.append('('); + sb.append('('); for (String name : methodArgs) { if (!first) { - buffer.append(','); + sb.append(','); } - buffer.append(name); + sb.append(name); first = false; } - buffer.append(")"); + sb.append(")"); } - buffer.append(" ("); - buffer.append(getStatusString()); - buffer.append(')'); - return buffer.toString(); + sb.append(" ("); + sb.append(getStatusString()); + sb.append(')'); + return sb.toString(); } private boolean isValidMethodName(String s) { @@ -225,8 +225,8 @@ public class MethodBreakpointSpec extends BreakpointSpec { * stripping whitespace after the name ends. */ int i = 0; - StringBuffer typePart = new StringBuffer(); - StringBuffer arrayPart = new StringBuffer(); + StringBuilder typePart = new StringBuilder(); + StringBuilder arrayPart = new StringBuilder(); name = name.trim(); int nameLength = name.length(); /* diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java index 69deb789a94..5f0c12086d6 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java @@ -185,7 +185,7 @@ public class ExpressionParser implements ExpressionParserConstants { } final public String Name() throws ParseException { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); jj_consume_token(IDENTIFIER); sb.append(token); label_2: diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java index 6df5e4bafc6..77b0980c282 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/ParseException.java @@ -114,7 +114,7 @@ public class ParseException extends Exception { int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); - StringBuffer expected = new StringBuffer(); + StringBuilder expected = new StringBuilder(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { @@ -164,7 +164,7 @@ public class ParseException extends Exception { * string literal. */ static String add_escapes(String str) { - StringBuffer retval = new StringBuffer(); + StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java index 5bc49c343a6..f6408697b48 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java @@ -73,7 +73,7 @@ public class TokenMgrError extends Error * equivalents in the given string */ protected static final String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); + StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java index 8b7e88facac..fbff95b2703 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/CommandInterpreter.java @@ -267,7 +267,7 @@ public class CommandInterpreter { buf[j] = ' '; } buf[79] = '\0'; - StringBuffer sbOut = new StringBuffer(); + StringBuilder sbOut = new StringBuilder(); sbOut.append(buf); // Right-justify the thread number at start of output string @@ -381,16 +381,16 @@ public class CommandInterpreter { } } else { clname = t.nextToken(); - StringBuffer sbuf = new StringBuffer(); + StringBuilder str = new StringBuilder(); // Allow VM arguments to be specified here? while (t.hasMoreTokens()) { String tok = t.nextToken(); - sbuf.append(tok); + str.append(tok); if (t.hasMoreTokens()) { - sbuf.append(' '); + str.append(' '); } } - String args = sbuf.toString(); + String args = str.toString(); try { String vmArgs = context.getVmArguments(); runtime.run(suspended, vmArgs, clname, args); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java index 52ceca4c19b..74c61b55969 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java @@ -333,7 +333,7 @@ public class ContextManager { private String processClasspathDefaults(String javaArgs) { if (javaArgs.indexOf("-classpath ") == -1) { - StringBuffer munged = new StringBuffer(javaArgs); + StringBuilder munged = new StringBuilder(javaArgs); SearchPath classpath = classManager.getClassPath(); if (classpath.isEmpty()) { String envcp = System.getProperty("env.class.path"); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceModel.java b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceModel.java index dc93d21ff4c..9b26646a70a 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceModel.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/gui/SourceModel.java @@ -236,7 +236,7 @@ public class SourceModel extends AbstractListModel { private String expandTabs(String s) { int col = 0; int len = s.length(); - StringBuffer sb = new StringBuffer(132); + StringBuilder sb = new StringBuilder(132); for (int i = 0; i < len; i++) { char c = s.charAt(i); sb.append(c); diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java index f39a7f8059e..db0f25c1cb8 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/BreakpointSpec.java @@ -154,27 +154,27 @@ class BreakpointSpec extends EventRequestSpec { @Override public String toString() { - StringBuffer buffer = new StringBuffer(refSpec.toString()); + StringBuilder sb = new StringBuilder(refSpec.toString()); if (isMethodBreakpoint()) { - buffer.append('.'); - buffer.append(methodId); + sb.append('.'); + sb.append(methodId); if (methodArgs != null) { boolean first = true; - buffer.append('('); + sb.append('('); for (String arg : methodArgs) { if (!first) { - buffer.append(','); + sb.append(','); } - buffer.append(arg); + sb.append(arg); first = false; } - buffer.append(")"); + sb.append(")"); } } else { - buffer.append(':'); - buffer.append(lineNumber); + sb.append(':'); + sb.append(lineNumber); } - return MessageOutput.format("breakpoint", buffer.toString()); + return MessageOutput.format("breakpoint", sb.toString()); } private Location location(ReferenceType refType) throws @@ -275,8 +275,8 @@ class BreakpointSpec extends EventRequestSpec { * stripping whitespace after the name ends */ int i = 0; - StringBuffer typePart = new StringBuffer(); - StringBuffer arrayPart = new StringBuffer(); + StringBuilder typePart = new StringBuilder(); + StringBuilder arrayPart = new StringBuilder(); name = name.trim(); int nameLength = name.length(); /* diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java index 33f6e3ddf7f..65a0a800e09 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Commands.java @@ -164,30 +164,30 @@ class Commands { } String typedName(Method method) { - StringBuffer buf = new StringBuffer(); - buf.append(method.name()); - buf.append("("); + StringBuilder sb = new StringBuilder(); + sb.append(method.name()); + sb.append("("); List args = method.argumentTypeNames(); int lastParam = args.size() - 1; // output param types except for the last for (int ii = 0; ii < lastParam; ii++) { - buf.append(args.get(ii)); - buf.append(", "); + sb.append(args.get(ii)); + sb.append(", "); } if (lastParam >= 0) { // output the last param String lastStr = args.get(lastParam); if (method.isVarArgs()) { // lastParam is an array. Replace the [] with ... - buf.append(lastStr.substring(0, lastStr.length() - 2)); - buf.append("..."); + sb.append(lastStr.substring(0, lastStr.length() - 2)); + sb.append("..."); } else { - buf.append(lastStr); + sb.append(lastStr); } } - buf.append(")"); - return buf.toString(); + sb.append(")"); + return sb.toString(); } void commandConnectors(VirtualMachineManager vmm) { @@ -226,7 +226,7 @@ class Commands { } void commandClasses() { - StringBuffer classList = new StringBuffer(); + StringBuilder classList = new StringBuilder(); for (ReferenceType refType : Env.vm().allClasses()) { classList.append(refType.name()); classList.append("\n"); @@ -309,7 +309,7 @@ class Commands { String idClass = t.nextToken(); ReferenceType cls = Env.getReferenceTypeFromToken(idClass); if (cls != null) { - StringBuffer methodsList = new StringBuffer(); + StringBuilder methodsList = new StringBuilder(); for (Method method : cls.allMethods()) { methodsList.append(method.declaringType().name()); methodsList.append(" "); @@ -333,7 +333,7 @@ class Commands { if (cls != null) { List fields = cls.allFields(); List visible = cls.visibleFields(); - StringBuffer fieldsList = new StringBuffer(); + StringBuilder fieldsList = new StringBuilder(); for (Field field : fields) { String s; if (!visible.contains(field)) { @@ -391,11 +391,11 @@ class Commands { * very long thread names, at the possible cost of lines * being wrapped by the display device. */ - StringBuffer idBuffer = new StringBuffer(Env.description(thr)); + StringBuilder idBuffer = new StringBuilder(Env.description(thr)); for (int i = idBuffer.length(); i < maxIdLength; i++) { idBuffer.append(" "); } - StringBuffer nameBuffer = new StringBuffer(thr.name()); + StringBuilder nameBuffer = new StringBuilder(thr.name()); for (int i = nameBuffer.length(); i < maxNameLength; i++) { nameBuffer.append(" "); } @@ -1606,16 +1606,16 @@ class Commands { private void dump(ObjectReference obj, ReferenceType refType, ReferenceType refTypeBase) { for (Field field : refType.fields()) { - StringBuffer o = new StringBuffer(); - o.append(" "); + StringBuilder sb = new StringBuilder(); + sb.append(" "); if (!refType.equals(refTypeBase)) { - o.append(refType.name()); - o.append("."); + sb.append(refType.name()); + sb.append("."); } - o.append(field.name()); - o.append(MessageOutput.format("colon space")); - o.append(obj.getValue(field)); - MessageOutput.printDirectln(o.toString()); // Special case: use printDirectln() + sb.append(field.name()); + sb.append(MessageOutput.format("colon space")); + sb.append(obj.getValue(field)); + MessageOutput.printDirectln(sb.toString()); // Special case: use printDirectln() } if (refType instanceof ClassType) { ClassType sup = ((ClassType)refType).superclass(); @@ -1954,7 +1954,7 @@ class Commands { } } - StringBuffer line = new StringBuffer(80); + StringBuilder line = new StringBuilder(80); line.append("0000: "); for (int i = 0; i < bytecodes.length; i++) { if ((i > 0) && (i % 16 == 0)) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Env.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Env.java index 63e1fe10e0e..b67295e840e 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/Env.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/Env.java @@ -114,12 +114,12 @@ class Env { } static String excludesString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (String pattern : excludes()) { - buffer.append(pattern); - buffer.append(","); + sb.append(pattern); + sb.append(","); } - return buffer.toString(); + return sb.toString(); } static void addExcludes(StepRequest request) { diff --git a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java index 1958b9a8eca..8de89b26689 100644 --- a/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java +++ b/jdk/src/share/classes/com/sun/tools/example/debug/tty/TTY.java @@ -827,17 +827,17 @@ public class TTY implements EventNotifier { private static String addArgument(String string, String argument) { if (hasWhitespace(argument) || argument.indexOf(',') != -1) { // Quotes were stripped out for this argument, add 'em back. - StringBuffer buffer = new StringBuffer(string); - buffer.append('"'); + StringBuilder sb = new StringBuilder(string); + sb.append('"'); for (int i = 0; i < argument.length(); i++) { char c = argument.charAt(i); if (c == '"') { - buffer.append('\\'); + sb.append('\\'); } - buffer.append(c); + sb.append(c); } - buffer.append("\" "); - return buffer.toString(); + sb.append("\" "); + return sb.toString(); } else { return string + argument + ' '; } diff --git a/jdk/src/share/classes/com/sun/tools/example/trace/Trace.java b/jdk/src/share/classes/com/sun/tools/example/trace/Trace.java index fa66b3bd3d5..2ce99f97a01 100644 --- a/jdk/src/share/classes/com/sun/tools/example/trace/Trace.java +++ b/jdk/src/share/classes/com/sun/tools/example/trace/Trace.java @@ -121,7 +121,7 @@ public class Trace { usage(); System.exit(1); } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(args[inx]); for (++inx; inx < args.length; ++inx) { sb.append(' '); diff --git a/jdk/src/share/classes/com/sun/tools/hat/internal/util/Misc.java b/jdk/src/share/classes/com/sun/tools/hat/internal/util/Misc.java index 0fdf405967c..84a9291003c 100644 --- a/jdk/src/share/classes/com/sun/tools/hat/internal/util/Misc.java +++ b/jdk/src/share/classes/com/sun/tools/hat/internal/util/Misc.java @@ -83,30 +83,30 @@ public class Misc { public static String encodeHtml(String str) { final int len = str.length(); - StringBuffer buf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < len; i++) { char ch = str.charAt(i); if (ch == '<') { - buf.append("<"); + sb.append("<"); } else if (ch == '>') { - buf.append(">"); + sb.append(">"); } else if (ch == '"') { - buf.append("""); + sb.append("""); } else if (ch == '\'') { - buf.append("'"); + sb.append("'"); } else if (ch == '&') { - buf.append("&"); + sb.append("&"); } else if (ch < ' ') { - buf.append("&#" + Integer.toString(ch) + ";"); + sb.append("&#" + Integer.toString(ch) + ";"); } else { int c = (ch & 0xFFFF); if (c > 127) { - buf.append("&#" + Integer.toString(c) + ";"); + sb.append("&#" + Integer.toString(c) + ";"); } else { - buf.append(ch); + sb.append(ch); } } } - return buf.toString(); + return sb.toString(); } } diff --git a/jdk/src/share/classes/com/sun/tools/jdi/FieldImpl.java b/jdk/src/share/classes/com/sun/tools/jdi/FieldImpl.java index ecf6fdcb625..a7d46501d1c 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/FieldImpl.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/FieldImpl.java @@ -95,12 +95,12 @@ public class FieldImpl extends TypeComponentImpl } public String toString() { - StringBuffer buf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); - buf.append(declaringType().name()); - buf.append('.'); - buf.append(name()); + sb.append(declaringType().name()); + sb.append('.'); + sb.append(name()); - return buf.toString(); + return sb.toString(); } } diff --git a/jdk/src/share/classes/com/sun/tools/jdi/JNITypeParser.java b/jdk/src/share/classes/com/sun/tools/jdi/JNITypeParser.java index 2ed7265eb7a..4905fc69065 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/JNITypeParser.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/JNITypeParser.java @@ -44,11 +44,11 @@ public class JNITypeParser { } static String typeNameToSignature(String signature) { - StringBuffer buffer = new StringBuffer(); + StringBuilder sb = new StringBuilder(); int firstIndex = signature.indexOf('['); int index = firstIndex; while (index != -1) { - buffer.append('['); + sb.append('['); index = signature.indexOf('[', index + 1); } @@ -57,28 +57,28 @@ public class JNITypeParser { } if (signature.equals("boolean")) { - buffer.append('Z'); + sb.append('Z'); } else if (signature.equals("byte")) { - buffer.append('B'); + sb.append('B'); } else if (signature.equals("char")) { - buffer.append('C'); + sb.append('C'); } else if (signature.equals("short")) { - buffer.append('S'); + sb.append('S'); } else if (signature.equals("int")) { - buffer.append('I'); + sb.append('I'); } else if (signature.equals("long")) { - buffer.append('J'); + sb.append('J'); } else if (signature.equals("float")) { - buffer.append('F'); + sb.append('F'); } else if (signature.equals("double")) { - buffer.append('D'); + sb.append('D'); } else { - buffer.append('L'); - buffer.append(signature.replace('.', '/')); - buffer.append(';'); + sb.append('L'); + sb.append(signature.replace('.', '/')); + sb.append(';'); } - return buffer.toString(); + return sb.toString(); } String typeName() { diff --git a/jdk/src/share/classes/com/sun/tools/jdi/MethodImpl.java b/jdk/src/share/classes/com/sun/tools/jdi/MethodImpl.java index 1d93f4c76ba..b5cd9c67abd 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/MethodImpl.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/MethodImpl.java @@ -387,7 +387,7 @@ public abstract class MethodImpl extends TypeComponentImpl } public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(declaringType().name()); sb.append("."); sb.append(name()); diff --git a/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java b/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java index be98d5e0f3e..ab76a876e6d 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java @@ -751,7 +751,7 @@ implements ReferenceType { String baseSourceDir() { if (baseSourceDir == null) { String typeName = name(); - StringBuffer sb = new StringBuffer(typeName.length() + 10); + StringBuilder sb = new StringBuilder(typeName.length() + 10); int index = 0; int nextIndex; diff --git a/jdk/src/share/classes/com/sun/tools/jdi/SDE.java b/jdk/src/share/classes/com/sun/tools/jdi/SDE.java index 2ccaf25eb66..25fed40042d 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/SDE.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/SDE.java @@ -56,16 +56,16 @@ class SDE { if (sourcePath == null) { sourcePath = refType.baseSourceDir() + sourceName; } else { - StringBuffer buf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < sourcePath.length(); ++i) { char ch = sourcePath.charAt(i); if (ch == '/') { - buf.append(File.separatorChar); + sb.append(File.separatorChar); } else { - buf.append(ch); + sb.append(ch); } } - sourcePath = buf.toString(); + sourcePath = sb.toString(); } isConverted = true; } @@ -327,7 +327,7 @@ class SDE { } String readLine() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); char ch; ignoreWhite(); diff --git a/jdk/src/share/classes/com/sun/tools/jdi/TargetVM.java b/jdk/src/share/classes/com/sun/tools/jdi/TargetVM.java index a94eb43eafd..941ab405130 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/TargetVM.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/TargetVM.java @@ -78,7 +78,7 @@ public class TargetVM implements Runnable { ", errorCode=" + packet.errorCode + ", flags=" + packet.flags); } - StringBuffer line = new StringBuffer(80); + StringBuilder line = new StringBuilder(80); line.append("0000: "); for (int i = 0; i < packet.data.length; i++) { if ((i > 0) && (i % 16 == 0)) { diff --git a/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java b/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java index 3397e0f3ad1..ca1c6e21408 100644 --- a/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java +++ b/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java @@ -742,7 +742,7 @@ class VirtualMachineImpl extends MirrorImpl } void printReceiveTrace(int depth, String string) { - StringBuffer sb = new StringBuffer("Receiving:"); + StringBuilder sb = new StringBuilder("Receiving:"); for (int i = depth; i > 0; --i) { sb.append(" "); } @@ -872,7 +872,7 @@ class VirtualMachineImpl extends MirrorImpl ReferenceTypeImpl referenceType(long id, int tag, String signature) { if ((vm.traceFlags & VirtualMachine.TRACE_REFTYPES) != 0) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("Looking up "); if (tag == JDWP.TypeTag.CLASS) { sb.append("Class"); diff --git a/jdk/src/share/classes/java/beans/Introspector.java b/jdk/src/share/classes/java/beans/Introspector.java index 10efa7ae5a8..3f1e564e8f5 100644 --- a/jdk/src/share/classes/java/beans/Introspector.java +++ b/jdk/src/share/classes/java/beans/Introspector.java @@ -1282,7 +1282,7 @@ public class Introspector { * Creates a key for a method in a method cache. */ private static String makeQualifiedMethodName(String name, String[] params) { - StringBuffer sb = new StringBuffer(name); + StringBuilder sb = new StringBuilder(name); sb.append('='); for (int i = 0; i < params.length; i++) { sb.append(':'); diff --git a/jdk/src/share/classes/java/beans/Statement.java b/jdk/src/share/classes/java/beans/Statement.java index 8eb88242a72..d1e6717817f 100644 --- a/jdk/src/share/classes/java/beans/Statement.java +++ b/jdk/src/share/classes/java/beans/Statement.java @@ -340,7 +340,7 @@ public class Statement { if (arguments == null) { arguments = emptyArray; } - StringBuffer result = new StringBuffer(instanceName(target) + "." + methodName + "("); + StringBuilder result = new StringBuilder(instanceName(target) + "." + methodName + "("); int n = arguments.length; for(int i = 0; i < n; i++) { result.append(instanceName(arguments[i])); diff --git a/jdk/src/share/classes/java/io/RandomAccessFile.java b/jdk/src/share/classes/java/io/RandomAccessFile.java index d5703937e54..ae1e530f168 100644 --- a/jdk/src/share/classes/java/io/RandomAccessFile.java +++ b/jdk/src/share/classes/java/io/RandomAccessFile.java @@ -890,7 +890,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { */ public final String readLine() throws IOException { - StringBuffer input = new StringBuffer(); + StringBuilder input = new StringBuilder(); int c = -1; boolean eol = false; diff --git a/jdk/src/share/classes/java/net/IDN.java b/jdk/src/share/classes/java/net/IDN.java index 34642b9824c..d4c8f5e426d 100644 --- a/jdk/src/share/classes/java/net/IDN.java +++ b/jdk/src/share/classes/java/net/IDN.java @@ -111,7 +111,7 @@ public final class IDN { public static String toASCII(String input, int flag) { int p = 0, q = 0; - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); if (isRootLabel(input)) { return "."; @@ -172,7 +172,7 @@ public final class IDN { */ public static String toUnicode(String input, int flag) { int p = 0, q = 0; - StringBuffer out = new StringBuffer(); + StringBuilder out = new StringBuilder(); if (isRootLabel(input)) { return "."; diff --git a/jdk/src/share/classes/java/net/SocketPermission.java b/jdk/src/share/classes/java/net/SocketPermission.java index d44c8471613..1f3248077be 100644 --- a/jdk/src/share/classes/java/net/SocketPermission.java +++ b/jdk/src/share/classes/java/net/SocketPermission.java @@ -733,7 +733,7 @@ public final class SocketPermission extends Permission InetAddress auth; try { - StringBuffer sb = new StringBuffer(39); + StringBuilder sb = new StringBuilder(39); for (int i = 15; i >= 0; i--) { sb.append(Integer.toHexString(((addr[i]) & 0x0f))); diff --git a/jdk/src/share/classes/java/net/URI.java b/jdk/src/share/classes/java/net/URI.java index 0035d00ead7..62dea657c04 100644 --- a/jdk/src/share/classes/java/net/URI.java +++ b/jdk/src/share/classes/java/net/URI.java @@ -1957,7 +1957,7 @@ public final class URI private void defineString() { if (string != null) return; - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (scheme != null) { sb.append(scheme); sb.append(':'); @@ -2015,7 +2015,7 @@ public final class URI if (i >= 0) path = base.substring(0, i + 1); } else { - StringBuffer sb = new StringBuffer(base.length() + cn); + StringBuilder sb = new StringBuilder(base.length() + cn); // 5.2 (6a) if (i >= 0) sb.append(base.substring(0, i + 1)); @@ -2778,7 +2778,7 @@ public final class URI if (s.indexOf('%') < 0) return s; - StringBuffer sb = new StringBuffer(n); + StringBuilder sb = new StringBuilder(n); ByteBuffer bb = ByteBuffer.allocate(n); CharBuffer cb = CharBuffer.allocate(n); CharsetDecoder dec = ThreadLocalCoders.decoderFor("UTF-8") diff --git a/jdk/src/share/classes/java/net/URISyntaxException.java b/jdk/src/share/classes/java/net/URISyntaxException.java index 8072c37244e..17d12bd9637 100644 --- a/jdk/src/share/classes/java/net/URISyntaxException.java +++ b/jdk/src/share/classes/java/net/URISyntaxException.java @@ -121,7 +121,7 @@ public class URISyntaxException * @return A string describing the parse error */ public String getMessage() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(getReason()); if (index > -1) { sb.append(" at index "); diff --git a/jdk/src/share/classes/java/net/URLDecoder.java b/jdk/src/share/classes/java/net/URLDecoder.java index 1e1138ad7ec..2c65c95fefc 100644 --- a/jdk/src/share/classes/java/net/URLDecoder.java +++ b/jdk/src/share/classes/java/net/URLDecoder.java @@ -134,7 +134,7 @@ public class URLDecoder { boolean needToChange = false; int numChars = s.length(); - StringBuffer sb = new StringBuffer(numChars > 500 ? numChars / 2 : numChars); + StringBuilder sb = new StringBuilder(numChars > 500 ? numChars / 2 : numChars); int i = 0; if (enc.length() == 0) { diff --git a/jdk/src/share/classes/java/net/URLEncoder.java b/jdk/src/share/classes/java/net/URLEncoder.java index 657572c6176..5ad817bc72c 100644 --- a/jdk/src/share/classes/java/net/URLEncoder.java +++ b/jdk/src/share/classes/java/net/URLEncoder.java @@ -201,7 +201,7 @@ public class URLEncoder { throws UnsupportedEncodingException { boolean needToChange = false; - StringBuffer out = new StringBuffer(s.length()); + StringBuilder out = new StringBuilder(s.length()); Charset charset; CharArrayWriter charArrayWriter = new CharArrayWriter(); diff --git a/jdk/src/share/classes/java/net/URLStreamHandler.java b/jdk/src/share/classes/java/net/URLStreamHandler.java index 0a8f1f1d5fe..9ea65260f3d 100644 --- a/jdk/src/share/classes/java/net/URLStreamHandler.java +++ b/jdk/src/share/classes/java/net/URLStreamHandler.java @@ -486,7 +486,7 @@ public abstract class URLStreamHandler { if (u.getRef() != null) len += 1 + u.getRef().length(); - StringBuffer result = new StringBuffer(len); + StringBuilder result = new StringBuilder(len); result.append(u.getProtocol()); result.append(":"); if (u.getAuthority() != null && u.getAuthority().length() > 0) { diff --git a/jdk/src/share/classes/java/nio/file/InvalidPathException.java b/jdk/src/share/classes/java/nio/file/InvalidPathException.java index 2c628652c24..c3d617b2896 100644 --- a/jdk/src/share/classes/java/nio/file/InvalidPathException.java +++ b/jdk/src/share/classes/java/nio/file/InvalidPathException.java @@ -117,7 +117,7 @@ public class InvalidPathException * @return a string describing the error */ public String getMessage() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(getReason()); if (index > -1) { sb.append(" at index "); diff --git a/jdk/src/share/classes/java/rmi/dgc/VMID.java b/jdk/src/share/classes/java/rmi/dgc/VMID.java index 913c598be2e..840bae4eeaa 100644 --- a/jdk/src/share/classes/java/rmi/dgc/VMID.java +++ b/jdk/src/share/classes/java/rmi/dgc/VMID.java @@ -120,15 +120,15 @@ public final class VMID implements java.io.Serializable { * Return string representation of this VMID. */ public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (addr != null) for (int i = 0; i < addr.length; ++ i) { int x = addr[i] & 0xFF; - result.append((x < 0x10 ? "0" : "") + - Integer.toString(x, 16)); + sb.append((x < 0x10 ? "0" : "") + + Integer.toString(x, 16)); } - result.append(':'); - result.append(uid.toString()); - return result.toString(); + sb.append(':'); + sb.append(uid.toString()); + return sb.toString(); } } diff --git a/jdk/src/share/classes/java/security/CodeSigner.java b/jdk/src/share/classes/java/security/CodeSigner.java index 37c12b153b3..a1d37ee208a 100644 --- a/jdk/src/share/classes/java/security/CodeSigner.java +++ b/jdk/src/share/classes/java/security/CodeSigner.java @@ -154,7 +154,7 @@ public final class CodeSigner implements Serializable { * if present. */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("("); sb.append("Signer: " + signerCertPath.getCertificates().get(0)); if (timestamp != null) { diff --git a/jdk/src/share/classes/java/security/Timestamp.java b/jdk/src/share/classes/java/security/Timestamp.java index f66d2883e62..668a6114510 100644 --- a/jdk/src/share/classes/java/security/Timestamp.java +++ b/jdk/src/share/classes/java/security/Timestamp.java @@ -141,7 +141,7 @@ public final class Timestamp implements Serializable { * its signer's certificate. */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("("); sb.append("timestamp: " + timestamp); List certs = signerCertPath.getCertificates(); diff --git a/jdk/src/share/classes/java/security/cert/CertPath.java b/jdk/src/share/classes/java/security/cert/CertPath.java index 8717f948203..88df135f6c0 100644 --- a/jdk/src/share/classes/java/security/cert/CertPath.java +++ b/jdk/src/share/classes/java/security/cert/CertPath.java @@ -220,7 +220,7 @@ public abstract class CertPath implements Serializable { * @return a string representation of this certification path */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); Iterator stringIterator = getCertificates().iterator(); diff --git a/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java b/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java index 12bd358cfff..e6ca94383fb 100644 --- a/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java +++ b/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java @@ -132,7 +132,7 @@ public class CollectionCertStoreParameters * @return a formatted string describing the parameters */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("CollectionCertStoreParameters: [\n"); sb.append(" collection: " + coll + "\n"); sb.append("]"); diff --git a/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java b/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java index 96fe9cd0939..2daef343d50 100644 --- a/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java +++ b/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java @@ -138,7 +138,7 @@ public class LDAPCertStoreParameters implements CertStoreParameters { * @return a formatted string describing the parameters */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("LDAPCertStoreParameters: [\n"); sb.append(" serverName: " + serverName + "\n"); diff --git a/jdk/src/share/classes/java/security/cert/PKIXBuilderParameters.java b/jdk/src/share/classes/java/security/cert/PKIXBuilderParameters.java index b33e1f8c1e2..51cf21e5e99 100644 --- a/jdk/src/share/classes/java/security/cert/PKIXBuilderParameters.java +++ b/jdk/src/share/classes/java/security/cert/PKIXBuilderParameters.java @@ -189,7 +189,7 @@ public class PKIXBuilderParameters extends PKIXParameters { * @return a formatted string describing the parameters */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("[\n"); sb.append(super.toString()); sb.append(" Maximum Path Length: " + maxPathLength + "\n"); diff --git a/jdk/src/share/classes/java/security/cert/PKIXCertPathBuilderResult.java b/jdk/src/share/classes/java/security/cert/PKIXCertPathBuilderResult.java index 3255a3bbda6..01cedffe9c8 100644 --- a/jdk/src/share/classes/java/security/cert/PKIXCertPathBuilderResult.java +++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathBuilderResult.java @@ -107,7 +107,7 @@ public class PKIXCertPathBuilderResult extends PKIXCertPathValidatorResult * {@code PKIXCertPathBuilderResult} */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("PKIXCertPathBuilderResult: [\n"); sb.append(" Certification Path: " + certPath + "\n"); sb.append(" Trust Anchor: " + getTrustAnchor().toString() + "\n"); diff --git a/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java b/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java index b40cd393c7d..3ba1e335a54 100644 --- a/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java +++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java @@ -148,7 +148,7 @@ public class PKIXCertPathValidatorResult implements CertPathValidatorResult { * {@code PKIXCertPathValidatorResult} */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("PKIXCertPathValidatorResult: [\n"); sb.append(" Trust Anchor: " + trustAnchor.toString() + "\n"); sb.append(" Policy Tree: " + String.valueOf(policyTree) + "\n"); diff --git a/jdk/src/share/classes/java/security/cert/PKIXParameters.java b/jdk/src/share/classes/java/security/cert/PKIXParameters.java index 4d8a344532e..a411f6e2aec 100644 --- a/jdk/src/share/classes/java/security/cert/PKIXParameters.java +++ b/jdk/src/share/classes/java/security/cert/PKIXParameters.java @@ -693,7 +693,7 @@ public class PKIXParameters implements CertPathParameters { * @return a formatted string describing the parameters. */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("[\n"); /* start with trusted anchor info */ diff --git a/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java b/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java index ec06a88ae58..c09ccd6c3cd 100644 --- a/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java +++ b/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java @@ -161,7 +161,7 @@ public class PolicyQualifierInfo { if (pqiString != null) return pqiString; HexDumpEncoder enc = new HexDumpEncoder(); - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("PolicyQualifierInfo: [\n"); sb.append(" qualifierID: " + mId + "\n"); sb.append(" qualifier: " + diff --git a/jdk/src/share/classes/java/security/cert/TrustAnchor.java b/jdk/src/share/classes/java/security/cert/TrustAnchor.java index c98bf814caf..f7fb2c89497 100644 --- a/jdk/src/share/classes/java/security/cert/TrustAnchor.java +++ b/jdk/src/share/classes/java/security/cert/TrustAnchor.java @@ -317,7 +317,7 @@ public class TrustAnchor { * @return a formatted string describing the {@code TrustAnchor} */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("[\n"); if (pubKey != null) { sb.append(" Trusted CA Public Key: " + pubKey.toString() + "\n"); diff --git a/jdk/src/share/classes/java/security/cert/X509CRLSelector.java b/jdk/src/share/classes/java/security/cert/X509CRLSelector.java index 0580ee36bf2..a0e6b5b600a 100644 --- a/jdk/src/share/classes/java/security/cert/X509CRLSelector.java +++ b/jdk/src/share/classes/java/security/cert/X509CRLSelector.java @@ -566,7 +566,7 @@ public class X509CRLSelector implements CRLSelector { * {@code X509CRLSelector}. */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("X509CRLSelector: [\n"); if (issuerNames != null) { sb.append(" IssuerNames:\n"); diff --git a/jdk/src/share/classes/java/security/cert/X509CertSelector.java b/jdk/src/share/classes/java/security/cert/X509CertSelector.java index aae32c93f44..feb85d28b58 100644 --- a/jdk/src/share/classes/java/security/cert/X509CertSelector.java +++ b/jdk/src/share/classes/java/security/cert/X509CertSelector.java @@ -1811,7 +1811,7 @@ public class X509CertSelector implements CertSelector { * {@code CertSelector} */ public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("X509CertSelector: [\n"); if (x509Cert != null) { sb.append(" Certificate: " + x509Cert.toString() + "\n"); diff --git a/jdk/src/share/classes/java/text/AttributedString.java b/jdk/src/share/classes/java/text/AttributedString.java index fa398e943aa..2e82924510a 100644 --- a/jdk/src/share/classes/java/text/AttributedString.java +++ b/jdk/src/share/classes/java/text/AttributedString.java @@ -243,11 +243,11 @@ public class AttributedString { throw new IllegalArgumentException("Invalid substring range"); // Copy the given string - StringBuffer textBuffer = new StringBuffer(); + StringBuilder textBuilder = new StringBuilder(); text.setIndex(beginIndex); for (char c = text.current(); text.getIndex() < endIndex; c = text.next()) - textBuffer.append(c); - this.text = textBuffer.toString(); + textBuilder.append(c); + this.text = textBuilder.toString(); if (beginIndex == endIndex) return; diff --git a/jdk/src/share/classes/java/text/ChoiceFormat.java b/jdk/src/share/classes/java/text/ChoiceFormat.java index f55837f8a4c..f8bd9a90b59 100644 --- a/jdk/src/share/classes/java/text/ChoiceFormat.java +++ b/jdk/src/share/classes/java/text/ChoiceFormat.java @@ -259,7 +259,7 @@ public class ChoiceFormat extends NumberFormat { * @return the pattern string */ public String toPattern() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for (int i = 0; i < choiceLimits.length; ++i) { if (i != 0) { result.append('|'); diff --git a/jdk/src/share/classes/java/util/Properties.java b/jdk/src/share/classes/java/util/Properties.java index 1df838e6394..e313c9716d0 100644 --- a/jdk/src/share/classes/java/util/Properties.java +++ b/jdk/src/share/classes/java/util/Properties.java @@ -602,7 +602,7 @@ class Properties extends Hashtable { if (bufLen < 0) { bufLen = Integer.MAX_VALUE; } - StringBuffer outBuffer = new StringBuffer(bufLen); + StringBuilder outBuffer = new StringBuilder(bufLen); for(int x=0; x= 0) { sb.append(" near index "); diff --git a/jdk/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java b/jdk/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java index 46d7748732c..5d2484017cb 100644 --- a/jdk/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java +++ b/jdk/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java @@ -289,7 +289,7 @@ public abstract class ImageInputStreamImpl implements ImageInputStream { } public String readLine() throws IOException { - StringBuffer input = new StringBuffer(); + StringBuilder input = new StringBuilder(); int c = -1; boolean eol = false; diff --git a/jdk/src/share/classes/javax/naming/BinaryRefAddr.java b/jdk/src/share/classes/javax/naming/BinaryRefAddr.java index 214e2aaa7f9..9061e2198de 100644 --- a/jdk/src/share/classes/javax/naming/BinaryRefAddr.java +++ b/jdk/src/share/classes/javax/naming/BinaryRefAddr.java @@ -165,7 +165,7 @@ public class BinaryRefAddr extends RefAddr { * @return The non-null string representation of this address. */ public String toString(){ - StringBuffer str = new StringBuffer("Address Type: " + addrType + "\n"); + StringBuilder str = new StringBuilder("Address Type: " + addrType + "\n"); str.append("AddressContents: "); for (int i = 0; i"i-j" otherwise. */ public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); int n = members.length; for (int i = 0; i < n; i++) { if (i > 0) { diff --git a/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java b/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java index aac527fed26..0f6a5dfe6c4 100644 --- a/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java @@ -257,7 +257,7 @@ public abstract class Size2DSyntax implements Serializable, Cloneable { * (unchecked exception) Thrown if {@code units < 1}. */ public String toString(int units, String unitsName) { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append(getX (units)); result.append('x'); result.append(getY (units)); @@ -312,7 +312,7 @@ public abstract class Size2DSyntax implements Serializable, Cloneable { * The values are reported in the internal units of micrometers. */ public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append(x); result.append('x'); result.append(y); diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java index c9e2b283e98..da38df976e7 100644 --- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java +++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java @@ -636,11 +636,11 @@ public class KerberosTicket implements Destroyable, Refreshable, public String toString() { if (destroyed) throw new IllegalStateException("This ticket is no longer valid"); - StringBuffer caddrBuf = new StringBuffer(); + StringBuilder caddrString = new StringBuilder(); if (clientAddresses != null) { for (int i = 0; i < clientAddresses.length; i++) { - caddrBuf.append("clientAddresses[" + i + "] = " + - clientAddresses[i].toString()); + caddrString.append("clientAddresses[" + i + "] = " + + clientAddresses[i].toString()); } } return ("Ticket (hex) = " + "\n" + @@ -660,7 +660,7 @@ public class KerberosTicket implements Destroyable, Refreshable, "End Time = " + endTime.toString() + "\n" + "Renew Till = " + String.valueOf(renewTill) + "\n" + "Client Addresses " + - (clientAddresses == null ? " Null " : caddrBuf.toString() + + (clientAddresses == null ? " Null " : caddrString.toString() + "\n")); } diff --git a/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java b/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java index 1c7ba46ede9..bb01fbe9f43 100644 --- a/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java +++ b/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java @@ -94,18 +94,18 @@ public abstract class CompoundControl extends Control { */ public String toString() { - StringBuffer buf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < controls.length; i++) { if (i != 0) { - buf.append(", "); + sb.append(", "); if ((i + 1) == controls.length) { - buf.append("and "); + sb.append("and "); } } - buf.append(controls[i].getType()); + sb.append(controls[i].getType()); } - return new String(getType() + " Control containing " + buf + " Controls."); + return new String(getType() + " Control containing " + sb + " Controls."); } diff --git a/jdk/src/share/classes/javax/sound/sampled/DataLine.java b/jdk/src/share/classes/javax/sound/sampled/DataLine.java index d0030c9baae..d9013560381 100644 --- a/jdk/src/share/classes/javax/sound/sampled/DataLine.java +++ b/jdk/src/share/classes/javax/sound/sampled/DataLine.java @@ -471,23 +471,23 @@ public interface DataLine extends Line { */ public String toString() { - StringBuffer buf = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if ( (formats.length == 1) && (formats[0] != null) ) { - buf.append(" supporting format " + formats[0]); + sb.append(" supporting format " + formats[0]); } else if (getFormats().length > 1) { - buf.append(" supporting " + getFormats().length + " audio formats"); + sb.append(" supporting " + getFormats().length + " audio formats"); } if ( (minBufferSize != AudioSystem.NOT_SPECIFIED) && (maxBufferSize != AudioSystem.NOT_SPECIFIED) ) { - buf.append(", and buffers of " + minBufferSize + " to " + maxBufferSize + " bytes"); + sb.append(", and buffers of " + minBufferSize + " to " + maxBufferSize + " bytes"); } else if ( (minBufferSize != AudioSystem.NOT_SPECIFIED) && (minBufferSize > 0) ) { - buf.append(", and buffers of at least " + minBufferSize + " bytes"); + sb.append(", and buffers of at least " + minBufferSize + " bytes"); } else if (maxBufferSize != AudioSystem.NOT_SPECIFIED) { - buf.append(", and buffers of up to " + minBufferSize + " bytes"); + sb.append(", and buffers of up to " + minBufferSize + " bytes"); } - return new String(super.toString() + buf); + return new String(super.toString() + sb); } } // class Info diff --git a/jdk/src/share/classes/javax/swing/JColorChooser.java b/jdk/src/share/classes/javax/swing/JColorChooser.java index 09cbf6c5d80..9420f499c41 100644 --- a/jdk/src/share/classes/javax/swing/JColorChooser.java +++ b/jdk/src/share/classes/javax/swing/JColorChooser.java @@ -542,7 +542,7 @@ public class JColorChooser extends JComponent implements Accessible { * @return a string representation of this JColorChooser */ protected String paramString() { - StringBuffer chooserPanelsString = new StringBuffer(""); + StringBuilder chooserPanelsString = new StringBuilder(""); for (int i=0; i 1) { - buf.delete(length-2, length); + sb.delete(length-2, length); } - buf.append("}"); - return buf.toString(); + sb.append("}"); + return sb.toString(); } } diff --git a/jdk/src/share/classes/javax/swing/RepaintManager.java b/jdk/src/share/classes/javax/swing/RepaintManager.java index c65c826eb45..5d397ad1af0 100644 --- a/jdk/src/share/classes/javax/swing/RepaintManager.java +++ b/jdk/src/share/classes/javax/swing/RepaintManager.java @@ -975,7 +975,7 @@ public class RepaintManager * @return a String representation of this object */ public synchronized String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if(dirtyComponents != null) sb.append("" + dirtyComponents); return sb.toString(); diff --git a/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java b/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java index 8dbdfcb8d3c..7bd565d9314 100644 --- a/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java +++ b/jdk/src/share/classes/javax/swing/event/TreeModelEvent.java @@ -292,24 +292,24 @@ public class TreeModelEvent extends EventObject { * @return a String representation of this object */ public String toString() { - StringBuffer retBuffer = new StringBuffer(); + StringBuilder sb = new StringBuilder(); - retBuffer.append(getClass().getName() + " " + - Integer.toString(hashCode())); + sb.append(getClass().getName() + " " + + Integer.toString(hashCode())); if(path != null) - retBuffer.append(" path " + path); + sb.append(" path " + path); if(childIndices != null) { - retBuffer.append(" indices [ "); + sb.append(" indices [ "); for(int counter = 0; counter < childIndices.length; counter++) - retBuffer.append(Integer.toString(childIndices[counter])+ " "); - retBuffer.append("]"); + sb.append(Integer.toString(childIndices[counter])+ " "); + sb.append("]"); } if(children != null) { - retBuffer.append(" children [ "); + sb.append(" children [ "); for(int counter = 0; counter < children.length; counter++) - retBuffer.append(children[counter] + " "); - retBuffer.append("]"); + sb.append(children[counter] + " "); + sb.append("]"); } - return retBuffer.toString(); + return sb.toString(); } } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java index b609dd2f2f0..e04b1c28e94 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java @@ -1322,8 +1322,8 @@ public class BasicFileChooserUI extends FileChooserUI { return null; } - StringBuffer plainBuf = new StringBuffer(); - StringBuffer htmlBuf = new StringBuffer(); + StringBuilder plainBuf = new StringBuilder(); + StringBuilder htmlBuf = new StringBuilder(); htmlBuf.append("\n\n