158
159
160 //----------------------------------------------------------------------------------------------------
161 // Implementation of TemplateTable: Debugging
162
163 void TemplateTable::transition(TosState tos_in, TosState tos_out) {
164 assert(_desc->tos_in() == tos_in , "inconsistent tos_in information");
165 assert(_desc->tos_out() == tos_out, "inconsistent tos_out information");
166 }
167
168
169 //----------------------------------------------------------------------------------------------------
170 // Implementation of TemplateTable: Initialization
171
172 bool TemplateTable::_is_initialized = false;
173 Template TemplateTable::_template_table [Bytecodes::number_of_codes];
174 Template TemplateTable::_template_table_wide[Bytecodes::number_of_codes];
175
176 Template* TemplateTable::_desc;
177 InterpreterMacroAssembler* TemplateTable::_masm;
178
179
180 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(), char filler) {
181 assert(filler == ' ', "just checkin'");
182 def(code, flags, in, out, (Template::generator)gen, 0);
183 }
184
185
186 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(int arg), int arg) {
187 // should factor out these constants
188 const int ubcp = 1 << Template::uses_bcp_bit;
189 const int disp = 1 << Template::does_dispatch_bit;
190 const int clvm = 1 << Template::calls_vm_bit;
191 const int iswd = 1 << Template::wide_bit;
192 // determine which table to use
193 bool is_wide = (flags & iswd) != 0;
194 // make sure that wide instructions have a vtos entry point
195 // (since they are executed extremely rarely, it doesn't pay out to have an
196 // extra set of 5 dispatch tables for the wide instructions - for simplicity
197 // they all go with one table)
230 // when called from interpreterRuntime.resolve_invoke().
231 //
232 #define iload TemplateTable::iload
233 #define lload TemplateTable::lload
234 #define fload TemplateTable::fload
235 #define dload TemplateTable::dload
236 #define aload TemplateTable::aload
237 #define istore TemplateTable::istore
238 #define lstore TemplateTable::lstore
239 #define fstore TemplateTable::fstore
240 #define dstore TemplateTable::dstore
241 #define astore TemplateTable::astore
242 #endif // TEMPLATE_TABLE_BUG
243
244 void TemplateTable::initialize() {
245 if (_is_initialized) return;
246
247 // Initialize table
248 TraceTime timer("TemplateTable initialization", TraceStartupTime);
249
250 // For better readability
251 const char _ = ' ';
252 const int ____ = 0;
253 const int ubcp = 1 << Template::uses_bcp_bit;
254 const int disp = 1 << Template::does_dispatch_bit;
255 const int clvm = 1 << Template::calls_vm_bit;
256 const int iswd = 1 << Template::wide_bit;
257 // interpr. templates
258 // Java spec bytecodes ubcp|disp|clvm|iswd in out generator argument
259 def(Bytecodes::_nop , ____|____|____|____, vtos, vtos, nop , _ );
260 def(Bytecodes::_aconst_null , ____|____|____|____, vtos, atos, aconst_null , _ );
261 def(Bytecodes::_iconst_m1 , ____|____|____|____, vtos, itos, iconst , -1 );
262 def(Bytecodes::_iconst_0 , ____|____|____|____, vtos, itos, iconst , 0 );
263 def(Bytecodes::_iconst_1 , ____|____|____|____, vtos, itos, iconst , 1 );
264 def(Bytecodes::_iconst_2 , ____|____|____|____, vtos, itos, iconst , 2 );
265 def(Bytecodes::_iconst_3 , ____|____|____|____, vtos, itos, iconst , 3 );
266 def(Bytecodes::_iconst_4 , ____|____|____|____, vtos, itos, iconst , 4 );
267 def(Bytecodes::_iconst_5 , ____|____|____|____, vtos, itos, iconst , 5 );
268 def(Bytecodes::_lconst_0 , ____|____|____|____, vtos, ltos, lconst , 0 );
269 def(Bytecodes::_lconst_1 , ____|____|____|____, vtos, ltos, lconst , 1 );
|
158
159
160 //----------------------------------------------------------------------------------------------------
161 // Implementation of TemplateTable: Debugging
162
163 void TemplateTable::transition(TosState tos_in, TosState tos_out) {
164 assert(_desc->tos_in() == tos_in , "inconsistent tos_in information");
165 assert(_desc->tos_out() == tos_out, "inconsistent tos_out information");
166 }
167
168
169 //----------------------------------------------------------------------------------------------------
170 // Implementation of TemplateTable: Initialization
171
172 bool TemplateTable::_is_initialized = false;
173 Template TemplateTable::_template_table [Bytecodes::number_of_codes];
174 Template TemplateTable::_template_table_wide[Bytecodes::number_of_codes];
175
176 Template* TemplateTable::_desc;
177 InterpreterMacroAssembler* TemplateTable::_masm;
178 BarrierSet* TemplateTable::_bs;
179
180
181 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(), char filler) {
182 assert(filler == ' ', "just checkin'");
183 def(code, flags, in, out, (Template::generator)gen, 0);
184 }
185
186
187 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(int arg), int arg) {
188 // should factor out these constants
189 const int ubcp = 1 << Template::uses_bcp_bit;
190 const int disp = 1 << Template::does_dispatch_bit;
191 const int clvm = 1 << Template::calls_vm_bit;
192 const int iswd = 1 << Template::wide_bit;
193 // determine which table to use
194 bool is_wide = (flags & iswd) != 0;
195 // make sure that wide instructions have a vtos entry point
196 // (since they are executed extremely rarely, it doesn't pay out to have an
197 // extra set of 5 dispatch tables for the wide instructions - for simplicity
198 // they all go with one table)
231 // when called from interpreterRuntime.resolve_invoke().
232 //
233 #define iload TemplateTable::iload
234 #define lload TemplateTable::lload
235 #define fload TemplateTable::fload
236 #define dload TemplateTable::dload
237 #define aload TemplateTable::aload
238 #define istore TemplateTable::istore
239 #define lstore TemplateTable::lstore
240 #define fstore TemplateTable::fstore
241 #define dstore TemplateTable::dstore
242 #define astore TemplateTable::astore
243 #endif // TEMPLATE_TABLE_BUG
244
245 void TemplateTable::initialize() {
246 if (_is_initialized) return;
247
248 // Initialize table
249 TraceTime timer("TemplateTable initialization", TraceStartupTime);
250
251 _bs = Universe::heap()->barrier_set();
252
253 // For better readability
254 const char _ = ' ';
255 const int ____ = 0;
256 const int ubcp = 1 << Template::uses_bcp_bit;
257 const int disp = 1 << Template::does_dispatch_bit;
258 const int clvm = 1 << Template::calls_vm_bit;
259 const int iswd = 1 << Template::wide_bit;
260 // interpr. templates
261 // Java spec bytecodes ubcp|disp|clvm|iswd in out generator argument
262 def(Bytecodes::_nop , ____|____|____|____, vtos, vtos, nop , _ );
263 def(Bytecodes::_aconst_null , ____|____|____|____, vtos, atos, aconst_null , _ );
264 def(Bytecodes::_iconst_m1 , ____|____|____|____, vtos, itos, iconst , -1 );
265 def(Bytecodes::_iconst_0 , ____|____|____|____, vtos, itos, iconst , 0 );
266 def(Bytecodes::_iconst_1 , ____|____|____|____, vtos, itos, iconst , 1 );
267 def(Bytecodes::_iconst_2 , ____|____|____|____, vtos, itos, iconst , 2 );
268 def(Bytecodes::_iconst_3 , ____|____|____|____, vtos, itos, iconst , 3 );
269 def(Bytecodes::_iconst_4 , ____|____|____|____, vtos, itos, iconst , 4 );
270 def(Bytecodes::_iconst_5 , ____|____|____|____, vtos, itos, iconst , 5 );
271 def(Bytecodes::_lconst_0 , ____|____|____|____, vtos, ltos, lconst , 0 );
272 def(Bytecodes::_lconst_1 , ____|____|____|____, vtos, ltos, lconst , 1 );
|