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 *
212 methodHandle static_target(TRAPS); // "specified" method (from constant pool)
213 Handle appendix(TRAPS); // if CPCE::has_appendix (from constant pool)
214
215 // Testers
216 bool is_invokeinterface() const { return invoke_code() == Bytecodes::_invokeinterface; }
217 bool is_invokevirtual() const { return invoke_code() == Bytecodes::_invokevirtual; }
218 bool is_invokestatic() const { return invoke_code() == Bytecodes::_invokestatic; }
219 bool is_invokespecial() const { return invoke_code() == Bytecodes::_invokespecial; }
220 bool is_invokedynamic() const { return invoke_code() == Bytecodes::_invokedynamic; }
221 bool is_invokehandle() const { return invoke_code() == Bytecodes::_invokehandle; }
222
223 bool has_receiver() const { return !is_invokestatic() && !is_invokedynamic(); }
224
225 bool is_valid() const { return is_invokeinterface() ||
226 is_invokevirtual() ||
227 is_invokestatic() ||
228 is_invokespecial() ||
229 is_invokedynamic() ||
230 is_invokehandle(); }
231
232 bool has_appendix() { return cpcache_entry()->has_appendix(); }
233
234 int size_of_parameters() const;
235
236 private:
237 // Helper to skip verification. Used is_valid() to check if the result is really an invoke
238 inline friend Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci);
239 };
240
241 inline Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci) {
242 return Bytecode_invoke(method, bci, false);
243 }
244
245
246 // Abstraction for all field accesses (put/get field/static)
247 class Bytecode_field: public Bytecode_member_ref {
248 public:
249 Bytecode_field(const methodHandle& method, int bci) : Bytecode_member_ref(method, bci) { verify(); }
250
251 // Testers
252 bool is_getfield() const { return java_code() == Bytecodes::_getfield; }
|
1 /*
2 * Copyright (c) 1997, 2018, 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 *
212 methodHandle static_target(TRAPS); // "specified" method (from constant pool)
213 Handle appendix(TRAPS); // if CPCE::has_appendix (from constant pool)
214
215 // Testers
216 bool is_invokeinterface() const { return invoke_code() == Bytecodes::_invokeinterface; }
217 bool is_invokevirtual() const { return invoke_code() == Bytecodes::_invokevirtual; }
218 bool is_invokestatic() const { return invoke_code() == Bytecodes::_invokestatic; }
219 bool is_invokespecial() const { return invoke_code() == Bytecodes::_invokespecial; }
220 bool is_invokedynamic() const { return invoke_code() == Bytecodes::_invokedynamic; }
221 bool is_invokehandle() const { return invoke_code() == Bytecodes::_invokehandle; }
222
223 bool has_receiver() const { return !is_invokestatic() && !is_invokedynamic(); }
224
225 bool is_valid() const { return is_invokeinterface() ||
226 is_invokevirtual() ||
227 is_invokestatic() ||
228 is_invokespecial() ||
229 is_invokedynamic() ||
230 is_invokehandle(); }
231
232 bool has_appendix();
233
234 int size_of_parameters() const;
235
236 private:
237 // Helper to skip verification. Used is_valid() to check if the result is really an invoke
238 inline friend Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci);
239 };
240
241 inline Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci) {
242 return Bytecode_invoke(method, bci, false);
243 }
244
245
246 // Abstraction for all field accesses (put/get field/static)
247 class Bytecode_field: public Bytecode_member_ref {
248 public:
249 Bytecode_field(const methodHandle& method, int bci) : Bytecode_member_ref(method, bci) { verify(); }
250
251 // Testers
252 bool is_getfield() const { return java_code() == Bytecodes::_getfield; }
|