Mercurial > hg > graal-compiler
annotate src/share/vm/graal/graalEnv.cpp @ 21074:2e35a4ea22ac
Add MaxVectorSize to Graal globals
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 21 Apr 2015 10:47:43 -0700 |
parents | a560c9b81f0f |
children |
rev | line source |
---|---|
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 * |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 */ |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 #include "graal/graalEnv.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 #include "classfile/systemDictionary.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 #include "classfile/vmSymbols.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 #include "code/scopeDesc.hpp" |
3690
f8d7ab42c479
Call NMethodSweeper::possibly_sweep() before registering a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3674
diff
changeset
|
30 #include "runtime/sweeper.hpp" |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 #include "compiler/compileBroker.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 #include "compiler/compileLog.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 #include "compiler/compilerOracle.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 #include "interpreter/linkResolver.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 #include "memory/allocation.inline.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 #include "memory/oopFactory.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 #include "memory/universe.inline.hpp" |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
38 #include "oops/methodData.hpp" |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 #include "oops/objArrayKlass.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 #include "prims/jvmtiExport.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 #include "runtime/init.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 #include "runtime/reflection.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 #include "runtime/sharedRuntime.hpp" |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 #include "utilities/dtrace.hpp" |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
7113
diff
changeset
|
45 #include "graal/graalRuntime.hpp" |
8215
b89a97928e72
Implement weak reference semantics for HotSpotInstalledCode in the default method installation case. Add new boolean[] array as parameter to the code installation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7935
diff
changeset
|
46 #include "graal/graalJavaAccess.hpp" |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 |
19321
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
48 GraalEnv::GraalEnv(CompileTask* task, int system_dictionary_modification_counter) { |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
49 _task = task; |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
50 _system_dictionary_modification_counter = system_dictionary_modification_counter; |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
51 { |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
52 // Get Jvmti capabilities under lock to get consistent values. |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
53 MutexLocker mu(JvmtiThreadState_lock); |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
54 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint(); |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
55 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables(); |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
56 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions(); |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
57 } |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
58 } |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
59 |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 // ------------------------------------------------------------------ |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 // Note: the logic of this method should mirror the logic of |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 // constantPoolOopDesc::verify_constant_pool_resolve. |
3674
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3672
diff
changeset
|
63 bool GraalEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) { |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
64 if (accessing_klass->oop_is_objArray()) { |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
65 accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass(); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 } |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
67 if (!accessing_klass->oop_is_instance()) { |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 return true; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
71 if (resolved_klass->oop_is_objArray()) { |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 // Find the element klass, if this is an array. |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
73 resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass(); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 } |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
75 if (resolved_klass->oop_is_instance()) { |
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
76 return Reflection::verify_class_access(accessing_klass(), resolved_klass(), true); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 return true; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
81 // ------------------------------------------------------------------ |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
82 KlassHandle GraalEnv::get_klass_by_name_impl(KlassHandle& accessing_klass, |
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
83 constantPoolHandle& cpool, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
84 Symbol* sym, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
85 bool require_local) { |
7126
ce248dc0a656
removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
86 GRAAL_EXCEPTION_CONTEXT; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
88 // Now we need to check the SystemDictionary |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 if (sym->byte_at(0) == 'L' && |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 sym->byte_at(sym->utf8_length()-1) == ';') { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
91 // This is a name from a signature. Strip off the trimmings. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 // Call recursive to keep scope of strippedsym. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 sym->utf8_length()-2, |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
95 CHECK_(KlassHandle())); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
96 return get_klass_by_name_impl(accessing_klass, cpool, strippedsym, require_local); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 Handle loader(THREAD, (oop)NULL); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 Handle domain(THREAD, (oop)NULL); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 if (!accessing_klass.is_null()) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 loader = Handle(THREAD, accessing_klass->class_loader()); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 domain = Handle(THREAD, accessing_klass->protection_domain()); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
106 KlassHandle found_klass; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
108 ttyUnlocker ttyul; // release tty lock to avoid ordering problems |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
109 MutexLocker ml(Compile_lock); |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
110 Klass* kls; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 if (!require_local) { |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
112 kls = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader, CHECK_(KlassHandle())); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
113 } else { |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
114 kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain, CHECK_(KlassHandle())); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 found_klass = KlassHandle(THREAD, kls); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 // If we fail to find an array klass, look again for its element type. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 // The element type may be available either locally or via constraints. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 // In either case, if we can find the element type in the system dictionary, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 // we must build an array type around it. The CI requires array klasses |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 // to be loaded if their element klasses are loaded, except when memory |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 // is exhausted. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 if (sym->byte_at(0) == '[' && |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
127 // We have an unloaded array. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 // Build it on the fly if the element class exists. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 sym->utf8_length()-1, |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
131 CHECK_(KlassHandle())); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 |
7094
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
7089
diff
changeset
|
133 // Get element Klass recursively. |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 KlassHandle elem_klass = |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 get_klass_by_name_impl(accessing_klass, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 cpool, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
137 elem_sym, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
138 require_local); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 if (!elem_klass.is_null()) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
140 // Now make an array for it |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
141 return elem_klass->array_klass(CHECK_(KlassHandle())); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 |
3639
2fd96b3040b9
Fixed build issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
145 if (found_klass.is_null() && !cpool.is_null() && cpool->has_preresolution()) { |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
146 // Look inside the constant pool for pre-resolved class entries. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 for (int i = cpool->length() - 1; i >= 1; i--) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
148 if (cpool->tag_at(i).is_klass()) { |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
149 Klass* kls = cpool->resolved_klass_at(i); |
6989
2afd99933ae6
Remove Klass::cast from graalEnv
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6948
diff
changeset
|
150 if (kls->name() == sym) { |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 return kls; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
154 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 return found_klass(); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 // ------------------------------------------------------------------ |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
161 KlassHandle GraalEnv::get_klass_by_name(KlassHandle& accessing_klass, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
162 Symbol* klass_name, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 bool require_local) { |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3639
diff
changeset
|
164 ResourceMark rm; |
3672
5e331d5f760e
removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3670
diff
changeset
|
165 constantPoolHandle cpool; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 return get_klass_by_name_impl(accessing_klass, |
3672
5e331d5f760e
removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3670
diff
changeset
|
167 cpool, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 klass_name, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 require_local); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
171 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 // ------------------------------------------------------------------ |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
173 // Implementation of get_klass_by_index. |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
174 KlassHandle GraalEnv::get_klass_by_index_impl(constantPoolHandle& cpool, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 int index, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 bool& is_accessible, |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
177 KlassHandle& accessor) { |
7126
ce248dc0a656
removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
178 GRAAL_EXCEPTION_CONTEXT; |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
179 KlassHandle klass (THREAD, ConstantPool::klass_at_if_loaded(cpool, index)); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
180 Symbol* klass_name = NULL; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
181 if (klass.is_null()) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 // The klass has not been inserted into the constant pool. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
183 // Try to look it up by name. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
184 { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
185 // We have to lock the cpool to keep the oop from being resolved |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 // while we are accessing it. |
13086
096c224171c4
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
12743
diff
changeset
|
187 MonitorLockerEx ml(cpool->lock()); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
189 constantTag tag = cpool->tag_at(index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
190 if (tag.is_klass()) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
191 // The klass has been inserted into the constant pool |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
192 // very recently. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
193 klass = KlassHandle(THREAD, cpool->resolved_klass_at(index)); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 } else if (tag.is_symbol()) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 klass_name = cpool->symbol_at(index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 } else { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
197 assert(cpool->tag_at(index).is_unresolved_klass(), "wrong tag"); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 klass_name = cpool->unresolved_klass_at(index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
199 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
200 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
201 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
203 if (klass.is_null()) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
204 // Not found in constant pool. Use the name to do the lookup. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
205 KlassHandle k = get_klass_by_name_impl(accessor, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
206 cpool, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 klass_name, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 false); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 // Calculate accessibility the hard way. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 if (k.is_null()) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 is_accessible = false; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
212 } else if (k->class_loader() != accessor->class_loader() && |
3674
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3672
diff
changeset
|
213 get_klass_by_name_impl(accessor, cpool, k->name(), true).is_null()) { |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 // Loaded only remotely. Not linked yet. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
215 is_accessible = false; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 } else { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 // Linked locally, and we must also check public/private, etc. |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
218 is_accessible = check_klass_accessibility(accessor, k); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 } |
3674
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3672
diff
changeset
|
220 if (!is_accessible) { |
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3672
diff
changeset
|
221 return KlassHandle(); |
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3672
diff
changeset
|
222 } |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
223 return k; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
226 // It is known to be accessible, since it was found in the constant pool. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
227 is_accessible = true; |
3654
4123781869da
More handles, fixed broken cast.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
228 return klass; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
231 // ------------------------------------------------------------------ |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 // Get a klass from the constant pool. |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
233 KlassHandle GraalEnv::get_klass_by_index(constantPoolHandle& cpool, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
234 int index, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 bool& is_accessible, |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
236 KlassHandle& accessor) { |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3639
diff
changeset
|
237 ResourceMark rm; |
3674
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3672
diff
changeset
|
238 KlassHandle result = get_klass_by_index_impl(cpool, index, is_accessible, accessor); |
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3672
diff
changeset
|
239 return result; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
240 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 // ------------------------------------------------------------------ |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 // Implementation of get_field_by_index. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 // |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 // Implementation note: the results of field lookups are cached |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 // in the accessor klass. |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
247 void GraalEnv::get_field_by_index_impl(instanceKlassHandle& klass, fieldDescriptor& field_desc, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
248 int index) { |
7126
ce248dc0a656
removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
249 GRAAL_EXCEPTION_CONTEXT; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
250 |
4603
a1238d5c6991
Small comment fix to test native code building guard in the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4174
diff
changeset
|
251 assert(klass->is_linked(), "must be linked before using its constant-pool"); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 constantPoolHandle cpool(thread, klass->constants()); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 // Get the field's name, signature, and type. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 Symbol* name = cpool->name_ref_at(index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 int nt_index = cpool->name_and_type_ref_index_at(index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
259 int sig_index = cpool->signature_ref_index_at(nt_index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 Symbol* signature = cpool->symbol_at(sig_index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
261 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
262 // Get the field's declared holder. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 int holder_index = cpool->klass_ref_index_at(index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 bool holder_is_accessible; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
265 KlassHandle declared_holder = get_klass_by_index(cpool, holder_index, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 holder_is_accessible, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 klass); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
268 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
269 // The declared holder of this field may not have been loaded. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
270 // Bail out with partial field information. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
271 if (!holder_is_accessible) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
272 return; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
273 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
274 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
275 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
276 // Perform the field lookup. |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
277 Klass* canonical_holder = |
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
278 InstanceKlass::cast(declared_holder())->find_field(name, signature, &field_desc); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
279 if (canonical_holder == NULL) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
280 return; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
281 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
283 assert(canonical_holder == field_desc.field_holder(), "just checking"); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
284 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 // ------------------------------------------------------------------ |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
287 // Get a field by index from a klass's constant pool. |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
288 void GraalEnv::get_field_by_index(instanceKlassHandle& accessor, fieldDescriptor& fd, int index) { |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3639
diff
changeset
|
289 ResourceMark rm; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 return get_field_by_index_impl(accessor, fd, index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
292 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
293 // ------------------------------------------------------------------ |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
294 // Perform an appropriate method lookup based on accessor, holder, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
295 // name, signature, and bytecode. |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
296 methodHandle GraalEnv::lookup_method(instanceKlassHandle& h_accessor, |
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
297 instanceKlassHandle& h_holder, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 Symbol* name, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 Symbol* sig, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
300 Bytecodes::Code bc) { |
7126
ce248dc0a656
removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
301 GRAAL_EXCEPTION_CONTEXT; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
302 LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL)); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
303 methodHandle dest_method; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
304 switch (bc) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
305 case Bytecodes::_invokestatic: |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
306 dest_method = |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
307 LinkResolver::resolve_static_call_or_null(h_holder, name, sig, h_accessor); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
308 break; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
309 case Bytecodes::_invokespecial: |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
310 dest_method = |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
311 LinkResolver::resolve_special_call_or_null(h_holder, name, sig, h_accessor); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 break; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
313 case Bytecodes::_invokeinterface: |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
314 dest_method = |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 LinkResolver::linktime_resolve_interface_method_or_null(h_holder, name, sig, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 h_accessor, true); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 break; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 case Bytecodes::_invokevirtual: |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
319 dest_method = |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
320 LinkResolver::linktime_resolve_virtual_method_or_null(h_holder, name, sig, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
321 h_accessor, true); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
322 break; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
323 default: ShouldNotReachHere(); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
324 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
325 |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
326 return dest_method; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
327 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
328 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
329 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
330 // ------------------------------------------------------------------ |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
331 methodHandle GraalEnv::get_method_by_index_impl(constantPoolHandle& cpool, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
332 int index, Bytecodes::Code bc, |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
333 instanceKlassHandle& accessor) { |
8945
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
334 if (bc == Bytecodes::_invokedynamic) { |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
335 ConstantPoolCacheEntry* cpce = cpool->invokedynamic_cp_cache_entry_at(index); |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
336 bool is_resolved = !cpce->is_f1_null(); |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
337 if (is_resolved) { |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
338 // Get the invoker Method* from the constant pool. |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
339 // (The appendix argument, if any, will be noted in the method's signature.) |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
340 Method* adapter = cpce->f1_as_method(); |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
341 return methodHandle(adapter); |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
342 } |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
343 |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
344 return NULL; |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
345 } |
7ef66078d837
add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents:
8215
diff
changeset
|
346 |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
347 int holder_index = cpool->klass_ref_index_at(index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
348 bool holder_is_accessible; |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
349 KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
350 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
351 // Get the method's name and signature. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
352 Symbol* name_sym = cpool->name_ref_at(index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 Symbol* sig_sym = cpool->signature_ref_at(index); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
354 |
9011
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
355 if (cpool->has_preresolution() |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
356 || (holder() == SystemDictionary::MethodHandle_klass() && |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
357 MethodHandles::is_signature_polymorphic_name(holder(), name_sym))) { |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
358 // Short-circuit lookups for JSR 292-related call sites. |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
359 // That is, do not rely only on name-based lookups, because they may fail |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
360 // if the names are not resolvable in the boot class loader (7056328). |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
361 switch (bc) { |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
362 case Bytecodes::_invokevirtual: |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
363 case Bytecodes::_invokeinterface: |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
364 case Bytecodes::_invokespecial: |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
365 case Bytecodes::_invokestatic: |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
366 { |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
367 Method* m = ConstantPool::method_at_if_loaded(cpool, index); |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
368 if (m != NULL) { |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
369 return m; |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
370 } |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
371 } |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
372 break; |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
373 } |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
374 } |
23762f2438b6
support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents:
8945
diff
changeset
|
375 |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
376 if (holder_is_accessible) { // Our declared holder is loaded. |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
377 instanceKlassHandle lookup = get_instance_klass_for_declared_method_holder(holder); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
378 methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
379 if (!m.is_null() && |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
380 (bc == Bytecodes::_invokestatic |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
381 ? InstanceKlass::cast(m->method_holder())->is_not_initialized() |
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
382 : !InstanceKlass::cast(m->method_holder())->is_loaded())) { |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
383 m = NULL; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
384 } |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
385 if (!m.is_null()) { |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
386 // We found the method. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
387 return m; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
388 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
389 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
390 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
391 // Either the declared holder was not loaded, or the method could |
7094
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
7089
diff
changeset
|
392 // not be found. |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
393 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
394 return NULL; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
395 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
396 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
397 // ------------------------------------------------------------------ |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
398 instanceKlassHandle GraalEnv::get_instance_klass_for_declared_method_holder(KlassHandle& method_holder) { |
7094
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
7089
diff
changeset
|
399 // For the case of <array>.clone(), the method holder can be an ArrayKlass* |
eec7173947a1
removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents:
7089
diff
changeset
|
400 // instead of an InstanceKlass*. For that case simply pretend that the |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
401 // declared holder is Object.clone since that's where the call will bottom out. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 if (method_holder->oop_is_instance()) { |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
403 return instanceKlassHandle(method_holder()); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 } else if (method_holder->oop_is_array()) { |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
405 return instanceKlassHandle(SystemDictionary::Object_klass()); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
406 } else { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
407 ShouldNotReachHere(); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
408 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 return NULL; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
410 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
411 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
412 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
413 // ------------------------------------------------------------------ |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
414 methodHandle GraalEnv::get_method_by_index(constantPoolHandle& cpool, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
415 int index, Bytecodes::Code bc, |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3664
diff
changeset
|
416 instanceKlassHandle& accessor) { |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3639
diff
changeset
|
417 ResourceMark rm; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
418 return get_method_by_index_impl(cpool, index, bc, accessor); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
419 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
420 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 // ------------------------------------------------------------------ |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 // Check for changes to the system dictionary during compilation |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
423 // class loads, evolution, breakpoints |
19782
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
424 GraalEnv::CodeInstallResult GraalEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code, |
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
425 GraalEnv* env, char** failure_detail) { |
19321
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
426 // If JVMTI capabilities were enabled during compile, the compilation is invalidated. |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
427 if (env != NULL) { |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
428 if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) { |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
429 *failure_detail = (char*) "Hotswapping or breakpointing was enabled during compilation"; |
19782
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
430 return GraalEnv::dependencies_failed; |
19321
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
431 } |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
432 } |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
433 |
19321
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
434 // Dependencies must be checked when the system dictionary changes |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
435 // or if we don't know whether it has changed (i.e., env == NULL). |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
436 // In debug mode, always check dependencies. |
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
437 bool counter_changed = env != NULL && env->_system_dictionary_modification_counter != SystemDictionary::number_of_modifications(); |
19782
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
438 bool verify_deps = env == NULL || trueInDebug || Debug::ENABLED(); |
19321
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
439 if (!counter_changed && !verify_deps) { |
19782
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
440 return GraalEnv::ok; |
19321
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
441 } |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
442 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
443 for (Dependencies::DepStream deps(dependencies); deps.next(); ) { |
19426
dd8989d5547f
provide more detail when Graal code installation fails due to a failed dependency check
Doug Simon <doug.simon@oracle.com>
parents:
19321
diff
changeset
|
444 Klass* witness = deps.check_dependency(); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
445 if (witness != NULL) { |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
446 // Use a fixed size buffer to prevent the string stream from |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
447 // resizing in the context of an inner resource mark. |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
448 char* buffer = NEW_RESOURCE_ARRAY(char, O_BUFLEN); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
449 stringStream st(buffer, O_BUFLEN); |
19426
dd8989d5547f
provide more detail when Graal code installation fails due to a failed dependency check
Doug Simon <doug.simon@oracle.com>
parents:
19321
diff
changeset
|
450 deps.print_dependency(witness, true, &st); |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
451 *failure_detail = st.as_string(); |
19782
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
452 if (env == NULL || counter_changed) { |
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
453 return GraalEnv::dependencies_failed; |
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
454 } else { |
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
455 // The dependencies were invalid at the time of installation |
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
456 // without any intervening modification of the system |
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
457 // dictionary. That means they were invalidly constructed. |
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
458 return GraalEnv::dependencies_invalid; |
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
459 } |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
460 } |
18696
b2859128b76a
Only log dependencies if LogCompilation is on
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18226
diff
changeset
|
461 if (LogCompilation) { |
b2859128b76a
Only log dependencies if LogCompilation is on
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18226
diff
changeset
|
462 deps.log_dependency(); |
b2859128b76a
Only log dependencies if LogCompilation is on
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18226
diff
changeset
|
463 } |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
464 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
465 |
19782
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
466 return GraalEnv::ok; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
467 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
468 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
469 // ------------------------------------------------------------------ |
7089
af30115c9d0e
added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents:
7069
diff
changeset
|
470 GraalEnv::CodeInstallResult GraalEnv::register_method( |
af30115c9d0e
added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents:
7069
diff
changeset
|
471 methodHandle& method, |
af30115c9d0e
added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents:
7069
diff
changeset
|
472 nmethod*& nm, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
473 int entry_bci, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
474 CodeOffsets* offsets, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
475 int orig_pc_offset, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 CodeBuffer* code_buffer, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
477 int frame_words, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
478 OopMapSet* oop_map_set, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
479 ExceptionHandlerTable* handler_table, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
480 AbstractCompiler* compiler, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
481 DebugInformationRecorder* debug_info, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
482 Dependencies* dependencies, |
19321
98592ae4b1fa
only record method dependencies if JVMTI hotswapping or breakpointing is enabled
Doug Simon <doug.simon@oracle.com>
parents:
18929
diff
changeset
|
483 GraalEnv* env, |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 int compile_id, |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 bool has_unsafe_access, |
8215
b89a97928e72
Implement weak reference semantics for HotSpotInstalledCode in the default method installation case. Add new boolean[] array as parameter to the code installation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7935
diff
changeset
|
486 Handle installed_code, |
19426
dd8989d5547f
provide more detail when Graal code installation fails due to a failed dependency check
Doug Simon <doug.simon@oracle.com>
parents:
19321
diff
changeset
|
487 Handle compiled_code, |
13641
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13086
diff
changeset
|
488 Handle speculation_log) { |
7126
ce248dc0a656
removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
489 GRAAL_EXCEPTION_CONTEXT; |
3690
f8d7ab42c479
Call NMethodSweeper::possibly_sweep() before registering a method.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3674
diff
changeset
|
490 NMethodSweeper::possibly_sweep(); |
7089
af30115c9d0e
added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents:
7069
diff
changeset
|
491 nm = NULL; |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13641
diff
changeset
|
492 int comp_level = CompLevel_full_optimization; |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
493 char* failure_detail = NULL; |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
494 GraalEnv::CodeInstallResult result; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
495 { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
496 // To prevent compile queue updates. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
497 MutexLocker locker(MethodCompileQueue_lock, THREAD); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
498 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
499 // Prevent SystemDictionary::add_to_hierarchy from running |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
500 // and invalidating our dependencies until we install this method. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
501 MutexLocker ml(Compile_lock); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
502 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
503 // Encode the dependencies now, so we can check them right away. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
504 dependencies->encode_content_bytes(); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
505 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
506 // Check for {class loads, evolution, breakpoints} during compilation |
19782
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
507 result = check_for_system_dictionary_modification(dependencies, compiled_code, env, &failure_detail); |
29916dcee0b8
Verify dependencies when assertions are enabled
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19487
diff
changeset
|
508 if (result != GraalEnv::ok) { |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
509 // While not a true deoptimization, it is a preemptive decompile. |
6948
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
510 MethodData* mdp = method()->method_data(); |
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
511 if (mdp != NULL) { |
e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
512 mdp->inc_decompile_count(); |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7126
diff
changeset
|
513 if (mdp->decompile_count() > (uint)PerMethodRecompilationCutoff) { |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7126
diff
changeset
|
514 // TODO (chaeubl) enable this in the fastdebug build only once we are more stable |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7126
diff
changeset
|
515 ResourceMark m; |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7126
diff
changeset
|
516 tty->print_cr("WARN: endless recompilation of %s. Method was set to not compilable.", method()->name_and_sig_as_C_string()); |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7126
diff
changeset
|
517 //ShouldNotReachHere(); |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7126
diff
changeset
|
518 } |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
519 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
520 |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
521 // All buffers in the CodeBuffer are allocated in the CodeCache. |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
522 // If the code buffer is created on each compile attempt |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
523 // as in C2, then it must be freed. |
3664
6e1abd79e7c8
Register assumptions before anything else. Don't free code blob (it is reused).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3661
diff
changeset
|
524 //code_buffer->free_blob(); |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
525 } else { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
526 ImplicitExceptionTable implicit_tbl; |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
527 nm = nmethod::new_nmethod(method, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
528 compile_id, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
529 entry_bci, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
530 offsets, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
531 orig_pc_offset, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
532 debug_info, dependencies, code_buffer, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
533 frame_words, oop_map_set, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
534 handler_table, &implicit_tbl, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
535 compiler, comp_level, installed_code, speculation_log); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
536 |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
537 // Free codeBlobs |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
538 //code_buffer->free_blob(); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
539 |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
540 if (nm == NULL) { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
541 // The CodeCache is full. Print out warning and disable compilation. |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
542 { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
543 MutexUnlocker ml(Compile_lock); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
544 MutexUnlocker locker(MethodCompileQueue_lock); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
545 CompileBroker::handle_full_code_cache(); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
546 } |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
547 } else { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
548 nm->set_has_unsafe_access(has_unsafe_access); |
20970
a560c9b81f0f
Add suport for oops in vector registers at safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19782
diff
changeset
|
549 #ifdef TARGET_ARCH_x86 |
a560c9b81f0f
Add suport for oops in vector registers at safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19782
diff
changeset
|
550 // It might be preferable to set this only for methods which |
a560c9b81f0f
Add suport for oops in vector registers at safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19782
diff
changeset
|
551 // use vector instructions but we currently don't track this |
a560c9b81f0f
Add suport for oops in vector registers at safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19782
diff
changeset
|
552 // and it probably wouldn't make much difference. |
21074
2e35a4ea22ac
Add MaxVectorSize to Graal globals
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20970
diff
changeset
|
553 nm->set_has_wide_vectors(MaxVectorSize > 16); |
20970
a560c9b81f0f
Add suport for oops in vector registers at safepoints
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19782
diff
changeset
|
554 #endif |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
555 |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
556 // Record successful registration. |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
557 // (Put nm into the task handle *before* publishing to the Java heap.) |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
558 CompileTask* task = env == NULL ? NULL : env->task(); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
559 if (task != NULL) task->set_code(nm); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
560 |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
561 if (installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(installed_code())) { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
562 if (entry_bci == InvocationEntryBci) { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
563 if (TieredCompilation) { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
564 // If there is an old version we're done with it |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
565 nmethod* old = method->code(); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
566 if (TraceMethodReplacement && old != NULL) { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
567 ResourceMark rm; |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
568 char *method_name = method->name_and_sig_as_C_string(); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
569 tty->print_cr("Replacing method %s", method_name); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
570 } |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
571 if (old != NULL ) { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
572 old->make_not_entrant(); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
573 } |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
574 } |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
575 if (TraceNMethodInstalls) { |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
576 ResourceMark rm; |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
577 char *method_name = method->name_and_sig_as_C_string(); |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
578 ttyLocker ttyl; |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
579 tty->print_cr("Installing method (%d) %s [entry point: %p]", |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
580 comp_level, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
581 method_name, nm->entry_point()); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
582 } |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
583 // Allow the code to be executed |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
584 method->set_code(method, nm); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
585 } else { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
586 if (TraceNMethodInstalls ) { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
587 ResourceMark rm; |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
588 char *method_name = method->name_and_sig_as_C_string(); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
589 ttyLocker ttyl; |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
590 tty->print_cr("Installing osr method (%d) %s @ %d", |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
591 comp_level, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
592 method_name, |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
593 entry_bci); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
594 } |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
595 InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm); |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
596 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
597 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
598 } |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
599 result = nm != NULL ? GraalEnv::ok :GraalEnv::cache_full; |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
600 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
601 } |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
602 |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
603 // String creation must be done outside lock |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
604 if (failure_detail != NULL) { |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
605 // A failure to allocate the string is silently ignored. |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
606 Handle message = java_lang_String::create_from_str(failure_detail, THREAD); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
607 HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message()); |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
608 } |
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
609 |
3635
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
610 // JVMTI -- compiled method notification (must be done outside lock) |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
611 if (nm != NULL) { |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
612 nm->post_compiled_method_load_event(); |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
613 } |
cb1181db8bec
Initial port of ciEnv to graalEnv.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
614 |
19487
fb38e004503c
moved creation of String for detailed dependency failure message outside of no safepoint region
Doug Simon <doug.simon@oracle.com>
parents:
19426
diff
changeset
|
615 return result; |
3703
50a1d38cd7ac
Add newlines at the end of files, otherwise my version of gcc complains
Christian Wimmer <christian.wimmer@oracle.com>
parents:
3690
diff
changeset
|
616 } |
50a1d38cd7ac
Add newlines at the end of files, otherwise my version of gcc complains
Christian Wimmer <christian.wimmer@oracle.com>
parents:
3690
diff
changeset
|
617 |