326 // array_addressing() 327 328 // Test invocation count vs threshold 329 Node *threshold = makecon(TypeInt::make(limit)); 330 Node *chk = _gvn.transform( new (C) CmpUNode( cnt, threshold) ); 331 BoolTest::mask btest = BoolTest::lt; 332 Node *tst = _gvn.transform( new (C) BoolNode( chk, btest) ); 333 // Branch to failure if threshold exceeded 334 { BuildCutout unless(this, tst, PROB_ALWAYS); 335 uncommon_trap(Deoptimization::Reason_age, 336 Deoptimization::Action_maybe_recompile); 337 } 338 } 339 340 //----------------------increment_and_test_invocation_counter------------------- 341 void Parse::increment_and_test_invocation_counter(int limit) { 342 if (!count_invocations()) return; 343 344 // Get the Method* node. 345 ciMethod* m = method(); 346 address counters_adr = m->ensure_method_counters(); 347 348 Node* ctrl = control(); 349 const TypePtr* adr_type = TypeRawPtr::make(counters_adr); 350 Node *counters_node = makecon(adr_type); 351 Node* adr_iic_node = basic_plus_adr(counters_node, counters_node, 352 MethodCounters::interpreter_invocation_counter_offset_in_bytes()); 353 Node* cnt = make_load(ctrl, adr_iic_node, TypeInt::INT, T_INT, adr_type); 354 355 test_counter_against_threshold(cnt, limit); 356 357 // Add one to the counter and store 358 Node* incr = _gvn.transform(new (C) AddINode(cnt, _gvn.intcon(1))); 359 store_to_memory( ctrl, adr_iic_node, incr, T_INT, adr_type ); 360 } 361 362 //----------------------------method_data_addressing--------------------------- 363 Node* Parse::method_data_addressing(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, Node* idx, uint stride) { 364 // Get offset within MethodData* of the data array 365 ByteSize data_offset = MethodData::data_offset(); 366 367 // Get cell offset of the ProfileData within data array 368 int cell_offset = md->dp_to_di(data->dp()); 369 | 326 // array_addressing() 327 328 // Test invocation count vs threshold 329 Node *threshold = makecon(TypeInt::make(limit)); 330 Node *chk = _gvn.transform( new (C) CmpUNode( cnt, threshold) ); 331 BoolTest::mask btest = BoolTest::lt; 332 Node *tst = _gvn.transform( new (C) BoolNode( chk, btest) ); 333 // Branch to failure if threshold exceeded 334 { BuildCutout unless(this, tst, PROB_ALWAYS); 335 uncommon_trap(Deoptimization::Reason_age, 336 Deoptimization::Action_maybe_recompile); 337 } 338 } 339 340 //----------------------increment_and_test_invocation_counter------------------- 341 void Parse::increment_and_test_invocation_counter(int limit) { 342 if (!count_invocations()) return; 343 344 // Get the Method* node. 345 ciMethod* m = method(); 346 MethodCounters* counters_adr = m->ensure_method_counters(); 347 if (counters_adr == NULL) { 348 C->record_failure("method counters allocation failed"); 349 // Record a failure but continue the compile. The null value is only 350 // a problem when we execute the method. Somewhere a failing() call 351 // will abort this compile anyway. 352 } 353 354 Node* ctrl = control(); 355 const TypePtr* adr_type = TypeRawPtr::make((address) counters_adr); 356 Node *counters_node = makecon(adr_type); 357 Node* adr_iic_node = basic_plus_adr(counters_node, counters_node, 358 MethodCounters::interpreter_invocation_counter_offset_in_bytes()); 359 Node* cnt = make_load(ctrl, adr_iic_node, TypeInt::INT, T_INT, adr_type); 360 361 test_counter_against_threshold(cnt, limit); 362 363 // Add one to the counter and store 364 Node* incr = _gvn.transform(new (C) AddINode(cnt, _gvn.intcon(1))); 365 store_to_memory( ctrl, adr_iic_node, incr, T_INT, adr_type ); 366 } 367 368 //----------------------------method_data_addressing--------------------------- 369 Node* Parse::method_data_addressing(ciMethodData* md, ciProfileData* data, ByteSize counter_offset, Node* idx, uint stride) { 370 // Get offset within MethodData* of the data array 371 ByteSize data_offset = MethodData::data_offset(); 372 373 // Get cell offset of the ProfileData within data array 374 int cell_offset = md->dp_to_di(data->dp()); 375 |