Mercurial > hg > truffle
comparison src/cpu/x86/vm/templateInterpreter_x86_64.cpp @ 1783:d5d065957597
6953144: Tiered compilation
Summary: Infrastructure for tiered compilation support (interpreter + c1 + c2) for 32 and 64 bit. Simple tiered policy implementation.
Reviewed-by: kvn, never, phh, twisti
author | iveresov |
---|---|
date | Fri, 03 Sep 2010 17:51:07 -0700 |
parents | e9ff18c4ace7 |
children | f95d63e2154a |
comparison
equal
deleted
inserted
replaced
1782:f353275af40e | 1783:d5d065957597 |
---|---|
308 // | 308 // |
309 void InterpreterGenerator::generate_counter_incr( | 309 void InterpreterGenerator::generate_counter_incr( |
310 Label* overflow, | 310 Label* overflow, |
311 Label* profile_method, | 311 Label* profile_method, |
312 Label* profile_method_continue) { | 312 Label* profile_method_continue) { |
313 | 313 const Address invocation_counter(rbx, in_bytes(methodOopDesc::invocation_counter_offset()) + |
314 const Address invocation_counter(rbx, | 314 in_bytes(InvocationCounter::counter_offset())); |
315 methodOopDesc::invocation_counter_offset() + | 315 // Note: In tiered we increment either counters in methodOop or in MDO depending if we're profiling or not. |
316 if (TieredCompilation) { | |
317 int increment = InvocationCounter::count_increment; | |
318 int mask = ((1 << Tier0InvokeNotifyFreqLog) - 1) << InvocationCounter::count_shift; | |
319 Label no_mdo, done; | |
320 if (ProfileInterpreter) { | |
321 // Are we profiling? | |
322 __ movptr(rax, Address(rbx, methodOopDesc::method_data_offset())); | |
323 __ testptr(rax, rax); | |
324 __ jccb(Assembler::zero, no_mdo); | |
325 // Increment counter in the MDO | |
326 const Address mdo_invocation_counter(rax, in_bytes(methodDataOopDesc::invocation_counter_offset()) + | |
327 in_bytes(InvocationCounter::counter_offset())); | |
328 __ increment_mask_and_jump(mdo_invocation_counter, increment, mask, rcx, false, Assembler::zero, overflow); | |
329 __ jmpb(done); | |
330 } | |
331 __ bind(no_mdo); | |
332 // Increment counter in methodOop (we don't need to load it, it's in ecx). | |
333 __ increment_mask_and_jump(invocation_counter, increment, mask, rcx, true, Assembler::zero, overflow); | |
334 __ bind(done); | |
335 } else { | |
336 const Address backedge_counter(rbx, | |
337 methodOopDesc::backedge_counter_offset() + | |
316 InvocationCounter::counter_offset()); | 338 InvocationCounter::counter_offset()); |
317 const Address backedge_counter(rbx, | 339 |
318 methodOopDesc::backedge_counter_offset() + | 340 if (ProfileInterpreter) { // %%% Merge this into methodDataOop |
319 InvocationCounter::counter_offset()); | 341 __ incrementl(Address(rbx, |
320 | 342 methodOopDesc::interpreter_invocation_counter_offset())); |
321 if (ProfileInterpreter) { // %%% Merge this into methodDataOop | 343 } |
322 __ incrementl(Address(rbx, | 344 // Update standard invocation counters |
323 methodOopDesc::interpreter_invocation_counter_offset())); | 345 __ movl(rax, backedge_counter); // load backedge counter |
324 } | 346 |
325 // Update standard invocation counters | 347 __ incrementl(rcx, InvocationCounter::count_increment); |
326 __ movl(rax, backedge_counter); // load backedge counter | 348 __ andl(rax, InvocationCounter::count_mask_value); // mask out the status bits |
327 | 349 |
328 __ incrementl(rcx, InvocationCounter::count_increment); | 350 __ movl(invocation_counter, rcx); // save invocation count |
329 __ andl(rax, InvocationCounter::count_mask_value); // mask out the | 351 __ addl(rcx, rax); // add both counters |
330 // status bits | 352 |
331 | 353 // profile_method is non-null only for interpreted method so |
332 __ movl(invocation_counter, rcx); // save invocation count | 354 // profile_method != NULL == !native_call |
333 __ addl(rcx, rax); // add both counters | 355 |
334 | 356 if (ProfileInterpreter && profile_method != NULL) { |
335 // profile_method is non-null only for interpreted method so | 357 // Test to see if we should create a method data oop |
336 // profile_method != NULL == !native_call | 358 __ cmp32(rcx, ExternalAddress((address)&InvocationCounter::InterpreterProfileLimit)); |
337 | 359 __ jcc(Assembler::less, *profile_method_continue); |
338 if (ProfileInterpreter && profile_method != NULL) { | 360 |
339 // Test to see if we should create a method data oop | 361 // if no method data exists, go to profile_method |
340 __ cmp32(rcx, ExternalAddress((address)&InvocationCounter::InterpreterProfileLimit)); | 362 __ test_method_data_pointer(rax, *profile_method); |
341 __ jcc(Assembler::less, *profile_method_continue); | 363 } |
342 | 364 |
343 // if no method data exists, go to profile_method | 365 __ cmp32(rcx, ExternalAddress((address)&InvocationCounter::InterpreterInvocationLimit)); |
344 __ test_method_data_pointer(rax, *profile_method); | 366 __ jcc(Assembler::aboveEqual, *overflow); |
345 } | 367 } |
346 | |
347 __ cmp32(rcx, ExternalAddress((address)&InvocationCounter::InterpreterInvocationLimit)); | |
348 __ jcc(Assembler::aboveEqual, *overflow); | |
349 } | 368 } |
350 | 369 |
351 void InterpreterGenerator::generate_counter_overflow(Label* do_continue) { | 370 void InterpreterGenerator::generate_counter_overflow(Label* do_continue) { |
352 | 371 |
353 // Asm interpreter on entry | 372 // Asm interpreter on entry |