1 /*
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.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1135 // Debugging/initialization
1136 friend class JavaClasses;
1137 };
1138
1139
1140 // Interface to java.lang.ClassLoader objects
1141
1142 #define CLASSLOADER_INJECTED_FIELDS(macro) \
1143 macro(java_lang_ClassLoader, loader_data, intptr_signature, false)
1144
1145 class java_lang_ClassLoader : AllStatic {
1146 private:
1147 // The fake offsets are added by the class loader when java.lang.Class is loaded
1148 enum {
1149 hc_parent_offset = 0
1150 };
1151 static int _loader_data_offset;
1152 static bool offsets_computed;
1153 static int parent_offset;
1154 static int parallelCapable_offset;
1155
1156 public:
1157 static void compute_offsets();
1158
1159 static ClassLoaderData** loader_data_addr(oop loader);
1160 static ClassLoaderData* loader_data(oop loader);
1161
1162 static oop parent(oop loader);
1163 static bool isAncestor(oop loader, oop cl);
1164
1165 // Support for parallelCapable field
1166 static bool parallelCapable(oop the_class_mirror);
1167
1168 static bool is_trusted_loader(oop loader);
1169
1170 // Fix for 4474172
1171 static oop non_reflection_class_loader(oop loader);
1172
1173 // Testers
1174 static bool is_subclass(Klass* klass) {
1175 return klass->is_subclass_of(SystemDictionary::ClassLoader_klass());
1176 }
1177 static bool is_instance(oop obj) {
1178 return obj != NULL && is_subclass(obj->klass());
1179 }
1180
1181 // Debugging
1182 friend class JavaClasses;
1183 friend class ClassFileParser; // access to number_of_fake_fields
1184 };
1185
1186
|
1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1135 // Debugging/initialization
1136 friend class JavaClasses;
1137 };
1138
1139
1140 // Interface to java.lang.ClassLoader objects
1141
1142 #define CLASSLOADER_INJECTED_FIELDS(macro) \
1143 macro(java_lang_ClassLoader, loader_data, intptr_signature, false)
1144
1145 class java_lang_ClassLoader : AllStatic {
1146 private:
1147 // The fake offsets are added by the class loader when java.lang.Class is loaded
1148 enum {
1149 hc_parent_offset = 0
1150 };
1151 static int _loader_data_offset;
1152 static bool offsets_computed;
1153 static int parent_offset;
1154 static int parallelCapable_offset;
1155 static int fullyConcurrent_offset;
1156
1157 public:
1158 static void compute_offsets();
1159
1160 static ClassLoaderData** loader_data_addr(oop loader);
1161 static ClassLoaderData* loader_data(oop loader);
1162
1163 static oop parent(oop loader);
1164 static bool isAncestor(oop loader, oop cl);
1165
1166 // Support for parallelCapable field
1167 static bool parallelCapable(oop the_class_mirror);
1168
1169 // Support for fullyConcurrent field
1170 static bool fullyConcurrent(oop the_class_mirror);
1171
1172 static bool is_trusted_loader(oop loader);
1173
1174 // Fix for 4474172
1175 static oop non_reflection_class_loader(oop loader);
1176
1177 // Testers
1178 static bool is_subclass(Klass* klass) {
1179 return klass->is_subclass_of(SystemDictionary::ClassLoader_klass());
1180 }
1181 static bool is_instance(oop obj) {
1182 return obj != NULL && is_subclass(obj->klass());
1183 }
1184
1185 // Debugging
1186 friend class JavaClasses;
1187 friend class ClassFileParser; // access to number_of_fake_fields
1188 };
1189
1190
|