1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
119 assert(MethodHandles::is_signature_polymorphic(id), "must match an intrinsic");
120 MethodKind kind = (MethodKind)( method_handle_invoke_FIRST +
121 ((int)id - vmIntrinsics::FIRST_MH_SIG_POLY) );
122 assert(kind <= method_handle_invoke_LAST, "parallel enum ranges");
123 return kind;
124 }
125
126 #ifndef CC_INTERP
127 switch (m->intrinsic_id()) {
128 // Use optimized stub code for CRC32 native methods.
129 case vmIntrinsics::_updateCRC32 : return java_util_zip_CRC32_update;
130 case vmIntrinsics::_updateBytesCRC32 : return java_util_zip_CRC32_updateBytes;
131 case vmIntrinsics::_updateByteBufferCRC32 : return java_util_zip_CRC32_updateByteBuffer;
132 // Use optimized stub code for CRC32C methods.
133 case vmIntrinsics::_updateBytesCRC32C : return java_util_zip_CRC32C_updateBytes;
134 case vmIntrinsics::_updateDirectByteBufferCRC32C : return java_util_zip_CRC32C_updateDirectByteBuffer;
135 case vmIntrinsics::_intBitsToFloat: return java_lang_Float_intBitsToFloat;
136 case vmIntrinsics::_floatToRawIntBits: return java_lang_Float_floatToRawIntBits;
137 case vmIntrinsics::_longBitsToDouble: return java_lang_Double_longBitsToDouble;
138 case vmIntrinsics::_doubleToRawLongBits: return java_lang_Double_doubleToRawLongBits;
139 }
140 #endif // CC_INTERP
141
142 // Native method?
143 // Note: This test must come _before_ the test for intrinsic
144 // methods. See also comments below.
145 if (m->is_native()) {
146 assert(!m->is_method_handle_intrinsic(), "overlapping bits here, watch out");
147 return m->is_synchronized() ? native_synchronized : native;
148 }
149
150 // Synchronized?
151 if (m->is_synchronized()) {
152 return zerolocals_synchronized;
153 }
154
155 if (RegisterFinalizersAtInit && m->code_size() == 1 &&
156 m->intrinsic_id() == vmIntrinsics::_Object_init) {
157 // We need to execute the special return bytecode to check for
158 // finalizer registration so create a normal frame.
165 }
166
167 // Special intrinsic method?
168 // Note: This test must come _after_ the test for native methods,
169 // otherwise we will run into problems with JDK 1.2, see also
170 // TemplateInterpreterGenerator::generate_method_entry() for
171 // for details.
172 switch (m->intrinsic_id()) {
173 case vmIntrinsics::_dsin : return java_lang_math_sin ;
174 case vmIntrinsics::_dcos : return java_lang_math_cos ;
175 case vmIntrinsics::_dtan : return java_lang_math_tan ;
176 case vmIntrinsics::_dabs : return java_lang_math_abs ;
177 case vmIntrinsics::_dsqrt : return java_lang_math_sqrt ;
178 case vmIntrinsics::_dlog : return java_lang_math_log ;
179 case vmIntrinsics::_dlog10: return java_lang_math_log10;
180 case vmIntrinsics::_dpow : return java_lang_math_pow ;
181 case vmIntrinsics::_dexp : return java_lang_math_exp ;
182 case vmIntrinsics::_fmaD : return java_lang_math_fmaD ;
183 case vmIntrinsics::_fmaF : return java_lang_math_fmaF ;
184
185 case vmIntrinsics::_Reference_get:
186 return java_lang_ref_reference_get;
187 }
188
189 // Accessor method?
190 if (m->is_getter()) {
191 // TODO: We should have used ::is_accessor above, but fast accessors in Zero expect only getters.
192 // See CppInterpreter::accessor_entry in cppInterpreter_zero.cpp. This should be fixed in Zero,
193 // then the call above updated to ::is_accessor
194 assert(m->size_of_parameters() == 1, "fast code for accessors assumes parameter size = 1");
195 return accessor;
196 }
197
198 // Note: for now: zero locals for all non-empty methods
199 return zerolocals;
200 }
201
202 #if INCLUDE_CDS
203
204 address AbstractInterpreter::get_trampoline_code_buffer(AbstractInterpreter::MethodKind kind) {
205 const size_t trampoline_size = SharedRuntime::trampoline_size();
206 address addr = MetaspaceShared::cds_i2i_entry_code_buffers((size_t)(AbstractInterpreter::number_of_method_entries) * trampoline_size);
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
119 assert(MethodHandles::is_signature_polymorphic(id), "must match an intrinsic");
120 MethodKind kind = (MethodKind)( method_handle_invoke_FIRST +
121 ((int)id - vmIntrinsics::FIRST_MH_SIG_POLY) );
122 assert(kind <= method_handle_invoke_LAST, "parallel enum ranges");
123 return kind;
124 }
125
126 #ifndef CC_INTERP
127 switch (m->intrinsic_id()) {
128 // Use optimized stub code for CRC32 native methods.
129 case vmIntrinsics::_updateCRC32 : return java_util_zip_CRC32_update;
130 case vmIntrinsics::_updateBytesCRC32 : return java_util_zip_CRC32_updateBytes;
131 case vmIntrinsics::_updateByteBufferCRC32 : return java_util_zip_CRC32_updateByteBuffer;
132 // Use optimized stub code for CRC32C methods.
133 case vmIntrinsics::_updateBytesCRC32C : return java_util_zip_CRC32C_updateBytes;
134 case vmIntrinsics::_updateDirectByteBufferCRC32C : return java_util_zip_CRC32C_updateDirectByteBuffer;
135 case vmIntrinsics::_intBitsToFloat: return java_lang_Float_intBitsToFloat;
136 case vmIntrinsics::_floatToRawIntBits: return java_lang_Float_floatToRawIntBits;
137 case vmIntrinsics::_longBitsToDouble: return java_lang_Double_longBitsToDouble;
138 case vmIntrinsics::_doubleToRawLongBits: return java_lang_Double_doubleToRawLongBits;
139 default: break;
140 }
141 #endif // CC_INTERP
142
143 // Native method?
144 // Note: This test must come _before_ the test for intrinsic
145 // methods. See also comments below.
146 if (m->is_native()) {
147 assert(!m->is_method_handle_intrinsic(), "overlapping bits here, watch out");
148 return m->is_synchronized() ? native_synchronized : native;
149 }
150
151 // Synchronized?
152 if (m->is_synchronized()) {
153 return zerolocals_synchronized;
154 }
155
156 if (RegisterFinalizersAtInit && m->code_size() == 1 &&
157 m->intrinsic_id() == vmIntrinsics::_Object_init) {
158 // We need to execute the special return bytecode to check for
159 // finalizer registration so create a normal frame.
166 }
167
168 // Special intrinsic method?
169 // Note: This test must come _after_ the test for native methods,
170 // otherwise we will run into problems with JDK 1.2, see also
171 // TemplateInterpreterGenerator::generate_method_entry() for
172 // for details.
173 switch (m->intrinsic_id()) {
174 case vmIntrinsics::_dsin : return java_lang_math_sin ;
175 case vmIntrinsics::_dcos : return java_lang_math_cos ;
176 case vmIntrinsics::_dtan : return java_lang_math_tan ;
177 case vmIntrinsics::_dabs : return java_lang_math_abs ;
178 case vmIntrinsics::_dsqrt : return java_lang_math_sqrt ;
179 case vmIntrinsics::_dlog : return java_lang_math_log ;
180 case vmIntrinsics::_dlog10: return java_lang_math_log10;
181 case vmIntrinsics::_dpow : return java_lang_math_pow ;
182 case vmIntrinsics::_dexp : return java_lang_math_exp ;
183 case vmIntrinsics::_fmaD : return java_lang_math_fmaD ;
184 case vmIntrinsics::_fmaF : return java_lang_math_fmaF ;
185
186 case vmIntrinsics::_Reference_get
187 : return java_lang_ref_reference_get;
188 default : break;
189 }
190
191 // Accessor method?
192 if (m->is_getter()) {
193 // TODO: We should have used ::is_accessor above, but fast accessors in Zero expect only getters.
194 // See CppInterpreter::accessor_entry in cppInterpreter_zero.cpp. This should be fixed in Zero,
195 // then the call above updated to ::is_accessor
196 assert(m->size_of_parameters() == 1, "fast code for accessors assumes parameter size = 1");
197 return accessor;
198 }
199
200 // Note: for now: zero locals for all non-empty methods
201 return zerolocals;
202 }
203
204 #if INCLUDE_CDS
205
206 address AbstractInterpreter::get_trampoline_code_buffer(AbstractInterpreter::MethodKind kind) {
207 const size_t trampoline_size = SharedRuntime::trampoline_size();
208 address addr = MetaspaceShared::cds_i2i_entry_code_buffers((size_t)(AbstractInterpreter::number_of_method_entries) * trampoline_size);
|