Mercurial > hg > truffle
annotate src/gpu/hsail/vm/gpu_hsail.cpp @ 15532:fd47de8808fc
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 06 May 2014 11:34:23 +0200 |
parents | d370d87e528f |
children | 063ec2920d21 |
rev | line source |
---|---|
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 * |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 */ |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 #include "runtime/javaCalls.hpp" |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 #include "runtime/gpu.hpp" |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
28 #include "runtime/deoptimization.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
29 #include "gpu_hsail.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
30 #include "utilities/debug.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
31 #include "utilities/exceptions.hpp" |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
32 #include "hsail/vm/gpu_hsail.hpp" |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 #include "utilities/globalDefinitions.hpp" |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 #include "utilities/ostream.hpp" |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
35 #include "graal/graalEnv.hpp" |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
36 #include "graal/graalCompiler.hpp" |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
37 #include "graal/graalJavaAccess.hpp" |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 #include "hsailKernelArguments.hpp" |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
39 #include "hsailJavaCallArguments.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
40 #include "code/pcDesc.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
41 #include "code/scopeDesc.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
42 #include "graal/graalVMToCompiler.hpp" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
43 #include "gpu_hsail_Frame.hpp" |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
45 // Entry to GPU native method implementation that transitions current thread to '_thread_in_vm'. |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
46 #define GPU_VMENTRY(result_type, name, signature) \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
47 JNIEXPORT result_type JNICALL name signature { \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
48 GRAAL_VM_ENTRY_MARK; \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
49 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
50 // Entry to GPU native method implementation that calls a JNI function |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
51 // and hence cannot transition current thread to '_thread_in_vm'. |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
52 #define GPU_ENTRY(result_type, name, signature) \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
53 JNIEXPORT result_type JNICALL name signature { \ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
54 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
55 #define GPU_END } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
56 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
57 #define CC (char*) /*cast a literal from (const char*)*/ |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
58 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(f)) |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
59 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
60 #define OBJECT "Ljava/lang/Object;" |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
61 #define STRING "Ljava/lang/String;" |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
62 #define JLTHREAD "Ljava/lang/Thread;" |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
63 #define HS_INSTALLED_CODE "Lcom/oracle/graal/hotspot/meta/HotSpotInstalledCode;" |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
64 #define HS_COMPILED_NMETHOD "Lcom/oracle/graal/hotspot/HotSpotCompiledNmethod;" |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
65 #define HS_NMETHOD "Lcom/oracle/graal/hotspot/meta/HotSpotNmethod;" |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
66 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
67 JNINativeMethod Hsail::HSAIL_methods[] = { |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
68 {CC"initialize", CC"()Z", FN_PTR(Hsail::initialize)}, |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
69 {CC"generateKernel", CC"([B" STRING ")J", FN_PTR(Hsail::generate_kernel)}, |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
70 {CC"executeKernel0", CC"("HS_INSTALLED_CODE"I["OBJECT"["OBJECT"["JLTHREAD"I[I)Z", FN_PTR(Hsail::execute_kernel_void_1d)}, |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
71 }; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
72 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
73 void * Hsail::_device_context = NULL; |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
74 jint Hsail::_notice_safepoints = false; |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
76 Hsail::okra_create_context_func_t Hsail::_okra_create_context; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
77 Hsail::okra_create_kernel_func_t Hsail::_okra_create_kernel; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
78 Hsail::okra_push_object_func_t Hsail::_okra_push_object; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
79 Hsail::okra_push_boolean_func_t Hsail::_okra_push_boolean; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
80 Hsail::okra_push_byte_func_t Hsail::_okra_push_byte; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
81 Hsail::okra_push_double_func_t Hsail::_okra_push_double; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
82 Hsail::okra_push_float_func_t Hsail::_okra_push_float; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
83 Hsail::okra_push_int_func_t Hsail::_okra_push_int; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
84 Hsail::okra_push_long_func_t Hsail::_okra_push_long; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
85 Hsail::okra_execute_with_range_func_t Hsail::_okra_execute_with_range; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
86 Hsail::okra_clearargs_func_t Hsail::_okra_clearargs; |
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
87 Hsail::okra_register_heap_func_t Hsail::_okra_register_heap; |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
89 struct Stats { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
90 int _dispatches; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
91 int _deopts; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
92 int _overflows; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
93 bool _changeSeen; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
94 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
95 public: |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
96 Stats() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
97 _dispatches = _deopts = _overflows = 0; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
98 _changeSeen = false; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
99 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
100 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
101 void incDeopts() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
102 _deopts++; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
103 _changeSeen = true; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
104 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
105 void incOverflows() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
106 _overflows++; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
107 _changeSeen = true; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
108 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
109 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
110 void finishDispatch() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
111 _dispatches++; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
112 if (_changeSeen) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
113 // print(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
114 _changeSeen = false; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
115 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
116 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
117 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
118 void print() { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
119 tty->print_cr("Disp=%d, Deopts=%d, Ovflows=%d", _dispatches, _deopts, _overflows); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
120 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
121 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
122 }; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
123 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
124 static Stats kernelStats; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
125 |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
126 //static jint in_kernel = 0; |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
127 |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
128 void Hsail::notice_safepoints() { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
129 _notice_safepoints = true; |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
130 // if (TraceGPUInteraction) { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
131 // tty->print_cr("[HSAIL] Notice safepoint in_kernel=%d", in_kernel); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
132 // } |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
133 } |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
134 |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
135 void Hsail::ignore_safepoints() { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
136 _notice_safepoints = false; |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
137 } |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
139 void Hsail::register_heap() { |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 // After the okra functions are set up and the heap is initialized, register the java heap with HSA |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 guarantee(Universe::heap() != NULL, "heap should be there by now."); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 if (TraceGPUInteraction) { |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 tty->print_cr("[HSAIL] heap=" PTR_FORMAT, Universe::heap()); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 tty->print_cr("[HSAIL] base=0x%08x, capacity=%ld", Universe::heap()->base(), Universe::heap()->capacity()); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 } |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 _okra_register_heap(Universe::heap()->base(), Universe::heap()->capacity()); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 } |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
148 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
149 GPU_VMENTRY(jboolean, Hsail::execute_kernel_void_1d, (JNIEnv* env, jclass, jobject kernel_handle, jint dimX, jobject args, jobject oops_save, |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
150 jobject donor_threads, jint allocBytesPerWorkitem, jobject oop_map_array)) |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
151 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
152 ResourceMark rm; |
15161
2c940b1a48d8
Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15067
diff
changeset
|
153 jlong nmethodValue = InstalledCode::address(kernel_handle); |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
154 if (nmethodValue == 0) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
155 SharedRuntime::throw_and_post_jvmti_exception(JavaThread::current(), vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException(), NULL); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
156 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
157 nmethod* nm = (nmethod*) (address) nmethodValue; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
158 methodHandle mh = nm->method(); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
159 Symbol* signature = mh->signature(); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
160 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
161 void* kernel = (void*) HotSpotInstalledCode::codeStart(kernel_handle); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
162 if (kernel == NULL) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
163 SharedRuntime::throw_and_post_jvmti_exception(JavaThread::current(), vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException(), NULL); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
164 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
165 |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
166 return execute_kernel_void_1d_internal((address) kernel, dimX, args, mh, nm, oops_save, donor_threads, allocBytesPerWorkitem, oop_map_array, CHECK_0); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
167 GPU_END |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
168 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
169 static void showRanges(jboolean *a, int len) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
170 // show ranges |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
171 bool lookFor = true; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
172 for (int i = 0; i < len; i++) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
173 if ((lookFor == true) && (a[i] != 0)) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
174 tty->print("%d", i); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
175 lookFor = false; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
176 } else if ((lookFor == false) && (a[i] == 0)) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
177 tty->print_cr("-%d", i-1); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
178 lookFor = true; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
179 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
180 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
181 if (lookFor == false) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
182 tty->print_cr("-%d", len-1); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
183 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
184 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
185 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
186 // fill and retire old tlab and get a new one |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
187 // if we can't get one, no problem someone will eventually do a gc |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
188 void Hsail::getNewTlabForDonorThread(ThreadLocalAllocBuffer* tlab, size_t tlabMinHsail) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
189 tlab->clear_before_allocation(); // fill and retire old tlab (will also check for null) |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
190 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
191 // get a size for a new tlab that is at least tlabMinHsail. |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
192 size_t new_tlab_size = tlab->compute_size(tlabMinHsail); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
193 if (new_tlab_size == 0) return; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
194 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
195 HeapWord* tlab_start = Universe::heap()->allocate_new_tlab(new_tlab_size); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
196 if (tlab_start == NULL) return; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
197 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
198 // ..and clear it if required |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
199 if (ZeroTLAB) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
200 Copy::zero_to_words(tlab_start, new_tlab_size); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
201 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
202 // and init the tlab pointers |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
203 tlab->fill(tlab_start, tlab_start, new_tlab_size); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
204 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
205 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
206 static void printTlabInfo (ThreadLocalAllocBuffer* tlab) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
207 HeapWord *start = tlab->start(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
208 HeapWord *top = tlab->top(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
209 HeapWord *end = tlab->end(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
210 // sizes are in bytes |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
211 size_t tlabFree = tlab->free() * HeapWordSize; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
212 size_t tlabUsed = tlab->used() * HeapWordSize; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
213 size_t tlabSize = tlabFree + tlabUsed; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
214 double freePct = 100.0 * (double) tlabFree/(double) tlabSize; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
215 tty->print_cr("(%p, %p, %p), siz=%ld, free=%ld (%f%%)", start, top, end, tlabSize, tlabFree, freePct); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
216 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
217 |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
218 class OopSaver : public StackObj { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
219 private: |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
220 objArrayOop _oopsSaveArray; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
221 typeArrayOop _oopMapArray; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
222 jobject _oops_save; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
223 jobject _oop_map_array; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
224 int _last_pcoffset; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
225 int _last_idx; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
226 int _saveAreaCounts; |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
227 |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
228 enum { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
229 SAVEAREACOUNTS_OFST=0, |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
230 SPAN_OFST=1, |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
231 HEADERSIZE=2 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
232 }; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
233 int mapPcOffsetToIndex(int pcOffset) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
234 if (pcOffset == _last_pcoffset) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
235 return _last_idx; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
236 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
237 int span = _oopMapArray->int_at(SPAN_OFST); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
238 for (int idx = HEADERSIZE; idx < _oopMapArray->length(); idx += span) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
239 int ofst = _oopMapArray->int_at(idx); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
240 if (ofst == pcOffset) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
241 _last_pcoffset = pcOffset; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
242 _last_idx = idx + 1; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
243 return _last_idx; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
244 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
245 } |
15488
d370d87e528f
fixed clang compilation error
Doug Simon <doug.simon@oracle.com>
parents:
15482
diff
changeset
|
246 ShouldNotReachHere(); |
d370d87e528f
fixed clang compilation error
Doug Simon <doug.simon@oracle.com>
parents:
15482
diff
changeset
|
247 return -1; |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
248 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
249 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
250 public: |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
251 OopSaver(jobject oops_save, jobject oop_map_array) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
252 _oops_save = oops_save; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
253 _oop_map_array = oop_map_array; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
254 _last_pcoffset = -1; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
255 _saveAreaCounts = getSaveAreaCounts(oop_map_array); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
256 resolveArrays(); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
257 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
258 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
259 void resolveArrays() { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
260 _oopsSaveArray = (objArrayOop) JNIHandles::resolve(_oops_save); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
261 _oopMapArray = (typeArrayOop) JNIHandles::resolve(_oop_map_array); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
262 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
263 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
264 void * getOopForBit(HSAILFrame * hsailFrame, int bit) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
265 assert(isOop(hsailFrame, bit), ""); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
266 void *oop; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
267 if (bit < hsailFrame->num_d_regs()) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
268 // d register |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
269 oop = (void*) hsailFrame->get_d_reg(bit); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
270 } else { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
271 // stack slot |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
272 int stackOffset = (bit - hsailFrame->num_d_regs()) * 8; // 8 bytes per stack slot |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
273 oop = (void *) hsailFrame->get_stackslot64(stackOffset); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
274 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
275 return oop; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
276 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
277 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
278 void putOopForBit(HSAILFrame * hsailFrame, int bit, void *oop) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
279 assert(isOop(hsailFrame, bit), ""); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
280 if (bit < hsailFrame->num_d_regs()) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
281 // d register |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
282 hsailFrame->put_d_reg(bit, (jlong) oop); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
283 } else { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
284 // stack slot |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
285 int stackOffset = (bit - hsailFrame->num_d_regs()) * 8; // 8 bytes per stack slot |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
286 hsailFrame->put_stackslot64(stackOffset, (jlong) oop); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
287 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
288 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
289 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
290 void saveOopsFromFrame(HSAILFrame * hsailFrame, int deoptSlot){ |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
291 // as used, no need to resolve arrays on each call |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
292 int oopsPerDeopt = hsailFrame->num_d_regs() + hsailFrame->num_stack_slots(); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
293 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
294 // handle the dregister and stackSlot based oops |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
295 for (int bit = 0; bit < oopsPerDeopt; bit++) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
296 if (isOop(hsailFrame, bit)) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
297 void* saved_oop = getOopForBit(hsailFrame, bit); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
298 int saveArrayIndex = deoptSlot * oopsPerDeopt + bit; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
299 _oopsSaveArray->obj_at_put(saveArrayIndex, (oop) saved_oop); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
300 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
301 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
302 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
303 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
304 void restoreOopsToFrame(HSAILFrame * hsailFrame, int deoptSlot, int workitem){ |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
305 // need to re-resolve on each restore |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
306 resolveArrays(); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
307 int oopsPerDeopt = hsailFrame->num_d_regs() + hsailFrame->num_stack_slots(); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
308 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
309 // handle the dregister and stackSlot based oops |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
310 for (int bit = 0; bit < oopsPerDeopt; bit++) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
311 if (isOop(hsailFrame, bit)) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
312 // the dregister or stack slot at this bit is an oop, retrieve it from array and put back in frame |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
313 int saveArrayIndex = deoptSlot * oopsPerDeopt + bit; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
314 void * newValue = (void *) _oopsSaveArray->obj_at(saveArrayIndex); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
315 void * oldValue = getOopForBit(hsailFrame, bit); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
316 assert((oldValue != 0 ? newValue != 0 : newValue == 0), "bad dregValue retrieved"); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
317 if (newValue != oldValue) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
318 if (TraceGPUInteraction) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
319 int numDRegs = hsailFrame->num_d_regs(); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
320 const char *name = (bit < numDRegs ? "$d" : "stk"); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
321 int num = (bit < numDRegs ? bit : bit - numDRegs); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
322 tty->print_cr("oop moved for %s%d, workitem %d, slot %d, old=%p, new=%p", |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
323 name, num, workitem, deoptSlot, oldValue, newValue); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
324 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
325 putOopForBit(hsailFrame, bit, newValue); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
326 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
327 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
328 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
329 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
330 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
331 bool isOop(HSAILFrame * hsailFrame, int bit){ |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
332 // re-resolve on each access |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
333 resolveArrays(); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
334 if (bit > hsailFrame->num_d_regs() + hsailFrame->num_stack_slots()) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
335 return false; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
336 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
337 int pcOffset = hsailFrame->pc_offset(); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
338 int bits_int_idx = mapPcOffsetToIndex(pcOffset) + (bit / 32); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
339 int bitpos = bit % 32; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
340 int bits = _oopMapArray->int_at(bits_int_idx); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
341 return ((bits & (1 << bitpos)) != 0); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
342 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
343 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
344 static int getSaveAreaCounts(jobject oopMapArrayObject) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
345 typeArrayOop oopMapArray = (typeArrayOop) JNIHandles::resolve(oopMapArrayObject); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
346 return oopMapArray->int_at(SAVEAREACOUNTS_OFST); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
347 } |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
348 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
349 }; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
350 |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
351 jboolean Hsail::execute_kernel_void_1d_internal(address kernel, int dimX, jobject args, methodHandle& mh, nmethod *nm, jobject oops_save, |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
352 jobject donor_threads, int allocBytesPerWorkitem, jobject oop_map_array, TRAPS) { |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
353 ResourceMark rm(THREAD); |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
354 objArrayOop argsArray = (objArrayOop) JNIHandles::resolve(args); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
355 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
356 // TODO: avoid donor thread logic if kernel does not allocate |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
357 objArrayOop donorThreadObjects = (objArrayOop) JNIHandles::resolve(donor_threads); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
358 int numDonorThreads = donorThreadObjects->length(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
359 guarantee(numDonorThreads > 0, "need at least one donor thread"); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
360 JavaThread** donorThreads = NEW_RESOURCE_ARRAY(JavaThread*, numDonorThreads); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
361 for (int i = 0; i < numDonorThreads; i++) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
362 donorThreads[i] = java_lang_Thread::thread(donorThreadObjects->obj_at(i)); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
363 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
364 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
365 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
366 // compute tlabMinHsail based on number of workitems, number of donor |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
367 // threads, allocBytesPerWorkitem rounded up |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
368 size_t tlabMinHsail = (allocBytesPerWorkitem * dimX + (numDonorThreads - 1)) / numDonorThreads; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
369 if (TraceGPUInteraction) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
370 tty->print_cr("computed tlabMinHsail = %d", tlabMinHsail); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
371 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
372 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
373 for (int i = 0; i < numDonorThreads; i++) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
374 JavaThread* donorThread = donorThreads[i]; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
375 ThreadLocalAllocBuffer* tlab = &donorThread->tlab(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
376 if (TraceGPUInteraction) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
377 tty->print("donorThread %d, is %p, tlab at %p -> ", i, donorThread, tlab); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
378 printTlabInfo(tlab); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
379 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
380 |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
381 // note: this used vs. free limit checking should be based on some |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
382 // heuristic where we see how much this kernel tends to allocate |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
383 if ((tlab->end() == NULL) || (tlab->free() * HeapWordSize < tlabMinHsail)) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
384 getNewTlabForDonorThread(tlab, tlabMinHsail); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
385 if (TraceGPUInteraction) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
386 tty->print("donorThread %d, refilled tlab, -> ", i); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
387 printTlabInfo(tlab); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
388 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
389 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
390 } |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
391 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
392 // Reset the kernel arguments |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
393 _okra_clearargs(kernel); |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
394 |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
395 // get how many bytes per deopt save area are required |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
396 int saveAreaCounts = OopSaver::getSaveAreaCounts(oop_map_array); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
397 int numSRegs = saveAreaCounts & 0xff; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
398 int numDRegs = (saveAreaCounts >> 8) & 0xff; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
399 int numStackSlots = (saveAreaCounts >> 16); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
400 int bytesPerSaveArea = numSRegs * 4 + (numDRegs + numStackSlots) * 8; |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
401 |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
402 HSAILDeoptimizationInfo* e; |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
403 if (UseHSAILDeoptimization) { |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
404 e = new (MAX_DEOPT_SLOTS, bytesPerSaveArea) HSAILDeoptimizationInfo(MAX_DEOPT_SLOTS, bytesPerSaveArea); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
405 e->set_never_ran_array(NEW_C_HEAP_ARRAY(jboolean, dimX, mtInternal)); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
406 memset(e->never_ran_array(), 0, dimX * sizeof(jboolean)); |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
407 e->set_donor_threads(donorThreads); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
408 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
409 |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
410 // This object sets up the kernel arguments |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
411 HSAILKernelArguments hka((address) kernel, mh->signature(), argsArray, mh->is_static(), e); |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
412 if (TraceGPUInteraction) { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
413 tty->print_cr("[HSAIL] range=%d", dimX); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
414 } |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
415 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
416 // if any object passed was null, throw an exception here |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
417 // doing this means the kernel code can avoid null checks on the object parameters. |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
418 if (hka.getFirstNullParameterIndex() >= 0) { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
419 char buf[64]; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
420 sprintf(buf, "Null Kernel Parameter seen, Parameter Index: %d", hka.getFirstNullParameterIndex()); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
421 JavaThread* thread = (JavaThread*)THREAD; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
422 thread->set_gpu_exception_bci(0); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
423 thread->set_gpu_exception_method(mh()); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
424 THROW_MSG_0(vmSymbols::java_lang_NullPointerException(), buf); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
425 } |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
426 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
427 // Run the kernel |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
428 bool success = false; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
429 { |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
430 TraceTime t("execute kernel", TraceGPUInteraction); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
431 |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
432 //in_kernel = 1; |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
433 // Run the kernel |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
434 success = _okra_execute_with_range(kernel, dimX); |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
435 //in_kernel = 0; |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
436 } |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
437 |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
438 // fix up any tlab tops that overflowed |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
439 bool anyOverflows = false; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
440 for (int i = 0; i < numDonorThreads; i++) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
441 JavaThread * donorThread = donorThreads[i]; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
442 ThreadLocalAllocBuffer* tlab = &donorThread->tlab(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
443 if (tlab->top() > tlab->end()) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
444 anyOverflows = true; |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
445 long overflowAmount = (long) tlab->top() - (long) tlab->pf_top(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
446 // tlab->set_top is private this ugly hack gets around that |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
447 *(long *)((char *)tlab + in_bytes(tlab->top_offset())) = (long) tlab->pf_top(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
448 if (TraceGPUInteraction) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
449 tty->print_cr("donorThread %d at %p overflowed by %ld bytes, setting last good top to %p", i, donorThread, overflowAmount, tlab->top()); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
450 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
451 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
452 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
453 if (anyOverflows) { |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
454 kernelStats.incOverflows(); |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
455 } |
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
456 |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
457 if (UseHSAILDeoptimization) { |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
458 kernelStats.incDeopts(); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
459 // check if any workitem requested a deopt |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
460 int deoptcode = e->deopt_occurred(); |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
461 if (deoptcode != 1) { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
462 if (deoptcode == 0) { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
463 if (TraceGPUInteraction && _notice_safepoints != 0) { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
464 tty->print_cr("[HSAIL] observed safepoint during kernel"); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
465 } |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
466 } else { |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
467 // error condition detected in deopt code |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
468 char msg[200]; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
469 sprintf(msg, "deopt error detected, slot for workitem %d was not empty", -1 * (deoptcode + 1)); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
470 guarantee(deoptcode == 1, msg); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
471 } |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
472 } else { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
473 |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
474 { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
475 TraceTime t3("handle deoptimizing workitems", TraceGPUInteraction); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
476 if (TraceGPUInteraction) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
477 tty->print_cr("deopt happened."); |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
478 HSAILKernelDeoptimization * pdeopt = e->get_deopt_save_state(0); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
479 tty->print_cr("first deopter was workitem %d", pdeopt->workitem()); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
480 } |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
481 |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
482 // Before handling any deopting workitems, save the pointers from |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
483 // the hsail frames in oops_save so they get adjusted by any |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
484 // GC. Need to do this before leaving thread_in_vm mode. |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
485 OopSaver oopSaver(oops_save, oop_map_array); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
486 // resolve handle only needed once here (not exiting vm mode) |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
487 oopSaver.resolveArrays(); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
488 |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
489 // since slots are allocated from the beginning, we know how far to look |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
490 assert(e->num_deopts() < e->num_slots(), "deopt save state overflow"); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
491 for (int k = 0; k < e->num_deopts(); k++) { |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
492 HSAILKernelDeoptimization * pdeopt = e->get_deopt_save_state(k); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
493 assert (pdeopt->workitem() >= 0, "bad workitem in deopt"); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
494 // this is a workitem that deopted |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
495 oopSaver.saveOopsFromFrame(pdeopt->first_frame(), k); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
496 } |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
497 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
498 // Handle any deopting workitems. |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
499 int count_deoptimized = 0; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
500 for (int k = 0; k < e->num_deopts(); k++) { |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
501 HSAILKernelDeoptimization * pdeopt = e->get_deopt_save_state(k); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
502 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
503 jint workitem = pdeopt->workitem(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
504 if (workitem != -1) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
505 int deoptId = pdeopt->pc_offset(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
506 HSAILFrame *hsailFrame = pdeopt->first_frame(); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
507 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
508 // update the hsailFrame from the oopsSaveArray |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
509 // will re-resolve the handles each time |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
510 oopSaver.restoreOopsToFrame(hsailFrame, k, workitem); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
511 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
512 JavaValue result(T_VOID); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
513 JavaCallArguments javaArgs; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
514 javaArgs.set_alternative_target(nm); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
515 javaArgs.push_int(deoptId); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
516 javaArgs.push_long((jlong) hsailFrame); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
517 |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
518 // override the deoptimization action with Action_none until we decide |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
519 // how to handle the other actions. |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
520 int myActionReason = Deoptimization::make_trap_request(Deoptimization::trap_request_reason(pdeopt->reason()), Deoptimization::Action_none); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
521 javaArgs.push_int(myActionReason); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
522 javaArgs.push_oop((oop) NULL); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
523 if (TraceGPUInteraction) { |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
524 tty->print_cr("[HSAIL] Deoptimizing to host for workitem=%d (slot=%d) with deoptId=%d, frame=" INTPTR_FORMAT ", actionAndReason=%d", workitem, k, deoptId, hsailFrame, myActionReason); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
525 // show the $d registers or stack slots containing references |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
526 int maxOopBits = hsailFrame->num_d_regs() + hsailFrame->num_stack_slots(); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
527 for (int bit = 0; bit < maxOopBits; bit++) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
528 if (oopSaver.isOop(hsailFrame, bit)) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
529 if (bit < hsailFrame->num_d_regs()) { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
530 // show $d reg oop |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
531 tty->print_cr(" oop $d%d = %p", bit, oopSaver.getOopForBit(hsailFrame, bit)); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
532 } else { |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
533 // show stack slot oop |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
534 int stackOffset = (bit - hsailFrame->num_d_regs()) * 8; // 8 bytes per stack slot |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
535 tty->print_cr(" oop stk:%d = %p", stackOffset, oopSaver.getOopForBit(hsailFrame, bit)); |
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
536 } |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
537 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
538 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
539 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
540 JavaCalls::call(&result, mh, &javaArgs, THREAD); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
541 count_deoptimized++; |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
542 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
543 } |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
544 if (TraceGPUInteraction) { |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
545 tty->print_cr("[HSAIL] Deoptimizing to host completed for %d workitems", count_deoptimized); |
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
546 } |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
547 } |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
548 } |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
549 |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
550 // Handle any never_ran workitems if there were any |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
551 { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
552 TraceTime t("handle never-rans ", TraceGPUInteraction); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
553 int count_never_ran = 0; |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
554 bool handleNeverRansHere = true; |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
555 // turn off verbose trace stuff for javacall arg setup |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
556 bool savedTraceGPUInteraction = TraceGPUInteraction; |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
557 TraceGPUInteraction = false; |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
558 jboolean *never_ran_array = e->never_ran_array(); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
559 if (handleNeverRansHere) { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
560 for (int k = 0; k < dimX; k++) { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
561 if (never_ran_array[k]) { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
562 // run it as a javaCall |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
563 KlassHandle methKlass = mh->method_holder(); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
564 Thread* THREAD = Thread::current(); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
565 JavaValue result(T_VOID); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
566 JavaCallArguments javaArgs; |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
567 // re-resolve the args_handle here |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
568 objArrayOop resolvedArgsArray = (objArrayOop) JNIHandles::resolve(args); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
569 // This object sets up the javaCall arguments |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
570 // the way argsArray is set up, this should work for instance methods as well |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
571 // (the receiver will be the first oop pushed) |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
572 HSAILJavaCallArguments hjca(&javaArgs, k, mh->signature(), resolvedArgsArray, mh->is_static()); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
573 if (mh->is_static()) { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
574 JavaCalls::call_static(&result, methKlass, mh->name(), mh->signature(), &javaArgs, THREAD); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
575 } else { |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
576 JavaCalls::call_virtual(&result, methKlass, mh->name(), mh->signature(), &javaArgs, THREAD); |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
577 } |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
578 count_never_ran++; |
14969
a6c144380ce7
HSAIL: added UseHSAILDeoptimization VM option for disabling HSAIL deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14768
diff
changeset
|
579 } |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
580 } |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
581 TraceGPUInteraction = savedTraceGPUInteraction; |
15482
a250a512434d
HSAIL: support for object values in stack slots at deoptimization points
Doug Simon <doug.simon@oracle.com>
parents:
15177
diff
changeset
|
582 if (TraceGPUInteraction && (count_never_ran > 0)) { |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
583 tty->print_cr("%d workitems never ran, have been run via JavaCall", count_never_ran); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
584 showRanges(never_ran_array, dimX); |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
585 } |
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
586 } // end of never-ran handling |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
587 } |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
588 |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
589 FREE_C_HEAP_ARRAY(jboolean, e->never_ran_array(), mtInternal); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
590 delete e; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
591 } |
15066
2cae21d9f122
HSAIL: initial support for object allocation in HSAIL kernels
Doug Simon <doug.simon@oracle.com>
parents:
14969
diff
changeset
|
592 kernelStats.finishDispatch(); |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
593 return success; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
594 } |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
595 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
596 GPU_ENTRY(jlong, Hsail::generate_kernel, (JNIEnv *env, jclass, jbyteArray code_handle, jstring name_handle)) |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
597 guarantee(_okra_create_kernel != NULL, "[HSAIL] Okra not linked"); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
598 ResourceMark rm; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
599 jsize name_len = env->GetStringLength(name_handle); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
600 jsize code_len = env->GetArrayLength(code_handle); |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
601 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
602 char* name = NEW_RESOURCE_ARRAY(char, name_len + 1); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
603 unsigned char *code = NEW_RESOURCE_ARRAY(unsigned char, code_len + 1); |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
604 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
605 code[code_len] = 0; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
606 name[name_len] = 0; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
607 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
608 env->GetByteArrayRegion(code_handle, 0, code_len, (jbyte*) code); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
609 env->GetStringUTFRegion(name_handle, 0, name_len, name); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
610 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
611 register_heap(); |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
612 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
613 // The kernel entrypoint is always run for the time being |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
614 const char* entryPointName = "&run"; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
615 |
13115
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
616 _device_context = _okra_create_context(); |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
617 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
618 return (jlong) _okra_create_kernel(_device_context, code, entryPointName); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
619 GPU_END |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
620 |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
621 #if defined(LINUX) |
13822
35fc64972250
fixed Linux compile error and removed name of not-yet-existing Windows Okra dll
Doug Simon <doug.simon@oracle.com>
parents:
13819
diff
changeset
|
622 static const char* okra_library_name = "libokra_x86_64.so"; |
13826
62bd4705894c
reverted removal of Okra Windows DLL name
Doug Simon <doug.simon@oracle.com>
parents:
13822
diff
changeset
|
623 #elif defined(_WINDOWS) |
62bd4705894c
reverted removal of Okra Windows DLL name
Doug Simon <doug.simon@oracle.com>
parents:
13822
diff
changeset
|
624 static char const* okra_library_name = "okra_x86_64.dll"; |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
625 #else |
13822
35fc64972250
fixed Linux compile error and removed name of not-yet-existing Windows Okra dll
Doug Simon <doug.simon@oracle.com>
parents:
13819
diff
changeset
|
626 static char const* okra_library_name = NULL; |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
627 #endif |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
628 |
13115
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
629 #define STRINGIFY(x) #x |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
630 |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
631 #define LOOKUP_OKRA_FUNCTION(name, alias) \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
632 _##alias = \ |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
633 CAST_TO_FN_PTR(alias##_func_t, os::dll_lookup(okra_lib_handle, STRINGIFY(name))); \ |
13115
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
634 if (_##alias == NULL) { \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
635 tty->print_cr("[HSAIL] ***** Error: Failed to lookup %s in %s, wrong version of OKRA?", STRINGIFY(name), okra_library_name); \ |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
636 return false; \ |
13115
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
637 } \ |
166ed1584f30
HSAIL: null checks when loading Okra library functions
Doug Simon <doug.simon@oracle.com>
parents:
13097
diff
changeset
|
638 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
639 GPU_ENTRY(jboolean, Hsail::initialize, (JNIEnv *env, jclass)) |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
640 if (okra_library_name == NULL) { |
13097 | 641 if (TraceGPUInteraction) { |
642 tty->print_cr("Unsupported HSAIL platform"); | |
643 } | |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
644 return false; |
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
645 } |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
646 |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
647 // here we know we have a valid okra_library_name to try to load |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
648 char ebuf[O_BUFLEN]; |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
649 char *okra_lib_name_from_env_var = getenv("_OKRA_SIM_LIB_PATH_"); |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
650 if (okra_lib_name_from_env_var != NULL) { |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
651 okra_library_name = okra_lib_name_from_env_var; |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
652 } |
13097 | 653 if (TraceGPUInteraction) { |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
654 tty->print_cr("[HSAIL] library is %s", okra_library_name); |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
655 } |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
656 void *okra_lib_handle = NULL; |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
657 #if defined(LINUX) |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
658 // Check first if the Okra library is already loaded. |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
659 // TODO: Figure out how to do this on other OSes. |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
660 okra_lib_handle = ::dlopen(okra_library_name, RTLD_LAZY | RTLD_NOLOAD); |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
661 #endif |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
662 // If Okra library is not already loaded, load it here |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
663 if (okra_lib_handle == NULL) { |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
664 okra_lib_handle = os::dll_load(okra_library_name, ebuf, O_BUFLEN); |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
665 } |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
666 if (okra_lib_handle == NULL) { |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
667 // Unable to open Okra library |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
668 if (TraceGPUInteraction) { |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
669 tty->print_cr("[HSAIL] library load failed."); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
670 } |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
671 return false; |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
672 } |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
673 |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
674 guarantee(_okra_create_context == NULL, "cannot repeat GPU initialization"); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
675 |
15067
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
676 // at this point we know okra_lib_handle is valid whether we loaded |
0e689f20706e
HSAIL: avoid loading native Okra library twice
Doug Simon <doug.simon@oracle.com>
parents:
15066
diff
changeset
|
677 // here or earlier. In either case, we can lookup the functions |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
678 LOOKUP_OKRA_FUNCTION(okra_create_context, okra_create_context); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
679 LOOKUP_OKRA_FUNCTION(okra_create_kernel, okra_create_kernel); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
680 LOOKUP_OKRA_FUNCTION(okra_push_object, okra_push_object); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
681 LOOKUP_OKRA_FUNCTION(okra_push_boolean, okra_push_boolean); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
682 LOOKUP_OKRA_FUNCTION(okra_push_byte, okra_push_byte); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
683 LOOKUP_OKRA_FUNCTION(okra_push_double, okra_push_double); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
684 LOOKUP_OKRA_FUNCTION(okra_push_float, okra_push_float); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
685 LOOKUP_OKRA_FUNCTION(okra_push_int, okra_push_int); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
686 LOOKUP_OKRA_FUNCTION(okra_push_long, okra_push_long); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
687 LOOKUP_OKRA_FUNCTION(okra_execute_with_range, okra_execute_with_range); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
688 LOOKUP_OKRA_FUNCTION(okra_clearargs, okra_clearargs); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
689 LOOKUP_OKRA_FUNCTION(okra_register_heap, okra_register_heap); |
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
690 // if we made it this far, real success |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
691 |
15177
66e3af78ea96
HSAIL: added safepoint support
Doug Simon <doug.simon@oracle.com>
parents:
15161
diff
changeset
|
692 Gpu::initialized_gpu(new Hsail()); |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
693 |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
694 return true; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
695 GPU_END |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
696 |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
13888
diff
changeset
|
697 |
13888
51584f76462d
pulled Ptx and Hsail classes out of gpu class namespace
Doug Simon <doug.simon@oracle.com>
parents:
13826
diff
changeset
|
698 bool Hsail::register_natives(JNIEnv* env) { |
13819
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
699 jclass klass = env->FindClass("com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend"); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
700 if (klass == NULL) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
701 if (TraceGPUInteraction) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
702 tty->print_cr("HSAILHotSpotBackend class not found"); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
703 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
704 return false; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
705 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
706 jint status = env->RegisterNatives(klass, HSAIL_methods, sizeof(HSAIL_methods) / sizeof(JNINativeMethod)); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
707 if (status != JNI_OK) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
708 if (TraceGPUInteraction) { |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
709 tty->print_cr("Error registering natives for HSAILHotSpotBackend: %d", status); |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
710 } |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
711 return false; |
49db2c1e3bee
added support for co-existing GPU backends (JBS:GRAAL-1)
Doug Simon <doug.simon@oracle.com>
parents:
13740
diff
changeset
|
712 } |
13740
bfd61161d752
HSAIL: support for using Okra simulator without needing to configure PATH and LD_LIBRARY_PATH
Doug Simon <doug.simon@oracle.com>
parents:
13115
diff
changeset
|
713 return true; |
12743
f1a55428a8d7
more HSAIL support in the C++ layer for executing HSAIL code on the simulator
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
714 } |