comparison src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @ 2100:b1a2afa37ec4

7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis Summary: Track allocated bytes in Thread's, update on TLAB retirement and direct allocation in Eden and tenured, add JNI methods for ThreadMXBean. Reviewed-by: coleenp, kvn, dholmes, ysr
author phh
date Fri, 07 Jan 2011 10:42:32 -0500
parents ac637b7220d1
children 5577848f5923
comparison
equal deleted inserted replaced
2097:039eb4201e06 2100:b1a2afa37ec4
1 /* 1 /*
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 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.
446 446
447 __ bind(retry_tlab); 447 __ bind(retry_tlab);
448 448
449 // get the instance size 449 // get the instance size
450 __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size); 450 __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size);
451
451 __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path); 452 __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path);
453
452 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2); 454 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
453 __ verify_oop(O0_obj); 455 __ verify_oop(O0_obj);
454 __ mov(O0, I0); 456 __ mov(O0, I0);
455 __ ret(); 457 __ ret();
456 __ delayed()->restore(); 458 __ delayed()->restore();
457 459
458 __ bind(try_eden); 460 __ bind(try_eden);
459 // get the instance size 461 // get the instance size
460 __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size); 462 __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size);
461 __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path); 463 __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path);
464 __ incr_allocated_bytes(G1_obj_size, 0, G3_t1);
465
462 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2); 466 __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
463 __ verify_oop(O0_obj); 467 __ verify_oop(O0_obj);
464 __ mov(O0, I0); 468 __ mov(O0, I0);
465 __ ret(); 469 __ ret();
466 __ delayed()->restore(); 470 __ delayed()->restore();
571 __ add(G1_arr_size, G3_t1, G1_arr_size); 575 __ add(G1_arr_size, G3_t1, G1_arr_size);
572 __ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size); 576 __ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size);
573 __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size); 577 __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size);
574 578
575 __ eden_allocate(O0_obj, G1_arr_size, 0, G3_t1, O1_t2, slow_path); // preserves G1_arr_size 579 __ eden_allocate(O0_obj, G1_arr_size, 0, G3_t1, O1_t2, slow_path); // preserves G1_arr_size
580 __ incr_allocated_bytes(G1_arr_size, 0, G3_t1);
576 581
577 __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2); 582 __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2);
578 __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset); 583 __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset);
579 __ sub(G1_arr_size, G3_t1, O1_t2); // body length 584 __ sub(G1_arr_size, G3_t1, O1_t2); // body length
580 __ add(O0_obj, G3_t1, G3_t1); // body start 585 __ add(O0_obj, G3_t1, G3_t1); // body start