comparison src/share/vm/gc_implementation/g1/g1BiasedArray.hpp @ 17937:78bbf4d43a14

8037816: Fix for 8036122 breaks build with Xcode5/clang 8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas 8043164: Format warning in traceStream.hpp Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings Reviewed-by: kvn, coleenp, iveresov, twisti
author drchase
date Thu, 22 May 2014 15:52:41 -0400
parents 5479cb006184
children 52b4284cb496 34714dc91411
comparison
equal deleted inserted replaced
17935:7384f6a12fc1 17937:78bbf4d43a14
1 /* 1 /*
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2013, 2014, 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.
53 // Initialize the members of this class. The biased start address of this array 53 // Initialize the members of this class. The biased start address of this array
54 // is the bias (in elements) multiplied by the element size. 54 // is the bias (in elements) multiplied by the element size.
55 void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) { 55 void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) {
56 assert(base != NULL, "just checking"); 56 assert(base != NULL, "just checking");
57 assert(length > 0, "just checking"); 57 assert(length > 0, "just checking");
58 assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %zd, larger than word size?", shift_by)); 58 assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by " SSIZE_FORMAT ", larger than word size?", (size_t) shift_by));
59 _base = base; 59 _base = base;
60 _length = length; 60 _length = length;
61 _biased_base = base - (bias * elem_size); 61 _biased_base = base - (bias * elem_size);
62 _bias = bias; 62 _bias = bias;
63 _shift_by = shift_by; 63 _shift_by = shift_by;
68 void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) { 68 void initialize(HeapWord* bottom, HeapWord* end, size_t target_elem_size_in_bytes, size_t mapping_granularity_in_bytes) {
69 assert(mapping_granularity_in_bytes > 0, "just checking"); 69 assert(mapping_granularity_in_bytes > 0, "just checking");
70 assert(is_power_of_2(mapping_granularity_in_bytes), 70 assert(is_power_of_2(mapping_granularity_in_bytes),
71 err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes)); 71 err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes));
72 assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0, 72 assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0,
73 err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, 73 err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT,
74 mapping_granularity_in_bytes, bottom)); 74 mapping_granularity_in_bytes, p2i(bottom)));
75 assert((uintptr_t)end % mapping_granularity_in_bytes == 0, 75 assert((uintptr_t)end % mapping_granularity_in_bytes == 0,
76 err_msg("end mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT, 76 err_msg("end mapping area address must be a multiple of mapping granularity %zd, is " PTR_FORMAT,
77 mapping_granularity_in_bytes, end)); 77 mapping_granularity_in_bytes, p2i(end)));
78 size_t num_target_elems = (end - bottom) / (mapping_granularity_in_bytes / HeapWordSize); 78 size_t num_target_elems = (end - bottom) / (mapping_granularity_in_bytes / HeapWordSize);
79 idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes; 79 idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes;
80 address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes); 80 address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes);
81 initialize_base(base, num_target_elems, bias, target_elem_size_in_bytes, log2_intptr(mapping_granularity_in_bytes)); 81 initialize_base(base, num_target_elems, bias, target_elem_size_in_bytes, log2_intptr(mapping_granularity_in_bytes));
82 } 82 }