1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
62 ResolutionErrorTable* SystemDictionary::_resolution_errors = NULL; |
62 ResolutionErrorTable* SystemDictionary::_resolution_errors = NULL; |
63 SymbolPropertyTable* SystemDictionary::_invoke_method_table = NULL; |
63 SymbolPropertyTable* SystemDictionary::_invoke_method_table = NULL; |
64 |
64 |
65 |
65 |
66 int SystemDictionary::_number_of_modifications = 0; |
66 int SystemDictionary::_number_of_modifications = 0; |
|
67 int SystemDictionary::_sdgeneration = 0; |
|
68 const int SystemDictionary::_primelist[_prime_array_size] = {1009,2017,4049,5051,10103, |
|
69 20201,40423,99991}; |
67 |
70 |
68 oop SystemDictionary::_system_loader_lock_obj = NULL; |
71 oop SystemDictionary::_system_loader_lock_obj = NULL; |
69 |
72 |
70 klassOop SystemDictionary::_well_known_klasses[SystemDictionary::WKID_LIMIT] |
73 klassOop SystemDictionary::_well_known_klasses[SystemDictionary::WKID_LIMIT] |
71 = { NULL /*, NULL...*/ }; |
74 = { NULL /*, NULL...*/ }; |
1176 // If there is a shared dictionary, then find the entry for the |
1179 // If there is a shared dictionary, then find the entry for the |
1177 // given shared system class, if any. |
1180 // given shared system class, if any. |
1178 |
1181 |
1179 klassOop SystemDictionary::find_shared_class(Symbol* class_name) { |
1182 klassOop SystemDictionary::find_shared_class(Symbol* class_name) { |
1180 if (shared_dictionary() != NULL) { |
1183 if (shared_dictionary() != NULL) { |
1181 unsigned int d_hash = dictionary()->compute_hash(class_name, Handle()); |
1184 unsigned int d_hash = shared_dictionary()->compute_hash(class_name, Handle()); |
1182 int d_index = dictionary()->hash_to_index(d_hash); |
1185 int d_index = shared_dictionary()->hash_to_index(d_hash); |
1183 return shared_dictionary()->find_shared_class(d_index, d_hash, class_name); |
1186 return shared_dictionary()->find_shared_class(d_index, d_hash, class_name); |
1184 } else { |
1187 } else { |
1185 return NULL; |
1188 return NULL; |
1186 } |
1189 } |
1187 } |
1190 } |
1748 |
1751 |
1749 void SystemDictionary::placeholders_do(OopClosure* blk) { |
1752 void SystemDictionary::placeholders_do(OopClosure* blk) { |
1750 placeholders()->oops_do(blk); |
1753 placeholders()->oops_do(blk); |
1751 } |
1754 } |
1752 |
1755 |
1753 |
1756 // Calculate a "good" systemdictionary size based |
|
1757 // on predicted or current loaded classes count |
|
1758 int SystemDictionary::calculate_systemdictionary_size(int classcount) { |
|
1759 int newsize = _old_default_sdsize; |
|
1760 if ((classcount > 0) && !DumpSharedSpaces) { |
|
1761 int desiredsize = classcount/_average_depth_goal; |
|
1762 for (newsize = _primelist[_sdgeneration]; _sdgeneration < _prime_array_size -1; |
|
1763 newsize = _primelist[++_sdgeneration]) { |
|
1764 if (desiredsize <= newsize) { |
|
1765 break; |
|
1766 } |
|
1767 } |
|
1768 } |
|
1769 return newsize; |
|
1770 } |
1754 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) { |
1771 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) { |
1755 bool result = dictionary()->do_unloading(is_alive); |
1772 bool result = dictionary()->do_unloading(is_alive); |
1756 constraints()->purge_loader_constraints(is_alive); |
1773 constraints()->purge_loader_constraints(is_alive); |
1757 resolution_errors()->purge_resolution_errors(is_alive); |
1774 resolution_errors()->purge_resolution_errors(is_alive); |
1758 return result; |
1775 return result; |
1871 |
1888 |
1872 void SystemDictionary::initialize(TRAPS) { |
1889 void SystemDictionary::initialize(TRAPS) { |
1873 // Allocate arrays |
1890 // Allocate arrays |
1874 assert(dictionary() == NULL, |
1891 assert(dictionary() == NULL, |
1875 "SystemDictionary should only be initialized once"); |
1892 "SystemDictionary should only be initialized once"); |
1876 _dictionary = new Dictionary(_nof_buckets); |
1893 _sdgeneration = 0; |
|
1894 _dictionary = new Dictionary(calculate_systemdictionary_size(PredictedLoadedClassCount)); |
1877 _placeholders = new PlaceholderTable(_nof_buckets); |
1895 _placeholders = new PlaceholderTable(_nof_buckets); |
1878 _number_of_modifications = 0; |
1896 _number_of_modifications = 0; |
1879 _loader_constraints = new LoaderConstraintTable(_loader_constraint_size); |
1897 _loader_constraints = new LoaderConstraintTable(_loader_constraint_size); |
1880 _resolution_errors = new ResolutionErrorTable(_resolution_error_size); |
1898 _resolution_errors = new ResolutionErrorTable(_resolution_error_size); |
1881 _invoke_method_table = new SymbolPropertyTable(_invoke_method_size); |
1899 _invoke_method_table = new SymbolPropertyTable(_invoke_method_size); |