Mercurial > hg > truffle
comparison src/share/vm/memory/heapInspection.cpp @ 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 | e0c9a1d29eb4 |
children | 833b0f92429a |
comparison
equal
deleted
inserted
replaced
17935:7384f6a12fc1 | 17937:78bbf4d43a14 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2002, 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. |
33 #include "utilities/macros.hpp" | 33 #include "utilities/macros.hpp" |
34 #if INCLUDE_ALL_GCS | 34 #if INCLUDE_ALL_GCS |
35 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" | 35 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
36 #endif // INCLUDE_ALL_GCS | 36 #endif // INCLUDE_ALL_GCS |
37 | 37 |
38 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC | |
39 | |
38 // HeapInspection | 40 // HeapInspection |
39 | 41 |
40 int KlassInfoEntry::compare(KlassInfoEntry* e1, KlassInfoEntry* e2) { | 42 int KlassInfoEntry::compare(KlassInfoEntry* e1, KlassInfoEntry* e2) { |
41 if(e1->_instance_words > e2->_instance_words) { | 43 if(e1->_instance_words > e2->_instance_words) { |
42 return -1; | 44 return -1; |
268 } | 270 } |
269 | 271 |
270 return true; | 272 return true; |
271 } | 273 } |
272 | 274 |
275 PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL | |
273 void KlassInfoHisto::print_title(outputStream* st, bool csv_format, | 276 void KlassInfoHisto::print_title(outputStream* st, bool csv_format, |
274 bool selected[], int width_table[], | 277 bool selected[], int width_table[], |
275 const char *name_table[]) { | 278 const char *name_table[]) { |
276 if (csv_format) { | 279 if (csv_format) { |
277 st->print("Index,Super"); | 280 st->print("Index,Super"); |
280 } | 283 } |
281 st->print(",ClassName"); | 284 st->print(",ClassName"); |
282 } else { | 285 } else { |
283 st->print("Index Super"); | 286 st->print("Index Super"); |
284 for (int c=0; c<KlassSizeStats::_num_columns; c++) { | 287 for (int c=0; c<KlassSizeStats::_num_columns; c++) { |
288 PRAGMA_DIAG_PUSH | |
289 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL | |
285 if (selected[c]) {st->print(str_fmt(width_table[c]), name_table[c]);} | 290 if (selected[c]) {st->print(str_fmt(width_table[c]), name_table[c]);} |
291 PRAGMA_DIAG_POP | |
286 } | 292 } |
287 st->print(" ClassName"); | 293 st->print(" ClassName"); |
288 } | 294 } |
289 | 295 |
290 if (is_selected("ClassLoader")) { | 296 if (is_selected("ClassLoader")) { |
393 if (selected[c]) { | 399 if (selected[c]) { |
394 switch (c) { | 400 switch (c) { |
395 case KlassSizeStats::_index_inst_size: | 401 case KlassSizeStats::_index_inst_size: |
396 case KlassSizeStats::_index_inst_count: | 402 case KlassSizeStats::_index_inst_count: |
397 case KlassSizeStats::_index_method_count: | 403 case KlassSizeStats::_index_method_count: |
404 PRAGMA_DIAG_PUSH | |
405 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL | |
398 st->print(str_fmt(width_table[c]), "-"); | 406 st->print(str_fmt(width_table[c]), "-"); |
407 PRAGMA_DIAG_POP | |
399 break; | 408 break; |
400 default: | 409 default: |
401 { | 410 { |
402 double perc = (double)(100) * (double)(colsum_table[c]) / (double)sz_sum._total_bytes; | 411 double perc = (double)(100) * (double)(colsum_table[c]) / (double)sz_sum._total_bytes; |
412 PRAGMA_DIAG_PUSH | |
413 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL | |
403 st->print(perc_fmt(width_table[c]), perc); | 414 st->print(perc_fmt(width_table[c]), perc); |
415 PRAGMA_DIAG_POP | |
404 } | 416 } |
405 } | 417 } |
406 } | 418 } |
407 } | 419 } |
408 } | 420 } |