Mercurial > hg > truffle
annotate src/cpu/x86/vm/interp_masm_x86.cpp @ 13806:0a20f43a4a78
Merge fixes.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 28 Jan 2014 13:36:16 +0100 |
parents | 5ccbab1c69f3 |
children | 8cdf3f43f63e |
rev | line source |
---|---|
12962
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
1 /* |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
4 * |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
8 * |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
13 * accompanied this code). |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
14 * |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
18 * |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
21 * questions. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
22 * |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
23 */ |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
24 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
26 #include "interp_masm_x86.hpp" |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
27 #include "interpreter/interpreter.hpp" |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
28 #include "oops/methodData.hpp" |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
29 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
30 #ifndef CC_INTERP |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
31 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
32 Label update, next, none; |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
33 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
34 verify_oop(obj); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
35 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
36 testptr(obj, obj); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
37 jccb(Assembler::notZero, update); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
38 orptr(mdo_addr, TypeEntries::null_seen); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
39 jmpb(next); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
40 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
41 bind(update); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
42 load_klass(obj, obj); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
43 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
44 xorptr(obj, mdo_addr); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
45 testptr(obj, TypeEntries::type_klass_mask); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
46 jccb(Assembler::zero, next); // klass seen before, nothing to |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
47 // do. The unknown bit may have been |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
48 // set already but no need to check. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
49 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
50 testptr(obj, TypeEntries::type_unknown); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
51 jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
52 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
53 cmpptr(mdo_addr, 0); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
54 jccb(Assembler::equal, none); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
55 cmpptr(mdo_addr, TypeEntries::null_seen); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
56 jccb(Assembler::equal, none); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
57 // There is a chance that the checks above (re-reading profiling |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
58 // data from memory) fail if another thread has just set the |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
59 // profiling to this obj's klass |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
60 xorptr(obj, mdo_addr); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
61 testptr(obj, TypeEntries::type_klass_mask); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
62 jccb(Assembler::zero, next); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
63 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
64 // different than before. Cannot keep accurate profile. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
65 orptr(mdo_addr, TypeEntries::type_unknown); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
66 jmpb(next); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
67 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
68 bind(none); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
69 // first time here. Set profile type. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
70 movptr(mdo_addr, obj); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
71 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
72 bind(next); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
73 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
74 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
75 void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
76 if (!ProfileInterpreter) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
77 return; |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
78 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
79 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
80 if (MethodData::profile_arguments() || MethodData::profile_return()) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
81 Label profile_continue; |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
82 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
83 test_method_data_pointer(mdp, profile_continue); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
84 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
85 int off_to_start = is_virtual ? in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size()); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
86 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
87 cmpb(Address(mdp, in_bytes(DataLayout::tag_offset()) - off_to_start), is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
88 jcc(Assembler::notEqual, profile_continue); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
89 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
90 if (MethodData::profile_arguments()) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
91 Label done; |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
92 int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset()); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
93 addptr(mdp, off_to_args); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
94 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
95 for (int i = 0; i < TypeProfileArgsLimit; i++) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
96 if (i > 0 || MethodData::profile_return()) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
97 // If return value type is profiled we may have no argument to profile |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
98 movptr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args)); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
99 subl(tmp, i*TypeStackSlotEntries::per_arg_count()); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
100 cmpl(tmp, TypeStackSlotEntries::per_arg_count()); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
101 jcc(Assembler::less, done); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
102 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
103 movptr(tmp, Address(callee, Method::const_offset())); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
104 load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset())); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
105 // stack offset o (zero based) from the start of the argument |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
106 // list, for n arguments translates into offset n - o - 1 from |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
107 // the end of the argument list |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
108 subptr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::stack_slot_offset(i))-off_to_args)); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
109 subl(tmp, 1); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
110 Address arg_addr = argument_address(tmp); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
111 movptr(tmp, arg_addr); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
112 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
113 Address mdo_arg_addr(mdp, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
114 profile_obj_type(tmp, mdo_arg_addr); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
115 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
116 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size()); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
117 addptr(mdp, to_add); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
118 off_to_args += to_add; |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
119 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
120 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
121 if (MethodData::profile_return()) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
122 movptr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args)); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
123 subl(tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count()); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
124 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
125 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
126 bind(done); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
127 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
128 if (MethodData::profile_return()) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
129 // We're right after the type profile for the last |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
130 // argument. tmp is the number of cell left in the |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
131 // CallTypeData/VirtualCallTypeData to reach its end. Non null |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
132 // if there's a return to profile. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
133 assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), "can't move past ret type"); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
134 shll(tmp, exact_log2(DataLayout::cell_size)); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
135 addptr(mdp, tmp); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
136 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
137 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
138 } else { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
139 assert(MethodData::profile_return(), "either profile call args or call ret"); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
140 update_mdp_by_constant(mdp, in_bytes(ReturnTypeEntry::size())); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
141 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
142 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
143 // mdp points right after the end of the |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
144 // CallTypeData/VirtualCallTypeData, right after the cells for the |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
145 // return value type if there's one |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
146 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
147 bind(profile_continue); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
148 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
149 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
150 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
151 void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
152 assert_different_registers(mdp, ret, tmp, _bcp_register); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
153 if (ProfileInterpreter && MethodData::profile_return()) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
154 Label profile_continue, done; |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
155 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
156 test_method_data_pointer(mdp, profile_continue); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
157 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
158 if (MethodData::profile_return_jsr292_only()) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
159 // If we don't profile all invoke bytecodes we must make sure |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
160 // it's a bytecode we indeed profile. We can't go back to the |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
161 // begining of the ProfileData we intend to update to check its |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
162 // type because we're right after it and we don't known its |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
163 // length |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
164 Label do_profile; |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
165 cmpb(Address(_bcp_register, 0), Bytecodes::_invokedynamic); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
166 jcc(Assembler::equal, do_profile); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
167 cmpb(Address(_bcp_register, 0), Bytecodes::_invokehandle); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
168 jcc(Assembler::equal, do_profile); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
169 get_method(tmp); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
170 cmpb(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
171 jcc(Assembler::notEqual, profile_continue); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
172 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
173 bind(do_profile); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
174 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
175 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
176 Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size())); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
177 mov(tmp, ret); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
178 profile_obj_type(tmp, mdo_ret_addr); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
179 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
180 bind(profile_continue); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
181 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
182 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
183 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
184 void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
185 if (ProfileInterpreter && MethodData::profile_parameters()) { |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
186 Label profile_continue, done; |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
187 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
188 test_method_data_pointer(mdp, profile_continue); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
189 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
190 // Load the offset of the area within the MDO used for |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
191 // parameters. If it's negative we're not profiling any parameters |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
192 movl(tmp1, Address(mdp, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()))); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
193 testl(tmp1, tmp1); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
194 jcc(Assembler::negative, profile_continue); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
195 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
196 // Compute a pointer to the area for parameters from the offset |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
197 // and move the pointer to the slot for the last |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
198 // parameters. Collect profiling from last parameter down. |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
199 // mdo start + parameters offset + array length - 1 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
200 addptr(mdp, tmp1); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
201 movptr(tmp1, Address(mdp, in_bytes(ArrayData::array_len_offset()))); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
202 decrement(tmp1, TypeStackSlotEntries::per_arg_count()); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
203 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
204 Label loop; |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
205 bind(loop); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
206 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
207 int off_base = in_bytes(ParametersTypeData::stack_slot_offset(0)); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
208 int type_base = in_bytes(ParametersTypeData::type_offset(0)); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
209 Address::ScaleFactor per_arg_scale = Address::times(DataLayout::cell_size); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
210 Address arg_off(mdp, tmp1, per_arg_scale, off_base); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
211 Address arg_type(mdp, tmp1, per_arg_scale, type_base); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
212 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
213 // load offset on the stack from the slot for this parameter |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
214 movptr(tmp2, arg_off); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
215 negptr(tmp2); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
216 // read the parameter from the local area |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
217 movptr(tmp2, Address(_locals_register, tmp2, Interpreter::stackElementScale())); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
218 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
219 // profile the parameter |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
220 profile_obj_type(tmp2, arg_type); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
221 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
222 // go to next parameter |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
223 decrement(tmp1, TypeStackSlotEntries::per_arg_count()); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
224 jcc(Assembler::positive, loop); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
225 |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
226 bind(profile_continue); |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
227 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
228 } |
5ccbab1c69f3
8026251: New type profiling points: parameters to methods
roland
parents:
diff
changeset
|
229 #endif |