src/cpu/x86/vm/templateInterpreter_x86_32.cpp

changeset 4936
aeaca88565e6
parent 4873
e961c11b85fe
child 4973
47766e2d2527
     1.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Thu Apr 04 21:15:43 2013 -0700
     1.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Tue Apr 09 17:17:41 2013 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -344,13 +344,13 @@
    1.11  // rcx: invocation counter
    1.12  //
    1.13  void InterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) {
    1.14 -  const Address invocation_counter(rbx, in_bytes(Method::invocation_counter_offset()) +
    1.15 -                                        in_bytes(InvocationCounter::counter_offset()));
    1.16 -  // Note: In tiered we increment either counters in Method* or in MDO depending if we're profiling or not.
    1.17 +  Label done;
    1.18 +  // Note: In tiered we increment either counters in MethodCounters* or in MDO
    1.19 +  // depending if we're profiling or not.
    1.20    if (TieredCompilation) {
    1.21      int increment = InvocationCounter::count_increment;
    1.22      int mask = ((1 << Tier0InvokeNotifyFreqLog)  - 1) << InvocationCounter::count_shift;
    1.23 -    Label no_mdo, done;
    1.24 +    Label no_mdo;
    1.25      if (ProfileInterpreter) {
    1.26        // Are we profiling?
    1.27        __ movptr(rax, Address(rbx, Method::method_data_offset()));
    1.28 @@ -363,23 +363,38 @@
    1.29        __ jmpb(done);
    1.30      }
    1.31      __ bind(no_mdo);
    1.32 -    // Increment counter in Method* (we don't need to load it, it's in rcx).
    1.33 -    __ increment_mask_and_jump(invocation_counter, increment, mask, rcx, true, Assembler::zero, overflow);
    1.34 +    // Increment counter in MethodCounters
    1.35 +    const Address invocation_counter(rax,
    1.36 +                  MethodCounters::invocation_counter_offset() +
    1.37 +                  InvocationCounter::counter_offset());
    1.38 +
    1.39 +    __ get_method_counters(rbx, rax, done);
    1.40 +    __ increment_mask_and_jump(invocation_counter, increment, mask,
    1.41 +                               rcx, false, Assembler::zero, overflow);
    1.42      __ bind(done);
    1.43    } else {
    1.44 -    const Address backedge_counter  (rbx, Method::backedge_counter_offset() +
    1.45 -                                          InvocationCounter::counter_offset());
    1.46 +    const Address backedge_counter  (rax,
    1.47 +                  MethodCounters::backedge_counter_offset() +
    1.48 +                  InvocationCounter::counter_offset());
    1.49 +    const Address invocation_counter(rax,
    1.50 +                  MethodCounters::invocation_counter_offset() +
    1.51 +                  InvocationCounter::counter_offset());
    1.52  
    1.53 -    if (ProfileInterpreter) { // %%% Merge this into MethodData*
    1.54 -      __ incrementl(Address(rbx,Method::interpreter_invocation_counter_offset()));
    1.55 +    __ get_method_counters(rbx, rax, done);
    1.56 +
    1.57 +    if (ProfileInterpreter) {
    1.58 +      __ incrementl(Address(rax,
    1.59 +              MethodCounters::interpreter_invocation_counter_offset()));
    1.60      }
    1.61 +
    1.62      // Update standard invocation counters
    1.63 +    __ movl(rcx, invocation_counter);
    1.64 +    __ incrementl(rcx, InvocationCounter::count_increment);
    1.65 +    __ movl(invocation_counter, rcx);             // save invocation count
    1.66 +
    1.67      __ movl(rax, backedge_counter);               // load backedge counter
    1.68 -
    1.69 -    __ incrementl(rcx, InvocationCounter::count_increment);
    1.70      __ andl(rax, InvocationCounter::count_mask_value);  // mask out the status bits
    1.71  
    1.72 -    __ movl(invocation_counter, rcx);             // save invocation count
    1.73      __ addl(rcx, rax);                            // add both counters
    1.74  
    1.75      // profile_method is non-null only for interpreted method so
    1.76 @@ -399,6 +414,7 @@
    1.77      __ cmp32(rcx,
    1.78               ExternalAddress((address)&InvocationCounter::InterpreterInvocationLimit));
    1.79      __ jcc(Assembler::aboveEqual, *overflow);
    1.80 +    __ bind(done);
    1.81    }
    1.82  }
    1.83  
    1.84 @@ -868,7 +884,6 @@
    1.85    address entry_point = __ pc();
    1.86  
    1.87    const Address constMethod       (rbx, Method::const_offset());
    1.88 -  const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
    1.89    const Address access_flags      (rbx, Method::access_flags_offset());
    1.90    const Address size_of_parameters(rcx, ConstMethod::size_of_parameters_offset());
    1.91  
    1.92 @@ -897,9 +912,7 @@
    1.93    // NULL oop temp (mirror or jni oop result)
    1.94    __ push((int32_t)NULL_WORD);
    1.95  
    1.96 -  if (inc_counter) __ movl(rcx, invocation_counter);  // (pre-)fetch invocation count
    1.97    // initialize fixed part of activation frame
    1.98 -
    1.99    generate_fixed_frame(true);
   1.100  
   1.101    // make sure method is native & not abstract
   1.102 @@ -1286,7 +1299,6 @@
   1.103    address entry_point = __ pc();
   1.104  
   1.105    const Address constMethod       (rbx, Method::const_offset());
   1.106 -  const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
   1.107    const Address access_flags      (rbx, Method::access_flags_offset());
   1.108    const Address size_of_parameters(rdx, ConstMethod::size_of_parameters_offset());
   1.109    const Address size_of_locals    (rdx, ConstMethod::size_of_locals_offset());
   1.110 @@ -1326,7 +1338,6 @@
   1.111      __ bind(exit);
   1.112    }
   1.113  
   1.114 -  if (inc_counter) __ movl(rcx, invocation_counter);  // (pre-)fetch invocation count
   1.115    // initialize fixed part of activation frame
   1.116    generate_fixed_frame(false);
   1.117  

mercurial