1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
4100 // store klass last. concurrent gcs assumes klass length is valid if |
4100 // store klass last. concurrent gcs assumes klass length is valid if |
4101 // klass field is not null. |
4101 // klass field is not null. |
4102 store_klass(t2, top); |
4102 store_klass(t2, top); |
4103 verify_oop(top); |
4103 verify_oop(top); |
4104 |
4104 |
|
4105 ld_ptr(G2_thread, in_bytes(JavaThread::tlab_start_offset()), t1); |
|
4106 sub(top, t1, t1); // size of tlab's allocated portion |
|
4107 incr_allocated_bytes(t1, 0, t2); |
|
4108 |
4105 // refill the tlab with an eden allocation |
4109 // refill the tlab with an eden allocation |
4106 bind(do_refill); |
4110 bind(do_refill); |
4107 ld_ptr(G2_thread, in_bytes(JavaThread::tlab_size_offset()), t1); |
4111 ld_ptr(G2_thread, in_bytes(JavaThread::tlab_size_offset()), t1); |
4108 sll_ptr(t1, LogHeapWordSize, t1); |
4112 sll_ptr(t1, LogHeapWordSize, t1); |
4109 // add object_size ?? |
4113 // allocate new tlab, address returned in top |
4110 eden_allocate(top, t1, 0, t2, t3, slow_case); |
4114 eden_allocate(top, t1, 0, t2, t3, slow_case); |
4111 |
4115 |
4112 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_start_offset())); |
4116 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_start_offset())); |
4113 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_top_offset())); |
4117 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_top_offset())); |
4114 #ifdef ASSERT |
4118 #ifdef ASSERT |
4130 sub(top, ThreadLocalAllocBuffer::alignment_reserve_in_bytes(), top); |
4134 sub(top, ThreadLocalAllocBuffer::alignment_reserve_in_bytes(), top); |
4131 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_end_offset())); |
4135 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_end_offset())); |
4132 verify_tlab(); |
4136 verify_tlab(); |
4133 br(Assembler::always, false, Assembler::pt, retry); |
4137 br(Assembler::always, false, Assembler::pt, retry); |
4134 delayed()->nop(); |
4138 delayed()->nop(); |
|
4139 } |
|
4140 |
|
4141 void MacroAssembler::incr_allocated_bytes(Register var_size_in_bytes, |
|
4142 int con_size_in_bytes, |
|
4143 Register t1) { |
|
4144 // Bump total bytes allocated by this thread |
|
4145 assert(t1->is_global(), "must be global reg"); // so all 64 bits are saved on a context switch |
|
4146 assert_different_registers(var_size_in_bytes, t1); |
|
4147 // v8 support has gone the way of the dodo |
|
4148 ldx(G2_thread, in_bytes(JavaThread::allocated_bytes_offset()), t1); |
|
4149 if (var_size_in_bytes->is_valid()) { |
|
4150 add(t1, var_size_in_bytes, t1); |
|
4151 } else { |
|
4152 add(t1, con_size_in_bytes, t1); |
|
4153 } |
|
4154 stx(t1, G2_thread, in_bytes(JavaThread::allocated_bytes_offset())); |
4135 } |
4155 } |
4136 |
4156 |
4137 Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) { |
4157 Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) { |
4138 switch (cond) { |
4158 switch (cond) { |
4139 // Note some conditions are synonyms for others |
4159 // Note some conditions are synonyms for others |