--- old/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp 2015-07-31 12:40:17.000000000 -0500 +++ new/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp 2015-07-31 12:40:17.000000000 -0500 @@ -28,22 +28,29 @@ #include "runtime/globals.hpp" #include "utilities/defaultStream.hpp" -Flag::Error ObjectAlignmentInBytesConstraintFunc(bool verbose, intx* value) { - if (!is_power_of_2(*value)) { - if (verbose == true) { - jio_fprintf(defaultStream::error_stream(), - "ObjectAlignmentInBytes=" INTX_FORMAT " must be power of 2\n", - *value); - } +static void print_error_if_needed(bool verbose, const char* msg, ...) { + if (verbose) { + va_list listPointer; + va_start(listPointer, msg); + jio_vfprintf(defaultStream::error_stream(), msg, listPointer); + va_end(listPointer); + } +} + +Flag::Error ObjectAlignmentInBytesConstraintFunc(bool verbose, intx value) { + if (!is_power_of_2(value)) { + print_error_if_needed(verbose, + "ObjectAlignmentInBytes=" INTX_FORMAT " must be " + "power of 2\n", + value); return Flag::VIOLATES_CONSTRAINT; } // In case page size is very small. - if (*value >= (intx)os::vm_page_size()) { - if (verbose == true) { - jio_fprintf(defaultStream::error_stream(), - "ObjectAlignmentInBytes=" INTX_FORMAT " must be less than page size " INTX_FORMAT "\n", - *value, (intx)os::vm_page_size()); - } + if (value >= (intx)os::vm_page_size()) { + print_error_if_needed(verbose, + "ObjectAlignmentInBytes=" INTX_FORMAT " must be " + "less than page size " INTX_FORMAT "\n", + value, (intx)os::vm_page_size()); return Flag::VIOLATES_CONSTRAINT; } return Flag::SUCCESS; @@ -51,13 +58,12 @@ // Need to enforce the padding not to break the existing field alignments. // It is sufficient to check against the largest type size. -Flag::Error ContendedPaddingWidthConstraintFunc(bool verbose, intx* value) { - if ((*value != 0) && ((*value % BytesPerLong) != 0)) { - if (verbose == true) { - jio_fprintf(defaultStream::error_stream(), - "ContendedPaddingWidth=" INTX_FORMAT " must be a multiple of %d\n", - *value, BytesPerLong); - } +Flag::Error ContendedPaddingWidthConstraintFunc(bool verbose, intx value) { + if ((value != 0) && ((value % BytesPerLong) != 0)) { + print_error_if_needed(verbose, + "ContendedPaddingWidth=" INTX_FORMAT " must be " + "a multiple of %d\n", + value, BytesPerLong); return Flag::VIOLATES_CONSTRAINT; } else { return Flag::SUCCESS;