Mercurial > hg > graal-compiler
annotate src/share/vm/runtime/gpu.cpp @ 11825:463f51256c86
AMD64HotSpot: emit jump to IC miss handler directly instead of emitting it inside verfied_entry
for empty methods we emitted something like this if a inline cache is needed:
prefix:
00: < IC check >
...
0b: jne <ic_miss_call>
11: nop
...
verified_entry:
20: ret
ic_miss_call:
21: jmp <entry of runtime function>
when a method is deoptimized, HotSpot patches the verified_entry (0x20) with a
jump to a stub that handles call-sites that has been made non-entrant. since this jump
is 5 bytes long, it will overwrite ic_miss_call and blow up every caller that
calls this method via the unverified entry (prefix).
the fix is to emit the jump to the runtime function inside the unverfied entry:
prefix:
00: < IC check >
...
0b: je <verified_entry>
11: jeq <entry of runtime function>
16: nop
...
verified_entry:
20: ret
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Mon, 30 Sep 2013 09:32:18 +0200 |
parents | 365d8f385fb5 |
children | 8d8f63069f58 |
rev | line source |
---|---|
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
1 /* |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
4 * |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
8 * |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
14 * |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
18 * |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
22 * |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
23 */ |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
24 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
26 #include "runtime/gpu.hpp" |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
27 |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
28 bool gpu::_available = false; // does the hardware exist? |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
29 bool gpu::_gpu_linkage = false; // is the driver library to access the GPU installed |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
30 bool gpu::_initialized = false; // is the GPU device initialized |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
31 gpu::TargetGPUIL gpu::_targetIL = gpu::NONE; // No GPU detected yet. |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
32 |
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
33 void gpu::init() { |
10879
d55f24eac4b1
PTX support for Linux
Morris Meyer <morris.meyer@oracle.com>
parents:
9430
diff
changeset
|
34 #if defined(TARGET_OS_FAMILY_bsd) || defined(TARGET_OS_FAMILY_linux) |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
35 gpu::probe_gpu(); |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
36 if (gpu::get_target_il_type() == gpu::PTX) { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
37 set_gpu_linkage(gpu::Ptx::probe_linkage()); |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
38 } else { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
39 set_gpu_linkage(false); |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
40 } |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
41 #endif |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
42 } |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
43 |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
44 void gpu::initialize_gpu() { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
45 if (gpu::has_gpu_linkage()) { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
46 if (gpu::get_target_il_type() == gpu::PTX) { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
47 set_initialized(gpu::Ptx::initialize_gpu()); |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
48 } |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
49 // Add initialization of other GPUs here |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
50 } |
9430
147162b27799
GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
51 } |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
52 |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
53 void * gpu::generate_kernel(unsigned char *code, int code_len, const char *name) { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
54 if (gpu::has_gpu_linkage()) { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
55 if (gpu::get_target_il_type() == gpu::PTX) { |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
56 return (gpu::Ptx::generate_kernel(code, code_len, name)); |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
57 } |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
58 // Add kernel generation functionality of other GPUs here |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
59 } |
11609
103795ab699d
gpu.cpp: fix warning: not all control paths return a value
Andreas Woess <andreas.woess@jku.at>
parents:
11606
diff
changeset
|
60 return NULL; |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
61 } |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
62 |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
63 bool gpu::execute_kernel(address kernel, PTXKernelArguments & ptxka, JavaValue& ret) { |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
64 if (gpu::has_gpu_linkage()) { |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
65 if (gpu::get_target_il_type() == gpu::PTX) { |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
66 return (gpu::Ptx::execute_kernel(kernel, ptxka, ret)); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
67 } |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
68 // Add kernel execution functionality of other GPUs here |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
69 } |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
70 return false; |
11606
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
71 } |
4f69a5189e77
Create runtime object based on GPUIL type newly added to gpu class; some code refactoring.
bharadwaj
parents:
10879
diff
changeset
|
72 |
11822
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
73 bool gpu::execute_warp(int dimX, int dimY, int dimZ, |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
74 address kernel, PTXKernelArguments & ptxka, JavaValue& ret) { |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
75 if (gpu::has_gpu_linkage()) { |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
76 if (gpu::get_target_il_type() == gpu::PTX) { |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
77 return (gpu::Ptx::execute_warp(dimX, dimY, dimZ, kernel, ptxka, ret)); |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
78 } |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
79 // Add kernel execution functionality of other GPUs here |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
80 } |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
81 return false; |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
82 } |
365d8f385fb5
PTX: one-dimensional parallel warp invocation, ParallelOver annotation
Morris Meyer <morris.meyer@oracle.com>
parents:
11609
diff
changeset
|
83 |