Tue, 15 Nov 2011 20:17:33 +0100
7110152: assert(size_in_words <= (julong)max_jint) failed: no overflow
Summary: Reduce what arrayOopDesc::max_array_length() returns to avoid int overflow
Reviewed-by: kvn, dholmes, tonyp
duke@435 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |
stefank@2314 | 26 | #define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "oops/instanceKlass.hpp" |
stefank@2314 | 29 | |
duke@435 | 30 | // An instanceRefKlass is a specialized instanceKlass for Java |
duke@435 | 31 | // classes that are subclasses of java/lang/ref/Reference. |
duke@435 | 32 | // |
duke@435 | 33 | // These classes are used to implement soft/weak/final/phantom |
duke@435 | 34 | // references and finalization, and need special treatment by the |
duke@435 | 35 | // garbage collector. |
duke@435 | 36 | // |
duke@435 | 37 | // During GC discovered reference objects are added (chained) to one |
duke@435 | 38 | // of the four lists below, depending on the type of reference. |
duke@435 | 39 | // The linked occurs through the next field in class java/lang/ref/Reference. |
duke@435 | 40 | // |
duke@435 | 41 | // Afterwards, the discovered references are processed in decreasing |
duke@435 | 42 | // order of reachability. Reference objects eligible for notification |
duke@435 | 43 | // are linked to the static pending_list in class java/lang/ref/Reference, |
duke@435 | 44 | // and the pending list lock object in the same class is notified. |
duke@435 | 45 | |
duke@435 | 46 | |
duke@435 | 47 | class instanceRefKlass: public instanceKlass { |
duke@435 | 48 | public: |
duke@435 | 49 | // Type testing |
duke@435 | 50 | bool oop_is_instanceRef() const { return true; } |
duke@435 | 51 | |
duke@435 | 52 | // Casting from klassOop |
duke@435 | 53 | static instanceRefKlass* cast(klassOop k) { |
duke@435 | 54 | assert(k->klass_part()->oop_is_instanceRef(), "cast to instanceRefKlass"); |
duke@435 | 55 | return (instanceRefKlass*) k->klass_part(); |
duke@435 | 56 | } |
duke@435 | 57 | |
duke@435 | 58 | // allocation |
duke@435 | 59 | DEFINE_ALLOCATE_PERMANENT(instanceRefKlass); |
duke@435 | 60 | |
duke@435 | 61 | // Garbage collection |
duke@435 | 62 | int oop_adjust_pointers(oop obj); |
duke@435 | 63 | void oop_follow_contents(oop obj); |
duke@435 | 64 | |
duke@435 | 65 | // Parallel Scavenge and Parallel Old |
duke@435 | 66 | PARALLEL_GC_DECLS |
duke@435 | 67 | |
duke@435 | 68 | int oop_oop_iterate(oop obj, OopClosure* blk) { |
duke@435 | 69 | return oop_oop_iterate_v(obj, blk); |
duke@435 | 70 | } |
duke@435 | 71 | int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { |
duke@435 | 72 | return oop_oop_iterate_v_m(obj, blk, mr); |
duke@435 | 73 | } |
duke@435 | 74 | |
duke@435 | 75 | #define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ |
duke@435 | 76 | int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ |
duke@435 | 77 | int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr); |
duke@435 | 78 | |
duke@435 | 79 | ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL) |
ysr@777 | 80 | ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL) |
ysr@777 | 81 | |
ysr@777 | 82 | #ifndef SERIALGC |
ysr@777 | 83 | #define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
ysr@777 | 84 | int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); |
ysr@777 | 85 | |
ysr@777 | 86 | ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
ysr@777 | 87 | ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
ysr@777 | 88 | #endif // !SERIALGC |
duke@435 | 89 | |
duke@435 | 90 | static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock); |
duke@435 | 91 | static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock); |
coleenp@2363 | 92 | static bool owns_pending_list_lock(JavaThread* thread); |
duke@435 | 93 | |
duke@435 | 94 | // Update non-static oop maps so 'referent', 'nextPending' and |
duke@435 | 95 | // 'discovered' will look like non-oops |
duke@435 | 96 | static void update_nonstatic_oop_maps(klassOop k); |
duke@435 | 97 | |
duke@435 | 98 | public: |
duke@435 | 99 | // Verification |
duke@435 | 100 | void oop_verify_on(oop obj, outputStream* st); |
duke@435 | 101 | }; |
stefank@2314 | 102 | |
stefank@2314 | 103 | #endif // SHARE_VM_OOPS_INSTANCEREFKLASS_HPP |