--- old/src/share/vm/runtime/arguments.cpp 2013-06-21 11:34:25.000000000 -0700 +++ new/src/share/vm/runtime/arguments.cpp 2013-06-21 11:34:25.000000000 -0700 @@ -1134,11 +1134,6 @@ FLAG_SET_DEFAULT(OldPLABSize, (intx)1024); } - // AlwaysTenure flag should make ParNew promote all at first collection. - // See CR 6362902. - if (AlwaysTenure) { - FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0); - } // When using compressed oops, we use local overflow stacks, // rather than using a global overflow list chained through // the klass word of the object's pre-image. @@ -2174,10 +2169,8 @@ status = status && verify_percentage(YoungGenerationSizeSupplement, "YoungGenerationSizeSupplement"); status = status && verify_percentage(TenuredGenerationSizeSupplement, "TenuredGenerationSizeSupplement"); - // the "age" field in the oop header is 4 bits; do not want to pull in markOop.hpp - // just for that, so hardcode here. - status = status && verify_interval(MaxTenuringThreshold, 0, 15, "MaxTenuringThreshold"); - status = status && verify_interval(InitialTenuringThreshold, 0, MaxTenuringThreshold, "MaxTenuringThreshold"); + status = status && verify_interval(MaxTenuringThreshold, 0, markOopDesc::max_age + 1, "MaxTenuringThreshold"); + status = status && verify_interval(InitialTenuringThreshold, 0, MaxTenuringThreshold, "InitialTenuringThreshold"); status = status && verify_percentage(TargetSurvivorRatio, "TargetSurvivorRatio"); status = status && verify_percentage(MarkSweepDeadRatio, "MarkSweepDeadRatio"); @@ -2885,14 +2878,34 @@ // but disallow DR and offlining (5008695). FLAG_SET_CMDLINE(bool, BindGCTaskThreadsToCPUs, true); + // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure; + // the last option wins. } else if (match_option(option, "-XX:+NeverTenure", &tail)) { - // The last option must always win. - FLAG_SET_CMDLINE(bool, AlwaysTenure, false); FLAG_SET_CMDLINE(bool, NeverTenure, true); + FLAG_SET_CMDLINE(bool, AlwaysTenure, false); + FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1); } else if (match_option(option, "-XX:+AlwaysTenure", &tail)) { - // The last option must always win. FLAG_SET_CMDLINE(bool, NeverTenure, false); FLAG_SET_CMDLINE(bool, AlwaysTenure, true); + FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0); + } else if (match_option(option, "-XX:MaxTenuringThreshold=", &tail)) { + uintx max_tenuring_thresh = 0; + if(!parse_uintx(tail, &max_tenuring_thresh, 0)) { + jio_fprintf(defaultStream::error_stream(), + "Invalid MaxTenuringThreshold: %s\n", option->optionString); + } + FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, max_tenuring_thresh); + + if (MaxTenuringThreshold == 0) { + FLAG_SET_CMDLINE(bool, NeverTenure, false); + FLAG_SET_CMDLINE(bool, AlwaysTenure, true); + } else { + FLAG_SET_CMDLINE(bool, NeverTenure, false); + FLAG_SET_CMDLINE(bool, AlwaysTenure, false); + if (MaxTenuringThreshold > markOopDesc::max_age + 1) { + FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, markOopDesc::max_age + 1); + } + } } else if (match_option(option, "-XX:+CMSPermGenSweepingEnabled", &tail) || match_option(option, "-XX:-CMSPermGenSweepingEnabled", &tail)) { jio_fprintf(defaultStream::error_stream(),