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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/javaClasses.inline.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/codeCacheExtensions.hpp"
30 #include "code/dependencyContext.hpp"
31 #include "compiler/compileBroker.hpp"
32 #include "interpreter/interpreter.hpp"
33 #include "interpreter/oopMapCache.hpp"
34 #include "interpreter/linkResolver.hpp"
35 #include "memory/allocation.inline.hpp"
36 #include "memory/oopFactory.hpp"
37 #include "memory/resourceArea.hpp"
38 #include "oops/objArrayOop.inline.hpp"
39 #include "oops/oop.inline.hpp"
40 #include "prims/methodHandles.hpp"
41 #include "runtime/compilationPolicy.hpp"
42 #include "runtime/javaCalls.hpp"
43 #include "runtime/timerTrace.hpp"
44 #include "runtime/reflection.hpp"
45 #include "runtime/signature.hpp"
46 #include "runtime/stubRoutines.hpp"
47 #include "utilities/exceptions.hpp"
48
49
77 _adapter_code = MethodHandlesAdapterBlob::create(adapter_code_size);
78 CodeBuffer code(_adapter_code);
79 MethodHandlesAdapterGenerator g(&code);
80 g.generate();
81 code.log_section_sizes("MethodHandlesAdapterBlob");
82 }
83
84 //------------------------------------------------------------------------------
85 // MethodHandlesAdapterGenerator::generate
86 //
87 void MethodHandlesAdapterGenerator::generate() {
88 // Generate generic method handle adapters.
89 // Generate interpreter entries
90 for (Interpreter::MethodKind mk = Interpreter::method_handle_invoke_FIRST;
91 mk <= Interpreter::method_handle_invoke_LAST;
92 mk = Interpreter::MethodKind(1 + (int)mk)) {
93 vmIntrinsics::ID iid = Interpreter::method_handle_intrinsic(mk);
94 StubCodeMark mark(this, "MethodHandle::interpreter_entry", vmIntrinsics::name_at(iid));
95 address entry = MethodHandles::generate_method_handle_interpreter_entry(_masm, iid);
96 if (entry != NULL) {
97 CodeCacheExtensions::handle_generated_pc(entry, vmIntrinsics::name_at(iid));
98 Interpreter::set_entry_for_kind(mk, entry);
99 }
100 // If the entry is not set, it will throw AbstractMethodError.
101 }
102 }
103
104 void MethodHandles::set_enabled(bool z) {
105 if (_enabled != z) {
106 guarantee(z, "can only enable once");
107 _enabled = z;
108 }
109 }
110
111 // MemberName support
112
113 // import java_lang_invoke_MemberName.*
114 enum {
115 IS_METHOD = java_lang_invoke_MemberName::MN_IS_METHOD,
116 IS_CONSTRUCTOR = java_lang_invoke_MemberName::MN_IS_CONSTRUCTOR,
117 IS_FIELD = java_lang_invoke_MemberName::MN_IS_FIELD,
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/javaClasses.inline.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "code/codeCache.hpp"
29 #include "code/dependencyContext.hpp"
30 #include "compiler/compileBroker.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "interpreter/oopMapCache.hpp"
33 #include "interpreter/linkResolver.hpp"
34 #include "memory/allocation.inline.hpp"
35 #include "memory/oopFactory.hpp"
36 #include "memory/resourceArea.hpp"
37 #include "oops/objArrayOop.inline.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "prims/methodHandles.hpp"
40 #include "runtime/compilationPolicy.hpp"
41 #include "runtime/javaCalls.hpp"
42 #include "runtime/timerTrace.hpp"
43 #include "runtime/reflection.hpp"
44 #include "runtime/signature.hpp"
45 #include "runtime/stubRoutines.hpp"
46 #include "utilities/exceptions.hpp"
47
48
76 _adapter_code = MethodHandlesAdapterBlob::create(adapter_code_size);
77 CodeBuffer code(_adapter_code);
78 MethodHandlesAdapterGenerator g(&code);
79 g.generate();
80 code.log_section_sizes("MethodHandlesAdapterBlob");
81 }
82
83 //------------------------------------------------------------------------------
84 // MethodHandlesAdapterGenerator::generate
85 //
86 void MethodHandlesAdapterGenerator::generate() {
87 // Generate generic method handle adapters.
88 // Generate interpreter entries
89 for (Interpreter::MethodKind mk = Interpreter::method_handle_invoke_FIRST;
90 mk <= Interpreter::method_handle_invoke_LAST;
91 mk = Interpreter::MethodKind(1 + (int)mk)) {
92 vmIntrinsics::ID iid = Interpreter::method_handle_intrinsic(mk);
93 StubCodeMark mark(this, "MethodHandle::interpreter_entry", vmIntrinsics::name_at(iid));
94 address entry = MethodHandles::generate_method_handle_interpreter_entry(_masm, iid);
95 if (entry != NULL) {
96 Interpreter::set_entry_for_kind(mk, entry);
97 }
98 // If the entry is not set, it will throw AbstractMethodError.
99 }
100 }
101
102 void MethodHandles::set_enabled(bool z) {
103 if (_enabled != z) {
104 guarantee(z, "can only enable once");
105 _enabled = z;
106 }
107 }
108
109 // MemberName support
110
111 // import java_lang_invoke_MemberName.*
112 enum {
113 IS_METHOD = java_lang_invoke_MemberName::MN_IS_METHOD,
114 IS_CONSTRUCTOR = java_lang_invoke_MemberName::MN_IS_CONSTRUCTOR,
115 IS_FIELD = java_lang_invoke_MemberName::MN_IS_FIELD,
|