Mercurial > hg > openjdk > bsd-port > hotspot
changeset 4800:2417fa1acf2b hs24-b51
Merge
author | amurillo |
---|---|
date | Fri, 28 Jun 2013 00:44:12 -0700 |
parents | 8c0bb41c24b2 (current diff) ad5bb04f36f5 (diff) |
children | 9658c969b7cf |
files | test/compiler/8011901/Test8011901.java |
diffstat | 17 files changed, 961 insertions(+), 112 deletions(-) [+] |
line wrap: on
line diff
--- a/make/hotspot_version Thu Jun 27 13:58:29 2013 -0700 +++ b/make/hotspot_version Fri Jun 28 00:44:12 2013 -0700 @@ -35,7 +35,7 @@ HS_MAJOR_VER=24 HS_MINOR_VER=0 -HS_BUILD_NUMBER=50 +HS_BUILD_NUMBER=51 JDK_MAJOR_VER=1 JDK_MINOR_VER=7
--- a/src/share/vm/adlc/formssel.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/adlc/formssel.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -235,6 +235,9 @@ return false; } +bool InstructForm::is_ideal_negD() const { + return (_matrule && _matrule->_rChild && strcmp(_matrule->_rChild->_opType, "NegD") == 0); +} // Return 'true' if this instruction matches an ideal 'Copy*' node int InstructForm::is_ideal_copy() const { @@ -533,6 +536,12 @@ if( data_type != Form::none ) rematerialize = true; + // Ugly: until a better fix is implemented, disable rematerialization for + // negD nodes because they are proved to be problematic. + if (is_ideal_negD()) { + return false; + } + // Constants if( _components.count() == 1 && _components[0]->is(Component::USE_DEF) ) rematerialize = true;
--- a/src/share/vm/adlc/formssel.hpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/adlc/formssel.hpp Fri Jun 28 00:44:12 2013 -0700 @@ -147,6 +147,7 @@ virtual int is_empty_encoding() const; // _size=0 and/or _insencode empty virtual int is_tls_instruction() const; // tlsLoadP rule or ideal ThreadLocal virtual int is_ideal_copy() const; // node matches ideal 'Copy*' + virtual bool is_ideal_negD() const; // node matches ideal 'NegD' virtual bool is_ideal_if() const; // node matches ideal 'If' virtual bool is_ideal_fastlock() const; // node matches 'FastLock' virtual bool is_ideal_membar() const; // node matches ideal 'MemBarXXX'
--- a/src/share/vm/classfile/symbolTable.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/classfile/symbolTable.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -610,6 +610,8 @@ bool StringTable::_needs_rehashing = false; +volatile int StringTable::_parallel_claimed_idx = 0; + // Pick hashing algorithm unsigned int StringTable::hash_string(const jchar* s, int len) { return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) : @@ -771,8 +773,18 @@ } } -void StringTable::oops_do(OopClosure* f) { - for (int i = 0; i < the_table()->table_size(); ++i) { +void StringTable::buckets_do(OopClosure* f, int start_idx, int end_idx) { + const int limit = the_table()->table_size(); + + assert(0 <= start_idx && start_idx <= limit, + err_msg("start_idx (" INT32_FORMAT ") oob?", start_idx)); + assert(0 <= end_idx && end_idx <= limit, + err_msg("end_idx (" INT32_FORMAT ") oob?", end_idx)); + assert(start_idx <= end_idx, + err_msg("Ordering: start_idx=" INT32_FORMAT", end_idx=" INT32_FORMAT, + start_idx, end_idx)); + + for (int i = start_idx; i < end_idx; i += 1) { HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i); HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i); while (entry != NULL) { @@ -791,6 +803,27 @@ } } +void StringTable::oops_do(OopClosure* f) { + buckets_do(f, 0, the_table()->table_size()); +} + +void StringTable::possibly_parallel_oops_do(OopClosure* f) { + const int ClaimChunkSize = 32; + const int limit = the_table()->table_size(); + + for (;;) { + // Grab next set of buckets to scan + int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize; + if (start_idx >= limit) { + // End of table + break; + } + + int end_idx = MIN2(limit, start_idx + ClaimChunkSize); + buckets_do(f, start_idx, end_idx); + } +} + void StringTable::verify() { for (int i = 0; i < the_table()->table_size(); ++i) { HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
--- a/src/share/vm/classfile/symbolTable.hpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/classfile/symbolTable.hpp Fri Jun 28 00:44:12 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -245,12 +245,19 @@ // Set if one bucket is out of balance due to hash algorithm deficiency static bool _needs_rehashing; + // Claimed high water mark for parallel chunked scanning + static volatile int _parallel_claimed_idx; + static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); oop basic_add(int index, Handle string_or_null, jchar* name, int len, unsigned int hashValue, TRAPS); oop lookup(int index, jchar* chars, int length, unsigned int hashValue); + // Apply the give oop closure to the entries to the buckets + // in the range [start_idx, end_idx). + static void buckets_do(OopClosure* f, int start_idx, int end_idx); + StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>)) {} @@ -278,9 +285,12 @@ // Delete pointers to otherwise-unreachable objects. static void unlink(BoolObjectClosure* cl); - // Invoke "f->do_oop" on the locations of all oops in the table. + // Serially invoke "f->do_oop" on the locations of all oops in the table. static void oops_do(OopClosure* f); + // Possibly parallel version of the above + static void possibly_parallel_oops_do(OopClosure* f); + // Hashing algorithm, used as the hash value used by the // StringTable for bucket selection and comparison (stored in the // HashtableEntry structures). This is used in the String.intern() method. @@ -315,5 +325,8 @@ // Rehash the symbol table if it gets out of balance static void rehash_table(); static bool needs_rehashing() { return _needs_rehashing; } + + // Parallel chunked scanning + static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; } }; #endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -1892,10 +1892,6 @@ save_heap_summary(); } - if (first_state > Idling) { - save_heap_summary(); - } - do_compaction_work(clear_all_soft_refs); // Has the GC time limit been exceeded?
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -309,7 +309,8 @@ void G1CollectorPolicy::initialize_flags() { set_min_alignment(HeapRegion::GrainBytes); - set_max_alignment(GenRemSet::max_alignment_constraint(rem_set_name())); + size_t card_table_alignment = GenRemSet::max_alignment_constraint(rem_set_name()); + set_max_alignment(MAX2(card_table_alignment, min_alignment())); if (SurvivorRatio < 1) { vm_exit_during_initialization("Invalid survivor ratio specified"); }
--- a/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -251,7 +251,7 @@ } if (PrintGC && Verbose) { - if (success && GC_locker::is_active()) { + if (success && GC_locker::is_active_and_needs_gc()) { gclog_or_tty->print_cr("Garbage collection disabled, expanded heap instead"); } }
--- a/src/share/vm/memory/collectorPolicy.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/memory/collectorPolicy.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -58,6 +58,13 @@ // CollectorPolicy methods. void CollectorPolicy::initialize_flags() { + assert(max_alignment() >= min_alignment(), + err_msg("max_alignment: " SIZE_FORMAT " less than min_alignment: " SIZE_FORMAT, + max_alignment(), min_alignment())); + assert(max_alignment() % min_alignment() == 0, + err_msg("max_alignment: " SIZE_FORMAT " not aligned by min_alignment: " SIZE_FORMAT, + max_alignment(), min_alignment())); + if (PermSize > MaxPermSize) { MaxPermSize = PermSize; } @@ -230,9 +237,6 @@ // All sizes must be multiples of the generation granularity. set_min_alignment((uintx) Generation::GenGrain); set_max_alignment(compute_max_alignment()); - assert(max_alignment() >= min_alignment() && - max_alignment() % min_alignment() == 0, - "invalid alignment constraints"); CollectorPolicy::initialize_flags();
--- a/src/share/vm/memory/sharedHeap.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/memory/sharedHeap.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -46,7 +46,6 @@ SH_PS_Management_oops_do, SH_PS_SystemDictionary_oops_do, SH_PS_jvmti_oops_do, - SH_PS_StringTable_oops_do, SH_PS_CodeCache_oops_do, // Leave this one last. SH_PS_NumElements @@ -135,6 +134,8 @@ { if (_active) { outer->change_strong_roots_parity(); + // Zero the claimed high water mark in the StringTable + StringTable::clear_parallel_claimed_index(); } } @@ -163,12 +164,14 @@ // Global (strong) JNI handles if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do)) JNIHandles::oops_do(roots); + // All threads execute this; the individual threads are task groups. - if (ParallelGCThreads > 0) { + if (CollectedHeap::use_parallel_gc_threads()) { Threads::possibly_parallel_oops_do(roots, code_roots); } else { Threads::oops_do(roots, code_roots); } + if (!_process_strong_tasks-> is_task_claimed(SH_PS_ObjectSynchronizer_oops_do)) ObjectSynchronizer::oops_do(roots); if (!_process_strong_tasks->is_task_claimed(SH_PS_FlatProfiler_oops_do)) @@ -186,12 +189,20 @@ } } - if (!_process_strong_tasks->is_task_claimed(SH_PS_StringTable_oops_do)) { - if (so & SO_Strings || (!collecting_perm_gen && !JavaObjectsInPerm)) { + // All threads execute the following. A specific chunk of buckets + // from the StringTable are the individual tasks. + if (so & SO_Strings || (!collecting_perm_gen && !JavaObjectsInPerm)) { + if (CollectedHeap::use_parallel_gc_threads()) { + StringTable::possibly_parallel_oops_do(roots); + } else { StringTable::oops_do(roots); } - if (JavaObjectsInPerm) { - // Verify the string table contents are in the perm gen + } + if (JavaObjectsInPerm) { + // Verify the string table contents are in the perm gen + if (CollectedHeap::use_parallel_gc_threads()) { + NOT_PRODUCT(StringTable::possibly_parallel_oops_do(&assert_is_perm_closure)); + } else { NOT_PRODUCT(StringTable::oops_do(&assert_is_perm_closure)); } }
--- a/src/share/vm/opto/escape.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/opto/escape.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -2162,7 +2162,7 @@ int opcode = uncast_base->Opcode(); assert(opcode == Op_ConP || opcode == Op_ThreadLocal || opcode == Op_CastX2P || uncast_base->is_DecodeN() || - (uncast_base->is_Mem() && uncast_base->bottom_type() == TypeRawPtr::NOTNULL) || + (uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_rawptr() != NULL)) || (uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()), "sanity"); } return base;
--- a/src/share/vm/opto/memnode.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/opto/memnode.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -2854,10 +2854,27 @@ if (in(0) && in(0)->is_top()) return NULL; // Eliminate volatile MemBars for scalar replaced objects. - if (can_reshape && req() == (Precedent+1) && - (Opcode() == Op_MemBarAcquire || Opcode() == Op_MemBarVolatile)) { + int opc = Opcode(); + if (can_reshape && req() == (Precedent + 1) && + (opc == Op_MemBarAcquire || opc == Op_MemBarVolatile)) { // Volatile field loads and stores. Node* my_mem = in(MemBarNode::Precedent); + // The MembarAquire may keep an unused LoadNode alive through the Precedent edge + if ((my_mem != NULL) && (opc == Op_MemBarAcquire) && (my_mem->outcnt() == 1)) { + // if the Precedent is a decodeN and its input (a Load) is used at more than one place, + // replace this Precedent (decodeN) with the Load instead. + if ((my_mem->Opcode() == Op_DecodeN) && (my_mem->in(1)->outcnt() > 1)) { + Node* load_node = my_mem->in(1); + set_req(MemBarNode::Precedent, load_node); + phase->is_IterGVN()->_worklist.push(my_mem); + my_mem = load_node; + } else{ + assert(my_mem->unique_out() == this, "sanity"); + del_req(Precedent); + phase->is_IterGVN()->_worklist.push(my_mem); // remove dead node later + my_mem = NULL; + } + } if (my_mem != NULL && my_mem->is_Mem()) { const TypeOopPtr* t_oop = my_mem->in(MemNode::Address)->bottom_type()->isa_oopptr(); // Check for scalar replaced object reference.
--- a/src/share/vm/services/memReporter.cpp Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/services/memReporter.cpp Fri Jun 28 00:44:12 2013 -0700 @@ -188,8 +188,8 @@ (MallocCallsitePointer*)prev_malloc_itr.current(); while (cur_malloc_callsite != NULL || prev_malloc_callsite != NULL) { - if (prev_malloc_callsite == NULL || - cur_malloc_callsite->addr() < prev_malloc_callsite->addr()) { + if (prev_malloc_callsite == NULL) { + assert(cur_malloc_callsite != NULL, "sanity check"); // this is a new callsite _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(), amount_in_current_scale(cur_malloc_callsite->amount()), @@ -197,22 +197,42 @@ diff_in_current_scale(cur_malloc_callsite->amount(), 0), diff(cur_malloc_callsite->count(), 0)); cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next(); - } else if (cur_malloc_callsite == NULL || - cur_malloc_callsite->addr() > prev_malloc_callsite->addr()) { + } else if (cur_malloc_callsite == NULL) { + assert(prev_malloc_callsite != NULL, "Sanity check"); // this callsite is already gone _outputer.diff_malloc_callsite(prev_malloc_callsite->addr(), - amount_in_current_scale(0), 0, + 0, 0, diff_in_current_scale(0, prev_malloc_callsite->amount()), diff(0, prev_malloc_callsite->count())); prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next(); - } else { // the same callsite - _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(), - amount_in_current_scale(cur_malloc_callsite->amount()), - cur_malloc_callsite->count(), - diff_in_current_scale(cur_malloc_callsite->amount(), prev_malloc_callsite->amount()), - diff(cur_malloc_callsite->count(), prev_malloc_callsite->count())); - cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next(); - prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next(); + } else { + assert(cur_malloc_callsite != NULL, "Sanity check"); + assert(prev_malloc_callsite != NULL, "Sanity check"); + if (cur_malloc_callsite->addr() < prev_malloc_callsite->addr()) { + // this is a new callsite + _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(), + amount_in_current_scale(cur_malloc_callsite->amount()), + cur_malloc_callsite->count(), + diff_in_current_scale(cur_malloc_callsite->amount(), 0), + diff(cur_malloc_callsite->count(), 0)); + cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next(); + } else if (cur_malloc_callsite->addr() > prev_malloc_callsite->addr()) { + // this callsite is already gone + _outputer.diff_malloc_callsite(prev_malloc_callsite->addr(), + 0, 0, + diff_in_current_scale(0, prev_malloc_callsite->amount()), + diff(0, prev_malloc_callsite->count())); + prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next(); + } else { + // the same callsite + _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(), + amount_in_current_scale(cur_malloc_callsite->amount()), + cur_malloc_callsite->count(), + diff_in_current_scale(cur_malloc_callsite->amount(), prev_malloc_callsite->amount()), + diff(cur_malloc_callsite->count(), prev_malloc_callsite->count())); + cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next(); + prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next(); + } } }
--- a/src/share/vm/trace/trace.xml Thu Jun 27 13:58:29 2013 -0700 +++ b/src/share/vm/trace/trace.xml Fri Jun 28 00:44:12 2013 -0700 @@ -151,7 +151,7 @@ <structvalue type="ObjectSpace" field="objectSpace" label="Object Space"/> </event> - <event id="PSHeapSummary" path="vm/gc/heap/ps_summary" label="ParallelScavengeHeap Summary" is_instant="true"> + <event id="PSHeapSummary" path="vm/gc/heap/ps_summary" label="Parallel Scavenge Heap Summary" is_instant="true"> <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/> <value type="GCWHEN" field="when" label="When" /> @@ -196,7 +196,7 @@ <value type="G1YCTYPE" field="type" label="Type" /> </event> - <event id="EvacuationInfo" path="vm/gc/detailed/evacuation_info" label="Evacuation Info" is_instant="true"> + <event id="EvacuationInfo" path="vm/gc/detailed/evacuation_info" label="Evacuation Information" is_instant="true"> <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/> <value type="UINT" field="cSetRegions" label="Collection Set Regions"/> <value type="BYTES64" field="cSetUsedBefore" label="Collection Set Before" description="Memory usage before GC in the collection set regions"/> @@ -204,7 +204,7 @@ <value type="UINT" field="allocationRegions" label="Allocation Regions" description="Regions chosen as allocation regions during evacuation (includes survivors and old space regions)"/> <value type="BYTES64" field="allocRegionsUsedBefore" label="Alloc Regions Before" description="Memory usage before GC in allocation regions"/> <value type="BYTES64" field="allocRegionsUsedAfter" label="Alloc Regions After" description="Memory usage after GC in allocation regions"/> - <value type="BYTES64" field="bytesCopied" label="BytesCopied"/> + <value type="BYTES64" field="bytesCopied" label="Bytes Copied"/> <value type="UINT" field="regionsFreed" label="Regions Freed"/> </event> @@ -233,14 +233,14 @@ <event id="PromotionFailed" path="vm/gc/detailed/promotion_failed" label="Promotion Failed" is_instant="true" description="Promotion of an object failed"> <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/> - <structvalue type="CopyFailed" field="data" label="data"/> + <structvalue type="CopyFailed" field="data" label="Data"/> <value type="OSTHREAD" field="thread" label="Running thread"/> </event> <event id="EvacuationFailed" path="vm/gc/detailed/evacuation_failed" label="Evacuation Failed" is_instant="true" description="Evacuation of an object failed"> <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/> - <structvalue type="CopyFailed" field="data" label="data"/> + <structvalue type="CopyFailed" field="data" label="Data"/> </event> <event id="ConcurrentModeFailure" path="vm/gc/detailed/concurrent_mode_failure" label="Concurrent Mode Failure" @@ -302,7 +302,7 @@ <value type="USHORT" field="sweepFractionIndex" label="Fraction Index"/> <value type="UINT" field="sweptCount" label="Methods Swept"/> <value type="UINT" field="flushedCount" label="Methods Flushed"/> - <value type="UINT" field="markedCount" label="Methods Reclaim"/> + <value type="UINT" field="markedCount" label="Methods Reclaimed"/> <value type="UINT" field="zombifiedCount" label="Methods Zombified"/> </event>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/8005956/PolynomialRoot.java Fri Jun 28 00:44:12 2013 -0700 @@ -0,0 +1,776 @@ +//package com.polytechnik.utils; +/* + * (C) Vladislav Malyshkin 2010 + * This file is under GPL version 3. + * + */ + +/** Polynomial root. + * @version $Id: PolynomialRoot.java,v 1.105 2012/08/18 00:00:05 mal Exp $ + * @author Vladislav Malyshkin mal@gromco.com + */ + +/** +* @test +* @bug 8005956 +* @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block +* +* @run main PolynomialRoot +*/ + +public class PolynomialRoot { + + +public static int findPolynomialRoots(final int n, + final double [] p, + final double [] re_root, + final double [] im_root) +{ + if(n==4) + { + return root4(p,re_root,im_root); + } + else if(n==3) + { + return root3(p,re_root,im_root); + } + else if(n==2) + { + return root2(p,re_root,im_root); + } + else if(n==1) + { + return root1(p,re_root,im_root); + } + else + { + throw new RuntimeException("n="+n+" is not supported yet"); + } +} + + + +static final double SQRT3=Math.sqrt(3.0),SQRT2=Math.sqrt(2.0); + + +private static final boolean PRINT_DEBUG=false; + +public static int root4(final double [] p,final double [] re_root,final double [] im_root) +{ + if(PRINT_DEBUG) System.err.println("=====================root4:p="+java.util.Arrays.toString(p)); + final double vs=p[4]; + if(PRINT_DEBUG) System.err.println("p[4]="+p[4]); + if(!(Math.abs(vs)>EPS)) + { + re_root[0]=re_root[1]=re_root[2]=re_root[3]= + im_root[0]=im_root[1]=im_root[2]=im_root[3]=Double.NaN; + return -1; + } + +/* zsolve_quartic.c - finds the complex roots of + * x^4 + a x^3 + b x^2 + c x + d = 0 + */ + final double a=p[3]/vs,b=p[2]/vs,c=p[1]/vs,d=p[0]/vs; + if(PRINT_DEBUG) System.err.println("input a="+a+" b="+b+" c="+c+" d="+d); + + + final double r4 = 1.0 / 4.0; + final double q2 = 1.0 / 2.0, q4 = 1.0 / 4.0, q8 = 1.0 / 8.0; + final double q1 = 3.0 / 8.0, q3 = 3.0 / 16.0; + final int mt; + + /* Deal easily with the cases where the quartic is degenerate. The + * ordering of solutions is done explicitly. */ + if (0 == b && 0 == c) + { + if (0 == d) + { + re_root[0]=-a; + im_root[0]=im_root[1]=im_root[2]=im_root[3]=0; + re_root[1]=re_root[2]=re_root[3]=0; + return 4; + } + else if (0 == a) + { + if (d > 0) + { + final double sq4 = Math.sqrt(Math.sqrt(d)); + re_root[0]=sq4*SQRT2/2; + im_root[0]=re_root[0]; + re_root[1]=-re_root[0]; + im_root[1]=re_root[0]; + re_root[2]=-re_root[0]; + im_root[2]=-re_root[0]; + re_root[3]=re_root[0]; + im_root[3]=-re_root[0]; + if(PRINT_DEBUG) System.err.println("Path a=0 d>0"); + } + else + { + final double sq4 = Math.sqrt(Math.sqrt(-d)); + re_root[0]=sq4; + im_root[0]=0; + re_root[1]=0; + im_root[1]=sq4; + re_root[2]=0; + im_root[2]=-sq4; + re_root[3]=-sq4; + im_root[3]=0; + if(PRINT_DEBUG) System.err.println("Path a=0 d<0"); + } + return 4; + } + } + + if (0.0 == c && 0.0 == d) + { + root2(new double []{p[2],p[3],p[4]},re_root,im_root); + re_root[2]=im_root[2]=re_root[3]=im_root[3]=0; + return 4; + } + + if(PRINT_DEBUG) System.err.println("G Path c="+c+" d="+d); + final double [] u=new double[3]; + + if(PRINT_DEBUG) System.err.println("Generic Path"); + /* For non-degenerate solutions, proceed by constructing and + * solving the resolvent cubic */ + final double aa = a * a; + final double pp = b - q1 * aa; + final double qq = c - q2 * a * (b - q4 * aa); + final double rr = d - q4 * a * (c - q4 * a * (b - q3 * aa)); + final double rc = q2 * pp , rc3 = rc / 3; + final double sc = q4 * (q4 * pp * pp - rr); + final double tc = -(q8 * qq * q8 * qq); + if(PRINT_DEBUG) System.err.println("aa="+aa+" pp="+pp+" qq="+qq+" rr="+rr+" rc="+rc+" sc="+sc+" tc="+tc); + final boolean flag_realroots; + + /* This code solves the resolvent cubic in a convenient fashion + * for this implementation of the quartic. If there are three real + * roots, then they are placed directly into u[]. If two are + * complex, then the real root is put into u[0] and the real + * and imaginary part of the complex roots are placed into + * u[1] and u[2], respectively. */ + { + final double qcub = (rc * rc - 3 * sc); + final double rcub = (rc*(2 * rc * rc - 9 * sc) + 27 * tc); + + final double Q = qcub / 9; + final double R = rcub / 54; + + final double Q3 = Q * Q * Q; + final double R2 = R * R; + + final double CR2 = 729 * rcub * rcub; + final double CQ3 = 2916 * qcub * qcub * qcub; + + if(PRINT_DEBUG) System.err.println("CR2="+CR2+" CQ3="+CQ3+" R="+R+" Q="+Q); + + if (0 == R && 0 == Q) + { + flag_realroots=true; + u[0] = -rc3; + u[1] = -rc3; + u[2] = -rc3; + } + else if (CR2 == CQ3) + { + flag_realroots=true; + final double sqrtQ = Math.sqrt (Q); + if (R > 0) + { + u[0] = -2 * sqrtQ - rc3; + u[1] = sqrtQ - rc3; + u[2] = sqrtQ - rc3; + } + else + { + u[0] = -sqrtQ - rc3; + u[1] = -sqrtQ - rc3; + u[2] = 2 * sqrtQ - rc3; + } + } + else if (R2 < Q3) + { + flag_realroots=true; + final double ratio = (R >= 0?1:-1) * Math.sqrt (R2 / Q3); + final double theta = Math.acos (ratio); + final double norm = -2 * Math.sqrt (Q); + + u[0] = norm * Math.cos (theta / 3) - rc3; + u[1] = norm * Math.cos ((theta + 2.0 * Math.PI) / 3) - rc3; + u[2] = norm * Math.cos ((theta - 2.0 * Math.PI) / 3) - rc3; + } + else + { + flag_realroots=false; + final double A = -(R >= 0?1:-1)*Math.pow(Math.abs(R)+Math.sqrt(R2-Q3),1.0/3.0); + final double B = Q / A; + + u[0] = A + B - rc3; + u[1] = -0.5 * (A + B) - rc3; + u[2] = -(SQRT3*0.5) * Math.abs (A - B); + } + if(PRINT_DEBUG) System.err.println("u[0]="+u[0]+" u[1]="+u[1]+" u[2]="+u[2]+" qq="+qq+" disc="+((CR2 - CQ3) / 2125764.0)); + } + /* End of solution to resolvent cubic */ + + /* Combine the square roots of the roots of the cubic + * resolvent appropriately. Also, calculate 'mt' which + * designates the nature of the roots: + * mt=1 : 4 real roots + * mt=2 : 0 real roots + * mt=3 : 2 real roots + */ + + + final double w1_re,w1_im,w2_re,w2_im,w3_re,w3_im,mod_w1w2,mod_w1w2_squared; + if (flag_realroots) + { + mod_w1w2=-1; + mt = 2; + int jmin=0; + double vmin=Math.abs(u[jmin]); + for(int j=1;j<3;j++) + { + final double vx=Math.abs(u[j]); + if(vx<vmin) + { + vmin=vx; + jmin=j; + } + } + final double u1=u[(jmin+1)%3],u2=u[(jmin+2)%3]; + mod_w1w2_squared=Math.abs(u1*u2); + if(u1>=0) + { + w1_re=Math.sqrt(u1); + w1_im=0; + } + else + { + w1_re=0; + w1_im=Math.sqrt(-u1); + } + if(u2>=0) + { + w2_re=Math.sqrt(u2); + w2_im=0; + } + else + { + w2_re=0; + w2_im=Math.sqrt(-u2); + } + if(PRINT_DEBUG) System.err.println("u1="+u1+" u2="+u2+" jmin="+jmin); + } + else + { + mt = 3; + final double w_mod2_sq=u[1]*u[1]+u[2]*u[2],w_mod2=Math.sqrt(w_mod2_sq),w_mod=Math.sqrt(w_mod2); + if(w_mod2_sq<=0) + { + w1_re=w1_im=0; + } + else + { + // calculate square root of a complex number (u[1],u[2]) + // the result is in the (w1_re,w1_im) + final double absu1=Math.abs(u[1]),absu2=Math.abs(u[2]),w; + if(absu1>=absu2) + { + final double t=absu2/absu1; + w=Math.sqrt(absu1*0.5 * (1.0 + Math.sqrt(1.0 + t * t))); + if(PRINT_DEBUG) System.err.println(" Path1 "); + } + else + { + final double t=absu1/absu2; + w=Math.sqrt(absu2*0.5 * (t + Math.sqrt(1.0 + t * t))); + if(PRINT_DEBUG) System.err.println(" Path1a "); + } + if(u[1]>=0) + { + w1_re=w; + w1_im=u[2]/(2*w); + if(PRINT_DEBUG) System.err.println(" Path2 "); + } + else + { + final double vi = (u[2] >= 0) ? w : -w; + w1_re=u[2]/(2*vi); + w1_im=vi; + if(PRINT_DEBUG) System.err.println(" Path2a "); + } + } + final double absu0=Math.abs(u[0]); + if(w_mod2>=absu0) + { + mod_w1w2=w_mod2; + mod_w1w2_squared=w_mod2_sq; + w2_re=w1_re; + w2_im=-w1_im; + } + else + { + mod_w1w2=-1; + mod_w1w2_squared=w_mod2*absu0; + if(u[0]>=0) + { + w2_re=Math.sqrt(absu0); + w2_im=0; + } + else + { + w2_re=0; + w2_im=Math.sqrt(absu0); + } + } + if(PRINT_DEBUG) System.err.println("u[0]="+u[0]+"u[1]="+u[1]+" u[2]="+u[2]+" absu0="+absu0+" w_mod="+w_mod+" w_mod2="+w_mod2); + } + + /* Solve the quadratic in order to obtain the roots + * to the quartic */ + if(mod_w1w2>0) + { + // a shorcut to reduce rounding error + w3_re=qq/(-8)/mod_w1w2; + w3_im=0; + } + else if(mod_w1w2_squared>0) + { + // regular path + final double mqq8n=qq/(-8)/mod_w1w2_squared; + w3_re=mqq8n*(w1_re*w2_re-w1_im*w2_im); + w3_im=-mqq8n*(w1_re*w2_im+w2_re*w1_im); + } + else + { + // typically occur when qq==0 + w3_re=w3_im=0; + } + + final double h = r4 * a; + if(PRINT_DEBUG) System.err.println("w1_re="+w1_re+" w1_im="+w1_im+" w2_re="+w2_re+" w2_im="+w2_im+" w3_re="+w3_re+" w3_im="+w3_im+" h="+h); + + re_root[0]=w1_re+w2_re+w3_re-h; + im_root[0]=w1_im+w2_im+w3_im; + re_root[1]=-(w1_re+w2_re)+w3_re-h; + im_root[1]=-(w1_im+w2_im)+w3_im; + re_root[2]=w2_re-w1_re-w3_re-h; + im_root[2]=w2_im-w1_im-w3_im; + re_root[3]=w1_re-w2_re-w3_re-h; + im_root[3]=w1_im-w2_im-w3_im; + + return 4; +} + + + + static void setRandomP(final double [] p,final int n,java.util.Random r) + { + if(r.nextDouble()<0.1) + { + // integer coefficiens + for(int j=0;j<p.length;j++) + { + if(j<=n) + { + p[j]=(r.nextInt(2)<=0?-1:1)*r.nextInt(10); + } + else + { + p[j]=0; + } + } + } + else + { + // real coefficiens + for(int j=0;j<p.length;j++) + { + if(j<=n) + { + p[j]=-1+2*r.nextDouble(); + } + else + { + p[j]=0; + } + } + } + if(Math.abs(p[n])<1e-2) + { + p[n]=(r.nextInt(2)<=0?-1:1)*(0.1+r.nextDouble()); + } + } + + + static void checkValues(final double [] p, + final int n, + final double rex, + final double imx, + final double eps, + final String txt) + { + double res=0,ims=0,sabs=0; + final double xabs=Math.abs(rex)+Math.abs(imx); + for(int k=n;k>=0;k--) + { + final double res1=(res*rex-ims*imx)+p[k]; + final double ims1=(ims*rex+res*imx); + res=res1; + ims=ims1; + sabs+=xabs*sabs+p[k]; + } + sabs=Math.abs(sabs); + if(false && sabs>1/eps? + (!(Math.abs(res/sabs)<=eps)||!(Math.abs(ims/sabs)<=eps)) + : + (!(Math.abs(res)<=eps)||!(Math.abs(ims)<=eps))) + { + throw new RuntimeException( + getPolinomTXT(p)+"\n"+ + "\t x.r="+rex+" x.i="+imx+"\n"+ + "res/sabs="+(res/sabs)+" ims/sabs="+(ims/sabs)+ + " sabs="+sabs+ + "\nres="+res+" ims="+ims+" n="+n+" eps="+eps+" "+ + " sabs>1/eps="+(sabs>1/eps)+ + " f1="+(!(Math.abs(res/sabs)<=eps)||!(Math.abs(ims/sabs)<=eps))+ + " f2="+(!(Math.abs(res)<=eps)||!(Math.abs(ims)<=eps))+ + " "+txt); + } + } + + static String getPolinomTXT(final double [] p) + { + final StringBuilder buf=new StringBuilder(); + buf.append("order="+(p.length-1)+"\t"); + for(int k=0;k<p.length;k++) + { + buf.append("p["+k+"]="+p[k]+";"); + } + return buf.toString(); + } + + static String getRootsTXT(int nr,final double [] re,final double [] im) + { + final StringBuilder buf=new StringBuilder(); + for(int k=0;k<nr;k++) + { + buf.append("x."+k+"("+re[k]+","+im[k]+")\n"); + } + return buf.toString(); + } + + static void testRoots(final int n, + final int n_tests, + final java.util.Random rn, + final double eps) + { + final double [] p=new double [n+1]; + final double [] rex=new double [n],imx=new double [n]; + for(int i=0;i<n_tests;i++) + { + for(int dg=n;dg-->-1;) + { + for(int dr=3;dr-->0;) + { + setRandomP(p,n,rn); + for(int j=0;j<=dg;j++) + { + p[j]=0; + } + if(dr==0) + { + p[0]=-1+2.0*rn.nextDouble(); + } + else if(dr==1) + { + p[0]=p[1]=0; + } + + findPolynomialRoots(n,p,rex,imx); + + for(int j=0;j<n;j++) + { + //System.err.println("j="+j); + checkValues(p,n,rex[j],imx[j],eps," t="+i); + } + } + } + } + System.err.println("testRoots(): n_tests="+n_tests+" OK, dim="+n); + } + + + + + static final double EPS=0; + + public static int root1(final double [] p,final double [] re_root,final double [] im_root) + { + if(!(Math.abs(p[1])>EPS)) + { + re_root[0]=im_root[0]=Double.NaN; + return -1; + } + re_root[0]=-p[0]/p[1]; + im_root[0]=0; + return 1; + } + + public static int root2(final double [] p,final double [] re_root,final double [] im_root) + { + if(!(Math.abs(p[2])>EPS)) + { + re_root[0]=re_root[1]=im_root[0]=im_root[1]=Double.NaN; + return -1; + } + final double b2=0.5*(p[1]/p[2]),c=p[0]/p[2],d=b2*b2-c; + if(d>=0) + { + final double sq=Math.sqrt(d); + if(b2<0) + { + re_root[1]=-b2+sq; + re_root[0]=c/re_root[1]; + } + else if(b2>0) + { + re_root[0]=-b2-sq; + re_root[1]=c/re_root[0]; + } + else + { + re_root[0]=-b2-sq; + re_root[1]=-b2+sq; + } + im_root[0]=im_root[1]=0; + } + else + { + final double sq=Math.sqrt(-d); + re_root[0]=re_root[1]=-b2; + im_root[0]=sq; + im_root[1]=-sq; + } + return 2; + } + + public static int root3(final double [] p,final double [] re_root,final double [] im_root) + { + final double vs=p[3]; + if(!(Math.abs(vs)>EPS)) + { + re_root[0]=re_root[1]=re_root[2]= + im_root[0]=im_root[1]=im_root[2]=Double.NaN; + return -1; + } + final double a=p[2]/vs,b=p[1]/vs,c=p[0]/vs; + /* zsolve_cubic.c - finds the complex roots of x^3 + a x^2 + b x + c = 0 + */ + final double q = (a * a - 3 * b); + final double r = (a*(2 * a * a - 9 * b) + 27 * c); + + final double Q = q / 9; + final double R = r / 54; + + final double Q3 = Q * Q * Q; + final double R2 = R * R; + + final double CR2 = 729 * r * r; + final double CQ3 = 2916 * q * q * q; + final double a3=a/3; + + if (R == 0 && Q == 0) + { + re_root[0]=re_root[1]=re_root[2]=-a3; + im_root[0]=im_root[1]=im_root[2]=0; + return 3; + } + else if (CR2 == CQ3) + { + /* this test is actually R2 == Q3, written in a form suitable + for exact computation with integers */ + + /* Due to finite precision some double roots may be missed, and + will be considered to be a pair of complex roots z = x +/- + epsilon i close to the real axis. */ + + final double sqrtQ = Math.sqrt (Q); + + if (R > 0) + { + re_root[0] = -2 * sqrtQ - a3; + re_root[1]=re_root[2]=sqrtQ - a3; + im_root[0]=im_root[1]=im_root[2]=0; + } + else + { + re_root[0]=re_root[1] = -sqrtQ - a3; + re_root[2]=2 * sqrtQ - a3; + im_root[0]=im_root[1]=im_root[2]=0; + } + return 3; + } + else if (R2 < Q3) + { + final double sgnR = (R >= 0 ? 1 : -1); + final double ratio = sgnR * Math.sqrt (R2 / Q3); + final double theta = Math.acos (ratio); + final double norm = -2 * Math.sqrt (Q); + final double r0 = norm * Math.cos (theta/3) - a3; + final double r1 = norm * Math.cos ((theta + 2.0 * Math.PI) / 3) - a3; + final double r2 = norm * Math.cos ((theta - 2.0 * Math.PI) / 3) - a3; + + re_root[0]=r0; + re_root[1]=r1; + re_root[2]=r2; + im_root[0]=im_root[1]=im_root[2]=0; + return 3; + } + else + { + final double sgnR = (R >= 0 ? 1 : -1); + final double A = -sgnR * Math.pow (Math.abs (R) + Math.sqrt (R2 - Q3), 1.0 / 3.0); + final double B = Q / A; + + re_root[0]=A + B - a3; + im_root[0]=0; + re_root[1]=-0.5 * (A + B) - a3; + im_root[1]=-(SQRT3*0.5) * Math.abs(A - B); + re_root[2]=re_root[1]; + im_root[2]=-im_root[1]; + return 3; + } + + } + + + static void root3a(final double [] p,final double [] re_root,final double [] im_root) + { + if(Math.abs(p[3])>EPS) + { + final double v=p[3], + a=p[2]/v,b=p[1]/v,c=p[0]/v, + a3=a/3,a3a=a3*a, + pd3=(b-a3a)/3, + qd2=a3*(a3a/3-0.5*b)+0.5*c, + Q=pd3*pd3*pd3+qd2*qd2; + if(Q<0) + { + // three real roots + final double SQ=Math.sqrt(-Q); + final double th=Math.atan2(SQ,-qd2); + im_root[0]=im_root[1]=im_root[2]=0; + final double f=2*Math.sqrt(-pd3); + re_root[0]=f*Math.cos(th/3)-a3; + re_root[1]=f*Math.cos((th+2*Math.PI)/3)-a3; + re_root[2]=f*Math.cos((th+4*Math.PI)/3)-a3; + //System.err.println("3r"); + } + else + { + // one real & two complex roots + final double SQ=Math.sqrt(Q); + final double r1=-qd2+SQ,r2=-qd2-SQ; + final double v1=Math.signum(r1)*Math.pow(Math.abs(r1),1.0/3), + v2=Math.signum(r2)*Math.pow(Math.abs(r2),1.0/3), + sv=v1+v2; + // real root + re_root[0]=sv-a3; + im_root[0]=0; + // complex roots + re_root[1]=re_root[2]=-0.5*sv-a3; + im_root[1]=(v1-v2)*(SQRT3*0.5); + im_root[2]=-im_root[1]; + //System.err.println("1r2c"); + } + } + else + { + re_root[0]=re_root[1]=re_root[2]=im_root[0]=im_root[1]=im_root[2]=Double.NaN; + } + } + + + static void printSpecialValues() + { + for(int st=0;st<6;st++) + { + //final double [] p=new double []{8,1,3,3.6,1}; + final double [] re_root=new double [4],im_root=new double [4]; + final double [] p; + final int n; + if(st<=3) + { + if(st<=0) + { + p=new double []{2,-4,6,-4,1}; + //p=new double []{-6,6,-6,8,-2}; + } + else if(st==1) + { + p=new double []{0,-4,8,3,-9}; + } + else if(st==2) + { + p=new double []{-1,0,2,0,-1}; + } + else + { + p=new double []{-5,2,8,-2,-3}; + } + root4(p,re_root,im_root); + n=4; + } + else + { + p=new double []{0,2,0,1}; + if(st==4) + { + p[1]=-p[1]; + } + root3(p,re_root,im_root); + n=3; + } + System.err.println("======== n="+n); + for(int i=0;i<=n;i++) + { + if(i<n) + { + System.err.println(String.valueOf(i)+"\t"+ + p[i]+"\t"+ + re_root[i]+"\t"+ + im_root[i]); + } + else + { + System.err.println(String.valueOf(i)+"\t"+p[i]+"\t"); + } + } + } + } + + + + public static void main(final String [] args) + { + final long t0=System.currentTimeMillis(); + final double eps=1e-6; + //checkRoots(); + final java.util.Random r=new java.util.Random(-1381923); + printSpecialValues(); + + final int n_tests=10000000; + //testRoots(2,n_tests,r,eps); + //testRoots(3,n_tests,r,eps); + testRoots(4,n_tests,r,eps); + final long t1=System.currentTimeMillis(); + System.err.println("PolynomialRoot.main: "+n_tests+" tests OK done in "+(t1-t0)+" milliseconds. ver=$Id: PolynomialRoot.java,v 1.105 2012/08/18 00:00:05 mal Exp $"); + } + + + +}
--- a/test/compiler/8011901/Test8011901.java Thu Jun 27 13:58:29 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 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. - */ - -/* - * @test - * @bug 8011901 - * @summary instruct xaddL_no_res shouldn't allow 64 bit constants. - * @run main/othervm -XX:-BackgroundCompilation Test8011901 - * - */ - -import java.lang.reflect.*; -import sun.misc.*; - -public class Test8011901 { - - private long ctl; - - private static final sun.misc.Unsafe U; - private static final long CTL; - - static { - try { - Field unsafe = sun.misc.Unsafe.class.getDeclaredField("theUnsafe"); - unsafe.setAccessible(true); - U = (sun.misc.Unsafe) unsafe.get(null); - CTL = U.objectFieldOffset(Test8011901.class.getDeclaredField("ctl")); - } catch (Exception e) { - throw new Error(e); - } - } - - public static void main(String[] args) { - for(int c = 0; c < 20000; c++) { - new Test8011901().makeTest(); - } - System.out.println("Test Passed"); - } - - public static final long EXPECTED = 1L << 42; - - public void makeTest() { - U.getAndAddLong(this, CTL, EXPECTED); - if (ctl != EXPECTED) { - throw new RuntimeException("Test failed. Expected: " + EXPECTED + ", but got = " + ctl); - } - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/gc/g1/TestRegionAlignment.java Fri Jun 28 00:44:12 2013 -0700 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 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. + */ + +/* + * @test TestRegionAlignment.java + * @bug 8013791 + * @summary Make sure that G1 ergonomics pick a heap size that is aligned with the region size + * @run main/othervm -XX:+UseG1GC -XX:G1HeapRegionSize=32m -XX:MaxRAM=555m TestRegionAlignment + * + * When G1 ergonomically picks a maximum heap size it must be aligned to the region size. + * This test tries to get the VM to pick a small and unaligned heap size (by using MaxRAM=555) and a + * large region size (by using -XX:G1HeapRegionSize=32m). This will fail without the fix for 8013791. + */ +public class TestRegionAlignment { + public static void main(String[] args) { } +}