Mercurial > hg > truffle
comparison src/share/vm/shark/sharkRuntime.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | f95d63e2154a |
children | d8ce2825b193 |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2008, 2009, 2010 Red Hat, Inc. | 3 * Copyright 2008, 2009, 2010 Red Hat, Inc. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | 5 * |
6 * This code is free software; you can redistribute it and/or modify it | 6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as | 7 * under the terms of the GNU General Public License version 2 only, as |
22 * questions. | 22 * questions. |
23 * | 23 * |
24 */ | 24 */ |
25 | 25 |
26 #include "precompiled.hpp" | 26 #include "precompiled.hpp" |
27 #include "oops/klassOop.hpp" | |
28 #include "runtime/biasedLocking.hpp" | 27 #include "runtime/biasedLocking.hpp" |
29 #include "runtime/deoptimization.hpp" | 28 #include "runtime/deoptimization.hpp" |
30 #include "runtime/thread.hpp" | 29 #include "runtime/thread.hpp" |
31 #include "shark/llvmHeaders.hpp" | 30 #include "shark/llvmHeaders.hpp" |
32 #include "shark/sharkRuntime.hpp" | 31 #include "shark/sharkRuntime.hpp" |
41 int num_indexes)) | 40 int num_indexes)) |
42 constantPoolHandle pool(thread, method(thread)->constants()); | 41 constantPoolHandle pool(thread, method(thread)->constants()); |
43 KlassHandle exc_klass(thread, ((oop) tos_at(thread, 0))->klass()); | 42 KlassHandle exc_klass(thread, ((oop) tos_at(thread, 0))->klass()); |
44 | 43 |
45 for (int i = 0; i < num_indexes; i++) { | 44 for (int i = 0; i < num_indexes; i++) { |
46 klassOop tmp = pool->klass_at(indexes[i], CHECK_0); | 45 Klass* tmp = pool->klass_at(indexes[i], CHECK_0); |
47 KlassHandle chk_klass(thread, tmp); | 46 KlassHandle chk_klass(thread, tmp); |
48 | 47 |
49 if (exc_klass() == chk_klass()) | 48 if (exc_klass() == chk_klass()) |
50 return i; | 49 return i; |
51 | 50 |
52 if (exc_klass()->klass_part()->is_subtype_of(chk_klass())) | 51 if (exc_klass()->is_subtype_of(chk_klass())) |
53 return i; | 52 return i; |
54 } | 53 } |
55 | 54 |
56 return -1; | 55 return -1; |
57 JRT_END | 56 JRT_END |
81 } | 80 } |
82 ObjectSynchronizer::slow_exit(object(), lock->lock(), thread); | 81 ObjectSynchronizer::slow_exit(object(), lock->lock(), thread); |
83 JRT_END | 82 JRT_END |
84 | 83 |
85 JRT_ENTRY(void, SharkRuntime::new_instance(JavaThread* thread, int index)) | 84 JRT_ENTRY(void, SharkRuntime::new_instance(JavaThread* thread, int index)) |
86 klassOop k_oop = method(thread)->constants()->klass_at(index, CHECK); | 85 Klass* k_oop = method(thread)->constants()->klass_at(index, CHECK); |
87 instanceKlassHandle klass(THREAD, k_oop); | 86 instanceKlassHandle klass(THREAD, k_oop); |
88 | 87 |
89 // Make sure we are not instantiating an abstract klass | 88 // Make sure we are not instantiating an abstract klass |
90 klass->check_valid_for_instantiation(true, CHECK); | 89 klass->check_valid_for_instantiation(true, CHECK); |
91 | 90 |
118 JRT_END | 117 JRT_END |
119 | 118 |
120 JRT_ENTRY(void, SharkRuntime::anewarray(JavaThread* thread, | 119 JRT_ENTRY(void, SharkRuntime::anewarray(JavaThread* thread, |
121 int index, | 120 int index, |
122 int size)) | 121 int size)) |
123 klassOop klass = method(thread)->constants()->klass_at(index, CHECK); | 122 Klass* klass = method(thread)->constants()->klass_at(index, CHECK); |
124 objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK); | 123 objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK); |
125 thread->set_vm_result(obj); | 124 thread->set_vm_result(obj); |
126 JRT_END | 125 JRT_END |
127 | 126 |
128 JRT_ENTRY(void, SharkRuntime::multianewarray(JavaThread* thread, | 127 JRT_ENTRY(void, SharkRuntime::multianewarray(JavaThread* thread, |
129 int index, | 128 int index, |
130 int ndims, | 129 int ndims, |
131 int* dims)) | 130 int* dims)) |
132 klassOop klass = method(thread)->constants()->klass_at(index, CHECK); | 131 Klass* klass = method(thread)->constants()->klass_at(index, CHECK); |
133 oop obj = arrayKlass::cast(klass)->multi_allocate(ndims, dims, CHECK); | 132 oop obj = arrayKlass::cast(klass)->multi_allocate(ndims, dims, CHECK); |
134 thread->set_vm_result(obj); | 133 thread->set_vm_result(obj); |
135 JRT_END | 134 JRT_END |
136 | 135 |
137 JRT_ENTRY(void, SharkRuntime::register_finalizer(JavaThread* thread, | 136 JRT_ENTRY(void, SharkRuntime::register_finalizer(JavaThread* thread, |
138 oop object)) | 137 oop object)) |
139 assert(object->is_oop(), "should be"); | 138 assert(object->is_oop(), "should be"); |
140 assert(object->klass()->klass_part()->has_finalizer(), "should have"); | 139 assert(object->klass()->has_finalizer(), "should have"); |
141 instanceKlass::register_finalizer(instanceOop(object), CHECK); | 140 InstanceKlass::register_finalizer(instanceOop(object), CHECK); |
142 JRT_END | 141 JRT_END |
143 | 142 |
144 JRT_ENTRY(void, SharkRuntime::throw_ArithmeticException(JavaThread* thread, | 143 JRT_ENTRY(void, SharkRuntime::throw_ArithmeticException(JavaThread* thread, |
145 const char* file, | 144 const char* file, |
146 int line)) | 145 int line)) |
194 else | 193 else |
195 tty->print("%p", value); | 194 tty->print("%p", value); |
196 tty->print_cr(""); | 195 tty->print_cr(""); |
197 } | 196 } |
198 | 197 |
199 bool SharkRuntime::is_subtype_of(klassOop check_klass, klassOop object_klass) { | 198 bool SharkRuntime::is_subtype_of(Klass* check_klass, Klass* object_klass) { |
200 return object_klass->klass_part()->is_subtype_of(check_klass); | 199 return object_klass->is_subtype_of(check_klass); |
201 } | 200 } |
202 | 201 |
203 int SharkRuntime::uncommon_trap(JavaThread* thread, int trap_request) { | 202 int SharkRuntime::uncommon_trap(JavaThread* thread, int trap_request) { |
204 Thread *THREAD = thread; | 203 Thread *THREAD = thread; |
205 | 204 |