Mercurial > hg > graal-compiler
diff src/cpu/x86/vm/templateInterpreter_x86_64.cpp @ 10105:aeaca88565e6
8010862: The Method counter fields used for profiling can be allocated lazily.
Summary: Allocate the method's profiling related metadata until they are needed.
Reviewed-by: coleenp, roland
author | jiangli |
---|---|
date | Tue, 09 Apr 2013 17:17:41 -0400 |
parents | e961c11b85fe |
children | 47766e2d2527 |
line wrap: on
line diff
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Thu Apr 04 21:15:43 2013 -0700 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Tue Apr 09 17:17:41 2013 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -300,13 +300,12 @@ Label* overflow, Label* profile_method, Label* profile_method_continue) { - const Address invocation_counter(rbx, in_bytes(Method::invocation_counter_offset()) + - in_bytes(InvocationCounter::counter_offset())); + Label done; // Note: In tiered we increment either counters in Method* or in MDO depending if we're profiling or not. if (TieredCompilation) { int increment = InvocationCounter::count_increment; int mask = ((1 << Tier0InvokeNotifyFreqLog) - 1) << InvocationCounter::count_shift; - Label no_mdo, done; + Label no_mdo; if (ProfileInterpreter) { // Are we profiling? __ movptr(rax, Address(rbx, Method::method_data_offset())); @@ -319,25 +318,36 @@ __ jmpb(done); } __ bind(no_mdo); - // Increment counter in Method* (we don't need to load it, it's in ecx). - __ increment_mask_and_jump(invocation_counter, increment, mask, rcx, true, Assembler::zero, overflow); + // Increment counter in MethodCounters + const Address invocation_counter(rax, + MethodCounters::invocation_counter_offset() + + InvocationCounter::counter_offset()); + __ get_method_counters(rbx, rax, done); + __ increment_mask_and_jump(invocation_counter, increment, mask, rcx, + false, Assembler::zero, overflow); __ bind(done); } else { - const Address backedge_counter(rbx, - Method::backedge_counter_offset() + - InvocationCounter::counter_offset()); + const Address backedge_counter(rax, + MethodCounters::backedge_counter_offset() + + InvocationCounter::counter_offset()); + const Address invocation_counter(rax, + MethodCounters::invocation_counter_offset() + + InvocationCounter::counter_offset()); - if (ProfileInterpreter) { // %%% Merge this into MethodData* - __ incrementl(Address(rbx, - Method::interpreter_invocation_counter_offset())); + __ get_method_counters(rbx, rax, done); + + if (ProfileInterpreter) { + __ incrementl(Address(rax, + MethodCounters::interpreter_invocation_counter_offset())); } // Update standard invocation counters - __ movl(rax, backedge_counter); // load backedge counter + __ movl(rcx, invocation_counter); + __ incrementl(rcx, InvocationCounter::count_increment); + __ movl(invocation_counter, rcx); // save invocation count - __ incrementl(rcx, InvocationCounter::count_increment); + __ movl(rax, backedge_counter); // load backedge counter __ andl(rax, InvocationCounter::count_mask_value); // mask out the status bits - __ movl(invocation_counter, rcx); // save invocation count __ addl(rcx, rax); // add both counters // profile_method is non-null only for interpreted method so @@ -354,6 +364,7 @@ __ cmp32(rcx, ExternalAddress((address)&InvocationCounter::InterpreterInvocationLimit)); __ jcc(Assembler::aboveEqual, *overflow); + __ bind(done); } } @@ -843,9 +854,6 @@ address entry_point = __ pc(); const Address constMethod (rbx, Method::const_offset()); - const Address invocation_counter(rbx, Method:: - invocation_counter_offset() + - InvocationCounter::counter_offset()); const Address access_flags (rbx, Method::access_flags_offset()); const Address size_of_parameters(rcx, ConstMethod:: size_of_parameters_offset()); @@ -876,10 +884,6 @@ // (static native method holder mirror/jni oop result) __ push((int) NULL_WORD); - if (inc_counter) { - __ movl(rcx, invocation_counter); // (pre-)fetch invocation count - } - // initialize fixed part of activation frame generate_fixed_frame(true); @@ -1296,9 +1300,6 @@ address entry_point = __ pc(); const Address constMethod(rbx, Method::const_offset()); - const Address invocation_counter(rbx, - Method::invocation_counter_offset() + - InvocationCounter::counter_offset()); const Address access_flags(rbx, Method::access_flags_offset()); const Address size_of_parameters(rdx, ConstMethod::size_of_parameters_offset()); @@ -1343,10 +1344,6 @@ __ bind(exit); } - // (pre-)fetch invocation count - if (inc_counter) { - __ movl(rcx, invocation_counter); - } // initialize fixed part of activation frame generate_fixed_frame(false);