Mercurial > hg > truffle
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java @ 10886:1b800f44ac0c
Make HotSpotNmethod class final and set it as declared type of OptimizedCallTarget.compiledMethod.
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Fri, 26 Jul 2013 16:53:34 +0200 |
parents | 63083745d390 |
children | 001c41b01d13 |
rev | line source |
---|---|
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.meta; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import java.lang.reflect.*; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.api.code.*; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.api.meta.*; |
10052
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10019
diff
changeset
|
31 import com.oracle.graal.graph.*; |
10654
d71c56c67921
Improve performance of calling Truffle call targets.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10581
diff
changeset
|
32 import com.oracle.graal.hotspot.bridge.*; |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 /** |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 * Implementation of {@link InstalledCode} for code installed as an nmethod. The nmethod stores a |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 * weak reference to an instance of this class. This is necessary to keep the nmethod from being |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 * unloaded while the associated {@link HotSpotNmethod} instance is alive. |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 * <p> |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 * Note that there is no (current) way for the reference from an nmethod to a {@link HotSpotNmethod} |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 * instance to be anything but weak. This is due to the fact that HotSpot does not treat nmethods as |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 * strong GC roots. |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 */ |
10886
1b800f44ac0c
Make HotSpotNmethod class final and set it as declared type of OptimizedCallTarget.compiledMethod.
Andreas Woess <andreas.woess@jku.at>
parents:
10659
diff
changeset
|
43 public final class HotSpotNmethod extends HotSpotInstalledCode { |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 private static final long serialVersionUID = -1784683588947054103L; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 private final HotSpotResolvedJavaMethod method; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 private final boolean isDefault; |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
49 private final boolean isExternal; |
10052
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10019
diff
changeset
|
50 private final Graph graph; |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 |
10052
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10019
diff
changeset
|
52 public HotSpotNmethod(HotSpotResolvedJavaMethod method, boolean isDefault, Graph graph) { |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 this.method = method; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 this.isDefault = isDefault; |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
55 this.isExternal = false; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
56 this.graph = graph; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
57 } |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
58 |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
59 public HotSpotNmethod(HotSpotResolvedJavaMethod method, boolean isDefault, boolean isExternal, Graph graph) { |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
60 this.method = method; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
61 this.isDefault = isDefault; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
62 this.isExternal = isExternal; |
10052
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10019
diff
changeset
|
63 this.graph = graph; |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 public boolean isDefault() { |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 return isDefault; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 } |
10581
63d0eaa9b25d
PTX checkstyle nits
Morris Meyer <morris.meyer@oracle.com>
parents:
10577
diff
changeset
|
69 |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
70 public boolean isExternal() { |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
71 return isExternal; |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
72 } |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 |
10052
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10019
diff
changeset
|
74 public Graph getGraph() { |
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10019
diff
changeset
|
75 return graph; |
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10019
diff
changeset
|
76 } |
5b21ddb3deaa
readd optional graph to HotSpotNmethod
Andreas Woess <andreas.woess@jku.at>
parents:
10019
diff
changeset
|
77 |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 @Override |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 public ResolvedJavaMethod getMethod() { |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 return method; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 @Override |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 public boolean isValid() { |
10475
3489047ffea2
Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10052
diff
changeset
|
85 return codeBlob != 0; |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 @Override |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 public void invalidate() { |
10476
cd68d6902328
Fix invalidateInstalledCode and delete isInstalledCodeValid.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10475
diff
changeset
|
90 graalRuntime().getCompilerToVM().invalidateInstalledCode(this); |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 @Override |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 public String toString() { |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 return String.format("InstalledNmethod[method=%s, codeBlob=0x%x, isDefault=%b]", method, codeBlob, isDefault); |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 @Override |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 public Object execute(Object arg1, Object arg2, Object arg3) throws InvalidInstalledCodeException { |
10659
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
100 assert checkThreeObjectArgs(); |
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
101 return CompilerToVMImpl.executeCompiledMethodIntrinsic(arg1, arg2, arg3, this); |
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
102 } |
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
103 |
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
104 protected boolean checkThreeObjectArgs() { |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 assert method.getSignature().getParameterCount(!Modifier.isStatic(method.getModifiers())) == 3; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
106 assert method.getSignature().getParameterKind(0) == Kind.Object; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 assert method.getSignature().getParameterKind(1) == Kind.Object; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 assert !Modifier.isStatic(method.getModifiers()) || method.getSignature().getParameterKind(2) == Kind.Object; |
10659
63083745d390
Clean up OptimizedCallTarget and HotSpotNmethod.execute.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10654
diff
changeset
|
109 return true; |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 private boolean checkArgs(Object... args) { |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
113 JavaType[] sig = MetaUtil.signatureToTypes(method); |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
114 assert args.length == sig.length : MetaUtil.format("%H.%n(%p): expected ", method) + sig.length + " args, got " + args.length; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
115 for (int i = 0; i < sig.length; i++) { |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
116 Object arg = args[i]; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
117 if (arg == null) { |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 assert sig[i].getKind() == Kind.Object : MetaUtil.format("%H.%n(%p): expected arg ", method) + i + " to be Object, not " + sig[i]; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 } else if (sig[i].getKind() != Kind.Object) { |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 assert sig[i].getKind().toBoxedJavaClass() == arg.getClass() : MetaUtil.format("%H.%n(%p): expected arg ", method) + i + " to be " + sig[i] + ", not " + arg.getClass(); |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 return true; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 @Override |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 public Object executeVarargs(Object... args) throws InvalidInstalledCodeException { |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 assert checkArgs(args); |
10577
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
129 if (isExternal()) { |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
130 return graalRuntime().getCompilerToGPU().executeExternalMethodVarargs(args, this); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
131 } else { |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
132 return graalRuntime().getCompilerToVM().executeCompiledMethodVarargs(args, this); |
9c7d9e2c8326
PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents:
10479
diff
changeset
|
133 } |
9668
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 @Override |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 public long getStart() { |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 return isValid() ? start : 0; |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 } |
fe9a18fbb15e
added subclasses for HotSpotInstalledCode: HotSpotNmethod and HotSpotRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 } |