author | mchung |
Tue, 24 Nov 2015 14:59:17 -0800 | |
changeset 34280 | 72bfaaffee36 |
parent 34273 | 8598d07915d9 |
child 35498 | 392b50de06c6 |
permissions | -rw-r--r-- |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
1 |
/* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
4 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
8 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
13 |
* accompanied this code). |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
14 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
18 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
21 |
* questions. |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
22 |
* |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
23 |
*/ |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
24 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
26 |
#define SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
27 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
28 |
#include "classfile/javaClasses.hpp" |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
29 |
#include "oops/oop.inline.hpp" |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
30 |
#include "oops/oopsHierarchy.hpp" |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
31 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
32 |
inline void java_lang_invoke_CallSite::set_target_volatile(oop site, oop target) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
33 |
site->obj_field_put_volatile(_target_offset, target); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
34 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
35 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
36 |
inline oop java_lang_invoke_CallSite::target(oop site) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
37 |
return site->obj_field(_target_offset); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
38 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
39 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
40 |
inline void java_lang_invoke_CallSite::set_target(oop site, oop target) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
41 |
site->obj_field_put(_target_offset, target); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
42 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
43 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
44 |
inline bool java_lang_String::is_instance_inlined(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
45 |
return obj != NULL && obj->klass() == SystemDictionary::String_klass(); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
46 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
47 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
48 |
inline bool java_lang_invoke_CallSite::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
49 |
return obj != NULL && is_subclass(obj->klass()); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
50 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
51 |
|
31037
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30263
diff
changeset
|
52 |
inline bool java_lang_invoke_MethodHandleNatives_CallSiteContext::is_instance(oop obj) { |
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30263
diff
changeset
|
53 |
return obj != NULL && is_subclass(obj->klass()); |
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30263
diff
changeset
|
54 |
} |
01a5c5fa5681
8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents:
30263
diff
changeset
|
55 |
|
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
56 |
inline bool java_lang_invoke_MemberName::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
57 |
return obj != NULL && is_subclass(obj->klass()); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
58 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
59 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
60 |
inline bool java_lang_invoke_MethodType::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
61 |
return obj != NULL && obj->klass() == SystemDictionary::MethodType_klass(); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
62 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
63 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
64 |
inline bool java_lang_invoke_MethodHandle::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
65 |
return obj != NULL && is_subclass(obj->klass()); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
66 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
67 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
68 |
inline bool java_lang_Class::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
69 |
return obj != NULL && obj->klass() == SystemDictionary::Class_klass(); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
70 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
71 |
|
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
72 |
inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
73 |
return obj != NULL && is_subclass(obj->klass()); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
74 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
75 |
|
34280 | 76 |
inline int Backtrace::merge_bci_and_version(int bci, int version) { |
77 |
// only store u2 for version, checking for overflow. |
|
78 |
if (version > USHRT_MAX || version < 0) version = USHRT_MAX; |
|
79 |
assert((jushort)bci == bci, "bci should be short"); |
|
80 |
return build_int_from_shorts(version, bci); |
|
81 |
} |
|
82 |
||
83 |
inline int Backtrace::merge_mid_and_cpref(int mid, int cpref) { |
|
84 |
// only store u2 for mid and cpref, checking for overflow. |
|
85 |
assert((jushort)mid == mid, "mid should be short"); |
|
86 |
assert((jushort)cpref == cpref, "cpref should be short"); |
|
87 |
return build_int_from_shorts(cpref, mid); |
|
88 |
} |
|
89 |
||
90 |
inline int Backtrace::bci_at(unsigned int merged) { |
|
91 |
return extract_high_short_from_int(merged); |
|
92 |
} |
|
93 |
||
94 |
inline int Backtrace::version_at(unsigned int merged) { |
|
95 |
return extract_low_short_from_int(merged); |
|
96 |
} |
|
97 |
||
98 |
inline int Backtrace::mid_at(unsigned int merged) { |
|
99 |
return extract_high_short_from_int(merged); |
|
100 |
} |
|
101 |
||
102 |
inline int Backtrace::cpref_at(unsigned int merged) { |
|
103 |
return extract_low_short_from_int(merged); |
|
104 |
} |
|
105 |
||
106 |
inline int Backtrace::get_line_number(const methodHandle& method, int bci) { |
|
107 |
int line_number = 0; |
|
108 |
if (method->is_native()) { |
|
109 |
// Negative value different from -1 below, enabling Java code in |
|
110 |
// class java.lang.StackTraceElement to distinguish "native" from |
|
111 |
// "no LineNumberTable". JDK tests for -2. |
|
112 |
line_number = -2; |
|
113 |
} else { |
|
114 |
// Returns -1 if no LineNumberTable, and otherwise actual line number |
|
115 |
line_number = method->line_number_from_bci(bci); |
|
116 |
if (line_number == -1 && ShowHiddenFrames) { |
|
117 |
line_number = bci + 1000000; |
|
118 |
} |
|
119 |
} |
|
120 |
return line_number; |
|
121 |
} |
|
122 |
||
123 |
/* |
|
124 |
* Returns the source file name of a given InstanceKlass and version |
|
125 |
*/ |
|
126 |
inline Symbol* Backtrace::get_source_file_name(InstanceKlass* holder, int version) { |
|
127 |
// Find the specific ik version that contains this source_file_name_index |
|
128 |
// via the previous versions list, but use the current version's |
|
129 |
// constant pool to look it up. The previous version's index has been |
|
130 |
// merged for the current constant pool. |
|
131 |
InstanceKlass* ik = holder->get_klass_version(version); |
|
132 |
// This version has been cleaned up. |
|
133 |
if (ik == NULL) return NULL; |
|
134 |
int source_file_name_index = ik->source_file_name_index(); |
|
135 |
return (source_file_name_index == 0) ? |
|
136 |
(Symbol*)NULL : holder->constants()->symbol_at(source_file_name_index); |
|
137 |
} |
|
138 |
||
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff
changeset
|
139 |
#endif // SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP |