annotate src/cpu/x86/vm/interp_masm_x86.cpp @ 24166:dad95e57f1de

Update MDO with Reason_not_compiled_exception_handler
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 14 Aug 2017 08:55:23 -0700
parents b5f3a471e646
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12962
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
1 /*
23614
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
12962
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
23614
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
30
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
31 // 8u does not have InterpreterMacroAssembler::load_earlyret_value here
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
32
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
33 void InterpreterMacroAssembler::narrow(Register result) {
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
34
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
35 // Get method->_constMethod->_result_type
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
36 movptr(rcx, Address(rbp, frame::interpreter_frame_method_offset * wordSize));
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
37 movptr(rcx, Address(rcx, Method::const_offset()));
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
38 load_unsigned_byte(rcx, Address(rcx, ConstMethod::result_type_offset()));
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
39
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
40 Label done, notBool, notByte, notChar;
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
41
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
42 // common case first
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
43 cmpl(rcx, T_INT);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
44 jcc(Assembler::equal, done);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
45
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
46 // mask integer result to narrower return type.
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
47 cmpl(rcx, T_BOOLEAN);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
48 jcc(Assembler::notEqual, notBool);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
49 andl(result, 0x1);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
50 jmp(done);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
51
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
52 bind(notBool);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
53 cmpl(rcx, T_BYTE);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
54 jcc(Assembler::notEqual, notByte);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
55 LP64_ONLY(movsbl(result, result);)
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
56 NOT_LP64(shll(result, 24);) // truncate upper 24 bits
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
57 NOT_LP64(sarl(result, 24);) // and sign-extend byte
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
58 jmp(done);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
59
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
60 bind(notByte);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
61 cmpl(rcx, T_CHAR);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
62 jcc(Assembler::notEqual, notChar);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
63 LP64_ONLY(movzwl(result, result);)
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
64 NOT_LP64(andl(result, 0xFFFF);) // truncate upper 16 bits
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
65 jmp(done);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
66
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
67 bind(notChar);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
68 // cmpl(rcx, T_SHORT); // all that's left
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
69 // jcc(Assembler::notEqual, done);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
70 LP64_ONLY(movswl(result, result);)
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
71 NOT_LP64(shll(result, 16);) // truncate upper 16 bits
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
72 NOT_LP64(sarl(result, 16);) // and sign-extend short
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
73
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
74 // Nothing to do for T_INT
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
75 bind(done);
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
76 }
32b682649973 8132051: Better byte behavior
kevinw
parents: 17900
diff changeset
77
12962
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
78 #ifndef CC_INTERP
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
79 void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
80 Label update, next, none;
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
81
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
82 verify_oop(obj);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
83
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
84 testptr(obj, obj);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
85 jccb(Assembler::notZero, update);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
86 orptr(mdo_addr, TypeEntries::null_seen);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
87 jmpb(next);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
88
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
89 bind(update);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
90 load_klass(obj, obj);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
91
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
92 xorptr(obj, mdo_addr);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
93 testptr(obj, TypeEntries::type_klass_mask);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
94 jccb(Assembler::zero, next); // klass seen before, nothing to
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
95 // do. The unknown bit may have been
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
96 // set already but no need to check.
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
97
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
98 testptr(obj, TypeEntries::type_unknown);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
99 jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore.
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
100
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
101 cmpptr(mdo_addr, 0);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
102 jccb(Assembler::equal, none);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
103 cmpptr(mdo_addr, TypeEntries::null_seen);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
104 jccb(Assembler::equal, none);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
105 // There is a chance that the checks above (re-reading profiling
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
106 // data from memory) fail if another thread has just set the
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
107 // profiling to this obj's klass
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
108 xorptr(obj, mdo_addr);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
109 testptr(obj, TypeEntries::type_klass_mask);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
110 jccb(Assembler::zero, next);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
111
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
112 // different than before. Cannot keep accurate profile.
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
113 orptr(mdo_addr, TypeEntries::type_unknown);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
114 jmpb(next);
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 bind(none);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
117 // first time here. Set profile type.
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
118 movptr(mdo_addr, obj);
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 bind(next);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
121 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
122
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
123 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
124 if (!ProfileInterpreter) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
125 return;
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
126 }
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_arguments() || MethodData::profile_return()) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
129 Label profile_continue;
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
130
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
131 test_method_data_pointer(mdp, profile_continue);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
132
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
133 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
134
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
135 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
136 jcc(Assembler::notEqual, profile_continue);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
137
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
138 if (MethodData::profile_arguments()) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
139 Label done;
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
140 int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset());
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
141 addptr(mdp, off_to_args);
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 for (int i = 0; i < TypeProfileArgsLimit; i++) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
144 if (i > 0 || MethodData::profile_return()) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
145 // 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
146 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
147 subl(tmp, i*TypeStackSlotEntries::per_arg_count());
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
148 cmpl(tmp, TypeStackSlotEntries::per_arg_count());
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
149 jcc(Assembler::less, done);
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 movptr(tmp, Address(callee, Method::const_offset()));
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
152 load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset()));
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
153 // stack offset o (zero based) from the start of the argument
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
154 // list, for n arguments translates into offset n - o - 1 from
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
155 // the end of the argument list
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
156 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
157 subl(tmp, 1);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
158 Address arg_addr = argument_address(tmp);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
159 movptr(tmp, arg_addr);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
160
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
161 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
162 profile_obj_type(tmp, mdo_arg_addr);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
163
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
164 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
165 addptr(mdp, to_add);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
166 off_to_args += to_add;
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
167 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
168
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
169 if (MethodData::profile_return()) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
170 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
171 subl(tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
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
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
174 bind(done);
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 if (MethodData::profile_return()) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
177 // We're right after the type profile for the last
14260
8cdf3f43f63e 8026253: New type profiling points: sparc support
roland
parents: 12962
diff changeset
178 // argument. tmp is the number of cells left in the
12962
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
179 // CallTypeData/VirtualCallTypeData to reach its end. Non null
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
180 // if there's a return to profile.
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
181 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
182 shll(tmp, exact_log2(DataLayout::cell_size));
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
183 addptr(mdp, tmp);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
184 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
185 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
186 } else {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
187 assert(MethodData::profile_return(), "either profile call args or call ret");
17900
ce9fd31ffd14 8039975: SIGSEGV in MethodData::next_data(ProfileData*)
roland
parents: 14260
diff changeset
188 update_mdp_by_constant(mdp, in_bytes(TypeEntriesAtCall::return_only_size()));
12962
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
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
191 // mdp points right after the end of the
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
192 // CallTypeData/VirtualCallTypeData, right after the cells for the
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
193 // return value type if there's one
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
194
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
195 bind(profile_continue);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
196 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
197 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
198
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
199 void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
200 assert_different_registers(mdp, ret, tmp, _bcp_register);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
201 if (ProfileInterpreter && MethodData::profile_return()) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
202 Label profile_continue, done;
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 test_method_data_pointer(mdp, profile_continue);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
205
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
206 if (MethodData::profile_return_jsr292_only()) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
207 // 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
208 // 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
209 // begining of the ProfileData we intend to update to check its
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
210 // 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
211 // length
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
212 Label do_profile;
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
213 cmpb(Address(_bcp_register, 0), Bytecodes::_invokedynamic);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
214 jcc(Assembler::equal, do_profile);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
215 cmpb(Address(_bcp_register, 0), Bytecodes::_invokehandle);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
216 jcc(Assembler::equal, do_profile);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
217 get_method(tmp);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
218 cmpb(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
219 jcc(Assembler::notEqual, profile_continue);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
220
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
221 bind(do_profile);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
222 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
223
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
224 Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size()));
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
225 mov(tmp, ret);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
226 profile_obj_type(tmp, mdo_ret_addr);
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 bind(profile_continue);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
229 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
230 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
231
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
232 void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
233 if (ProfileInterpreter && MethodData::profile_parameters()) {
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
234 Label profile_continue, done;
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
235
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
236 test_method_data_pointer(mdp, profile_continue);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
237
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
238 // Load the offset of the area within the MDO used for
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
239 // parameters. If it's negative we're not profiling any parameters
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
240 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
241 testl(tmp1, tmp1);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
242 jcc(Assembler::negative, profile_continue);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
243
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
244 // Compute a pointer to the area for parameters from the offset
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
245 // and move the pointer to the slot for the last
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
246 // parameters. Collect profiling from last parameter down.
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
247 // mdo start + parameters offset + array length - 1
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
248 addptr(mdp, tmp1);
14260
8cdf3f43f63e 8026253: New type profiling points: sparc support
roland
parents: 12962
diff changeset
249 movptr(tmp1, Address(mdp, ArrayData::array_len_offset()));
12962
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
250 decrement(tmp1, TypeStackSlotEntries::per_arg_count());
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
251
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
252 Label loop;
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
253 bind(loop);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
254
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
255 int off_base = in_bytes(ParametersTypeData::stack_slot_offset(0));
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
256 int type_base = in_bytes(ParametersTypeData::type_offset(0));
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
257 Address::ScaleFactor per_arg_scale = Address::times(DataLayout::cell_size);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
258 Address arg_off(mdp, tmp1, per_arg_scale, off_base);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
259 Address arg_type(mdp, tmp1, per_arg_scale, type_base);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
260
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
261 // load offset on the stack from the slot for this parameter
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
262 movptr(tmp2, arg_off);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
263 negptr(tmp2);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
264 // read the parameter from the local area
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
265 movptr(tmp2, Address(_locals_register, tmp2, Interpreter::stackElementScale()));
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
266
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
267 // profile the parameter
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
268 profile_obj_type(tmp2, arg_type);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
269
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
270 // go to next parameter
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
271 decrement(tmp1, TypeStackSlotEntries::per_arg_count());
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
272 jcc(Assembler::positive, loop);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
273
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
274 bind(profile_continue);
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
275 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
276 }
5ccbab1c69f3 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
277 #endif