Mercurial > hg > graal-compiler
annotate src/cpu/zero/vm/compiledIC_zero.cpp @ 17073:1d69b5c58bfe
Insert proxies when peeking through proxy for array length
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 09 Sep 2014 11:53:53 +0200 |
parents | a6e09d6dd8e5 |
children | c64b6b0c40c8 |
rev | line source |
---|---|
10168
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
1 /* |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
4 * |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
8 * |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
13 * accompanied this code). |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
14 * |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
18 * |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
21 * questions. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
22 * |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
23 */ |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
24 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
26 #include "classfile/systemDictionary.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
27 #include "code/codeCache.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
28 #include "code/compiledIC.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
29 #include "code/icBuffer.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
30 #include "code/nmethod.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
31 #include "code/vtableStubs.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
32 #include "interpreter/interpreter.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
33 #include "interpreter/linkResolver.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
34 #include "memory/metadataFactory.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
35 #include "memory/oopFactory.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
36 #include "oops/method.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
37 #include "oops/oop.inline.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
38 #include "oops/symbol.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
39 #include "runtime/icache.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
40 #include "runtime/sharedRuntime.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
41 #include "runtime/stubRoutines.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
42 #include "utilities/events.hpp" |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
43 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
44 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
45 // Release the CompiledICHolder* associated with this call site is there is one. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
46 void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
47 // This call site might have become stale so inspect it carefully. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
48 NativeCall* call = nativeCall_at(call_site->addr()); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
49 if (is_icholder_entry(call->destination())) { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
50 NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
51 InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
52 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
53 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
54 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
55 bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
56 // This call site might have become stale so inspect it carefully. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
57 NativeCall* call = nativeCall_at(call_site->addr()); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
58 return is_icholder_entry(call->destination()); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
59 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
60 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
61 //----------------------------------------------------------------------------- |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
62 // High-level access to an inline cache. Guaranteed to be MT-safe. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
63 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
64 CompiledIC::CompiledIC(nmethod* nm, NativeCall* call) |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
65 : _ic_call(call) |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
66 { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
67 address ic_call = call->instruction_address(); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
68 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
69 assert(ic_call != NULL, "ic_call address must be set"); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
70 assert(nm != NULL, "must pass nmethod"); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
71 assert(nm->contains(ic_call), "must be in nmethod"); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
72 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
73 // Search for the ic_call at the given address. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
74 RelocIterator iter(nm, ic_call, ic_call+1); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
75 bool ret = iter.next(); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
76 assert(ret == true, "relocInfo must exist at this address"); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
77 assert(iter.addr() == ic_call, "must find ic_call"); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
78 if (iter.type() == relocInfo::virtual_call_type) { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
79 virtual_call_Relocation* r = iter.virtual_call_reloc(); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
80 _is_optimized = false; |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
81 _value = nativeMovConstReg_at(r->cached_value()); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
82 } else { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
83 assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call"); |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
84 _is_optimized = true; |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
85 _value = NULL; |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
86 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
87 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
88 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
89 // ---------------------------------------------------------------------------- |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
90 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
91 void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
92 ShouldNotReachHere(); // Only needed for COMPILER2. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
93 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
94 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
95 int CompiledStaticCall::to_interp_stub_size() { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
96 ShouldNotReachHere(); // Only needed for COMPILER2. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
97 return 0; |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
98 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
99 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
100 // Relocation entries for call stub, compiled java to interpreter. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
101 int CompiledStaticCall::reloc_to_interp_stub() { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
102 ShouldNotReachHere(); // Only needed for COMPILER2. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
103 return 0; |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
104 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
105 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
106 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
107 ShouldNotReachHere(); // Only needed for COMPILER2. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
108 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
109 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
110 void CompiledStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
111 ShouldNotReachHere(); // Only needed for COMPILER2. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
112 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
113 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
114 //----------------------------------------------------------------------------- |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
115 // Non-product mode code. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
116 #ifndef PRODUCT |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
117 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
118 void CompiledStaticCall::verify() { |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
119 ShouldNotReachHere(); // Only needed for COMPILER2. |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
120 } |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
121 |
a6e09d6dd8e5
8003853: specify offset of IC load in java_to_interp stub
dlong
parents:
diff
changeset
|
122 #endif // !PRODUCT |