Mercurial > hg > truffle
comparison src/share/vm/opto/matcher.cpp @ 1162:d749b1813f40
Merge
author | trims |
---|---|
date | Fri, 15 Jan 2010 14:25:44 -0800 |
parents | 97125851f396 |
children | 844a9d73ec22 |
comparison
equal
deleted
inserted
replaced
1130:1bc68593a110 | 1162:d749b1813f40 |
---|---|
68 _visited(&_states_arena), | 68 _visited(&_states_arena), |
69 _shared(&_states_arena), | 69 _shared(&_states_arena), |
70 _dontcare(&_states_arena) { | 70 _dontcare(&_states_arena) { |
71 C->set_matcher(this); | 71 C->set_matcher(this); |
72 | 72 |
73 idealreg2spillmask[Op_RegI] = NULL; | 73 idealreg2spillmask [Op_RegI] = NULL; |
74 idealreg2spillmask[Op_RegN] = NULL; | 74 idealreg2spillmask [Op_RegN] = NULL; |
75 idealreg2spillmask[Op_RegL] = NULL; | 75 idealreg2spillmask [Op_RegL] = NULL; |
76 idealreg2spillmask[Op_RegF] = NULL; | 76 idealreg2spillmask [Op_RegF] = NULL; |
77 idealreg2spillmask[Op_RegD] = NULL; | 77 idealreg2spillmask [Op_RegD] = NULL; |
78 idealreg2spillmask[Op_RegP] = NULL; | 78 idealreg2spillmask [Op_RegP] = NULL; |
79 | 79 |
80 idealreg2debugmask[Op_RegI] = NULL; | 80 idealreg2debugmask [Op_RegI] = NULL; |
81 idealreg2debugmask[Op_RegN] = NULL; | 81 idealreg2debugmask [Op_RegN] = NULL; |
82 idealreg2debugmask[Op_RegL] = NULL; | 82 idealreg2debugmask [Op_RegL] = NULL; |
83 idealreg2debugmask[Op_RegF] = NULL; | 83 idealreg2debugmask [Op_RegF] = NULL; |
84 idealreg2debugmask[Op_RegD] = NULL; | 84 idealreg2debugmask [Op_RegD] = NULL; |
85 idealreg2debugmask[Op_RegP] = NULL; | 85 idealreg2debugmask [Op_RegP] = NULL; |
86 | |
87 idealreg2mhdebugmask[Op_RegI] = NULL; | |
88 idealreg2mhdebugmask[Op_RegN] = NULL; | |
89 idealreg2mhdebugmask[Op_RegL] = NULL; | |
90 idealreg2mhdebugmask[Op_RegF] = NULL; | |
91 idealreg2mhdebugmask[Op_RegD] = NULL; | |
92 idealreg2mhdebugmask[Op_RegP] = NULL; | |
93 | |
86 debug_only(_mem_node = NULL;) // Ideal memory node consumed by mach node | 94 debug_only(_mem_node = NULL;) // Ideal memory node consumed by mach node |
87 } | 95 } |
88 | 96 |
89 //------------------------------warp_incoming_stk_arg------------------------ | 97 //------------------------------warp_incoming_stk_arg------------------------ |
90 // This warps a VMReg into an OptoReg::Name | 98 // This warps a VMReg into an OptoReg::Name |
387 // Disallow any debug info in outgoing argument areas by setting the | 395 // Disallow any debug info in outgoing argument areas by setting the |
388 // initial mask accordingly. | 396 // initial mask accordingly. |
389 void Matcher::init_first_stack_mask() { | 397 void Matcher::init_first_stack_mask() { |
390 | 398 |
391 // Allocate storage for spill masks as masks for the appropriate load type. | 399 // Allocate storage for spill masks as masks for the appropriate load type. |
392 RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask)*12); | 400 RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask) * 3*6); |
393 idealreg2spillmask[Op_RegN] = &rms[0]; | 401 |
394 idealreg2spillmask[Op_RegI] = &rms[1]; | 402 idealreg2spillmask [Op_RegN] = &rms[0]; |
395 idealreg2spillmask[Op_RegL] = &rms[2]; | 403 idealreg2spillmask [Op_RegI] = &rms[1]; |
396 idealreg2spillmask[Op_RegF] = &rms[3]; | 404 idealreg2spillmask [Op_RegL] = &rms[2]; |
397 idealreg2spillmask[Op_RegD] = &rms[4]; | 405 idealreg2spillmask [Op_RegF] = &rms[3]; |
398 idealreg2spillmask[Op_RegP] = &rms[5]; | 406 idealreg2spillmask [Op_RegD] = &rms[4]; |
399 idealreg2debugmask[Op_RegN] = &rms[6]; | 407 idealreg2spillmask [Op_RegP] = &rms[5]; |
400 idealreg2debugmask[Op_RegI] = &rms[7]; | 408 |
401 idealreg2debugmask[Op_RegL] = &rms[8]; | 409 idealreg2debugmask [Op_RegN] = &rms[6]; |
402 idealreg2debugmask[Op_RegF] = &rms[9]; | 410 idealreg2debugmask [Op_RegI] = &rms[7]; |
403 idealreg2debugmask[Op_RegD] = &rms[10]; | 411 idealreg2debugmask [Op_RegL] = &rms[8]; |
404 idealreg2debugmask[Op_RegP] = &rms[11]; | 412 idealreg2debugmask [Op_RegF] = &rms[9]; |
413 idealreg2debugmask [Op_RegD] = &rms[10]; | |
414 idealreg2debugmask [Op_RegP] = &rms[11]; | |
415 | |
416 idealreg2mhdebugmask[Op_RegN] = &rms[12]; | |
417 idealreg2mhdebugmask[Op_RegI] = &rms[13]; | |
418 idealreg2mhdebugmask[Op_RegL] = &rms[14]; | |
419 idealreg2mhdebugmask[Op_RegF] = &rms[15]; | |
420 idealreg2mhdebugmask[Op_RegD] = &rms[16]; | |
421 idealreg2mhdebugmask[Op_RegP] = &rms[17]; | |
405 | 422 |
406 OptoReg::Name i; | 423 OptoReg::Name i; |
407 | 424 |
408 // At first, start with the empty mask | 425 // At first, start with the empty mask |
409 C->FIRST_STACK_mask().Clear(); | 426 C->FIRST_STACK_mask().Clear(); |
440 idealreg2spillmask[Op_RegP]->OR(C->FIRST_STACK_mask()); | 457 idealreg2spillmask[Op_RegP]->OR(C->FIRST_STACK_mask()); |
441 | 458 |
442 // Make up debug masks. Any spill slot plus callee-save registers. | 459 // Make up debug masks. Any spill slot plus callee-save registers. |
443 // Caller-save registers are assumed to be trashable by the various | 460 // Caller-save registers are assumed to be trashable by the various |
444 // inline-cache fixup routines. | 461 // inline-cache fixup routines. |
445 *idealreg2debugmask[Op_RegN]= *idealreg2spillmask[Op_RegN]; | 462 *idealreg2debugmask [Op_RegN]= *idealreg2spillmask[Op_RegN]; |
446 *idealreg2debugmask[Op_RegI]= *idealreg2spillmask[Op_RegI]; | 463 *idealreg2debugmask [Op_RegI]= *idealreg2spillmask[Op_RegI]; |
447 *idealreg2debugmask[Op_RegL]= *idealreg2spillmask[Op_RegL]; | 464 *idealreg2debugmask [Op_RegL]= *idealreg2spillmask[Op_RegL]; |
448 *idealreg2debugmask[Op_RegF]= *idealreg2spillmask[Op_RegF]; | 465 *idealreg2debugmask [Op_RegF]= *idealreg2spillmask[Op_RegF]; |
449 *idealreg2debugmask[Op_RegD]= *idealreg2spillmask[Op_RegD]; | 466 *idealreg2debugmask [Op_RegD]= *idealreg2spillmask[Op_RegD]; |
450 *idealreg2debugmask[Op_RegP]= *idealreg2spillmask[Op_RegP]; | 467 *idealreg2debugmask [Op_RegP]= *idealreg2spillmask[Op_RegP]; |
468 | |
469 *idealreg2mhdebugmask[Op_RegN]= *idealreg2spillmask[Op_RegN]; | |
470 *idealreg2mhdebugmask[Op_RegI]= *idealreg2spillmask[Op_RegI]; | |
471 *idealreg2mhdebugmask[Op_RegL]= *idealreg2spillmask[Op_RegL]; | |
472 *idealreg2mhdebugmask[Op_RegF]= *idealreg2spillmask[Op_RegF]; | |
473 *idealreg2mhdebugmask[Op_RegD]= *idealreg2spillmask[Op_RegD]; | |
474 *idealreg2mhdebugmask[Op_RegP]= *idealreg2spillmask[Op_RegP]; | |
451 | 475 |
452 // Prevent stub compilations from attempting to reference | 476 // Prevent stub compilations from attempting to reference |
453 // callee-saved registers from debug info | 477 // callee-saved registers from debug info |
454 bool exclude_soe = !Compile::current()->is_method_compilation(); | 478 bool exclude_soe = !Compile::current()->is_method_compilation(); |
455 | 479 |
456 for( i=OptoReg::Name(0); i<OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i,1) ) { | 480 for( i=OptoReg::Name(0); i<OptoReg::Name(_last_Mach_Reg); i = OptoReg::add(i,1) ) { |
457 // registers the caller has to save do not work | 481 // registers the caller has to save do not work |
458 if( _register_save_policy[i] == 'C' || | 482 if( _register_save_policy[i] == 'C' || |
459 _register_save_policy[i] == 'A' || | 483 _register_save_policy[i] == 'A' || |
460 (_register_save_policy[i] == 'E' && exclude_soe) ) { | 484 (_register_save_policy[i] == 'E' && exclude_soe) ) { |
461 idealreg2debugmask[Op_RegN]->Remove(i); | 485 idealreg2debugmask [Op_RegN]->Remove(i); |
462 idealreg2debugmask[Op_RegI]->Remove(i); // Exclude save-on-call | 486 idealreg2debugmask [Op_RegI]->Remove(i); // Exclude save-on-call |
463 idealreg2debugmask[Op_RegL]->Remove(i); // registers from debug | 487 idealreg2debugmask [Op_RegL]->Remove(i); // registers from debug |
464 idealreg2debugmask[Op_RegF]->Remove(i); // masks | 488 idealreg2debugmask [Op_RegF]->Remove(i); // masks |
465 idealreg2debugmask[Op_RegD]->Remove(i); | 489 idealreg2debugmask [Op_RegD]->Remove(i); |
466 idealreg2debugmask[Op_RegP]->Remove(i); | 490 idealreg2debugmask [Op_RegP]->Remove(i); |
467 } | 491 |
468 } | 492 idealreg2mhdebugmask[Op_RegN]->Remove(i); |
493 idealreg2mhdebugmask[Op_RegI]->Remove(i); | |
494 idealreg2mhdebugmask[Op_RegL]->Remove(i); | |
495 idealreg2mhdebugmask[Op_RegF]->Remove(i); | |
496 idealreg2mhdebugmask[Op_RegD]->Remove(i); | |
497 idealreg2mhdebugmask[Op_RegP]->Remove(i); | |
498 } | |
499 } | |
500 | |
501 // Subtract the register we use to save the SP for MethodHandle | |
502 // invokes to from the debug mask. | |
503 const RegMask save_mask = method_handle_invoke_SP_save_mask(); | |
504 idealreg2mhdebugmask[Op_RegN]->SUBTRACT(save_mask); | |
505 idealreg2mhdebugmask[Op_RegI]->SUBTRACT(save_mask); | |
506 idealreg2mhdebugmask[Op_RegL]->SUBTRACT(save_mask); | |
507 idealreg2mhdebugmask[Op_RegF]->SUBTRACT(save_mask); | |
508 idealreg2mhdebugmask[Op_RegD]->SUBTRACT(save_mask); | |
509 idealreg2mhdebugmask[Op_RegP]->SUBTRACT(save_mask); | |
469 } | 510 } |
470 | 511 |
471 //---------------------------is_save_on_entry---------------------------------- | 512 //---------------------------is_save_on_entry---------------------------------- |
472 bool Matcher::is_save_on_entry( int reg ) { | 513 bool Matcher::is_save_on_entry( int reg ) { |
473 return | 514 return |
987 uint cnt; | 1028 uint cnt; |
988 // Split out case for SafePoint vs Call | 1029 // Split out case for SafePoint vs Call |
989 CallNode *call; | 1030 CallNode *call; |
990 const TypeTuple *domain; | 1031 const TypeTuple *domain; |
991 ciMethod* method = NULL; | 1032 ciMethod* method = NULL; |
1033 bool is_method_handle_invoke = false; // for special kill effects | |
992 if( sfpt->is_Call() ) { | 1034 if( sfpt->is_Call() ) { |
993 call = sfpt->as_Call(); | 1035 call = sfpt->as_Call(); |
994 domain = call->tf()->domain(); | 1036 domain = call->tf()->domain(); |
995 cnt = domain->cnt(); | 1037 cnt = domain->cnt(); |
996 | 1038 |
1011 const CallJavaNode *call_java = call->as_CallJava(); | 1053 const CallJavaNode *call_java = call->as_CallJava(); |
1012 method = call_java->method(); | 1054 method = call_java->method(); |
1013 mcall_java->_method = method; | 1055 mcall_java->_method = method; |
1014 mcall_java->_bci = call_java->_bci; | 1056 mcall_java->_bci = call_java->_bci; |
1015 mcall_java->_optimized_virtual = call_java->is_optimized_virtual(); | 1057 mcall_java->_optimized_virtual = call_java->is_optimized_virtual(); |
1058 is_method_handle_invoke = call_java->is_method_handle_invoke(); | |
1059 mcall_java->_method_handle_invoke = is_method_handle_invoke; | |
1016 if( mcall_java->is_MachCallStaticJava() ) | 1060 if( mcall_java->is_MachCallStaticJava() ) |
1017 mcall_java->as_MachCallStaticJava()->_name = | 1061 mcall_java->as_MachCallStaticJava()->_name = |
1018 call_java->as_CallStaticJava()->_name; | 1062 call_java->as_CallStaticJava()->_name; |
1019 if( mcall_java->is_MachCallDynamicJava() ) | 1063 if( mcall_java->is_MachCallDynamicJava() ) |
1020 mcall_java->as_MachCallDynamicJava()->_vtable_index = | 1064 mcall_java->as_MachCallDynamicJava()->_vtable_index = |
1122 } // End of for all arguments | 1166 } // End of for all arguments |
1123 | 1167 |
1124 // Compute number of stack slots needed to restore stack in case of | 1168 // Compute number of stack slots needed to restore stack in case of |
1125 // Pascal-style argument popping. | 1169 // Pascal-style argument popping. |
1126 mcall->_argsize = out_arg_limit_per_call - begin_out_arg_area; | 1170 mcall->_argsize = out_arg_limit_per_call - begin_out_arg_area; |
1171 } | |
1172 | |
1173 if (is_method_handle_invoke) { | |
1174 // Kill some extra stack space in case method handles want to do | |
1175 // a little in-place argument insertion. | |
1176 int regs_per_word = NOT_LP64(1) LP64_ONLY(2); // %%% make a global const! | |
1177 out_arg_limit_per_call += MethodHandlePushLimit * regs_per_word; | |
1178 // Do not update mcall->_argsize because (a) the extra space is not | |
1179 // pushed as arguments and (b) _argsize is dead (not used anywhere). | |
1127 } | 1180 } |
1128 | 1181 |
1129 // Compute the max stack slot killed by any call. These will not be | 1182 // Compute the max stack slot killed by any call. These will not be |
1130 // available for debug info, and will be used to adjust FIRST_STACK_mask | 1183 // available for debug info, and will be used to adjust FIRST_STACK_mask |
1131 // after all call sites have been visited. | 1184 // after all call sites have been visited. |