Merge

Fri, 07 Jan 2011 13:59:48 -0800

author
dcubed
date
Fri, 07 Jan 2011 13:59:48 -0800
changeset 2424
55d7d18ccff9
parent 2422
4537d449ba57
parent 2423
b1a2afa37ec4
child 2425
84f36150fcc3
child 2443
df307487d610

Merge

     1.1 --- a/src/cpu/sparc/vm/assembler_sparc.cpp	Fri Jan 07 15:57:02 2011 -0500
     1.2 +++ b/src/cpu/sparc/vm/assembler_sparc.cpp	Fri Jan 07 13:59:48 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2011, 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 @@ -4083,11 +4083,15 @@
    1.11    store_klass(t2, top);
    1.12    verify_oop(top);
    1.13  
    1.14 +  ld_ptr(G2_thread, in_bytes(JavaThread::tlab_start_offset()), t1);
    1.15 +  sub(top, t1, t1); // size of tlab's allocated portion
    1.16 +  incr_allocated_bytes(t1, 0, t2);
    1.17 +
    1.18    // refill the tlab with an eden allocation
    1.19    bind(do_refill);
    1.20    ld_ptr(G2_thread, in_bytes(JavaThread::tlab_size_offset()), t1);
    1.21    sll_ptr(t1, LogHeapWordSize, t1);
    1.22 -  // add object_size ??
    1.23 +  // allocate new tlab, address returned in top
    1.24    eden_allocate(top, t1, 0, t2, t3, slow_case);
    1.25  
    1.26    st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_start_offset()));
    1.27 @@ -4115,6 +4119,22 @@
    1.28    delayed()->nop();
    1.29  }
    1.30  
    1.31 +void MacroAssembler::incr_allocated_bytes(Register var_size_in_bytes,
    1.32 +                                          int con_size_in_bytes,
    1.33 +                                          Register t1) {
    1.34 +  // Bump total bytes allocated by this thread
    1.35 +  assert(t1->is_global(), "must be global reg"); // so all 64 bits are saved on a context switch
    1.36 +  assert_different_registers(var_size_in_bytes, t1);
    1.37 +  // v8 support has gone the way of the dodo
    1.38 +  ldx(G2_thread, in_bytes(JavaThread::allocated_bytes_offset()), t1);
    1.39 +  if (var_size_in_bytes->is_valid()) {
    1.40 +    add(t1, var_size_in_bytes, t1);
    1.41 +  } else {
    1.42 +    add(t1, con_size_in_bytes, t1);
    1.43 +  }
    1.44 +  stx(t1, G2_thread, in_bytes(JavaThread::allocated_bytes_offset()));
    1.45 +}
    1.46 +
    1.47  Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) {
    1.48    switch (cond) {
    1.49      // Note some conditions are synonyms for others
     2.1 --- a/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Jan 07 15:57:02 2011 -0500
     2.2 +++ b/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Jan 07 13:59:48 2011 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -2388,6 +2388,7 @@
    2.11      Label&   slow_case                 // continuation point if fast allocation fails
    2.12    );
    2.13    void tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case);
    2.14 +  void incr_allocated_bytes(Register var_size_in_bytes, int con_size_in_bytes, Register t1);
    2.15  
    2.16    // interface method calling
    2.17    void lookup_interface_method(Register recv_klass,
     3.1 --- a/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Fri Jan 07 15:57:02 2011 -0500
     3.2 +++ b/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Fri Jan 07 13:59:48 2011 -0800
     3.3 @@ -166,7 +166,7 @@
     3.4    Register obj,                        // result: pointer to object after successful allocation
     3.5    Register var_size_in_bytes,          // object size in bytes if unknown at compile time; invalid otherwise
     3.6    int      con_size_in_bytes,          // object size in bytes if   known at compile time
     3.7 -  Register t1,                         // temp register
     3.8 +  Register t1,                         // temp register, must be global register for incr_allocated_bytes
     3.9    Register t2,                         // temp register
    3.10    Label&   slow_case                   // continuation point if fast allocation fails
    3.11  ) {
    3.12 @@ -174,6 +174,7 @@
    3.13      tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
    3.14    } else {
    3.15      eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
    3.16 +    incr_allocated_bytes(var_size_in_bytes, con_size_in_bytes, t1);
    3.17    }
    3.18  }
    3.19  
    3.20 @@ -214,7 +215,7 @@
    3.21  void C1_MacroAssembler::allocate_object(
    3.22    Register obj,                        // result: pointer to object after successful allocation
    3.23    Register t1,                         // temp register
    3.24 -  Register t2,                         // temp register
    3.25 +  Register t2,                         // temp register, must be a global register for try_allocate
    3.26    Register t3,                         // temp register
    3.27    int      hdr_size,                   // object header size in words
    3.28    int      obj_size,                   // object size in words
     4.1 --- a/src/cpu/sparc/vm/c1_MacroAssembler_sparc.hpp	Fri Jan 07 15:57:02 2011 -0500
     4.2 +++ b/src/cpu/sparc/vm/c1_MacroAssembler_sparc.hpp	Fri Jan 07 13:59:48 2011 -0800
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
     5.1 --- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Fri Jan 07 15:57:02 2011 -0500
     5.2 +++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Fri Jan 07 13:59:48 2011 -0800
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -448,7 +448,9 @@
    5.11  
    5.12            // get the instance size
    5.13            __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size);
    5.14 +
    5.15            __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path);
    5.16 +
    5.17            __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
    5.18            __ verify_oop(O0_obj);
    5.19            __ mov(O0, I0);
    5.20 @@ -459,6 +461,8 @@
    5.21            // get the instance size
    5.22            __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size);
    5.23            __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path);
    5.24 +          __ incr_allocated_bytes(G1_obj_size, 0, G3_t1);
    5.25 +
    5.26            __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
    5.27            __ verify_oop(O0_obj);
    5.28            __ mov(O0, I0);
    5.29 @@ -573,6 +577,7 @@
    5.30            __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size);
    5.31  
    5.32            __ eden_allocate(O0_obj, G1_arr_size, 0, G3_t1, O1_t2, slow_path);  // preserves G1_arr_size
    5.33 +          __ incr_allocated_bytes(G1_arr_size, 0, G3_t1);
    5.34  
    5.35            __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2);
    5.36            __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset);
     6.1 --- a/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Jan 07 15:57:02 2011 -0500
     6.2 +++ b/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Jan 07 13:59:48 2011 -0800
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -3393,21 +3393,21 @@
    6.11      __ delayed()->st_ptr(RnewTopValue, G2_thread, in_bytes(JavaThread::tlab_top_offset()));
    6.12  
    6.13      if (allow_shared_alloc) {
    6.14 -    // Check if tlab should be discarded (refill_waste_limit >= free)
    6.15 -    __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
    6.16 -    __ sub(RendValue, RoldTopValue, RfreeValue);
    6.17 +      // Check if tlab should be discarded (refill_waste_limit >= free)
    6.18 +      __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
    6.19 +      __ sub(RendValue, RoldTopValue, RfreeValue);
    6.20  #ifdef _LP64
    6.21 -    __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
    6.22 +      __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
    6.23  #else
    6.24 -    __ srl(RfreeValue, LogHeapWordSize, RfreeValue);
    6.25 +      __ srl(RfreeValue, LogHeapWordSize, RfreeValue);
    6.26  #endif
    6.27 -    __ cmp(RtlabWasteLimitValue, RfreeValue);
    6.28 -    __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, slow_case); // tlab waste is small
    6.29 -    __ delayed()->nop();
    6.30 -
    6.31 -    // increment waste limit to prevent getting stuck on this slow path
    6.32 -    __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
    6.33 -    __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
    6.34 +      __ cmp(RtlabWasteLimitValue, RfreeValue);
    6.35 +      __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, slow_case); // tlab waste is small
    6.36 +      __ delayed()->nop();
    6.37 +
    6.38 +      // increment waste limit to prevent getting stuck on this slow path
    6.39 +      __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
    6.40 +      __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
    6.41      } else {
    6.42        // No allocation in the shared eden.
    6.43        __ br(Assembler::always, false, Assembler::pt, slow_case);
    6.44 @@ -3445,6 +3445,9 @@
    6.45      __ cmp(RoldTopValue, RnewTopValue);
    6.46      __ brx(Assembler::notEqual, false, Assembler::pn, retry);
    6.47      __ delayed()->nop();
    6.48 +
    6.49 +    // bump total bytes allocated by this thread
    6.50 +    __ incr_allocated_bytes(Roffset, 0, G1_scratch);
    6.51    }
    6.52  
    6.53    if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
     7.1 --- a/src/cpu/x86/vm/assembler_x86.cpp	Fri Jan 07 15:57:02 2011 -0500
     7.2 +++ b/src/cpu/x86/vm/assembler_x86.cpp	Fri Jan 07 13:59:48 2011 -0800
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -820,7 +820,20 @@
    7.11  }
    7.12  
    7.13  
    7.14 -// Now the Assembler instruction (identical for 32/64 bits)
    7.15 +// Now the Assembler instructions (identical for 32/64 bits)
    7.16 +
    7.17 +void Assembler::adcl(Address dst, int32_t imm32) {
    7.18 +  InstructionMark im(this);
    7.19 +  prefix(dst);
    7.20 +  emit_arith_operand(0x81, rdx, dst, imm32);
    7.21 +}
    7.22 +
    7.23 +void Assembler::adcl(Address dst, Register src) {
    7.24 +  InstructionMark im(this);
    7.25 +  prefix(dst, src);
    7.26 +  emit_byte(0x11);
    7.27 +  emit_operand(src, dst);
    7.28 +}
    7.29  
    7.30  void Assembler::adcl(Register dst, int32_t imm32) {
    7.31    prefix(dst);
    7.32 @@ -2195,9 +2208,7 @@
    7.33  void Assembler::orl(Address dst, int32_t imm32) {
    7.34    InstructionMark im(this);
    7.35    prefix(dst);
    7.36 -  emit_byte(0x81);
    7.37 -  emit_operand(rcx, dst, 4);
    7.38 -  emit_long(imm32);
    7.39 +  emit_arith_operand(0x81, rcx, dst, imm32);
    7.40  }
    7.41  
    7.42  void Assembler::orl(Register dst, int32_t imm32) {
    7.43 @@ -2205,7 +2216,6 @@
    7.44    emit_arith(0x81, 0xC8, dst, imm32);
    7.45  }
    7.46  
    7.47 -
    7.48  void Assembler::orl(Register dst, Address src) {
    7.49    InstructionMark im(this);
    7.50    prefix(src, dst);
    7.51 @@ -2213,7 +2223,6 @@
    7.52    emit_operand(dst, src);
    7.53  }
    7.54  
    7.55 -
    7.56  void Assembler::orl(Register dst, Register src) {
    7.57    (void) prefix_and_encode(dst->encoding(), src->encoding());
    7.58    emit_arith(0x0B, 0xC0, dst, src);
    7.59 @@ -2692,15 +2701,14 @@
    7.60  void Assembler::subl(Address dst, int32_t imm32) {
    7.61    InstructionMark im(this);
    7.62    prefix(dst);
    7.63 -  if (is8bit(imm32)) {
    7.64 -    emit_byte(0x83);
    7.65 -    emit_operand(rbp, dst, 1);
    7.66 -    emit_byte(imm32 & 0xFF);
    7.67 -  } else {
    7.68 -    emit_byte(0x81);
    7.69 -    emit_operand(rbp, dst, 4);
    7.70 -    emit_long(imm32);
    7.71 -  }
    7.72 +  emit_arith_operand(0x81, rbp, dst, imm32);
    7.73 +}
    7.74 +
    7.75 +void Assembler::subl(Address dst, Register src) {
    7.76 +  InstructionMark im(this);
    7.77 +  prefix(dst, src);
    7.78 +  emit_byte(0x29);
    7.79 +  emit_operand(src, dst);
    7.80  }
    7.81  
    7.82  void Assembler::subl(Register dst, int32_t imm32) {
    7.83 @@ -2708,13 +2716,6 @@
    7.84    emit_arith(0x81, 0xE8, dst, imm32);
    7.85  }
    7.86  
    7.87 -void Assembler::subl(Address dst, Register src) {
    7.88 -  InstructionMark im(this);
    7.89 -  prefix(dst, src);
    7.90 -  emit_byte(0x29);
    7.91 -  emit_operand(src, dst);
    7.92 -}
    7.93 -
    7.94  void Assembler::subl(Register dst, Address src) {
    7.95    InstructionMark im(this);
    7.96    prefix(src, dst);
    7.97 @@ -4333,6 +4334,7 @@
    7.98    emit_byte(0xD3);
    7.99    emit_byte(0xF8 | encode);
   7.100  }
   7.101 +
   7.102  void Assembler::sbbq(Address dst, int32_t imm32) {
   7.103    InstructionMark im(this);
   7.104    prefixq(dst);
   7.105 @@ -4392,15 +4394,14 @@
   7.106  void Assembler::subq(Address dst, int32_t imm32) {
   7.107    InstructionMark im(this);
   7.108    prefixq(dst);
   7.109 -  if (is8bit(imm32)) {
   7.110 -    emit_byte(0x83);
   7.111 -    emit_operand(rbp, dst, 1);
   7.112 -    emit_byte(imm32 & 0xFF);
   7.113 -  } else {
   7.114 -    emit_byte(0x81);
   7.115 -    emit_operand(rbp, dst, 4);
   7.116 -    emit_long(imm32);
   7.117 -  }
   7.118 +  emit_arith_operand(0x81, rbp, dst, imm32);
   7.119 +}
   7.120 +
   7.121 +void Assembler::subq(Address dst, Register src) {
   7.122 +  InstructionMark im(this);
   7.123 +  prefixq(dst, src);
   7.124 +  emit_byte(0x29);
   7.125 +  emit_operand(src, dst);
   7.126  }
   7.127  
   7.128  void Assembler::subq(Register dst, int32_t imm32) {
   7.129 @@ -4408,13 +4409,6 @@
   7.130    emit_arith(0x81, 0xE8, dst, imm32);
   7.131  }
   7.132  
   7.133 -void Assembler::subq(Address dst, Register src) {
   7.134 -  InstructionMark im(this);
   7.135 -  prefixq(dst, src);
   7.136 -  emit_byte(0x29);
   7.137 -  emit_operand(src, dst);
   7.138 -}
   7.139 -
   7.140  void Assembler::subq(Register dst, Address src) {
   7.141    InstructionMark im(this);
   7.142    prefixq(src, dst);
   7.143 @@ -7136,9 +7130,9 @@
   7.144  }
   7.145  
   7.146  // Preserves rbx, and rdx.
   7.147 -void MacroAssembler::tlab_refill(Label& retry,
   7.148 -                                 Label& try_eden,
   7.149 -                                 Label& slow_case) {
   7.150 +Register MacroAssembler::tlab_refill(Label& retry,
   7.151 +                                     Label& try_eden,
   7.152 +                                     Label& slow_case) {
   7.153    Register top = rax;
   7.154    Register t1  = rcx;
   7.155    Register t2  = rsi;
   7.156 @@ -7185,7 +7179,7 @@
   7.157  
   7.158    // if tlab is currently allocated (top or end != null) then
   7.159    // fill [top, end + alignment_reserve) with array object
   7.160 -  testptr (top, top);
   7.161 +  testptr(top, top);
   7.162    jcc(Assembler::zero, do_refill);
   7.163  
   7.164    // set up the mark word
   7.165 @@ -7197,16 +7191,20 @@
   7.166    movl(Address(top, arrayOopDesc::length_offset_in_bytes()), t1);
   7.167    // set klass to intArrayKlass
   7.168    // dubious reloc why not an oop reloc?
   7.169 -  movptr(t1, ExternalAddress((address) Universe::intArrayKlassObj_addr()));
   7.170 +  movptr(t1, ExternalAddress((address)Universe::intArrayKlassObj_addr()));
   7.171    // store klass last.  concurrent gcs assumes klass length is valid if
   7.172    // klass field is not null.
   7.173    store_klass(top, t1);
   7.174  
   7.175 +  movptr(t1, top);
   7.176 +  subptr(t1, Address(thread_reg, in_bytes(JavaThread::tlab_start_offset())));
   7.177 +  incr_allocated_bytes(thread_reg, t1, 0);
   7.178 +
   7.179    // refill the tlab with an eden allocation
   7.180    bind(do_refill);
   7.181    movptr(t1, Address(thread_reg, in_bytes(JavaThread::tlab_size_offset())));
   7.182    shlptr(t1, LogHeapWordSize);
   7.183 -  // add object_size ??
   7.184 +  // allocate new tlab, address returned in top
   7.185    eden_allocate(top, t1, 0, t2, slow_case);
   7.186  
   7.187    // Check that t1 was preserved in eden_allocate.
   7.188 @@ -7234,6 +7232,34 @@
   7.189    movptr(Address(thread_reg, in_bytes(JavaThread::tlab_end_offset())), top);
   7.190    verify_tlab();
   7.191    jmp(retry);
   7.192 +
   7.193 +  return thread_reg; // for use by caller
   7.194 +}
   7.195 +
   7.196 +void MacroAssembler::incr_allocated_bytes(Register thread,
   7.197 +                                          Register var_size_in_bytes,
   7.198 +                                          int con_size_in_bytes,
   7.199 +                                          Register t1) {
   7.200 +#ifdef _LP64
   7.201 +  if (var_size_in_bytes->is_valid()) {
   7.202 +    addq(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), var_size_in_bytes);
   7.203 +  } else {
   7.204 +    addq(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), con_size_in_bytes);
   7.205 +  }
   7.206 +#else
   7.207 +  if (!thread->is_valid()) {
   7.208 +    assert(t1->is_valid(), "need temp reg");
   7.209 +    thread = t1;
   7.210 +    get_thread(thread);
   7.211 +  }
   7.212 +
   7.213 +  if (var_size_in_bytes->is_valid()) {
   7.214 +    addl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), var_size_in_bytes);
   7.215 +  } else {
   7.216 +    addl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), con_size_in_bytes);
   7.217 +  }
   7.218 +  adcl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())+4), 0);
   7.219 +#endif
   7.220  }
   7.221  
   7.222  static const double     pi_4 =  0.7853981633974483;
     8.1 --- a/src/cpu/x86/vm/assembler_x86.hpp	Fri Jan 07 15:57:02 2011 -0500
     8.2 +++ b/src/cpu/x86/vm/assembler_x86.hpp	Fri Jan 07 13:59:48 2011 -0800
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     8.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -674,12 +674,14 @@
    8.11    // Utilities
    8.12  
    8.13  #ifdef _LP64
    8.14 - static bool is_simm(int64_t x, int nbits) { return -( CONST64(1) << (nbits-1) )  <= x   &&   x  <  ( CONST64(1) << (nbits-1) ); }
    8.15 + static bool is_simm(int64_t x, int nbits) { return -(CONST64(1) << (nbits-1)) <= x &&
    8.16 +                                                    x < (CONST64(1) << (nbits-1)); }
    8.17   static bool is_simm32(int64_t x) { return x == (int64_t)(int32_t)x; }
    8.18  #else
    8.19 - static bool is_simm(int32_t x, int nbits) { return -( 1 << (nbits-1) )  <= x   &&   x  <  ( 1 << (nbits-1) ); }
    8.20 + static bool is_simm(int32_t x, int nbits) { return -(1 << (nbits-1)) <= x &&
    8.21 +                                                    x < (1 << (nbits-1)); }
    8.22   static bool is_simm32(int32_t x) { return true; }
    8.23 -#endif // LP64
    8.24 +#endif // _LP64
    8.25  
    8.26    // Generic instructions
    8.27    // Does 32bit or 64bit as needed for the platform. In some sense these
    8.28 @@ -705,7 +707,6 @@
    8.29    void push(void* v);
    8.30    void pop(void* v);
    8.31  
    8.32 -
    8.33    // These do register sized moves/scans
    8.34    void rep_mov();
    8.35    void rep_set();
    8.36 @@ -716,6 +717,8 @@
    8.37  
    8.38    // Vanilla instructions in lexical order
    8.39  
    8.40 +  void adcl(Address dst, int32_t imm32);
    8.41 +  void adcl(Address dst, Register src);
    8.42    void adcl(Register dst, int32_t imm32);
    8.43    void adcl(Register dst, Address src);
    8.44    void adcl(Register dst, Register src);
    8.45 @@ -724,7 +727,6 @@
    8.46    void adcq(Register dst, Address src);
    8.47    void adcq(Register dst, Register src);
    8.48  
    8.49 -
    8.50    void addl(Address dst, int32_t imm32);
    8.51    void addl(Address dst, Register src);
    8.52    void addl(Register dst, int32_t imm32);
    8.53 @@ -737,7 +739,6 @@
    8.54    void addq(Register dst, Address src);
    8.55    void addq(Register dst, Register src);
    8.56  
    8.57 -
    8.58    void addr_nop_4();
    8.59    void addr_nop_5();
    8.60    void addr_nop_7();
    8.61 @@ -759,7 +760,6 @@
    8.62    void andq(Register dst, Address src);
    8.63    void andq(Register dst, Register src);
    8.64  
    8.65 -
    8.66    // Bitwise Logical AND of Packed Double-Precision Floating-Point Values
    8.67    void andpd(XMMRegister dst, Address src);
    8.68    void andpd(XMMRegister dst, XMMRegister src);
    8.69 @@ -1151,7 +1151,7 @@
    8.70  #ifdef _LP64
    8.71    void movq(Register dst, Register src);
    8.72    void movq(Register dst, Address src);
    8.73 -  void movq(Address dst, Register src);
    8.74 +  void movq(Address  dst, Register src);
    8.75  #endif
    8.76  
    8.77    void movq(Address     dst, MMXRegister src );
    8.78 @@ -1177,7 +1177,7 @@
    8.79    void movsbq(Register dst, Register src);
    8.80  
    8.81    // Move signed 32bit immediate to 64bit extending sign
    8.82 -  void movslq(Address dst, int32_t imm64);
    8.83 +  void movslq(Address  dst, int32_t imm64);
    8.84    void movslq(Register dst, int32_t imm64);
    8.85  
    8.86    void movslq(Register dst, Address src);
    8.87 @@ -1857,7 +1857,10 @@
    8.88      Register t2,                       // temp register
    8.89      Label&   slow_case                 // continuation point if fast allocation fails
    8.90    );
    8.91 -  void tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case);
    8.92 +  Register tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case); // returns TLS address
    8.93 +  void incr_allocated_bytes(Register thread,
    8.94 +                            Register var_size_in_bytes, int con_size_in_bytes,
    8.95 +                            Register t1 = noreg);
    8.96  
    8.97    // interface method calling
    8.98    void lookup_interface_method(Register recv_klass,
    8.99 @@ -2180,9 +2183,9 @@
   8.100    void divss(XMMRegister dst, Address src)        { Assembler::divss(dst, src); }
   8.101    void divss(XMMRegister dst, AddressLiteral src) { Assembler::divss(dst, as_Address(src)); }
   8.102  
   8.103 -  void movsd(XMMRegister dst, XMMRegister src)    { Assembler::movsd(dst, src); }
   8.104 -  void movsd(Address dst, XMMRegister src)        { Assembler::movsd(dst, src); }
   8.105 -  void movsd(XMMRegister dst, Address src)        { Assembler::movsd(dst, src); }
   8.106 +  void movsd(XMMRegister dst, XMMRegister src) { Assembler::movsd(dst, src); }
   8.107 +  void movsd(Address dst, XMMRegister src)     { Assembler::movsd(dst, src); }
   8.108 +  void movsd(XMMRegister dst, Address src)     { Assembler::movsd(dst, src); }
   8.109    void movsd(XMMRegister dst, AddressLiteral src) { Assembler::movsd(dst, as_Address(src)); }
   8.110  
   8.111    void mulsd(XMMRegister dst, XMMRegister src)    { Assembler::mulsd(dst, src); }
     9.1 --- a/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Fri Jan 07 15:57:02 2011 -0500
     9.2 +++ b/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Fri Jan 07 13:59:48 2011 -0800
     9.3 @@ -1,5 +1,5 @@
     9.4  /*
     9.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     9.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     9.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8   *
     9.9   * This code is free software; you can redistribute it and/or modify it
    9.10 @@ -141,6 +141,7 @@
    9.11      tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
    9.12    } else {
    9.13      eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
    9.14 +    incr_allocated_bytes(noreg, var_size_in_bytes, con_size_in_bytes, t1);
    9.15    }
    9.16  }
    9.17  
    9.18 @@ -234,7 +235,7 @@
    9.19  
    9.20  void C1_MacroAssembler::allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case) {
    9.21    assert(obj == rax, "obj must be in rax, for cmpxchg");
    9.22 -  assert(obj != t1 && obj != t2 && t1 != t2, "registers must be different"); // XXX really?
    9.23 +  assert_different_registers(obj, t1, t2); // XXX really?
    9.24    assert(header_size >= 0 && object_size >= header_size, "illegal sizes");
    9.25  
    9.26    try_allocate(obj, noreg, object_size * BytesPerWord, t1, t2, slow_case);
    10.1 --- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Fri Jan 07 15:57:02 2011 -0500
    10.2 +++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Fri Jan 07 13:59:48 2011 -0800
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -977,7 +977,6 @@
   10.11          // verify that that there is really a valid exception in rax,
   10.12          __ verify_not_null_oop(exception_oop);
   10.13  
   10.14 -
   10.15          oop_maps = new OopMapSet();
   10.16          OopMap* oop_map = generate_oop_map(sasm, 1);
   10.17          generate_handle_exception(sasm, oop_maps, oop_map);
   10.18 @@ -1037,13 +1036,16 @@
   10.19            // if we got here then the TLAB allocation failed, so try
   10.20            // refilling the TLAB or allocating directly from eden.
   10.21            Label retry_tlab, try_eden;
   10.22 -          __ tlab_refill(retry_tlab, try_eden, slow_path); // does not destroy rdx (klass)
   10.23 +          const Register thread =
   10.24 +            __ tlab_refill(retry_tlab, try_eden, slow_path); // does not destroy rdx (klass), returns rdi
   10.25  
   10.26            __ bind(retry_tlab);
   10.27  
   10.28            // get the instance size (size is postive so movl is fine for 64bit)
   10.29            __ movl(obj_size, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes()));
   10.30 +
   10.31            __ tlab_allocate(obj, obj_size, 0, t1, t2, slow_path);
   10.32 +
   10.33            __ initialize_object(obj, klass, obj_size, 0, t1, t2);
   10.34            __ verify_oop(obj);
   10.35            __ pop(rbx);
   10.36 @@ -1053,7 +1055,10 @@
   10.37            __ bind(try_eden);
   10.38            // get the instance size (size is postive so movl is fine for 64bit)
   10.39            __ movl(obj_size, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes()));
   10.40 +
   10.41            __ eden_allocate(obj, obj_size, 0, t1, slow_path);
   10.42 +          __ incr_allocated_bytes(thread, obj_size, 0);
   10.43 +
   10.44            __ initialize_object(obj, klass, obj_size, 0, t1, t2);
   10.45            __ verify_oop(obj);
   10.46            __ pop(rbx);
   10.47 @@ -1143,12 +1148,13 @@
   10.48            // if we got here then the TLAB allocation failed, so try
   10.49            // refilling the TLAB or allocating directly from eden.
   10.50            Label retry_tlab, try_eden;
   10.51 -          __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves rbx, & rdx
   10.52 +          const Register thread =
   10.53 +            __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves rbx & rdx, returns rdi
   10.54  
   10.55            __ bind(retry_tlab);
   10.56  
   10.57            // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F))
   10.58 -          // since size is postive movl does right thing on 64bit
   10.59 +          // since size is positive movl does right thing on 64bit
   10.60            __ movl(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes()));
   10.61            // since size is postive movl does right thing on 64bit
   10.62            __ movl(arr_size, length);
   10.63 @@ -1175,7 +1181,7 @@
   10.64  
   10.65            __ bind(try_eden);
   10.66            // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F))
   10.67 -          // since size is postive movl does right thing on 64bit
   10.68 +          // since size is positive movl does right thing on 64bit
   10.69            __ movl(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes()));
   10.70            // since size is postive movl does right thing on 64bit
   10.71            __ movl(arr_size, length);
   10.72 @@ -1188,6 +1194,7 @@
   10.73            __ andptr(arr_size, ~MinObjAlignmentInBytesMask);
   10.74  
   10.75            __ eden_allocate(obj, arr_size, 0, t1, slow_path);  // preserves arr_size
   10.76 +          __ incr_allocated_bytes(thread, arr_size, 0);
   10.77  
   10.78            __ initialize_header(obj, klass, length, t1, t2);
   10.79            __ movb(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes() + (Klass::_lh_header_size_shift / BitsPerByte)));
    11.1 --- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Jan 07 15:57:02 2011 -0500
    11.2 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Jan 07 13:59:48 2011 -0800
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    11.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    11.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.8   *
    11.9   * This code is free software; you can redistribute it and/or modify it
   11.10 @@ -3203,10 +3203,12 @@
   11.11    const bool allow_shared_alloc =
   11.12      Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
   11.13  
   11.14 +  const Register thread = rcx;
   11.15 +  if (UseTLAB || allow_shared_alloc) {
   11.16 +    __ get_thread(thread);
   11.17 +  }
   11.18 +
   11.19    if (UseTLAB) {
   11.20 -    const Register thread = rcx;
   11.21 -
   11.22 -    __ get_thread(thread);
   11.23      __ movptr(rax, Address(thread, in_bytes(JavaThread::tlab_top_offset())));
   11.24      __ lea(rbx, Address(rax, rdx, Address::times_1));
   11.25      __ cmpptr(rbx, Address(thread, in_bytes(JavaThread::tlab_end_offset())));
   11.26 @@ -3247,6 +3249,8 @@
   11.27  
   11.28      // if someone beat us on the allocation, try again, otherwise continue
   11.29      __ jcc(Assembler::notEqual, retry);
   11.30 +
   11.31 +    __ incr_allocated_bytes(thread, rdx, 0);
   11.32    }
   11.33  
   11.34    if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
   11.35 @@ -3256,12 +3260,12 @@
   11.36      __ decrement(rdx, sizeof(oopDesc));
   11.37      __ jcc(Assembler::zero, initialize_header);
   11.38  
   11.39 -  // Initialize topmost object field, divide rdx by 8, check if odd and
   11.40 -  // test if zero.
   11.41 +    // Initialize topmost object field, divide rdx by 8, check if odd and
   11.42 +    // test if zero.
   11.43      __ xorl(rcx, rcx);    // use zero reg to clear memory (shorter code)
   11.44      __ shrl(rdx, LogBytesPerLong); // divide by 2*oopSize and set carry flag if odd
   11.45  
   11.46 -  // rdx must have been multiple of 8
   11.47 +    // rdx must have been multiple of 8
   11.48  #ifdef ASSERT
   11.49      // make sure rdx was multiple of 8
   11.50      Label L;
    12.1 --- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Fri Jan 07 15:57:02 2011 -0500
    12.2 +++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Fri Jan 07 13:59:48 2011 -0800
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    12.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -3266,6 +3266,8 @@
   12.11  
   12.12      // if someone beat us on the allocation, try again, otherwise continue
   12.13      __ jcc(Assembler::notEqual, retry);
   12.14 +
   12.15 +    __ incr_allocated_bytes(r15_thread, rdx, 0);
   12.16    }
   12.17  
   12.18    if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
    13.1 --- a/src/os/solaris/vm/os_solaris.cpp	Fri Jan 07 15:57:02 2011 -0500
    13.2 +++ b/src/os/solaris/vm/os_solaris.cpp	Fri Jan 07 13:59:48 2011 -0800
    13.3 @@ -1,5 +1,5 @@
    13.4  /*
    13.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    13.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    13.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.8   *
    13.9   * This code is free software; you can redistribute it and/or modify it
   13.10 @@ -283,7 +283,7 @@
   13.11                 is_error_reported(),
   13.12                "sp must be inside of selected thread stack");
   13.13  
   13.14 -    thread->_self_raw_id = raw_id;  // mark for quick retrieval
   13.15 +    thread->set_self_raw_id(raw_id);  // mark for quick retrieval
   13.16      _get_thread_cache[ index ] = thread;
   13.17    }
   13.18    return thread;
    14.1 --- a/src/os/solaris/vm/thread_solaris.inline.hpp	Fri Jan 07 15:57:02 2011 -0500
    14.2 +++ b/src/os/solaris/vm/thread_solaris.inline.hpp	Fri Jan 07 13:59:48 2011 -0800
    14.3 @@ -1,5 +1,5 @@
    14.4  /*
    14.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    14.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
    14.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.8   *
    14.9   * This code is free software; you can redistribute it and/or modify it
   14.10 @@ -53,10 +53,10 @@
   14.11  
   14.12    uintptr_t raw = pd_raw_thread_id();
   14.13    int ix = pd_cache_index(raw);
   14.14 -  Thread *Candidate = ThreadLocalStorage::_get_thread_cache[ix];
   14.15 -  if (Candidate->_self_raw_id == raw) {
   14.16 +  Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix];
   14.17 +  if (candidate->self_raw_id() == raw) {
   14.18      // hit
   14.19 -    return Candidate;
   14.20 +    return candidate;
   14.21    } else {
   14.22      return ThreadLocalStorage::get_thread_via_cache_slowly(raw, ix);
   14.23    }
    15.1 --- a/src/share/vm/gc_interface/collectedHeap.inline.hpp	Fri Jan 07 15:57:02 2011 -0500
    15.2 +++ b/src/share/vm/gc_interface/collectedHeap.inline.hpp	Fri Jan 07 13:59:48 2011 -0800
    15.3 @@ -1,5 +1,5 @@
    15.4  /*
    15.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    15.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    15.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.8   *
    15.9   * This code is free software; you can redistribute it and/or modify it
   15.10 @@ -153,6 +153,7 @@
   15.11        check_for_non_bad_heap_word_value(result, size));
   15.12      assert(!HAS_PENDING_EXCEPTION,
   15.13             "Unexpected exception, will result in uninitialized storage");
   15.14 +    THREAD->incr_allocated_bytes(size * HeapWordSize);
   15.15      return result;
   15.16    }
   15.17  
    16.1 --- a/src/share/vm/memory/threadLocalAllocBuffer.cpp	Fri Jan 07 15:57:02 2011 -0500
    16.2 +++ b/src/share/vm/memory/threadLocalAllocBuffer.cpp	Fri Jan 07 13:59:48 2011 -0800
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -114,6 +114,11 @@
   16.11  void ThreadLocalAllocBuffer::make_parsable(bool retire) {
   16.12    if (end() != NULL) {
   16.13      invariants();
   16.14 +
   16.15 +    if (retire) {
   16.16 +      myThread()->incr_allocated_bytes(used_bytes());
   16.17 +    }
   16.18 +
   16.19      CollectedHeap::fill_with_object(top(), hard_end(), retire);
   16.20  
   16.21      if (retire || ZeroTLAB) {  // "Reset" the TLAB
    17.1 --- a/src/share/vm/memory/threadLocalAllocBuffer.hpp	Fri Jan 07 15:57:02 2011 -0500
    17.2 +++ b/src/share/vm/memory/threadLocalAllocBuffer.hpp	Fri Jan 07 13:59:48 2011 -0800
    17.3 @@ -1,5 +1,5 @@
    17.4  /*
    17.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    17.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    17.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.8   *
    17.9   * This code is free software; you can redistribute it and/or modify it
   17.10 @@ -112,6 +112,8 @@
   17.11    HeapWord* top() const                          { return _top; }
   17.12    HeapWord* pf_top() const                       { return _pf_top; }
   17.13    size_t desired_size() const                    { return _desired_size; }
   17.14 +  size_t used() const                            { return pointer_delta(top(), start()); }
   17.15 +  size_t used_bytes() const                      { return pointer_delta(top(), start(), 1); }
   17.16    size_t free() const                            { return pointer_delta(end(), top()); }
   17.17    // Don't discard tlab if remaining space is larger than this.
   17.18    size_t refill_waste_limit() const              { return _refill_waste_limit; }
    18.1 --- a/src/share/vm/opto/macro.cpp	Fri Jan 07 15:57:02 2011 -0500
    18.2 +++ b/src/share/vm/opto/macro.cpp	Fri Jan 07 13:59:48 2011 -0800
    18.3 @@ -1,5 +1,5 @@
    18.4  /*
    18.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    18.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    18.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.8   *
    18.9   * This code is free software; you can redistribute it and/or modify it
   18.10 @@ -1158,7 +1158,7 @@
   18.11      // Note: We set the control input on "eden_end" and "old_eden_top" when using
   18.12      //       a TLAB to work around a bug where these values were being moved across
   18.13      //       a safepoint.  These are not oops, so they cannot be include in the oop
   18.14 -    //       map, but the can be changed by a GC.   The proper way to fix this would
   18.15 +    //       map, but they can be changed by a GC.   The proper way to fix this would
   18.16      //       be to set the raw memory state when generating a  SafepointNode.  However
   18.17      //       this will require extensive changes to the loop optimization in order to
   18.18      //       prevent a degradation of the optimization.
   18.19 @@ -1167,24 +1167,24 @@
   18.20  
   18.21      // allocate the Region and Phi nodes for the result
   18.22      result_region = new (C, 3) RegionNode(3);
   18.23 -    result_phi_rawmem = new (C, 3) PhiNode( result_region, Type::MEMORY, TypeRawPtr::BOTTOM );
   18.24 -    result_phi_rawoop = new (C, 3) PhiNode( result_region, TypeRawPtr::BOTTOM );
   18.25 -    result_phi_i_o    = new (C, 3) PhiNode( result_region, Type::ABIO ); // I/O is used for Prefetch
   18.26 +    result_phi_rawmem = new (C, 3) PhiNode(result_region, Type::MEMORY, TypeRawPtr::BOTTOM);
   18.27 +    result_phi_rawoop = new (C, 3) PhiNode(result_region, TypeRawPtr::BOTTOM);
   18.28 +    result_phi_i_o    = new (C, 3) PhiNode(result_region, Type::ABIO); // I/O is used for Prefetch
   18.29  
   18.30      // We need a Region for the loop-back contended case.
   18.31      enum { fall_in_path = 1, contended_loopback_path = 2 };
   18.32      Node *contended_region;
   18.33      Node *contended_phi_rawmem;
   18.34 -    if( UseTLAB ) {
   18.35 +    if (UseTLAB) {
   18.36        contended_region = toobig_false;
   18.37        contended_phi_rawmem = mem;
   18.38      } else {
   18.39        contended_region = new (C, 3) RegionNode(3);
   18.40 -      contended_phi_rawmem = new (C, 3) PhiNode( contended_region, Type::MEMORY, TypeRawPtr::BOTTOM);
   18.41 +      contended_phi_rawmem = new (C, 3) PhiNode(contended_region, Type::MEMORY, TypeRawPtr::BOTTOM);
   18.42        // Now handle the passing-too-big test.  We fall into the contended
   18.43        // loop-back merge point.
   18.44 -      contended_region    ->init_req( fall_in_path, toobig_false );
   18.45 -      contended_phi_rawmem->init_req( fall_in_path, mem );
   18.46 +      contended_region    ->init_req(fall_in_path, toobig_false);
   18.47 +      contended_phi_rawmem->init_req(fall_in_path, mem);
   18.48        transform_later(contended_region);
   18.49        transform_later(contended_phi_rawmem);
   18.50      }
   18.51 @@ -1192,78 +1192,101 @@
   18.52      // Load(-locked) the heap top.
   18.53      // See note above concerning the control input when using a TLAB
   18.54      Node *old_eden_top = UseTLAB
   18.55 -      ? new (C, 3) LoadPNode     ( ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM )
   18.56 -      : new (C, 3) LoadPLockedNode( contended_region, contended_phi_rawmem, eden_top_adr );
   18.57 +      ? new (C, 3) LoadPNode      (ctrl, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, TypeRawPtr::BOTTOM)
   18.58 +      : new (C, 3) LoadPLockedNode(contended_region, contended_phi_rawmem, eden_top_adr);
   18.59  
   18.60      transform_later(old_eden_top);
   18.61      // Add to heap top to get a new heap top
   18.62 -    Node *new_eden_top = new (C, 4) AddPNode( top(), old_eden_top, size_in_bytes );
   18.63 +    Node *new_eden_top = new (C, 4) AddPNode(top(), old_eden_top, size_in_bytes);
   18.64      transform_later(new_eden_top);
   18.65      // Check for needing a GC; compare against heap end
   18.66 -    Node *needgc_cmp = new (C, 3) CmpPNode( new_eden_top, eden_end );
   18.67 +    Node *needgc_cmp = new (C, 3) CmpPNode(new_eden_top, eden_end);
   18.68      transform_later(needgc_cmp);
   18.69 -    Node *needgc_bol = new (C, 2) BoolNode( needgc_cmp, BoolTest::ge );
   18.70 +    Node *needgc_bol = new (C, 2) BoolNode(needgc_cmp, BoolTest::ge);
   18.71      transform_later(needgc_bol);
   18.72 -    IfNode *needgc_iff = new (C, 2) IfNode(contended_region, needgc_bol, PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN );
   18.73 +    IfNode *needgc_iff = new (C, 2) IfNode(contended_region, needgc_bol, PROB_UNLIKELY_MAG(4), COUNT_UNKNOWN);
   18.74      transform_later(needgc_iff);
   18.75  
   18.76      // Plug the failing-heap-space-need-gc test into the slow-path region
   18.77 -    Node *needgc_true = new (C, 1) IfTrueNode( needgc_iff );
   18.78 +    Node *needgc_true = new (C, 1) IfTrueNode(needgc_iff);
   18.79      transform_later(needgc_true);
   18.80 -    if( initial_slow_test ) {
   18.81 -      slow_region    ->init_req( need_gc_path, needgc_true );
   18.82 +    if (initial_slow_test) {
   18.83 +      slow_region->init_req(need_gc_path, needgc_true);
   18.84        // This completes all paths into the slow merge point
   18.85        transform_later(slow_region);
   18.86      } else {                      // No initial slow path needed!
   18.87        // Just fall from the need-GC path straight into the VM call.
   18.88 -      slow_region    = needgc_true;
   18.89 +      slow_region = needgc_true;
   18.90      }
   18.91      // No need for a GC.  Setup for the Store-Conditional
   18.92 -    Node *needgc_false = new (C, 1) IfFalseNode( needgc_iff );
   18.93 +    Node *needgc_false = new (C, 1) IfFalseNode(needgc_iff);
   18.94      transform_later(needgc_false);
   18.95  
   18.96      // Grab regular I/O before optional prefetch may change it.
   18.97      // Slow-path does no I/O so just set it to the original I/O.
   18.98 -    result_phi_i_o->init_req( slow_result_path, i_o );
   18.99 +    result_phi_i_o->init_req(slow_result_path, i_o);
  18.100  
  18.101      i_o = prefetch_allocation(i_o, needgc_false, contended_phi_rawmem,
  18.102                                old_eden_top, new_eden_top, length);
  18.103  
  18.104 +    // Name successful fast-path variables
  18.105 +    Node* fast_oop = old_eden_top;
  18.106 +    Node* fast_oop_ctrl;
  18.107 +    Node* fast_oop_rawmem;
  18.108 +
  18.109      // Store (-conditional) the modified eden top back down.
  18.110      // StorePConditional produces flags for a test PLUS a modified raw
  18.111      // memory state.
  18.112 -    Node *store_eden_top;
  18.113 -    Node *fast_oop_ctrl;
  18.114 -    if( UseTLAB ) {
  18.115 -      store_eden_top = new (C, 4) StorePNode( needgc_false, contended_phi_rawmem, eden_top_adr, TypeRawPtr::BOTTOM, new_eden_top );
  18.116 +    if (UseTLAB) {
  18.117 +      Node* store_eden_top =
  18.118 +        new (C, 4) StorePNode(needgc_false, contended_phi_rawmem, eden_top_adr,
  18.119 +                              TypeRawPtr::BOTTOM, new_eden_top);
  18.120        transform_later(store_eden_top);
  18.121        fast_oop_ctrl = needgc_false; // No contention, so this is the fast path
  18.122 +      fast_oop_rawmem = store_eden_top;
  18.123      } else {
  18.124 -      store_eden_top = new (C, 5) StorePConditionalNode( needgc_false, contended_phi_rawmem, eden_top_adr, new_eden_top, old_eden_top );
  18.125 +      Node* store_eden_top =
  18.126 +        new (C, 5) StorePConditionalNode(needgc_false, contended_phi_rawmem, eden_top_adr,
  18.127 +                                         new_eden_top, fast_oop/*old_eden_top*/);
  18.128        transform_later(store_eden_top);
  18.129 -      Node *contention_check = new (C, 2) BoolNode( store_eden_top, BoolTest::ne );
  18.130 +      Node *contention_check = new (C, 2) BoolNode(store_eden_top, BoolTest::ne);
  18.131        transform_later(contention_check);
  18.132        store_eden_top = new (C, 1) SCMemProjNode(store_eden_top);
  18.133        transform_later(store_eden_top);
  18.134  
  18.135        // If not using TLABs, check to see if there was contention.
  18.136 -      IfNode *contention_iff = new (C, 2) IfNode ( needgc_false, contention_check, PROB_MIN, COUNT_UNKNOWN );
  18.137 +      IfNode *contention_iff = new (C, 2) IfNode (needgc_false, contention_check, PROB_MIN, COUNT_UNKNOWN);
  18.138        transform_later(contention_iff);
  18.139 -      Node *contention_true = new (C, 1) IfTrueNode( contention_iff );
  18.140 +      Node *contention_true = new (C, 1) IfTrueNode(contention_iff);
  18.141        transform_later(contention_true);
  18.142        // If contention, loopback and try again.
  18.143 -      contended_region->init_req( contended_loopback_path, contention_true );
  18.144 -      contended_phi_rawmem->init_req( contended_loopback_path, store_eden_top );
  18.145 +      contended_region->init_req(contended_loopback_path, contention_true);
  18.146 +      contended_phi_rawmem->init_req(contended_loopback_path, store_eden_top);
  18.147  
  18.148        // Fast-path succeeded with no contention!
  18.149 -      Node *contention_false = new (C, 1) IfFalseNode( contention_iff );
  18.150 +      Node *contention_false = new (C, 1) IfFalseNode(contention_iff);
  18.151        transform_later(contention_false);
  18.152        fast_oop_ctrl = contention_false;
  18.153 +
  18.154 +      // Bump total allocated bytes for this thread
  18.155 +      Node* thread = new (C, 1) ThreadLocalNode();
  18.156 +      transform_later(thread);
  18.157 +      Node* alloc_bytes_adr = basic_plus_adr(top()/*not oop*/, thread,
  18.158 +                                             in_bytes(JavaThread::allocated_bytes_offset()));
  18.159 +      Node* alloc_bytes = make_load(fast_oop_ctrl, store_eden_top, alloc_bytes_adr,
  18.160 +                                    0, TypeLong::LONG, T_LONG);
  18.161 +#ifdef _LP64
  18.162 +      Node* alloc_size = size_in_bytes;
  18.163 +#else
  18.164 +      Node* alloc_size = new (C, 2) ConvI2LNode(size_in_bytes);
  18.165 +      transform_later(alloc_size);
  18.166 +#endif
  18.167 +      Node* new_alloc_bytes = new (C, 3) AddLNode(alloc_bytes, alloc_size);
  18.168 +      transform_later(new_alloc_bytes);
  18.169 +      fast_oop_rawmem = make_store(fast_oop_ctrl, store_eden_top, alloc_bytes_adr,
  18.170 +                                   0, new_alloc_bytes, T_LONG);
  18.171      }
  18.172  
  18.173 -    // Rename successful fast-path variables to make meaning more obvious
  18.174 -    Node* fast_oop        = old_eden_top;
  18.175 -    Node* fast_oop_rawmem = store_eden_top;
  18.176      fast_oop_rawmem = initialize_object(alloc,
  18.177                                          fast_oop_ctrl, fast_oop_rawmem, fast_oop,
  18.178                                          klass_node, length, size_in_bytes);
  18.179 @@ -1282,11 +1305,11 @@
  18.180  
  18.181        call->init_req(TypeFunc::Parms+0, thread);
  18.182        call->init_req(TypeFunc::Parms+1, fast_oop);
  18.183 -      call->init_req( TypeFunc::Control, fast_oop_ctrl );
  18.184 -      call->init_req( TypeFunc::I_O    , top() )        ;   // does no i/o
  18.185 -      call->init_req( TypeFunc::Memory , fast_oop_rawmem );
  18.186 -      call->init_req( TypeFunc::ReturnAdr, alloc->in(TypeFunc::ReturnAdr) );
  18.187 -      call->init_req( TypeFunc::FramePtr, alloc->in(TypeFunc::FramePtr) );
  18.188 +      call->init_req(TypeFunc::Control, fast_oop_ctrl);
  18.189 +      call->init_req(TypeFunc::I_O    , top()); // does no i/o
  18.190 +      call->init_req(TypeFunc::Memory , fast_oop_rawmem);
  18.191 +      call->init_req(TypeFunc::ReturnAdr, alloc->in(TypeFunc::ReturnAdr));
  18.192 +      call->init_req(TypeFunc::FramePtr, alloc->in(TypeFunc::FramePtr));
  18.193        transform_later(call);
  18.194        fast_oop_ctrl = new (C, 1) ProjNode(call,TypeFunc::Control);
  18.195        transform_later(fast_oop_ctrl);
  18.196 @@ -1295,10 +1318,10 @@
  18.197      }
  18.198  
  18.199      // Plug in the successful fast-path into the result merge point
  18.200 -    result_region    ->init_req( fast_result_path, fast_oop_ctrl );
  18.201 -    result_phi_rawoop->init_req( fast_result_path, fast_oop );
  18.202 -    result_phi_i_o   ->init_req( fast_result_path, i_o );
  18.203 -    result_phi_rawmem->init_req( fast_result_path, fast_oop_rawmem );
  18.204 +    result_region    ->init_req(fast_result_path, fast_oop_ctrl);
  18.205 +    result_phi_rawoop->init_req(fast_result_path, fast_oop);
  18.206 +    result_phi_i_o   ->init_req(fast_result_path, i_o);
  18.207 +    result_phi_rawmem->init_req(fast_result_path, fast_oop_rawmem);
  18.208    } else {
  18.209      slow_region = ctrl;
  18.210    }
    19.1 --- a/src/share/vm/prims/jvmti.xml	Fri Jan 07 15:57:02 2011 -0500
    19.2 +++ b/src/share/vm/prims/jvmti.xml	Fri Jan 07 13:59:48 2011 -0800
    19.3 @@ -1,7 +1,7 @@
    19.4  <?xml version="1.0" encoding="ISO-8859-1"?>
    19.5  <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>
    19.6  <!--
    19.7 - Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    19.8 + Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
    19.9   DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   19.10  
   19.11   This code is free software; you can redistribute it and/or modify it
   19.12 @@ -10697,7 +10697,7 @@
   19.13  	    <internallink id="mUTF">modified UTF-8</internallink> string.
   19.14  	  </description>
   19.15  	</param>
   19.16 -        <param id="value">
   19.17 +        <param id="value_ptr">
   19.18  	  <inbuf>
   19.19  	    <char/>
   19.20  	    <nullok>
    20.1 --- a/src/share/vm/prims/jvmtiEnv.cpp	Fri Jan 07 15:57:02 2011 -0500
    20.2 +++ b/src/share/vm/prims/jvmtiEnv.cpp	Fri Jan 07 13:59:48 2011 -0800
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
   20.10 @@ -1802,7 +1802,7 @@
   20.11  // depth - pre-checked as non-negative
   20.12  // value - pre-checked for NULL
   20.13  jvmtiError
   20.14 -JvmtiEnv::GetLocalInstance(JavaThread* java_thread, jint depth, jobject* value){
   20.15 +JvmtiEnv::GetLocalInstance(JavaThread* java_thread, jint depth, jobject* value_ptr){
   20.16    JavaThread* current_thread = JavaThread::current();
   20.17    // rm object is created to clean up the javaVFrame created in
   20.18    // doit_prologue(), but after doit() is finished with it.
   20.19 @@ -1814,7 +1814,7 @@
   20.20    if (err != JVMTI_ERROR_NONE) {
   20.21      return err;
   20.22    } else {
   20.23 -    *value = op.value().l;
   20.24 +    *value_ptr = op.value().l;
   20.25      return JVMTI_ERROR_NONE;
   20.26    }
   20.27  } /* end GetLocalInstance */
   20.28 @@ -3440,12 +3440,12 @@
   20.29  // property - pre-checked for NULL
   20.30  // value - NULL is a valid value, must be checked
   20.31  jvmtiError
   20.32 -JvmtiEnv::SetSystemProperty(const char* property, const char* value) {
   20.33 +JvmtiEnv::SetSystemProperty(const char* property, const char* value_ptr) {
   20.34    jvmtiError err =JVMTI_ERROR_NOT_AVAILABLE;
   20.35  
   20.36    for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
   20.37      if (strcmp(property, p->key()) == 0) {
   20.38 -      if (p->set_value((char *)value)) {
   20.39 +      if (p->set_value((char *)value_ptr)) {
   20.40          err =  JVMTI_ERROR_NONE;
   20.41        }
   20.42      }
    21.1 --- a/src/share/vm/runtime/thread.cpp	Fri Jan 07 15:57:02 2011 -0500
    21.2 +++ b/src/share/vm/runtime/thread.cpp	Fri Jan 07 13:59:48 2011 -0800
    21.3 @@ -1,5 +1,5 @@
    21.4  /*
    21.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    21.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    21.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.8   *
    21.9   * This code is free software; you can redistribute it and/or modify it
   21.10 @@ -177,20 +177,19 @@
   21.11  
   21.12  
   21.13  Thread::Thread() {
   21.14 -  // stack
   21.15 -  _stack_base   = NULL;
   21.16 -  _stack_size   = 0;
   21.17 -  _self_raw_id  = 0;
   21.18 -  _lgrp_id      = -1;
   21.19 -  _osthread     = NULL;
   21.20 +  // stack and get_thread
   21.21 +  set_stack_base(NULL);
   21.22 +  set_stack_size(0);
   21.23 +  set_self_raw_id(0);
   21.24 +  set_lgrp_id(-1);
   21.25  
   21.26    // allocated data structures
   21.27 +  set_osthread(NULL);
   21.28    set_resource_area(new ResourceArea());
   21.29    set_handle_area(new HandleArea(NULL));
   21.30    set_active_handles(NULL);
   21.31    set_free_handle_block(NULL);
   21.32    set_last_handle_mark(NULL);
   21.33 -  set_osthread(NULL);
   21.34  
   21.35    // This initial value ==> never claimed.
   21.36    _oops_do_parity = 0;
   21.37 @@ -205,6 +204,7 @@
   21.38    NOT_PRODUCT(_skip_gcalot = false;)
   21.39    CHECK_UNHANDLED_OOPS_ONLY(_gc_locked_out_count = 0;)
   21.40    _jvmti_env_iteration_count = 0;
   21.41 +  set_allocated_bytes(0);
   21.42    _vm_operation_started_count = 0;
   21.43    _vm_operation_completed_count = 0;
   21.44    _current_pending_monitor = NULL;
   21.45 @@ -3231,7 +3231,7 @@
   21.46        warning("java.lang.ArithmeticException has not been initialized");
   21.47        warning("java.lang.StackOverflowError has not been initialized");
   21.48      }
   21.49 -  }
   21.50 +    }
   21.51  
   21.52    // See        : bugid 4211085.
   21.53    // Background : the static initializer of java.lang.Compiler tries to read
    22.1 --- a/src/share/vm/runtime/thread.hpp	Fri Jan 07 15:57:02 2011 -0500
    22.2 +++ b/src/share/vm/runtime/thread.hpp	Fri Jan 07 13:59:48 2011 -0800
    22.3 @@ -1,5 +1,5 @@
    22.4  /*
    22.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    22.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    22.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.8   *
    22.9   * This code is free software; you can redistribute it and/or modify it
   22.10 @@ -60,7 +60,7 @@
   22.11  class JvmtiGetLoadedClassesClosure;
   22.12  class ThreadStatistics;
   22.13  class ConcurrentLocksDump;
   22.14 -class ParkEvent ;
   22.15 +class ParkEvent;
   22.16  class Parker;
   22.17  
   22.18  class ciEnv;
   22.19 @@ -170,7 +170,7 @@
   22.20    //
   22.21  
   22.22    // suspend/resume lock: used for self-suspend
   22.23 -  Monitor*    _SR_lock;
   22.24 +  Monitor* _SR_lock;
   22.25  
   22.26   protected:
   22.27    enum SuspendFlags {
   22.28 @@ -194,7 +194,7 @@
   22.29   public:
   22.30    void enter_signal_handler() { _num_nested_signal++; }
   22.31    void leave_signal_handler() { _num_nested_signal--; }
   22.32 -  bool is_inside_signal_handler() const  { return _num_nested_signal > 0; }
   22.33 +  bool is_inside_signal_handler() const { return _num_nested_signal > 0; }
   22.34  
   22.35   private:
   22.36    // Debug tracing
   22.37 @@ -215,7 +215,7 @@
   22.38  
   22.39    public:
   22.40     void set_last_handle_mark(HandleMark* mark)   { _last_handle_mark = mark; }
   22.41 -    HandleMark* last_handle_mark() const          { return _last_handle_mark; }
   22.42 +   HandleMark* last_handle_mark() const          { return _last_handle_mark; }
   22.43    private:
   22.44  
   22.45    // debug support for checking if code does allow safepoints or not
   22.46 @@ -227,11 +227,11 @@
   22.47    //
   22.48    // The two classes No_Safepoint_Verifier and No_Allocation_Verifier are used to set these counters.
   22.49    //
   22.50 -  NOT_PRODUCT(int _allow_safepoint_count;)       // If 0, thread allow a safepoint to happen
   22.51 -  debug_only (int _allow_allocation_count;)      // If 0, the thread is allowed to allocate oops.
   22.52 +  NOT_PRODUCT(int _allow_safepoint_count;)      // If 0, thread allow a safepoint to happen
   22.53 +  debug_only (int _allow_allocation_count;)     // If 0, the thread is allowed to allocate oops.
   22.54  
   22.55    // Used by SkipGCALot class.
   22.56 -  NOT_PRODUCT(bool _skip_gcalot;)                // Should we elide gc-a-lot?
   22.57 +  NOT_PRODUCT(bool _skip_gcalot;)               // Should we elide gc-a-lot?
   22.58  
   22.59    // Record when GC is locked out via the GC_locker mechanism
   22.60    CHECK_UNHANDLED_OOPS_ONLY(int _gc_locked_out_count;)
   22.61 @@ -242,24 +242,26 @@
   22.62    friend class ThreadLocalStorage;
   22.63    friend class GC_locker;
   22.64  
   22.65 -  ThreadLocalAllocBuffer _tlab;                  // Thread-local eden
   22.66 +  ThreadLocalAllocBuffer _tlab;                 // Thread-local eden
   22.67 +  jlong _allocated_bytes;                       // Cumulative number of bytes allocated on
   22.68 +                                                // the Java heap
   22.69  
   22.70 -  int   _vm_operation_started_count;             // VM_Operation support
   22.71 -  int   _vm_operation_completed_count;           // VM_Operation support
   22.72 +  int   _vm_operation_started_count;            // VM_Operation support
   22.73 +  int   _vm_operation_completed_count;          // VM_Operation support
   22.74  
   22.75 -  ObjectMonitor* _current_pending_monitor;       // ObjectMonitor this thread
   22.76 -                                                 // is waiting to lock
   22.77 -  bool _current_pending_monitor_is_from_java;    // locking is from Java code
   22.78 +  ObjectMonitor* _current_pending_monitor;      // ObjectMonitor this thread
   22.79 +                                                // is waiting to lock
   22.80 +  bool _current_pending_monitor_is_from_java;   // locking is from Java code
   22.81  
   22.82    // ObjectMonitor on which this thread called Object.wait()
   22.83    ObjectMonitor* _current_waiting_monitor;
   22.84  
   22.85    // Private thread-local objectmonitor list - a simple cache organized as a SLL.
   22.86   public:
   22.87 -  ObjectMonitor * omFreeList ;
   22.88 -  int omFreeCount ;                             // length of omFreeList
   22.89 -  int omFreeProvision ;                         // reload chunk size
   22.90 -  ObjectMonitor * omInUseList;                  // SLL to track monitors in circulation
   22.91 +  ObjectMonitor* omFreeList;
   22.92 +  int omFreeCount;                              // length of omFreeList
   22.93 +  int omFreeProvision;                          // reload chunk size
   22.94 +  ObjectMonitor* omInUseList;                   // SLL to track monitors in circulation
   22.95    int omInUseCount;                             // length of omInUseList
   22.96  
   22.97   public:
   22.98 @@ -280,7 +282,6 @@
   22.99    // Testers
  22.100    virtual bool is_VM_thread()       const            { return false; }
  22.101    virtual bool is_Java_thread()     const            { return false; }
  22.102 -  // Remove this ifdef when C1 is ported to the compiler interface.
  22.103    virtual bool is_Compiler_thread() const            { return false; }
  22.104    virtual bool is_hidden_from_external_view() const  { return false; }
  22.105    virtual bool is_jvmti_agent_thread() const         { return false; }
  22.106 @@ -344,15 +345,15 @@
  22.107    // Support for Unhandled Oop detection
  22.108  #ifdef CHECK_UNHANDLED_OOPS
  22.109   private:
  22.110 -  UnhandledOops *_unhandled_oops;
  22.111 +  UnhandledOops* _unhandled_oops;
  22.112   public:
  22.113 -  UnhandledOops* unhandled_oops()               { return _unhandled_oops; }
  22.114 +  UnhandledOops* unhandled_oops() { return _unhandled_oops; }
  22.115    // Mark oop safe for gc.  It may be stack allocated but won't move.
  22.116 -  void allow_unhandled_oop(oop *op)              {
  22.117 +  void allow_unhandled_oop(oop *op) {
  22.118      if (CheckUnhandledOops) unhandled_oops()->allow_unhandled_oop(op);
  22.119    }
  22.120    // Clear oops at safepoint so crashes point to unhandled oop violator
  22.121 -  void clear_unhandled_oops()                   {
  22.122 +  void clear_unhandled_oops() {
  22.123      if (CheckUnhandledOops) unhandled_oops()->clear_unhandled_oops();
  22.124    }
  22.125    bool is_gc_locked_out() { return _gc_locked_out_count > 0; }
  22.126 @@ -392,6 +393,22 @@
  22.127      }
  22.128    }
  22.129  
  22.130 +  jlong allocated_bytes()               { return _allocated_bytes; }
  22.131 +  void set_allocated_bytes(jlong value) { _allocated_bytes = value; }
  22.132 +  void incr_allocated_bytes(jlong size) { _allocated_bytes += size; }
  22.133 +  jlong cooked_allocated_bytes() {
  22.134 +    jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
  22.135 +    if (UseTLAB) {
  22.136 +      size_t used_bytes = tlab().used_bytes();
  22.137 +      if ((ssize_t)used_bytes > 0) {
  22.138 +        // More-or-less valid tlab.  The load_acquire above should ensure
  22.139 +        // that the result of the add is <= the instantaneous value
  22.140 +        return allocated_bytes + used_bytes;
  22.141 +      }
  22.142 +    }
  22.143 +    return allocated_bytes;
  22.144 +  }
  22.145 +
  22.146    // VM operation support
  22.147    int vm_operation_ticket()                      { return ++_vm_operation_started_count; }
  22.148    int vm_operation_completed_count()             { return _vm_operation_completed_count; }
  22.149 @@ -489,8 +506,11 @@
  22.150      return (_stack_base >= adr && adr >= (_stack_base - _stack_size));
  22.151    }
  22.152  
  22.153 -  int     lgrp_id() const                 { return _lgrp_id; }
  22.154 -  void    set_lgrp_id(int value)          { _lgrp_id = value; }
  22.155 +  uintptr_t self_raw_id()                    { return _self_raw_id; }
  22.156 +  void      set_self_raw_id(uintptr_t value) { _self_raw_id = value; }
  22.157 +
  22.158 +  int     lgrp_id() const        { return _lgrp_id; }
  22.159 +  void    set_lgrp_id(int value) { _lgrp_id = value; }
  22.160  
  22.161    // Printing
  22.162    void print_on(outputStream* st) const;
  22.163 @@ -502,7 +522,7 @@
  22.164  #ifdef ASSERT
  22.165   private:
  22.166    // Deadlock detection support for Mutex locks. List of locks own by thread.
  22.167 -  Monitor *_owned_locks;
  22.168 +  Monitor* _owned_locks;
  22.169    // Mutex::set_owner_implementation is the only place where _owned_locks is modified,
  22.170    // thus the friendship
  22.171    friend class Mutex;
  22.172 @@ -511,7 +531,7 @@
  22.173   public:
  22.174    void print_owned_locks_on(outputStream* st) const;
  22.175    void print_owned_locks() const                 { print_owned_locks_on(tty);    }
  22.176 -  Monitor * owned_locks() const                  { return _owned_locks;          }
  22.177 +  Monitor* owned_locks() const                   { return _owned_locks;          }
  22.178    bool owns_locks() const                        { return owned_locks() != NULL; }
  22.179    bool owns_locks_but_compiled_lock() const;
  22.180  
  22.181 @@ -538,7 +558,7 @@
  22.182    static ByteSize stack_size_offset()            { return byte_offset_of(Thread, _stack_size ); }
  22.183  
  22.184  #define TLAB_FIELD_OFFSET(name) \
  22.185 -  static ByteSize tlab_##name##_offset()            { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); }
  22.186 +  static ByteSize tlab_##name##_offset()         { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); }
  22.187  
  22.188    TLAB_FIELD_OFFSET(start)
  22.189    TLAB_FIELD_OFFSET(end)
  22.190 @@ -552,6 +572,8 @@
  22.191  
  22.192  #undef TLAB_FIELD_OFFSET
  22.193  
  22.194 +  static ByteSize allocated_bytes_offset()       { return byte_offset_of(Thread, _allocated_bytes ); }
  22.195 +
  22.196   public:
  22.197    volatile intptr_t _Stalled ;
  22.198    volatile int _TypeTag ;
    23.1 --- a/src/share/vm/services/jmm.h	Fri Jan 07 15:57:02 2011 -0500
    23.2 +++ b/src/share/vm/services/jmm.h	Fri Jan 07 13:59:48 2011 -0800
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    23.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.8   *
    23.9   * This code is free software; you can redistribute it and/or modify it
   23.10 @@ -60,7 +60,8 @@
   23.11    unsigned int isBootClassPathSupported : 1;
   23.12    unsigned int isObjectMonitorUsageSupported : 1;
   23.13    unsigned int isSynchronizerUsageSupported : 1;
   23.14 -  unsigned int : 24;
   23.15 +  unsigned int isThreadAllocatedMemorySupported : 1;
   23.16 +  unsigned int : 23;
   23.17  } jmmOptionalSupport;
   23.18  
   23.19  typedef enum {
   23.20 @@ -105,7 +106,8 @@
   23.21    JMM_VERBOSE_GC                     = 21,
   23.22    JMM_VERBOSE_CLASS                  = 22,
   23.23    JMM_THREAD_CONTENTION_MONITORING   = 23,
   23.24 -  JMM_THREAD_CPU_TIME                = 24
   23.25 +  JMM_THREAD_CPU_TIME                = 24,
   23.26 +  JMM_THREAD_ALLOCATED_MEMORY        = 25
   23.27  } jmmBoolAttribute;
   23.28  
   23.29  
   23.30 @@ -213,7 +215,10 @@
   23.31    jobject      (JNICALL *GetMemoryPoolUsage)     (JNIEnv* env, jobject pool);
   23.32    jobject      (JNICALL *GetPeakMemoryPoolUsage) (JNIEnv* env, jobject pool);
   23.33  
   23.34 -  void*        reserved4;
   23.35 +  void         (JNICALL *GetThreadAllocatedMemory)
   23.36 +                                                 (JNIEnv *env,
   23.37 +                                                  jlongArray ids,
   23.38 +                                                  jlongArray sizeArray);
   23.39  
   23.40    jobject      (JNICALL *GetMemoryUsage)         (JNIEnv* env, jboolean heap);
   23.41  
   23.42 @@ -228,6 +233,8 @@
   23.43                                                    jlong* result);
   23.44  
   23.45    jobjectArray (JNICALL *FindCircularBlockedThreads) (JNIEnv *env);
   23.46 +
   23.47 +  // Not used in JDK 6 or JDK 7
   23.48    jlong        (JNICALL *GetThreadCpuTime)       (JNIEnv *env, jlong thread_id);
   23.49  
   23.50    jobjectArray (JNICALL *GetVMGlobalNames)       (JNIEnv *env);
   23.51 @@ -262,14 +269,22 @@
   23.52    void         (JNICALL *GetLastGCStat)          (JNIEnv *env,
   23.53                                                    jobject mgr,
   23.54                                                    jmmGCStat *gc_stat);
   23.55 -  jlong        (JNICALL *GetThreadCpuTimeWithKind) (JNIEnv *env,
   23.56 -                                                    jlong thread_id,
   23.57 -                                                    jboolean user_sys_cpu_time);
   23.58 -  void*        reserved5;
   23.59 +
   23.60 +  jlong        (JNICALL *GetThreadCpuTimeWithKind)
   23.61 +                                                 (JNIEnv *env,
   23.62 +                                                  jlong thread_id,
   23.63 +                                                  jboolean user_sys_cpu_time);
   23.64 +  void         (JNICALL *GetThreadCpuTimesWithKind)
   23.65 +                                                 (JNIEnv *env,
   23.66 +                                                  jlongArray ids,
   23.67 +                                                  jlongArray timeArray,
   23.68 +                                                  jboolean user_sys_cpu_time);
   23.69 +
   23.70    jint         (JNICALL *DumpHeap0)              (JNIEnv *env,
   23.71                                                    jstring outputfile,
   23.72                                                    jboolean live);
   23.73 -  jobjectArray (JNICALL *FindDeadlocks)             (JNIEnv *env, jboolean object_monitors_only);
   23.74 +  jobjectArray (JNICALL *FindDeadlocks)          (JNIEnv *env,
   23.75 +                                                  jboolean object_monitors_only);
   23.76    void         (JNICALL *SetVMGlobal)            (JNIEnv *env,
   23.77                                                    jstring flag_name,
   23.78                                                    jvalue  new_value);
    24.1 --- a/src/share/vm/services/management.cpp	Fri Jan 07 15:57:02 2011 -0500
    24.2 +++ b/src/share/vm/services/management.cpp	Fri Jan 07 13:59:48 2011 -0800
    24.3 @@ -1,5 +1,5 @@
    24.4  /*
    24.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    24.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    24.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.8   *
    24.9   * This code is free software; you can redistribute it and/or modify it
   24.10 @@ -101,12 +101,14 @@
   24.11      _optional_support.isCurrentThreadCpuTimeSupported = 0;
   24.12      _optional_support.isOtherThreadCpuTimeSupported = 0;
   24.13    }
   24.14 +
   24.15    _optional_support.isBootClassPathSupported = 1;
   24.16    _optional_support.isObjectMonitorUsageSupported = 1;
   24.17  #ifndef SERVICES_KERNEL
   24.18    // This depends on the heap inspector
   24.19    _optional_support.isSynchronizerUsageSupported = 1;
   24.20  #endif // SERVICES_KERNEL
   24.21 +  _optional_support.isThreadAllocatedMemorySupported = 1;
   24.22  }
   24.23  
   24.24  void Management::initialize(TRAPS) {
   24.25 @@ -386,11 +388,6 @@
   24.26  
   24.27  static void validate_thread_id_array(typeArrayHandle ids_ah, TRAPS) {
   24.28    int num_threads = ids_ah->length();
   24.29 -  // should be non-empty array
   24.30 -  if (num_threads == 0) {
   24.31 -    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
   24.32 -              "Empty array of thread IDs");
   24.33 -  }
   24.34  
   24.35    // Validate input thread IDs
   24.36    int i = 0;
   24.37 @@ -402,11 +399,9 @@
   24.38                  "Invalid thread ID entry");
   24.39      }
   24.40    }
   24.41 -
   24.42  }
   24.43  
   24.44  static void validate_thread_info_array(objArrayHandle infoArray_h, TRAPS) {
   24.45 -
   24.46    // check if the element of infoArray is of type ThreadInfo class
   24.47    klassOop threadinfo_klass = Management::java_lang_management_ThreadInfo_klass(CHECK);
   24.48    klassOop element_klass = objArrayKlass::cast(infoArray_h->klass())->element_klass();
   24.49 @@ -414,7 +409,6 @@
   24.50      THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
   24.51                "infoArray element type is not ThreadInfo class");
   24.52    }
   24.53 -
   24.54  }
   24.55  
   24.56  
   24.57 @@ -770,6 +764,45 @@
   24.58    return prev;
   24.59  JVM_END
   24.60  
   24.61 +// Gets an array containing the amount of memory allocated on the Java
   24.62 +// heap for a set of threads (in bytes).  Each element of the array is
   24.63 +// the amount of memory allocated for the thread ID specified in the
   24.64 +// corresponding entry in the given array of thread IDs; or -1 if the
   24.65 +// thread does not exist or has terminated.
   24.66 +JVM_ENTRY(void, jmm_GetThreadAllocatedMemory(JNIEnv *env, jlongArray ids,
   24.67 +                                             jlongArray sizeArray))
   24.68 +  // Check if threads is null
   24.69 +  if (ids == NULL || sizeArray == NULL) {
   24.70 +    THROW(vmSymbols::java_lang_NullPointerException());
   24.71 +  }
   24.72 +
   24.73 +  ResourceMark rm(THREAD);
   24.74 +  typeArrayOop ta = typeArrayOop(JNIHandles::resolve_non_null(ids));
   24.75 +  typeArrayHandle ids_ah(THREAD, ta);
   24.76 +
   24.77 +  typeArrayOop sa = typeArrayOop(JNIHandles::resolve_non_null(sizeArray));
   24.78 +  typeArrayHandle sizeArray_h(THREAD, sa);
   24.79 +
   24.80 +  // validate the thread id array
   24.81 +  validate_thread_id_array(ids_ah, CHECK);
   24.82 +
   24.83 +  // sizeArray must be of the same length as the given array of thread IDs
   24.84 +  int num_threads = ids_ah->length();
   24.85 +  if (num_threads != sizeArray_h->length()) {
   24.86 +    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
   24.87 +              "The length of the given long array does not match the length of "
   24.88 +              "the given array of thread IDs");
   24.89 +  }
   24.90 +
   24.91 +  MutexLockerEx ml(Threads_lock);
   24.92 +  for (int i = 0; i < num_threads; i++) {
   24.93 +    JavaThread* java_thread = find_java_thread_from_id(ids_ah->long_at(i));
   24.94 +    if (java_thread != NULL) {
   24.95 +      sizeArray_h->long_at_put(i, java_thread->cooked_allocated_bytes());
   24.96 +    }
   24.97 +  }
   24.98 +JVM_END
   24.99 +
  24.100  // Returns a java/lang/management/MemoryUsage object representing
  24.101  // the memory usage for the heap or non-heap memory.
  24.102  JVM_ENTRY(jobject, jmm_GetMemoryUsage(JNIEnv* env, jboolean heap))
  24.103 @@ -834,6 +867,8 @@
  24.104      return ThreadService::is_thread_monitoring_contention();
  24.105    case JMM_THREAD_CPU_TIME:
  24.106      return ThreadService::is_thread_cpu_time_enabled();
  24.107 +  case JMM_THREAD_ALLOCATED_MEMORY:
  24.108 +    return ThreadService::is_thread_allocated_memory_enabled();
  24.109    default:
  24.110      assert(0, "Unrecognized attribute");
  24.111      return false;
  24.112 @@ -851,6 +886,8 @@
  24.113      return ThreadService::set_thread_monitoring_contention(flag != 0);
  24.114    case JMM_THREAD_CPU_TIME:
  24.115      return ThreadService::set_thread_cpu_time_enabled(flag != 0);
  24.116 +  case JMM_THREAD_ALLOCATED_MEMORY:
  24.117 +    return ThreadService::set_thread_allocated_memory_enabled(flag != 0);
  24.118    default:
  24.119      assert(0, "Unrecognized attribute");
  24.120      return false;
  24.121 @@ -1096,6 +1133,7 @@
  24.122  //               maxDepth == 0  requests no stack trace.
  24.123  //   infoArray - array of ThreadInfo objects
  24.124  //
  24.125 +// QQQ - Why does this method return a value instead of void?
  24.126  JVM_ENTRY(jint, jmm_GetThreadInfo(JNIEnv *env, jlongArray ids, jint maxDepth, jobjectArray infoArray))
  24.127    // Check if threads is null
  24.128    if (ids == NULL || infoArray == NULL) {
  24.129 @@ -1159,7 +1197,6 @@
  24.130      }
  24.131    } else {
  24.132      // obtain thread dump with the specific list of threads with stack trace
  24.133 -
  24.134      do_thread_dump(&dump_result,
  24.135                     ids_ah,
  24.136                     num_threads,
  24.137 @@ -1252,8 +1289,6 @@
  24.138        continue;
  24.139      }
  24.140  
  24.141 -
  24.142 -
  24.143      ThreadStackTrace* stacktrace = ts->get_stack_trace();
  24.144      assert(stacktrace != NULL, "Must have a stack trace dumped");
  24.145  
  24.146 @@ -1500,6 +1535,49 @@
  24.147    return -1;
  24.148  JVM_END
  24.149  
  24.150 +// Gets an array containing the CPU times consumed by a set of threads
  24.151 +// (in nanoseconds).  Each element of the array is the CPU time for the
  24.152 +// thread ID specified in the corresponding entry in the given array
  24.153 +// of thread IDs; or -1 if the thread does not exist or has terminated.
  24.154 +// If user_sys_cpu_time = true, the sum of user level and system CPU time
  24.155 +// for the given thread is returned; otherwise, only user level CPU time
  24.156 +// is returned.
  24.157 +JVM_ENTRY(void, jmm_GetThreadCpuTimesWithKind(JNIEnv *env, jlongArray ids,
  24.158 +                                              jlongArray timeArray,
  24.159 +                                              jboolean user_sys_cpu_time))
  24.160 +  // Check if threads is null
  24.161 +  if (ids == NULL || timeArray == NULL) {
  24.162 +    THROW(vmSymbols::java_lang_NullPointerException());
  24.163 +  }
  24.164 +
  24.165 +  ResourceMark rm(THREAD);
  24.166 +  typeArrayOop ta = typeArrayOop(JNIHandles::resolve_non_null(ids));
  24.167 +  typeArrayHandle ids_ah(THREAD, ta);
  24.168 +
  24.169 +  typeArrayOop tia = typeArrayOop(JNIHandles::resolve_non_null(timeArray));
  24.170 +  typeArrayHandle timeArray_h(THREAD, tia);
  24.171 +
  24.172 +  // validate the thread id array
  24.173 +  validate_thread_id_array(ids_ah, CHECK);
  24.174 +
  24.175 +  // timeArray must be of the same length as the given array of thread IDs
  24.176 +  int num_threads = ids_ah->length();
  24.177 +  if (num_threads != timeArray_h->length()) {
  24.178 +    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
  24.179 +              "The length of the given long array does not match the length of "
  24.180 +              "the given array of thread IDs");
  24.181 +  }
  24.182 +
  24.183 +  MutexLockerEx ml(Threads_lock);
  24.184 +  for (int i = 0; i < num_threads; i++) {
  24.185 +    JavaThread* java_thread = find_java_thread_from_id(ids_ah->long_at(i));
  24.186 +    if (java_thread != NULL) {
  24.187 +      timeArray_h->long_at_put(i, os::thread_cpu_time((Thread*)java_thread,
  24.188 +                                                      user_sys_cpu_time != 0));
  24.189 +    }
  24.190 +  }
  24.191 +JVM_END
  24.192 +
  24.193  // Returns a String array of all VM global flag names
  24.194  JVM_ENTRY(jobjectArray, jmm_GetVMGlobalNames(JNIEnv *env))
  24.195    // last flag entry is always NULL, so subtract 1
  24.196 @@ -2020,7 +2098,7 @@
  24.197    jmm_GetMemoryManagers,
  24.198    jmm_GetMemoryPoolUsage,
  24.199    jmm_GetPeakMemoryPoolUsage,
  24.200 -  NULL,
  24.201 +  jmm_GetThreadAllocatedMemory,
  24.202    jmm_GetMemoryUsage,
  24.203    jmm_GetLongAttribute,
  24.204    jmm_GetBoolAttribute,
  24.205 @@ -2038,7 +2116,7 @@
  24.206    jmm_GetGCExtAttributeInfo,
  24.207    jmm_GetLastGCStat,
  24.208    jmm_GetThreadCpuTimeWithKind,
  24.209 -  NULL,
  24.210 +  jmm_GetThreadCpuTimesWithKind,
  24.211    jmm_DumpHeap0,
  24.212    jmm_FindDeadlockedThreads,
  24.213    jmm_SetVMGlobal,
    25.1 --- a/src/share/vm/services/threadService.cpp	Fri Jan 07 15:57:02 2011 -0500
    25.2 +++ b/src/share/vm/services/threadService.cpp	Fri Jan 07 13:59:48 2011 -0800
    25.3 @@ -1,5 +1,5 @@
    25.4  /*
    25.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    25.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    25.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.8   *
    25.9   * This code is free software; you can redistribute it and/or modify it
   25.10 @@ -46,6 +46,7 @@
   25.11  // Default is disabled.
   25.12  bool ThreadService::_thread_monitoring_contention_enabled = false;
   25.13  bool ThreadService::_thread_cpu_time_enabled = false;
   25.14 +bool ThreadService::_thread_allocated_memory_enabled = false;
   25.15  
   25.16  PerfCounter*  ThreadService::_total_threads_count = NULL;
   25.17  PerfVariable* ThreadService::_live_threads_count = NULL;
   25.18 @@ -84,6 +85,8 @@
   25.19    if (os::is_thread_cpu_time_supported()) {
   25.20      _thread_cpu_time_enabled = true;
   25.21    }
   25.22 +
   25.23 +  _thread_allocated_memory_enabled = true; // Always on, so enable it
   25.24  }
   25.25  
   25.26  void ThreadService::reset_peak_thread_count() {
   25.27 @@ -181,6 +184,15 @@
   25.28    return prev;
   25.29  }
   25.30  
   25.31 +bool ThreadService::set_thread_allocated_memory_enabled(bool flag) {
   25.32 +  MutexLocker m(Management_lock);
   25.33 +
   25.34 +  bool prev = _thread_allocated_memory_enabled;
   25.35 +  _thread_allocated_memory_enabled = flag;
   25.36 +
   25.37 +  return prev;
   25.38 +}
   25.39 +
   25.40  // GC support
   25.41  void ThreadService::oops_do(OopClosure* f) {
   25.42    for (ThreadDumpResult* dump = _threaddump_list; dump != NULL; dump = dump->next()) {
    26.1 --- a/src/share/vm/services/threadService.hpp	Fri Jan 07 15:57:02 2011 -0500
    26.2 +++ b/src/share/vm/services/threadService.hpp	Fri Jan 07 13:59:48 2011 -0800
    26.3 @@ -1,5 +1,5 @@
    26.4  /*
    26.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    26.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    26.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.8   *
    26.9   * This code is free software; you can redistribute it and/or modify it
   26.10 @@ -65,6 +65,7 @@
   26.11  
   26.12    static bool          _thread_monitoring_contention_enabled;
   26.13    static bool          _thread_cpu_time_enabled;
   26.14 +  static bool          _thread_allocated_memory_enabled;
   26.15  
   26.16    // Need to keep the list of thread dump result that
   26.17    // keep references to methodOop since thread dump can be
   26.18 @@ -83,6 +84,9 @@
   26.19    static bool set_thread_cpu_time_enabled(bool flag);
   26.20    static bool is_thread_cpu_time_enabled()    { return _thread_cpu_time_enabled; }
   26.21  
   26.22 +  static bool set_thread_allocated_memory_enabled(bool flag);
   26.23 +  static bool is_thread_allocated_memory_enabled() { return _thread_cpu_time_enabled; }
   26.24 +
   26.25    static jlong get_total_thread_count()       { return _total_threads_count->get_value(); }
   26.26    static jlong get_peak_thread_count()        { return _peak_threads_count->get_value(); }
   26.27    static jlong get_live_thread_count()        { return _live_threads_count->get_value() - _exiting_threads_count; }

mercurial