Mercurial > hg > graal-jvmci-8
annotate src/share/vm/jvmci/jvmciRuntime.cpp @ 22530:cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 07 Sep 2015 22:23:35 +0200 |
parents | 23db6926b163 |
children | ea6d1727fdc6 |
rev | line source |
---|---|
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1 /* |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
4 * |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
7 * published by the Free Software Foundation. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
8 * |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
13 * accompanied this code). |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
14 * |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
18 * |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
21 * questions. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
22 */ |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
23 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
24 #include "precompiled.hpp" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
25 #include "asm/codeBuffer.hpp" |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
26 #include "code/codeCache.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
27 #include "compiler/compileBroker.hpp" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
28 #include "compiler/disassembler.hpp" |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
29 #include "jvmci/jvmciRuntime.hpp" |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
30 #include "jvmci/jvmciCompilerToVM.hpp" |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
31 #include "jvmci/jvmciCompiler.hpp" |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
32 #include "jvmci/jvmciJavaAccess.hpp" |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
33 #include "jvmci/jvmciEnv.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
34 #include "memory/oopFactory.hpp" |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
35 #include "oops/oop.inline.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
36 #include "prims/jvm.h" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
37 #include "runtime/biasedLocking.hpp" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
38 #include "runtime/interfaceSupport.hpp" |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
39 #include "runtime/reflection.hpp" |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
40 #include "runtime/sharedRuntime.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
41 #include "utilities/debug.hpp" |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
42 #include "utilities/defaultStream.hpp" |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
43 |
21587
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
44 #if defined(_MSC_VER) |
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
45 #define strtoll _strtoi64 |
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
46 #endif |
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
47 |
59c3f921e454
fixes for windows build (size_t conversion, missing precompiled.hpp, missing strtof, strtoll in Windows SDK)
Christian Wirth <christian.wirth@oracle.com>
parents:
21564
diff
changeset
|
48 jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL; |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
49 bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false; |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
50 const char* JVMCIRuntime::_compiler = NULL; |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
51 const char* JVMCIRuntime::_options = NULL; |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
52 bool JVMCIRuntime::_shutdown_called = false; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
53 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
54 void JVMCIRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) { |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
55 #ifdef _LP64 |
22523
67ffe0bc3dc6
[SPARC] Don't check if enough space is available at the end of the heap for tlab
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22517
diff
changeset
|
56 #ifndef TARGET_ARCH_sparc |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
57 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
58 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024; |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
59 guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)"); |
22523
67ffe0bc3dc6
[SPARC] Don't check if enough space is available at the end of the heap for tlab
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22517
diff
changeset
|
60 #endif // TARGET_ARCH_sparc |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
61 #else |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
62 fatal("check TLAB allocation code for address space conflicts"); |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
63 #endif |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
64 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
65 ensure_jvmci_class_loader_is_initialized(); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
66 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
67 JavaThread* THREAD = JavaThread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
68 { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
69 ThreadToNativeFromVM trans(THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
70 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
71 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
72 HandleMark hm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
73 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
74 jvmci_compute_offsets(); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
75 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
76 // Ensure _non_oop_bits is initialized |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
77 Universe::non_oop_word(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
78 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
79 env->RegisterNatives(c2vmClass, CompilerToVM::methods, CompilerToVM::methods_count()); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
80 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
81 if (HAS_PENDING_EXCEPTION) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
82 abort_on_pending_exception(PENDING_EXCEPTION, "Could not register natives"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
83 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
84 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
85 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
86 BufferBlob* JVMCIRuntime::initialize_buffer_blob() { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
87 JavaThread* THREAD = JavaThread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
88 BufferBlob* buffer_blob = THREAD->get_buffer_blob(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
89 if (buffer_blob == NULL) { |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
90 buffer_blob = BufferBlob::create("JVMCI thread-local CodeBuffer", JVMCINMethodSizeLimit); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
91 if (buffer_blob != NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
92 THREAD->set_buffer_blob(buffer_blob); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
93 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
94 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
95 return buffer_blob; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
96 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
97 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
98 BasicType JVMCIRuntime::kindToBasicType(jchar ch) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
99 switch(ch) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
100 case 'z': return T_BOOLEAN; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
101 case 'b': return T_BYTE; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
102 case 's': return T_SHORT; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
103 case 'c': return T_CHAR; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
104 case 'i': return T_INT; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
105 case 'f': return T_FLOAT; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
106 case 'j': return T_LONG; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
107 case 'd': return T_DOUBLE; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
108 case 'a': return T_OBJECT; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
109 case '-': return T_ILLEGAL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
110 default: |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
111 fatal(err_msg("unexpected Kind: %c", ch)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
112 break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
113 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
114 return T_ILLEGAL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
115 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
116 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
117 // Simple helper to see if the caller of a runtime stub which |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
118 // entered the VM has been deoptimized |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
119 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
120 static bool caller_is_deopted() { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
121 JavaThread* thread = JavaThread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
122 RegisterMap reg_map(thread, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
123 frame runtime_frame = thread->last_frame(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
124 frame caller_frame = runtime_frame.sender(®_map); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
125 assert(caller_frame.is_compiled_frame(), "must be compiled"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
126 return caller_frame.is_deoptimized_frame(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
127 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
128 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
129 // Stress deoptimization |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
130 static void deopt_caller() { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
131 if ( !caller_is_deopted()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
132 JavaThread* thread = JavaThread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
133 RegisterMap reg_map(thread, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
134 frame runtime_frame = thread->last_frame(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
135 frame caller_frame = runtime_frame.sender(®_map); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
136 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
137 assert(caller_is_deopted(), "Must be deoptimized"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
138 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
139 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
140 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
141 JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance(JavaThread* thread, Klass* klass)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
142 JRT_BLOCK; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
143 assert(klass->is_klass(), "not a class"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
144 instanceKlassHandle h(thread, klass); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
145 h->check_valid_for_instantiation(true, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
146 // make sure klass is initialized |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
147 h->initialize(CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
148 // allocate instance and return via TLS |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
149 oop obj = h->allocate_instance(CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
150 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
151 JRT_BLOCK_END; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
152 |
22447
ecbf949a9dcd
replace JVMCIDeferredInitBarriers with ReduceInitialCardMarks
Doug Simon <doug.simon@oracle.com>
parents:
22438
diff
changeset
|
153 if (ReduceInitialCardMarks) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
154 new_store_pre_barrier(thread); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
155 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
156 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
157 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
158 JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array(JavaThread* thread, Klass* array_klass, jint length)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
159 JRT_BLOCK; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
160 // Note: no handle for klass needed since they are not used |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
161 // anymore after new_objArray() and no GC can happen before. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
162 // (This may have to change if this code changes!) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
163 assert(array_klass->is_klass(), "not a class"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
164 oop obj; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
165 if (array_klass->oop_is_typeArray()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
166 BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
167 obj = oopFactory::new_typeArray(elt_type, length, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
168 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
169 Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
170 obj = oopFactory::new_objArray(elem_klass, length, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
171 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
172 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
173 // This is pretty rare but this runtime patch is stressful to deoptimization |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
174 // if we deoptimize here so force a deopt to stress the path. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
175 if (DeoptimizeALot) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
176 static int deopts = 0; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
177 // Alternate between deoptimizing and raising an error (which will also cause a deopt) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
178 if (deopts++ % 2 == 0) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
179 ResourceMark rm(THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
180 THROW(vmSymbols::java_lang_OutOfMemoryError()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
181 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
182 deopt_caller(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
183 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
184 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
185 JRT_BLOCK_END; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
186 |
22447
ecbf949a9dcd
replace JVMCIDeferredInitBarriers with ReduceInitialCardMarks
Doug Simon <doug.simon@oracle.com>
parents:
22438
diff
changeset
|
187 if (ReduceInitialCardMarks) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
188 new_store_pre_barrier(thread); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
189 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
190 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
191 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
192 void JVMCIRuntime::new_store_pre_barrier(JavaThread* thread) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
193 // After any safepoint, just before going back to compiled code, |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
194 // we inform the GC that we will be doing initializing writes to |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
195 // this object in the future without emitting card-marks, so |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
196 // GC may take any compensating steps. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
197 // NOTE: Keep this code consistent with GraphKit::store_barrier. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
198 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
199 oop new_obj = thread->vm_result(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
200 if (new_obj == NULL) return; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
201 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
202 assert(Universe::heap()->can_elide_tlab_store_barriers(), |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
203 "compiler must check this first"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
204 // GC may decide to give back a safer copy of new_obj. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
205 new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
206 thread->set_vm_result(new_obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
207 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
208 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
209 JRT_ENTRY(void, JVMCIRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
210 assert(klass->is_klass(), "not a class"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
211 assert(rank >= 1, "rank must be nonzero"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
212 oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
213 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
214 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
215 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
216 JRT_ENTRY(void, JVMCIRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
217 oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
218 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
219 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
220 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
221 JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
222 instanceKlassHandle klass(THREAD, java_lang_Class::as_Klass(type_mirror)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
223 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
224 if (klass == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
225 ResourceMark rm(THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
226 THROW(vmSymbols::java_lang_InstantiationException()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
227 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
228 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
229 // Create new instance (the receiver) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
230 klass->check_valid_for_instantiation(false, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
231 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
232 // Make sure klass gets initialized |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
233 klass->initialize(CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
234 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
235 oop obj = klass->allocate_instance(CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
236 thread->set_vm_result(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
237 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
238 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
239 extern void vm_exit(int code); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
240 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
241 // Enter this method from compiled code handler below. This is where we transition |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
242 // to VM mode. This is done as a helper routine so that the method called directly |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
243 // from compiled code does not have to transition to VM. This allows the entry |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
244 // method to see if the nmethod that we have just looked up a handler for has |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
245 // been deoptimized while we were in the vm. This simplifies the assembly code |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
246 // cpu directories. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
247 // |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
248 // We are entering here from exception stub (via the entry method below) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
249 // If there is a compiled exception handler in this method, we will continue there; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
250 // otherwise we will unwind the stack and continue at the caller of top frame method |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
251 // Note: we enter in Java using a special JRT wrapper. This wrapper allows us to |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
252 // control the area where we can allow a safepoint. After we exit the safepoint area we can |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
253 // check to see if the handler we are going to return is now in a nmethod that has |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
254 // been deoptimized. If that is the case we return the deopt blob |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
255 // unpack_with_exception entry instead. This makes life for the exception blob easier |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
256 // because making that same check and diverting is painful from assembly language. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
257 JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm)) |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
258 // Reset method handle flag. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
259 thread->set_is_method_handle_return(false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
260 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
261 Handle exception(thread, ex); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
262 nm = CodeCache::find_nmethod(pc); |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
263 assert(nm != NULL, "this is not a compiled method"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
264 // Adjust the pc as needed/ |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
265 if (nm->is_deopt_pc(pc)) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
266 RegisterMap map(thread, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
267 frame exception_frame = thread->last_frame().sender(&map); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
268 // if the frame isn't deopted then pc must not correspond to the caller of last_frame |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
269 assert(exception_frame.is_deoptimized_frame(), "must be deopted"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
270 pc = exception_frame.pc(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
271 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
272 #ifdef ASSERT |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
273 assert(exception.not_null(), "NULL exceptions should be handled by throw_exception"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
274 assert(exception->is_oop(), "just checking"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
275 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
276 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
277 if (ExitVMOnVerifyError) vm_exit(-1); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
278 ShouldNotReachHere(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
279 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
280 #endif |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
281 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
282 // Check the stack guard pages and reenable them if necessary and there is |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
283 // enough space on the stack to do so. Use fast exceptions only if the guard |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
284 // pages are enabled. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
285 bool guard_pages_enabled = thread->stack_yellow_zone_enabled(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
286 if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
287 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
288 if (JvmtiExport::can_post_on_exceptions()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
289 // To ensure correct notification of exception catches and throws |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
290 // we have to deoptimize here. If we attempted to notify the |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
291 // catches and throws during this exception lookup it's possible |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
292 // we could deoptimize on the way out of the VM and end back in |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
293 // the interpreter at the throw site. This would result in double |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
294 // notifications since the interpreter would also notify about |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
295 // these same catches and throws as it unwound the frame. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
296 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
297 RegisterMap reg_map(thread); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
298 frame stub_frame = thread->last_frame(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
299 frame caller_frame = stub_frame.sender(®_map); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
300 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
301 // We don't really want to deoptimize the nmethod itself since we |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
302 // can actually continue in the exception handler ourselves but I |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
303 // don't see an easy way to have the desired effect. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
304 Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
305 assert(caller_is_deopted(), "Must be deoptimized"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
306 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
307 return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
308 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
309 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
310 // ExceptionCache is used only for exceptions at call sites and not for implicit exceptions |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
311 if (guard_pages_enabled) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
312 address fast_continuation = nm->handler_for_exception_and_pc(exception, pc); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
313 if (fast_continuation != NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
314 // Set flag if return address is a method handle call site. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
315 thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
316 return fast_continuation; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
317 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
318 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
319 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
320 // If the stack guard pages are enabled, check whether there is a handler in |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
321 // the current method. Otherwise (guard pages disabled), force an unwind and |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
322 // skip the exception cache update (i.e., just leave continuation==NULL). |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
323 address continuation = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
324 if (guard_pages_enabled) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
325 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
326 // New exception handling mechanism can support inlined methods |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
327 // with exception handlers since the mappings are from PC to PC |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
328 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
329 // debugging support |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
330 // tracing |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
331 if (TraceExceptions) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
332 ttyLocker ttyl; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
333 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
334 tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "", |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
335 exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
336 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
337 // for AbortVMOnException flag |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
338 NOT_PRODUCT(Exceptions::debug_check_abort(exception)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
339 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
340 // Clear out the exception oop and pc since looking up an |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
341 // exception handler can cause class loading, which might throw an |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
342 // exception and those fields are expected to be clear during |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
343 // normal bytecode execution. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
344 thread->clear_exception_oop_and_pc(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
345 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
346 continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
347 // If an exception was thrown during exception dispatch, the exception oop may have changed |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
348 thread->set_exception_oop(exception()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
349 thread->set_exception_pc(pc); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
350 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
351 // the exception cache is used only by non-implicit exceptions |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
352 if (continuation != NULL && !SharedRuntime::deopt_blob()->contains(continuation)) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
353 nm->add_handler_for_exception_and_pc(exception, pc, continuation); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
354 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
355 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
356 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
357 // Set flag if return address is a method handle call site. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
358 thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
359 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
360 if (TraceExceptions) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
361 ttyLocker ttyl; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
362 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
363 tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT, |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
364 p2i(thread), p2i(continuation), p2i(pc)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
365 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
366 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
367 return continuation; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
368 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
369 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
370 // Enter this method from compiled code only if there is a Java exception handler |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
371 // in the method handling the exception. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
372 // We are entering here from exception stub. We don't do a normal VM transition here. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
373 // We do it in a helper. This is so we can check to see if the nmethod we have just |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
374 // searched for an exception handler has been deoptimized in the meantime. |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
375 address JVMCIRuntime::exception_handler_for_pc(JavaThread* thread) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
376 oop exception = thread->exception_oop(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
377 address pc = thread->exception_pc(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
378 // Still in Java mode |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
379 DEBUG_ONLY(ResetNoHandleMark rnhm); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
380 nmethod* nm = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
381 address continuation = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
382 { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
383 // Enter VM mode by calling the helper |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
384 ResetNoHandleMark rnhm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
385 continuation = exception_handler_for_pc_helper(thread, exception, pc, nm); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
386 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
387 // Back in JAVA, use no oops DON'T safepoint |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
388 |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
389 // Now check to see if the compiled method we were called from is now deoptimized. |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
390 // If so we must return to the deopt blob and deoptimize the nmethod |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
391 if (nm != NULL && caller_is_deopted()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
392 continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
393 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
394 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
395 assert(continuation != NULL, "no handler found"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
396 return continuation; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
397 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
398 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
399 JRT_ENTRY(void, JVMCIRuntime::create_null_exception(JavaThread* thread)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
400 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
401 thread->set_vm_result(PENDING_EXCEPTION); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
402 CLEAR_PENDING_EXCEPTION; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
403 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
404 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
405 JRT_ENTRY(void, JVMCIRuntime::create_out_of_bounds_exception(JavaThread* thread, jint index)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
406 char message[jintAsStringSize]; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
407 sprintf(message, "%d", index); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
408 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
409 thread->set_vm_result(PENDING_EXCEPTION); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
410 CLEAR_PENDING_EXCEPTION; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
411 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
412 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
413 JRT_ENTRY_NO_ASYNC(void, JVMCIRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
414 if (TraceJVMCI >= 3) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
415 char type[O_BUFLEN]; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
416 obj->klass()->name()->as_C_string(type, O_BUFLEN); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
417 markOop mark = obj->mark(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
418 tty->print_cr("%s: entered locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, p2i(mark), p2i(lock)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
419 tty->flush(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
420 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
421 #ifdef ASSERT |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
422 if (PrintBiasedLockingStatistics) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
423 Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
424 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
425 #endif |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
426 Handle h_obj(thread, obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
427 assert(h_obj()->is_oop(), "must be NULL or an object"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
428 if (UseBiasedLocking) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
429 // Retry fast entry if bias is revoked to avoid unnecessary inflation |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
430 ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
431 } else { |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
432 if (JVMCIUseFastLocking) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
433 // When using fast locking, the compiled code has already tried the fast case |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
434 ObjectSynchronizer::slow_enter(h_obj, lock, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
435 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
436 ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
437 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
438 } |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
439 if (TraceJVMCI >= 3) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
440 tty->print_cr("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), p2i(obj)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
441 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
442 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
443 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
444 JRT_LEAF(void, JVMCIRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
445 assert(thread == JavaThread::current(), "threads must correspond"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
446 assert(thread->last_Java_sp(), "last_Java_sp must be set"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
447 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
448 EXCEPTION_MARK; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
449 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
450 #ifdef DEBUG |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
451 if (!obj->is_oop()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
452 ResetNoHandleMark rhm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
453 nmethod* method = thread->last_frame().cb()->as_nmethod_or_null(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
454 if (method != NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
455 tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
456 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
457 thread->print_stack_on(tty); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
458 assert(false, "invalid lock object pointer dected"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
459 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
460 #endif |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
461 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
462 if (JVMCIUseFastLocking) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
463 // When using fast locking, the compiled code has already tried the fast case |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
464 ObjectSynchronizer::slow_exit(obj, lock, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
465 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
466 ObjectSynchronizer::fast_exit(obj, lock, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
467 } |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
468 if (TraceJVMCI >= 3) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
469 char type[O_BUFLEN]; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
470 obj->klass()->name()->as_C_string(type, O_BUFLEN); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
471 tty->print_cr("%s: exited locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, p2i(obj->mark()), p2i(lock)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
472 tty->flush(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
473 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
474 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
475 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
476 JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, jint flags)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
477 bool string = mask_bits_are_true(flags, LOG_OBJECT_STRING); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
478 bool addr = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
479 bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
480 if (!string) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
481 if (!addr && obj->is_oop_or_null(true)) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
482 char buf[O_BUFLEN]; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
483 tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
484 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
485 tty->print(INTPTR_FORMAT, p2i(obj)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
486 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
487 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
488 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
489 assert(obj != NULL && java_lang_String::is_instance(obj), "must be"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
490 char *buf = java_lang_String::as_utf8_string(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
491 tty->print_raw(buf); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
492 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
493 if (newline) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
494 tty->cr(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
495 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
496 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
497 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
498 JRT_LEAF(void, JVMCIRuntime::write_barrier_pre(JavaThread* thread, oopDesc* obj)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
499 thread->satb_mark_queue().enqueue(obj); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
500 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
501 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
502 JRT_LEAF(void, JVMCIRuntime::write_barrier_post(JavaThread* thread, void* card_addr)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
503 thread->dirty_card_queue().enqueue(card_addr); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
504 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
505 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
506 JRT_LEAF(jboolean, JVMCIRuntime::validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
507 bool ret = true; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
508 if(!Universe::heap()->is_in_closed_subset(parent)) { |
22507
693e1df2b808
Add spaces around format macros
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22501
diff
changeset
|
509 tty->print_cr("Parent Object " INTPTR_FORMAT " not in heap", p2i(parent)); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
510 parent->print(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
511 ret=false; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
512 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
513 if(!Universe::heap()->is_in_closed_subset(child)) { |
22507
693e1df2b808
Add spaces around format macros
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22501
diff
changeset
|
514 tty->print_cr("Child Object " INTPTR_FORMAT " not in heap", p2i(child)); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
515 child->print(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
516 ret=false; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
517 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
518 return (jint)ret; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
519 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
520 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
521 JRT_ENTRY(void, JVMCIRuntime::vm_error(JavaThread* thread, jlong where, jlong format, jlong value)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
522 ResourceMark rm; |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
523 const char *error_msg = where == 0L ? "<internal JVMCI error>" : (char*) (address) where; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
524 char *detail_msg = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
525 if (format != 0L) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
526 const char* buf = (char*) (address) format; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
527 size_t detail_msg_length = strlen(buf) * 2; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
528 detail_msg = (char *) NEW_RESOURCE_ARRAY(u_char, detail_msg_length); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
529 jio_snprintf(detail_msg, detail_msg_length, buf, value); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
530 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
531 report_vm_error(__FILE__, __LINE__, error_msg, detail_msg); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
532 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
533 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
534 JRT_LEAF(oopDesc*, JVMCIRuntime::load_and_clear_exception(JavaThread* thread)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
535 oop exception = thread->exception_oop(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
536 assert(exception != NULL, "npe"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
537 thread->set_exception_oop(NULL); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
538 thread->set_exception_pc(0); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
539 return exception; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
540 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
541 |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
542 PRAGMA_DIAG_PUSH |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
543 PRAGMA_FORMAT_NONLITERAL_IGNORED |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
544 JRT_LEAF(void, JVMCIRuntime::log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
545 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
546 assert(format != NULL && java_lang_String::is_instance(format), "must be"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
547 char *buf = java_lang_String::as_utf8_string(format); |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
548 tty->print((const char*)buf, v1, v2, v3); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
549 JRT_END |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
550 PRAGMA_DIAG_POP |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
551 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
552 static void decipher(jlong v, bool ignoreZero) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
553 if (v != 0 || !ignoreZero) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
554 void* p = (void *)(address) v; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
555 CodeBlob* cb = CodeCache::find_blob(p); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
556 if (cb) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
557 if (cb->is_nmethod()) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
558 char buf[O_BUFLEN]; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
559 tty->print("%s [" INTPTR_FORMAT "+" JLONG_FORMAT "]", cb->as_nmethod_or_null()->method()->name_and_sig_as_C_string(buf, O_BUFLEN), p2i(cb->code_begin()), (jlong)((address)v - cb->code_begin())); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
560 return; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
561 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
562 cb->print_value_on(tty); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
563 return; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
564 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
565 if (Universe::heap()->is_in(p)) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
566 oop obj = oop(p); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
567 obj->print_value_on(tty); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
568 return; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
569 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
570 tty->print(INTPTR_FORMAT " [long: " JLONG_FORMAT ", double %lf, char %c]",p2i((void *)v), (jlong)v, (jdouble)v, (char)v); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
571 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
572 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
573 |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
574 PRAGMA_DIAG_PUSH |
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
575 PRAGMA_FORMAT_NONLITERAL_IGNORED |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
576 JRT_LEAF(void, JVMCIRuntime::vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
577 ResourceMark rm; |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
578 const char *buf = (const char*) (address) format; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
579 if (vmError) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
580 if (buf != NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
581 fatal(err_msg(buf, v1, v2, v3)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
582 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
583 fatal("<anonymous error>"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
584 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
585 } else if (buf != NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
586 tty->print(buf, v1, v2, v3); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
587 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
588 assert(v2 == 0, "v2 != 0"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
589 assert(v3 == 0, "v3 != 0"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
590 decipher(v1, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
591 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
592 JRT_END |
22517
0915f5bfdfaa
Adopt some jvmci-9 source changes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22515
diff
changeset
|
593 PRAGMA_DIAG_POP |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
594 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
595 JRT_LEAF(void, JVMCIRuntime::log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
596 union { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
597 jlong l; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
598 jdouble d; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
599 jfloat f; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
600 } uu; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
601 uu.l = value; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
602 switch (typeChar) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
603 case 'z': tty->print(value == 0 ? "false" : "true"); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
604 case 'b': tty->print("%d", (jbyte) value); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
605 case 'c': tty->print("%c", (jchar) value); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
606 case 's': tty->print("%d", (jshort) value); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
607 case 'i': tty->print("%d", (jint) value); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
608 case 'f': tty->print("%f", uu.f); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
609 case 'j': tty->print(JLONG_FORMAT, value); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
610 case 'd': tty->print("%lf", uu.d); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
611 default: assert(false, "unknown typeChar"); break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
612 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
613 if (newline) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
614 tty->cr(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
615 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
616 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
617 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
618 JRT_ENTRY(jint, JVMCIRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
619 return (jint) obj->identity_hash(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
620 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
621 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
622 JRT_ENTRY(jboolean, JVMCIRuntime::thread_is_interrupted(JavaThread* thread, oopDesc* receiver, jboolean clear_interrupted)) |
21207
93dc70e47fb0
documented why THREAD_IS_INTERRUPTED foreign call is NOT_LEAF
Doug Simon <doug.simon@oracle.com>
parents:
21123
diff
changeset
|
623 // Ensure that the C++ Thread and OSThread structures aren't freed before we operate. |
93dc70e47fb0
documented why THREAD_IS_INTERRUPTED foreign call is NOT_LEAF
Doug Simon <doug.simon@oracle.com>
parents:
21123
diff
changeset
|
624 // This locking requires thread_in_vm which is why this method cannot be JRT_LEAF. |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
625 Handle receiverHandle(thread, receiver); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
626 MutexLockerEx ml(thread->threadObj() == (void*)receiver ? NULL : Threads_lock); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
627 JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
628 if (receiverThread == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
629 // The other thread may exit during this process, which is ok so return false. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
630 return JNI_FALSE; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
631 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
632 return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
633 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
634 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
635 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
636 JRT_ENTRY(jint, JVMCIRuntime::test_deoptimize_call_int(JavaThread* thread, int value)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
637 deopt_caller(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
638 return value; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
639 JRT_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
640 |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
641 // private static void JVMCIClassLoaderFactory.init(ClassLoader loader) |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
642 JVM_ENTRY(void, JVM_InitJVMCIClassLoader(JNIEnv *env, jclass c, jobject loader_handle)) |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
643 SystemDictionary::init_jvmci_loader(JNIHandles::resolve(loader_handle)); |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
644 SystemDictionary::WKID scan = SystemDictionary::FIRST_JVMCI_WKID; |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
645 SystemDictionary::initialize_wk_klasses_through(SystemDictionary::LAST_JVMCI_WKID, scan, CHECK); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
646 JVM_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
647 |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
648 // private static JVMCIRuntime JVMCI.initializeRuntime() |
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
649 JVM_ENTRY(jobject, JVM_GetJVMCIRuntime(JNIEnv *env, jclass c)) |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
650 JVMCIRuntime::initialize_HotSpotJVMCIRuntime(); |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
651 return JVMCIRuntime::get_HotSpotJVMCIRuntime_jobject(); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
652 JVM_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
653 |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
654 // private static Service[] Services.getServiceImpls(String serviceClass) |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
655 JVM_ENTRY(jobject, JVM_GetJVMCIServiceImpls(JNIEnv *env, jclass c, jclass serviceClass)) |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
656 HandleMark hm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
657 ResourceMark rm; |
22416
8abc6030cf1c
ensure JVMCI class loader is initialized before attempting to load service provider
Andreas Woess <andreas.woess@oracle.com>
parents:
22401
diff
changeset
|
658 JVMCIRuntime::ensure_jvmci_class_loader_is_initialized(); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
659 KlassHandle serviceKlass(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(serviceClass))); |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
660 return JNIHandles::make_local(THREAD, JVMCIRuntime::get_service_impls(serviceKlass, THREAD)()); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
661 JVM_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
662 |
22461
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
663 Handle JVMCIRuntime::callStatic(const char* className, const char* methodName, const char* signature, JavaCallArguments* args) { |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
664 guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
665 Thread* THREAD = Thread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
666 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
667 TempNewSymbol name = SymbolTable::new_symbol(className, CHECK_ABORT_(Handle())); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
668 KlassHandle klass = load_required_class(name); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
669 TempNewSymbol runtime = SymbolTable::new_symbol(methodName, CHECK_ABORT_(Handle())); |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
670 TempNewSymbol sig = SymbolTable::new_symbol(signature, CHECK_ABORT_(Handle())); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
671 JavaValue result(T_OBJECT); |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
672 if (args == NULL) { |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
673 JavaCalls::call_static(&result, klass, runtime, sig, CHECK_ABORT_(Handle())); |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
674 } else { |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
675 JavaCalls::call_static(&result, klass, runtime, sig, args, CHECK_ABORT_(Handle())); |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
676 } |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
677 return Handle((oop)result.get_jobject()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
678 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
679 |
22511
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
680 static bool jvmci_options_file_exists() { |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
681 const char* home = Arguments::get_java_home(); |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
682 size_t path_len = strlen(home) + strlen("/lib/jvmci/options") + 1; |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
683 char path[JVM_MAXPATHLEN]; |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
684 char sep = os::file_separator()[0]; |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
685 jio_snprintf(path, JVM_MAXPATHLEN, "%s%clib%cjvmci%coptions", home, sep, sep, sep); |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
686 struct stat st; |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
687 return os::stat(path, &st) == 0; |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
688 } |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
689 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
690 void JVMCIRuntime::initialize_HotSpotJVMCIRuntime() { |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
691 if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) { |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
692 Thread* THREAD = Thread::current(); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
693 #ifdef ASSERT |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
694 // This should only be called in the context of the JVMCI class being initialized |
22054 | 695 TempNewSymbol name = SymbolTable::new_symbol("jdk/internal/jvmci/runtime/JVMCI", CHECK_ABORT); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
696 instanceKlassHandle klass = InstanceKlass::cast(load_required_class(name)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
697 assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD), |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
698 "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
699 #endif |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
700 |
22511
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
701 bool parseOptionsFile = jvmci_options_file_exists(); |
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
702 if (_options != NULL || parseOptionsFile) { |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
703 JavaCallArguments args; |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
704 oop options = java_lang_String::create_oop_from_str(_options, CHECK_ABORT); |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
705 args.push_oop(options); |
22511
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
706 args.push_int(parseOptionsFile); |
22461
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
707 callStatic("jdk/internal/jvmci/options/OptionsParser", |
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
708 "parseOptionsFromVM", |
22511
df5a7841f92a
revived support for specifying JVMCI options in <jre>/lib/jvmci/options
Doug Simon <doug.simon@oracle.com>
parents:
22507
diff
changeset
|
709 "(Ljava/lang/String;Z)Ljava/lang/Boolean;", &args); |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
710 } |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
711 |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
712 if (_compiler != NULL) { |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
713 JavaCallArguments args; |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
714 oop compiler = java_lang_String::create_oop_from_str(_compiler, CHECK_ABORT); |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
715 args.push_oop(compiler); |
22461
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
716 callStatic("jdk/internal/jvmci/hotspot/HotSpotJVMCICompilerConfig", |
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
717 "selectCompiler", |
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
718 "(Ljava/lang/String;)Ljava/lang/Boolean;", &args); |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
719 } |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
720 |
22461
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
721 Handle result = callStatic("jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime", |
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
722 "runtime", |
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
723 "()Ljdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime;"); |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
724 _HotSpotJVMCIRuntime_initialized = true; |
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
725 _HotSpotJVMCIRuntime_instance = JNIHandles::make_global(result()); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
726 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
727 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
728 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
729 void JVMCIRuntime::initialize_JVMCI() { |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
730 if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) { |
22461
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
731 callStatic("jdk/internal/jvmci/runtime/JVMCI", |
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
732 "getRuntime", |
07d9f0909560
Rename callInitializer to callStatic
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22454
diff
changeset
|
733 "()Ljdk/internal/jvmci/runtime/JVMCIRuntime;"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
734 } |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
735 assert(_HotSpotJVMCIRuntime_initialized == true, "what?"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
736 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
737 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
738 void JVMCIRuntime::metadata_do(void f(Metadata*)) { |
22515
feb4131657bb
JVMCIRuntime::metadata_do shouldn't run until HotSpotJVMCIRuntime is initialized
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22511
diff
changeset
|
739 if (!is_HotSpotJVMCIRuntime_initialized()) { |
feb4131657bb
JVMCIRuntime::metadata_do shouldn't run until HotSpotJVMCIRuntime is initialized
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22511
diff
changeset
|
740 assert(HotSpotJVMCIMetaAccessContext::klass() == NULL || |
feb4131657bb
JVMCIRuntime::metadata_do shouldn't run until HotSpotJVMCIRuntime is initialized
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22511
diff
changeset
|
741 !HotSpotJVMCIMetaAccessContext::klass()->is_linked() || |
feb4131657bb
JVMCIRuntime::metadata_do shouldn't run until HotSpotJVMCIRuntime is initialized
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22511
diff
changeset
|
742 HotSpotJVMCIMetaAccessContext::allContexts() == NULL, "shouldn't be anything registered yet"); |
22464
3fb432661d59
make JVMCIRuntime::metadata_do return immediately if HotSpotJVMCIMetaAccessContext has not yet been loaded
Doug Simon <doug.simon@oracle.com>
parents:
22461
diff
changeset
|
743 return; |
3fb432661d59
make JVMCIRuntime::metadata_do return immediately if HotSpotJVMCIMetaAccessContext has not yet been loaded
Doug Simon <doug.simon@oracle.com>
parents:
22461
diff
changeset
|
744 } |
22515
feb4131657bb
JVMCIRuntime::metadata_do shouldn't run until HotSpotJVMCIRuntime is initialized
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22511
diff
changeset
|
745 |
22454
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
746 // WeakReference<HotSpotJVMCIMetaAccessContext>[] |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
747 objArrayOop allContexts = HotSpotJVMCIMetaAccessContext::allContexts(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
748 if (allContexts == NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
749 return; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
750 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
751 for (int i = 0; i < allContexts->length(); i++) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
752 oop ref = allContexts->obj_at(i); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
753 if (ref != NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
754 oop referent = java_lang_ref_Reference::referent(ref); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
755 if (referent != NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
756 // Chunked Object[] with last element pointing to next chunk |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
757 objArrayOop metadataRoots = HotSpotJVMCIMetaAccessContext::metadataRoots(referent); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
758 while (metadataRoots != NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
759 for (int typeIndex = 0; typeIndex < metadataRoots->length() - 1; typeIndex++) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
760 oop reference = metadataRoots->obj_at(typeIndex); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
761 if (reference == NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
762 continue; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
763 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
764 oop metadataRoot = java_lang_ref_Reference::referent(reference); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
765 if (metadataRoot == NULL) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
766 continue; |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
767 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
768 if (metadataRoot->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
769 Method* method = CompilerToVM::asMethod(metadataRoot); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
770 f(method); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
771 } else if (metadataRoot->is_a(SystemDictionary::HotSpotConstantPool_klass())) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
772 ConstantPool* constantPool = CompilerToVM::asConstantPool(metadataRoot); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
773 f(constantPool); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
774 } else if (metadataRoot->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
775 Klass* klass = CompilerToVM::asKlass(metadataRoot); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
776 f(klass); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
777 } else { |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
778 metadataRoot->print(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
779 ShouldNotReachHere(); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
780 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
781 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
782 metadataRoots = (objArrayOop)metadataRoots->obj_at(metadataRoots->length() - 1); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
783 assert(metadataRoots == NULL || metadataRoots->is_objArray(), "wrong type"); |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
784 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
785 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
786 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
787 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
788 } |
76af33d4d504
Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22447
diff
changeset
|
789 |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
790 // private static void CompilerToVMImpl.init() |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
791 JVM_ENTRY(void, JVM_InitializeJVMCINatives(JNIEnv *env, jclass c2vmClass)) |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
792 JVMCIRuntime::initialize_natives(env, c2vmClass); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
793 JVM_END |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
794 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
795 void JVMCIRuntime::ensure_jvmci_class_loader_is_initialized() { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
796 // This initialization code is guarded by a static pointer to the Factory class. |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
797 // Once it is non-null, the JVMCI class loader and well known JVMCI classes are |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
798 // guaranteed to have been initialized. By going through the static |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
799 // initializer of Factory, we can rely on class initialization semantics to |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
800 // synchronize threads racing to do the initialization. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
801 static Klass* _FactoryKlass = NULL; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
802 if (_FactoryKlass == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
803 Thread* THREAD = Thread::current(); |
22054 | 804 TempNewSymbol name = SymbolTable::new_symbol("jdk/internal/jvmci/service/JVMCIClassLoaderFactory", CHECK_ABORT); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
805 KlassHandle klass = SystemDictionary::resolve_or_fail(name, true, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
806 if (HAS_PENDING_EXCEPTION) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
807 static volatile int seen_error = 0; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
808 if (!seen_error && Atomic::cmpxchg(1, &seen_error, 0) == 0) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
809 // Only report the failure on the first thread that hits it |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
810 abort_on_pending_exception(PENDING_EXCEPTION, "JVMCI classes are not available"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
811 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
812 CLEAR_PENDING_EXCEPTION; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
813 // Give first thread time to report the error. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
814 os::sleep(THREAD, 100, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
815 vm_abort(false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
816 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
817 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
818 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
819 // We cannot use jvmciJavaAccess for this because we are currently in the |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
820 // process of initializing that mechanism. |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
821 TempNewSymbol field_name = SymbolTable::new_symbol("useJVMCIClassLoader", CHECK_ABORT); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
822 fieldDescriptor field_desc; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
823 if (klass->find_field(field_name, vmSymbols::bool_signature(), &field_desc) == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
824 ResourceMark rm; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
825 fatal(err_msg("Invalid layout of %s at %s", field_name->as_C_string(), klass->external_name())); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
826 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
827 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
828 InstanceKlass* ik = InstanceKlass::cast(klass()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
829 address addr = ik->static_field_addr(field_desc.offset() - InstanceMirrorKlass::offset_of_static_fields()); |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
830 *((jboolean *) addr) = (jboolean) UseJVMCIClassLoader; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
831 klass->initialize(CHECK_ABORT); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
832 _FactoryKlass = klass(); |
21562 | 833 assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized"); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
834 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
835 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
836 |
21956
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
837 /** |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
838 * Closure for parsing a line from a *.properties file in jre/lib/jvmci/properties. |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
839 * The line must match the regular expression "[^=]+=.*". That is one or more |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
840 * characters other than '=' followed by '=' followed by zero or more characters. |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
841 * Everything before the '=' is the property name and everything after '=' is the value. |
22438
dfd506f2ed61
Add comment to jvmci.properties file.
Roland Schatz <roland.schatz@oracle.com>
parents:
22429
diff
changeset
|
842 * Lines that start with '#' are treated as comments and ignored. |
21956
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
843 * No special processing of whitespace or any escape characters is performed. |
22530
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22528
diff
changeset
|
844 * The last definition of a property "wins" (i.e., it overrides all earlier |
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22528
diff
changeset
|
845 * definitions of the property). |
21956
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
846 */ |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
847 class JVMCIPropertiesFileClosure : public ParseClosure { |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
848 SystemProperty** _plist; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
849 public: |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
850 JVMCIPropertiesFileClosure(SystemProperty** plist) : _plist(plist) {} |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
851 void do_line(char* line) { |
22438
dfd506f2ed61
Add comment to jvmci.properties file.
Roland Schatz <roland.schatz@oracle.com>
parents:
22429
diff
changeset
|
852 if (line[0] == '#') { |
dfd506f2ed61
Add comment to jvmci.properties file.
Roland Schatz <roland.schatz@oracle.com>
parents:
22429
diff
changeset
|
853 // skip comment |
dfd506f2ed61
Add comment to jvmci.properties file.
Roland Schatz <roland.schatz@oracle.com>
parents:
22429
diff
changeset
|
854 return; |
dfd506f2ed61
Add comment to jvmci.properties file.
Roland Schatz <roland.schatz@oracle.com>
parents:
22429
diff
changeset
|
855 } |
21956
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
856 size_t len = strlen(line); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
857 char* sep = strchr(line, '='); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
858 if (sep == NULL) { |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
859 warn_and_abort("invalid format: could not find '=' character"); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
860 return; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
861 } |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
862 if (sep == line) { |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
863 warn_and_abort("invalid format: name cannot be empty"); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
864 return; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
865 } |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
866 *sep = '\0'; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
867 const char* name = line; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
868 char* value = sep + 1; |
22530
cbab86a6c7f6
make processing of <jre>/lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins"
Doug Simon <doug.simon@oracle.com>
parents:
22528
diff
changeset
|
869 Arguments::PropertyList_unique_add(_plist, name, value); |
21956
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
870 } |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
871 }; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
872 |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
873 void JVMCIRuntime::parse_properties(SystemProperty** plist) { |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
874 char jvmciDir[JVM_MAXPATHLEN]; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
875 const char* fileSep = os::file_separator(); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
876 jio_snprintf(jvmciDir, sizeof(jvmciDir), "%s%slib%sjvmci", |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
877 Arguments::get_java_home(), fileSep, fileSep, fileSep); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
878 DIR* dir = os::opendir(jvmciDir); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
879 if (dir != NULL) { |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
880 struct dirent *entry; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
881 char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(jvmciDir), mtInternal); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
882 JVMCIPropertiesFileClosure closure(plist); |
21970
1e0012efac83
Also fix compiler warning (thus, error) on Windows.
Christian Wirth <christian.wirth@oracle.com>
parents:
21961
diff
changeset
|
883 const unsigned suffix_len = (unsigned)strlen(".properties"); |
21956
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
884 while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL && !closure.is_aborted()) { |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
885 const char* name = entry->d_name; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
886 if (strlen(name) > suffix_len && strcmp(name + strlen(name) - suffix_len, ".properties") == 0) { |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
887 char propertiesFilePath[JVM_MAXPATHLEN]; |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
888 jio_snprintf(propertiesFilePath, sizeof(propertiesFilePath), "%s%s%s",jvmciDir, fileSep, name); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
889 JVMCIRuntime::parse_lines(propertiesFilePath, &closure, false); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
890 } |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
891 } |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
892 FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
893 os::closedir(dir); |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
894 } |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
895 } |
35affb9c707a
add properties from <jdk>/jre/lib/jvmci/*.properties files to system properties
Doug Simon <doug.simon@oracle.com>
parents:
21876
diff
changeset
|
896 |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
897 #define CHECK_WARN_ABORT_(message) THREAD); \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
898 if (HAS_PENDING_EXCEPTION) { \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
899 warning(message); \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
900 char buf[512]; \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
901 jio_snprintf(buf, 512, "Uncaught exception at %s:%d", __FILE__, __LINE__); \ |
21562 | 902 JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \ |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
903 return; \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
904 } \ |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
905 (void)(0 |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
906 |
22429
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
907 void JVMCIRuntime::save_compiler(const char* compiler) { |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
908 assert(compiler != NULL, "npe"); |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
909 assert(_compiler == NULL, "cannot reassign JVMCI compiler"); |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
910 _compiler = compiler; |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
911 } |
a1b0a76567c7
Select default compiler from jvmci.compiler system property.
Roland Schatz <roland.schatz@oracle.com>
parents:
22416
diff
changeset
|
912 |
22398
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
913 void JVMCIRuntime::save_options(const char* options) { |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
914 assert(options != NULL, "npe"); |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
915 assert(_options == NULL, "cannot reassign JVMCI options"); |
4f6caa445b92
moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
916 _options = options; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
917 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
918 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
919 Handle JVMCIRuntime::create_Service(const char* name, TRAPS) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
920 TempNewSymbol kname = SymbolTable::new_symbol(name, CHECK_NH); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
921 Klass* k = resolve_or_fail(kname, CHECK_NH); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
922 instanceKlassHandle klass(THREAD, k); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
923 klass->initialize(CHECK_NH); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
924 klass->check_valid_for_instantiation(true, CHECK_NH); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
925 JavaValue result(T_VOID); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
926 instanceHandle service = klass->allocate_instance_handle(CHECK_NH); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
927 JavaCalls::call_special(&result, service, klass, vmSymbols::object_initializer_name(), vmSymbols::void_method_signature(), THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
928 return service; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
929 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
930 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
931 void JVMCIRuntime::shutdown() { |
21527
07b088d61d5d
added HotSpotJVMCIRuntime* classes, replaced references to HotSpotGraalRuntime in VM with HotSpotJVMCIRuntime (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21526
diff
changeset
|
932 if (_HotSpotJVMCIRuntime_instance != NULL) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
933 _shutdown_called = true; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
934 JavaThread* THREAD = JavaThread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
935 HandleMark hm(THREAD); |
21616
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21614
diff
changeset
|
936 Handle receiver = get_HotSpotJVMCIRuntime(); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
937 JavaValue result(T_VOID); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
938 JavaCallArguments args; |
21616
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21614
diff
changeset
|
939 args.push_oop(receiver); |
4c146c9367b6
recast VM compilation request via JVMCI to be a HotSpot JVMCI event, removing the last direct reference to a Graal class in the VM (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21614
diff
changeset
|
940 JavaCalls::call_special(&result, receiver->klass(), vmSymbols::shutdown_method_name(), vmSymbols::void_method_signature(), &args, CHECK_ABORT); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
941 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
942 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
943 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
944 void JVMCIRuntime::call_printStackTrace(Handle exception, Thread* thread) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
945 assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected"); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
946 JavaValue result(T_VOID); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
947 JavaCalls::call_virtual(&result, |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
948 exception, |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
949 KlassHandle(thread, |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
950 SystemDictionary::Throwable_klass()), |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
951 vmSymbols::printStackTrace_name(), |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
952 vmSymbols::void_method_signature(), |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
953 thread); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
954 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
955 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
956 void JVMCIRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
957 Thread* THREAD = Thread::current(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
958 CLEAR_PENDING_EXCEPTION; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
959 tty->print_raw_cr(message); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
960 call_printStackTrace(exception, THREAD); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
961 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
962 // Give other aborting threads to also print their stack traces. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
963 // This can be very useful when debugging class initialization |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
964 // failures. |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
965 os::sleep(THREAD, 200, false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
966 |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
967 vm_abort(dump_core); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
968 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
969 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
970 Klass* JVMCIRuntime::resolve_or_null(Symbol* name, TRAPS) { |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
971 return SystemDictionary::resolve_or_null(name, SystemDictionary::jvmci_loader(), Handle(), CHECK_NULL); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
972 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
973 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
974 Klass* JVMCIRuntime::resolve_or_fail(Symbol* name, TRAPS) { |
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
975 return SystemDictionary::resolve_or_fail(name, SystemDictionary::jvmci_loader(), Handle(), true, CHECK_NULL); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
976 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
977 |
21559
be896a1983c0
recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
978 Klass* JVMCIRuntime::load_required_class(Symbol* name) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
979 Klass* klass = resolve_or_null(name, Thread::current()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
980 if (klass == NULL) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
981 tty->print_cr("Could not load class %s", name->as_C_string()); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
982 vm_abort(false); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
983 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
984 return klass; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
985 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
986 |
21562 | 987 void JVMCIRuntime::parse_lines(char* path, ParseClosure* closure, bool warnStatFailure) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
988 struct stat st; |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
989 if (os::stat(path, &st) == 0 && (st.st_mode & S_IFREG) == S_IFREG) { // exists & is regular file |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
990 int file_handle = os::open(path, 0, 0); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
991 if (file_handle != -1) { |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
992 char* buffer = NEW_C_HEAP_ARRAY(char, st.st_size + 1, mtInternal); |
21626
ca3c6538bcec
JVMCI update makefiles for Solaris/SPARC; os::read at early stage of VM does not work, use ::read as fallback in JVMCIRuntime::parse_lines (JBS:GRAAL-54)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21617
diff
changeset
|
993 int num_read; |
22501
d113a94d4fdd
Call JVMCIRuntime::parse_properties in Threads::create_vm
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22464
diff
changeset
|
994 num_read = (int) os::read(file_handle, (char*) buffer, st.st_size); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
995 if (num_read == -1) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
996 warning("Error reading file %s due to %s", path, strerror(errno)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
997 } else if (num_read != st.st_size) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
998 warning("Only read %d of " SIZE_FORMAT " bytes from %s", num_read, (size_t) st.st_size, path); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
999 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1000 os::close(file_handle); |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1001 closure->set_filename(path); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1002 if (num_read == st.st_size) { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1003 buffer[num_read] = '\0'; |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1004 |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1005 char* line = buffer; |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1006 while (line - buffer < num_read && !closure->is_aborted()) { |
21123
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1007 // find line end (\r, \n or \r\n) |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1008 char* nextline = NULL; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1009 char* cr = strchr(line, '\r'); |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1010 char* lf = strchr(line, '\n'); |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1011 if (cr != NULL && lf != NULL) { |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1012 char* min = MIN2(cr, lf); |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1013 *min = '\0'; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1014 if (lf == cr + 1) { |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1015 nextline = lf + 1; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1016 } else { |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1017 nextline = min + 1; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1018 } |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1019 } else if (cr != NULL) { |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1020 *cr = '\0'; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1021 nextline = cr + 1; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1022 } else if (lf != NULL) { |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1023 *lf = '\0'; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1024 nextline = lf + 1; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1025 } |
21123
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1026 // trim left |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1027 while (*line == ' ' || *line == '\t') line++; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1028 char* end = line + strlen(line); |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1029 // trim right |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1030 while (end > line && (*(end -1) == ' ' || *(end -1) == '\t')) end--; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1031 *end = '\0'; |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1032 // skip comments and empty lines |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1033 if (*line != '#' && strlen(line) > 0) { |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1034 closure->parse_line(line); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1035 } |
21123
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1036 if (nextline != NULL) { |
85b0935625c1
graalRuntime: make service file parsing more robust:
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21033
diff
changeset
|
1037 line = nextline; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1038 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1039 // File without newline at the end |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1040 break; |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1041 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1042 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1043 } |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1044 FREE_C_HEAP_ARRAY(char, buffer, mtInternal); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1045 } else { |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1046 warning("Error opening file %s due to %s", path, strerror(errno)); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1047 } |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1048 } else if (warnStatFailure) { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1049 warning("Could not stat file %s due to %s", path, strerror(errno)); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1050 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1051 } |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1052 |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1053 class ServiceParseClosure : public ParseClosure { |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1054 GrowableArray<char*> _implNames; |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1055 public: |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1056 ServiceParseClosure() : _implNames() {} |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1057 void do_line(char* line) { |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1058 size_t lineLen = strlen(line); |
21876
d358434dd6b7
Use ressource array while parsing services rather than leak a heap array
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21875
diff
changeset
|
1059 char* implName = NEW_RESOURCE_ARRAY(char, lineLen + 1); |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1060 // Turn all '.'s into '/'s |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1061 for (size_t index = 0; index < lineLen; ++index) { |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1062 if (line[index] == '.') { |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1063 implName[index] = '/'; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1064 } else { |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1065 implName[index] = line[index]; |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1066 } |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1067 } |
21519
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1068 implName[lineLen] = '\0'; |
cecb4e39521c
Use files in lib/graal/options to define Graal options (-G:...) instead of generating code for them
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21516
diff
changeset
|
1069 _implNames.append(implName); |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1070 } |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1071 GrowableArray<char*>* implNames() {return &_implNames;} |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1072 }; |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1073 |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1074 |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
1075 objArrayHandle JVMCIRuntime::get_service_impls(KlassHandle serviceKlass, TRAPS) { |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1076 const char* home = Arguments::get_java_home(); |
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1077 const char* serviceName = serviceKlass->external_name(); |
22401
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1078 char* path; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1079 char sep = os::file_separator()[0]; |
22401
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1080 if (JVMCIServicesDir == NULL) { |
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1081 size_t path_len = strlen(home) + strlen("/lib/jvmci/services/") + strlen(serviceName) + 1; |
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1082 path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, path_len); |
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1083 sprintf(path, "%s%clib%cjvmci%cservices%c%s", home, sep, sep, sep, sep, serviceName); |
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1084 } else { |
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1085 size_t path_len = strlen(JVMCIServicesDir) + strlen(serviceName) + 1; |
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1086 path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, path_len); |
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1087 sprintf(path, "%s%c%s", JVMCIServicesDir, sep, serviceName); |
31e0737e2fce
added -XX:JVMCIServicesDir for specifying an alternative to <jre>/lib/jvmci/services
Doug Simon <doug.simon@oracle.com>
parents:
22398
diff
changeset
|
1088 } |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1089 ServiceParseClosure closure; |
21633
9966b358bc2b
Services: don't throw exceptions or print warnings when there are no implementations for a non-required service
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21626
diff
changeset
|
1090 parse_lines(path, &closure, false); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1091 |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1092 GrowableArray<char*>* implNames = closure.implNames(); |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
1093 objArrayOop servicesOop = oopFactory::new_objArray(serviceKlass(), implNames->length(), CHECK_(objArrayHandle())); |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1094 objArrayHandle services(THREAD, servicesOop); |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1095 for (int i = 0; i < implNames->length(); ++i) { |
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1096 char* implName = implNames->at(i); |
21563
4f63449b4422
revived post option parsing handler notification
Doug Simon <doug.simon@oracle.com>
parents:
21562
diff
changeset
|
1097 Handle service = create_Service(implName, CHECK_(objArrayHandle())); |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1098 services->obj_at_put(i, service()); |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1099 } |
21515
1ab7802d35c9
Factor GraalRuntime::parse_lines out of GraalRuntime::get_service_impls
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21207
diff
changeset
|
1100 return services; |
21033
4527d2428f37
Convert graalRuntime.cpp to unix line delimiters
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21031
diff
changeset
|
1101 } |