Mercurial > hg > truffle
comparison src/share/vm/prims/methodHandles.cpp @ 1330:4a9cc99938e3
Merge
author | acorn |
---|---|
date | Fri, 26 Mar 2010 11:10:26 -0400 |
parents | 9eba43136cb5 |
children | cd5dbf694d45 |
comparison
equal
deleted
inserted
replaced
1329:84043c7507b9 | 1330:4a9cc99938e3 |
---|---|
1 /* | 1 /* |
2 * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 2008-2010 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
80 "adapter_spread_args/more", | 80 "adapter_spread_args/more", |
81 | 81 |
82 NULL | 82 NULL |
83 }; | 83 }; |
84 | 84 |
85 // Adapters. | |
86 MethodHandlesAdapterBlob* MethodHandles::_adapter_code = NULL; | |
87 int MethodHandles::_adapter_code_size = StubRoutines::method_handles_adapters_code_size; | |
88 | |
85 jobject MethodHandles::_raise_exception_method; | 89 jobject MethodHandles::_raise_exception_method; |
86 | 90 |
87 #ifdef ASSERT | 91 #ifdef ASSERT |
88 bool MethodHandles::spot_check_entry_names() { | 92 bool MethodHandles::spot_check_entry_names() { |
89 assert(!strcmp(entry_name(_invokestatic_mh), "invokestatic"), ""); | 93 assert(!strcmp(entry_name(_invokestatic_mh), "invokestatic"), ""); |
92 assert(!strcmp(entry_name(_adapter_ricochet), "adapter_ricochet"), ""); | 96 assert(!strcmp(entry_name(_adapter_ricochet), "adapter_ricochet"), ""); |
93 assert(!strcmp(entry_name(_adapter_opt_unboxi), "adapter_ref_to_prim/unboxi"), ""); | 97 assert(!strcmp(entry_name(_adapter_opt_unboxi), "adapter_ref_to_prim/unboxi"), ""); |
94 return true; | 98 return true; |
95 } | 99 } |
96 #endif | 100 #endif |
101 | |
102 | |
103 //------------------------------------------------------------------------------ | |
104 // MethodHandles::generate_adapters | |
105 // | |
106 void MethodHandles::generate_adapters() { | |
107 if (!EnableMethodHandles || SystemDictionary::MethodHandle_klass() == NULL) return; | |
108 | |
109 assert(_adapter_code == NULL, "generate only once"); | |
110 | |
111 ResourceMark rm; | |
112 TraceTime timer("MethodHandles adapters generation", TraceStartupTime); | |
113 _adapter_code = MethodHandlesAdapterBlob::create(_adapter_code_size); | |
114 if (_adapter_code == NULL) | |
115 vm_exit_out_of_memory(_adapter_code_size, "CodeCache: no room for MethodHandles adapters"); | |
116 CodeBuffer code(_adapter_code->instructions_begin(), _adapter_code->instructions_size()); | |
117 | |
118 MethodHandlesAdapterGenerator g(&code); | |
119 g.generate(); | |
120 } | |
121 | |
122 | |
123 //------------------------------------------------------------------------------ | |
124 // MethodHandlesAdapterGenerator::generate | |
125 // | |
126 void MethodHandlesAdapterGenerator::generate() { | |
127 // Generate generic method handle adapters. | |
128 for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST; | |
129 ek < MethodHandles::_EK_LIMIT; | |
130 ek = MethodHandles::EntryKind(1 + (int)ek)) { | |
131 StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek)); | |
132 MethodHandles::generate_method_handle_stub(_masm, ek); | |
133 } | |
134 } | |
135 | |
97 | 136 |
98 void MethodHandles::set_enabled(bool z) { | 137 void MethodHandles::set_enabled(bool z) { |
99 if (_enabled != z) { | 138 if (_enabled != z) { |
100 guarantee(z && EnableMethodHandles, "can only enable once, and only if -XX:+EnableMethodHandles"); | 139 guarantee(z && EnableMethodHandles, "can only enable once, and only if -XX:+EnableMethodHandles"); |
101 _enabled = z; | 140 _enabled = z; |