209
210
211 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg ), bool arg) {
212 def(code, flags, in, out, (Template::generator)gen, (int)arg);
213 }
214
215
216 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(TosState tos), TosState tos) {
217 def(code, flags, in, out, (Template::generator)gen, (int)tos);
218 }
219
220
221 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Condition cc), Condition cc) {
222 def(code, flags, in, out, (Template::generator)gen, (int)cc);
223 }
224
225 #if defined(TEMPLATE_TABLE_BUG)
226 //
227 // It appears that gcc (version 2.91) generates bad code for the template
228 // table init if this macro is not defined. My symptom was an assertion
229 // assert(Universe::heap()->is_in(obj), "sanity check") in handles.cpp line 24.
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", TRACETIME_LOG(Info, startuptime));
249
250 _bs = Universe::heap()->barrier_set();
251
252 // For better readability
253 const char _ = ' ';
254 const int ____ = 0;
255 const int ubcp = 1 << Template::uses_bcp_bit;
256 const int disp = 1 << Template::does_dispatch_bit;
257 const int clvm = 1 << Template::calls_vm_bit;
258 const int iswd = 1 << Template::wide_bit;
259 // interpr. templates
260 // Java spec bytecodes ubcp|disp|clvm|iswd in out generator argument
261 def(Bytecodes::_nop , ____|____|____|____, vtos, vtos, nop , _ );
262 def(Bytecodes::_aconst_null , ____|____|____|____, vtos, atos, aconst_null , _ );
263 def(Bytecodes::_iconst_m1 , ____|____|____|____, vtos, itos, iconst , -1 );
264 def(Bytecodes::_iconst_0 , ____|____|____|____, vtos, itos, iconst , 0 );
265 def(Bytecodes::_iconst_1 , ____|____|____|____, vtos, itos, iconst , 1 );
266 def(Bytecodes::_iconst_2 , ____|____|____|____, vtos, itos, iconst , 2 );
267 def(Bytecodes::_iconst_3 , ____|____|____|____, vtos, itos, iconst , 3 );
268 def(Bytecodes::_iconst_4 , ____|____|____|____, vtos, itos, iconst , 4 );
269 def(Bytecodes::_iconst_5 , ____|____|____|____, vtos, itos, iconst , 5 );
270 def(Bytecodes::_lconst_0 , ____|____|____|____, vtos, ltos, lconst , 0 );
|
209
210
211 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg ), bool arg) {
212 def(code, flags, in, out, (Template::generator)gen, (int)arg);
213 }
214
215
216 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(TosState tos), TosState tos) {
217 def(code, flags, in, out, (Template::generator)gen, (int)tos);
218 }
219
220
221 void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Condition cc), Condition cc) {
222 def(code, flags, in, out, (Template::generator)gen, (int)cc);
223 }
224
225 #if defined(TEMPLATE_TABLE_BUG)
226 //
227 // It appears that gcc (version 2.91) generates bad code for the template
228 // table init if this macro is not defined. My symptom was an assertion
229 // assert(GC::gc()->heap()->is_in(obj), "sanity check") in handles.cpp line 24.
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", TRACETIME_LOG(Info, startuptime));
249
250 _bs = GC::gc()->heap()->barrier_set();
251
252 // For better readability
253 const char _ = ' ';
254 const int ____ = 0;
255 const int ubcp = 1 << Template::uses_bcp_bit;
256 const int disp = 1 << Template::does_dispatch_bit;
257 const int clvm = 1 << Template::calls_vm_bit;
258 const int iswd = 1 << Template::wide_bit;
259 // interpr. templates
260 // Java spec bytecodes ubcp|disp|clvm|iswd in out generator argument
261 def(Bytecodes::_nop , ____|____|____|____, vtos, vtos, nop , _ );
262 def(Bytecodes::_aconst_null , ____|____|____|____, vtos, atos, aconst_null , _ );
263 def(Bytecodes::_iconst_m1 , ____|____|____|____, vtos, itos, iconst , -1 );
264 def(Bytecodes::_iconst_0 , ____|____|____|____, vtos, itos, iconst , 0 );
265 def(Bytecodes::_iconst_1 , ____|____|____|____, vtos, itos, iconst , 1 );
266 def(Bytecodes::_iconst_2 , ____|____|____|____, vtos, itos, iconst , 2 );
267 def(Bytecodes::_iconst_3 , ____|____|____|____, vtos, itos, iconst , 3 );
268 def(Bytecodes::_iconst_4 , ____|____|____|____, vtos, itos, iconst , 4 );
269 def(Bytecodes::_iconst_5 , ____|____|____|____, vtos, itos, iconst , 5 );
270 def(Bytecodes::_lconst_0 , ____|____|____|____, vtos, ltos, lconst , 0 );
|