Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/globals.cpp @ 14909:4ca6dc0799b6
Backout jdk9 merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 01 Apr 2014 13:57:07 +0200 |
parents | d8041d695d19 |
children | dffc37fa7157 |
comparison
equal
deleted
inserted
replaced
14908:8db6e76cb658 | 14909:4ca6dc0799b6 |
---|---|
29 #include "runtime/globals.hpp" | 29 #include "runtime/globals.hpp" |
30 #include "runtime/globals_extension.hpp" | 30 #include "runtime/globals_extension.hpp" |
31 #include "utilities/ostream.hpp" | 31 #include "utilities/ostream.hpp" |
32 #include "utilities/macros.hpp" | 32 #include "utilities/macros.hpp" |
33 #include "utilities/top.hpp" | 33 #include "utilities/top.hpp" |
34 #include "trace/tracing.hpp" | |
35 #if INCLUDE_ALL_GCS | 34 #if INCLUDE_ALL_GCS |
36 #include "gc_implementation/g1/g1_globals.hpp" | 35 #include "gc_implementation/g1/g1_globals.hpp" |
37 #endif // INCLUDE_ALL_GCS | 36 #endif // INCLUDE_ALL_GCS |
38 #ifdef COMPILER1 | 37 #ifdef COMPILER1 |
39 #include "c1/c1_globals.hpp" | 38 #include "c1/c1_globals.hpp" |
63 MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ | 62 MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ |
64 MATERIALIZE_NOTPRODUCT_FLAG) | 63 MATERIALIZE_NOTPRODUCT_FLAG) |
65 | 64 |
66 MATERIALIZE_FLAGS_EXT | 65 MATERIALIZE_FLAGS_EXT |
67 | 66 |
68 | |
69 static bool is_product_build() { | |
70 #ifdef PRODUCT | |
71 return true; | |
72 #else | |
73 return false; | |
74 #endif | |
75 } | |
76 | 67 |
77 void Flag::check_writable() { | 68 void Flag::check_writable() { |
78 if (is_constant_in_binary()) { | 69 if (is_constant_in_binary()) { |
79 fatal(err_msg("flag is constant: %s", _name)); | 70 fatal(err_msg("flag is constant: %s", _name)); |
80 } | 71 } |
245 } | 236 } |
246 | 237 |
247 // Get custom message for this locked flag, or return NULL if | 238 // Get custom message for this locked flag, or return NULL if |
248 // none is available. | 239 // none is available. |
249 void Flag::get_locked_message(char* buf, int buflen) const { | 240 void Flag::get_locked_message(char* buf, int buflen) const { |
250 buf[0] = '\0'; | |
251 if (is_diagnostic() && !is_unlocked()) { | |
252 jio_snprintf(buf, buflen, "Error: VM option '%s' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.\n", | |
253 _name); | |
254 return; | |
255 } | |
256 if (is_experimental() && !is_unlocked()) { | |
257 jio_snprintf(buf, buflen, "Error: VM option '%s' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.\n", | |
258 _name); | |
259 return; | |
260 } | |
261 if (is_develop() && is_product_build()) { | |
262 jio_snprintf(buf, buflen, "Error: VM option '%s' is develop and is available only in debug version of VM.\n", | |
263 _name); | |
264 return; | |
265 } | |
266 if (is_notproduct() && is_product_build()) { | |
267 jio_snprintf(buf, buflen, "Error: VM option '%s' is notproduct and is available only in debug version of VM.\n", | |
268 _name); | |
269 return; | |
270 } | |
271 get_locked_message_ext(buf, buflen); | 241 get_locked_message_ext(buf, buflen); |
272 } | 242 } |
273 | 243 |
274 bool Flag::is_writeable() const { | 244 bool Flag::is_writeable() const { |
275 return is_manageable() || (is_product() && is_read_write()) || is_writeable_ext(); | 245 return is_manageable() || (is_product() && is_read_write()) || is_writeable_ext(); |
326 st->print("%-16s", cp); | 296 st->print("%-16s", cp); |
327 } | 297 } |
328 else st->print("%-16s", ""); | 298 else st->print("%-16s", ""); |
329 } | 299 } |
330 | 300 |
331 st->print("%-20s", " "); | 301 st->print("%-20"); |
332 print_kind(st); | 302 print_kind(st); |
333 | 303 |
334 if (withComments) { | 304 if (withComments) { |
335 #ifndef PRODUCT | 305 #ifndef PRODUCT |
336 st->print("%s", _doc); | 306 st->print("%s", _doc); |
505 if (strlen(s) != (unsigned int) len) return false; | 475 if (strlen(s) != (unsigned int) len) return false; |
506 return strncmp(s, q, len) == 0; | 476 return strncmp(s, q, len) == 0; |
507 } | 477 } |
508 | 478 |
509 // Search the flag table for a named flag | 479 // Search the flag table for a named flag |
510 Flag* Flag::find_flag(const char* name, size_t length, bool allow_locked, bool return_flag) { | 480 Flag* Flag::find_flag(const char* name, size_t length, bool allow_locked) { |
511 for (Flag* current = &flagTable[0]; current->_name != NULL; current++) { | 481 for (Flag* current = &flagTable[0]; current->_name != NULL; current++) { |
512 if (str_equal(current->_name, name, length)) { | 482 if (str_equal(current->_name, name, length)) { |
513 // Found a matching entry. | 483 // Found a matching entry. |
514 // Don't report notproduct and develop flags in product builds. | 484 // Don't report notproduct and develop flags in product builds. |
515 if (current->is_constant_in_binary()) { | 485 if (current->is_constant_in_binary()) { |
516 return (return_flag == true ? current : NULL); | 486 return NULL; |
517 } | 487 } |
518 // Report locked flags only if allowed. | 488 // Report locked flags only if allowed. |
519 if (!(current->is_unlocked() || current->is_unlocker())) { | 489 if (!(current->is_unlocked() || current->is_unlocker())) { |
520 if (!allow_locked) { | 490 if (!allow_locked) { |
521 // disable use of locked flags, e.g. diagnostic, experimental, | 491 // disable use of locked flags, e.g. diagnostic, experimental, |
605 if (result == NULL) return false; | 575 if (result == NULL) return false; |
606 *value = result->is_command_line(); | 576 *value = result->is_command_line(); |
607 return true; | 577 return true; |
608 } | 578 } |
609 | 579 |
610 template<class E, class T> | |
611 static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) | |
612 { | |
613 E e; | |
614 e.set_name(name); | |
615 e.set_old_value(old_value); | |
616 e.set_new_value(new_value); | |
617 e.set_origin(origin); | |
618 e.commit(); | |
619 } | |
620 | |
621 bool CommandLineFlags::boolAt(char* name, size_t len, bool* value) { | 580 bool CommandLineFlags::boolAt(char* name, size_t len, bool* value) { |
622 Flag* result = Flag::find_flag(name, len); | 581 Flag* result = Flag::find_flag(name, len); |
623 if (result == NULL) return false; | 582 if (result == NULL) return false; |
624 if (!result->is_bool()) return false; | 583 if (!result->is_bool()) return false; |
625 *value = result->get_bool(); | 584 *value = result->get_bool(); |
629 bool CommandLineFlags::boolAtPut(char* name, size_t len, bool* value, Flag::Flags origin) { | 588 bool CommandLineFlags::boolAtPut(char* name, size_t len, bool* value, Flag::Flags origin) { |
630 Flag* result = Flag::find_flag(name, len); | 589 Flag* result = Flag::find_flag(name, len); |
631 if (result == NULL) return false; | 590 if (result == NULL) return false; |
632 if (!result->is_bool()) return false; | 591 if (!result->is_bool()) return false; |
633 bool old_value = result->get_bool(); | 592 bool old_value = result->get_bool(); |
634 trace_flag_changed<EventBooleanFlagChanged, bool>(name, old_value, *value, origin); | |
635 result->set_bool(*value); | 593 result->set_bool(*value); |
636 *value = old_value; | 594 *value = old_value; |
637 result->set_origin(origin); | 595 result->set_origin(origin); |
638 return true; | 596 return true; |
639 } | 597 } |
640 | 598 |
641 void CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, Flag::Flags origin) { | 599 void CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, Flag::Flags origin) { |
642 Flag* faddr = address_of_flag(flag); | 600 Flag* faddr = address_of_flag(flag); |
643 guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type"); | 601 guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type"); |
644 trace_flag_changed<EventBooleanFlagChanged, bool>(faddr->_name, faddr->get_bool(), value, origin); | |
645 faddr->set_bool(value); | 602 faddr->set_bool(value); |
646 faddr->set_origin(origin); | 603 faddr->set_origin(origin); |
647 } | 604 } |
648 | 605 |
649 bool CommandLineFlags::intxAt(char* name, size_t len, intx* value) { | 606 bool CommandLineFlags::intxAt(char* name, size_t len, intx* value) { |
657 bool CommandLineFlags::intxAtPut(char* name, size_t len, intx* value, Flag::Flags origin) { | 614 bool CommandLineFlags::intxAtPut(char* name, size_t len, intx* value, Flag::Flags origin) { |
658 Flag* result = Flag::find_flag(name, len); | 615 Flag* result = Flag::find_flag(name, len); |
659 if (result == NULL) return false; | 616 if (result == NULL) return false; |
660 if (!result->is_intx()) return false; | 617 if (!result->is_intx()) return false; |
661 intx old_value = result->get_intx(); | 618 intx old_value = result->get_intx(); |
662 trace_flag_changed<EventLongFlagChanged, s8>(name, old_value, *value, origin); | |
663 result->set_intx(*value); | 619 result->set_intx(*value); |
664 *value = old_value; | 620 *value = old_value; |
665 result->set_origin(origin); | 621 result->set_origin(origin); |
666 return true; | 622 return true; |
667 } | 623 } |
668 | 624 |
669 void CommandLineFlagsEx::intxAtPut(CommandLineFlagWithType flag, intx value, Flag::Flags origin) { | 625 void CommandLineFlagsEx::intxAtPut(CommandLineFlagWithType flag, intx value, Flag::Flags origin) { |
670 Flag* faddr = address_of_flag(flag); | 626 Flag* faddr = address_of_flag(flag); |
671 guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type"); | 627 guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type"); |
672 trace_flag_changed<EventLongFlagChanged, s8>(faddr->_name, faddr->get_intx(), value, origin); | |
673 faddr->set_intx(value); | 628 faddr->set_intx(value); |
674 faddr->set_origin(origin); | 629 faddr->set_origin(origin); |
675 } | 630 } |
676 | 631 |
677 bool CommandLineFlags::uintxAt(char* name, size_t len, uintx* value) { | 632 bool CommandLineFlags::uintxAt(char* name, size_t len, uintx* value) { |
685 bool CommandLineFlags::uintxAtPut(char* name, size_t len, uintx* value, Flag::Flags origin) { | 640 bool CommandLineFlags::uintxAtPut(char* name, size_t len, uintx* value, Flag::Flags origin) { |
686 Flag* result = Flag::find_flag(name, len); | 641 Flag* result = Flag::find_flag(name, len); |
687 if (result == NULL) return false; | 642 if (result == NULL) return false; |
688 if (!result->is_uintx()) return false; | 643 if (!result->is_uintx()) return false; |
689 uintx old_value = result->get_uintx(); | 644 uintx old_value = result->get_uintx(); |
690 trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin); | |
691 result->set_uintx(*value); | 645 result->set_uintx(*value); |
692 *value = old_value; | 646 *value = old_value; |
693 result->set_origin(origin); | 647 result->set_origin(origin); |
694 return true; | 648 return true; |
695 } | 649 } |
696 | 650 |
697 void CommandLineFlagsEx::uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin) { | 651 void CommandLineFlagsEx::uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin) { |
698 Flag* faddr = address_of_flag(flag); | 652 Flag* faddr = address_of_flag(flag); |
699 guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type"); | 653 guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type"); |
700 trace_flag_changed<EventUnsignedLongFlagChanged, u8>(faddr->_name, faddr->get_uintx(), value, origin); | |
701 faddr->set_uintx(value); | 654 faddr->set_uintx(value); |
702 faddr->set_origin(origin); | 655 faddr->set_origin(origin); |
703 } | 656 } |
704 | 657 |
705 bool CommandLineFlags::uint64_tAt(char* name, size_t len, uint64_t* value) { | 658 bool CommandLineFlags::uint64_tAt(char* name, size_t len, uint64_t* value) { |
713 bool CommandLineFlags::uint64_tAtPut(char* name, size_t len, uint64_t* value, Flag::Flags origin) { | 666 bool CommandLineFlags::uint64_tAtPut(char* name, size_t len, uint64_t* value, Flag::Flags origin) { |
714 Flag* result = Flag::find_flag(name, len); | 667 Flag* result = Flag::find_flag(name, len); |
715 if (result == NULL) return false; | 668 if (result == NULL) return false; |
716 if (!result->is_uint64_t()) return false; | 669 if (!result->is_uint64_t()) return false; |
717 uint64_t old_value = result->get_uint64_t(); | 670 uint64_t old_value = result->get_uint64_t(); |
718 trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin); | |
719 result->set_uint64_t(*value); | 671 result->set_uint64_t(*value); |
720 *value = old_value; | 672 *value = old_value; |
721 result->set_origin(origin); | 673 result->set_origin(origin); |
722 return true; | 674 return true; |
723 } | 675 } |
724 | 676 |
725 void CommandLineFlagsEx::uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin) { | 677 void CommandLineFlagsEx::uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin) { |
726 Flag* faddr = address_of_flag(flag); | 678 Flag* faddr = address_of_flag(flag); |
727 guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type"); | 679 guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type"); |
728 trace_flag_changed<EventUnsignedLongFlagChanged, u8>(faddr->_name, faddr->get_uint64_t(), value, origin); | |
729 faddr->set_uint64_t(value); | 680 faddr->set_uint64_t(value); |
730 faddr->set_origin(origin); | 681 faddr->set_origin(origin); |
731 } | 682 } |
732 | 683 |
733 bool CommandLineFlags::doubleAt(char* name, size_t len, double* value) { | 684 bool CommandLineFlags::doubleAt(char* name, size_t len, double* value) { |
741 bool CommandLineFlags::doubleAtPut(char* name, size_t len, double* value, Flag::Flags origin) { | 692 bool CommandLineFlags::doubleAtPut(char* name, size_t len, double* value, Flag::Flags origin) { |
742 Flag* result = Flag::find_flag(name, len); | 693 Flag* result = Flag::find_flag(name, len); |
743 if (result == NULL) return false; | 694 if (result == NULL) return false; |
744 if (!result->is_double()) return false; | 695 if (!result->is_double()) return false; |
745 double old_value = result->get_double(); | 696 double old_value = result->get_double(); |
746 trace_flag_changed<EventDoubleFlagChanged, double>(name, old_value, *value, origin); | |
747 result->set_double(*value); | 697 result->set_double(*value); |
748 *value = old_value; | 698 *value = old_value; |
749 result->set_origin(origin); | 699 result->set_origin(origin); |
750 return true; | 700 return true; |
751 } | 701 } |
752 | 702 |
753 void CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin) { | 703 void CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin) { |
754 Flag* faddr = address_of_flag(flag); | 704 Flag* faddr = address_of_flag(flag); |
755 guarantee(faddr != NULL && faddr->is_double(), "wrong flag type"); | 705 guarantee(faddr != NULL && faddr->is_double(), "wrong flag type"); |
756 trace_flag_changed<EventDoubleFlagChanged, double>(faddr->_name, faddr->get_double(), value, origin); | |
757 faddr->set_double(value); | 706 faddr->set_double(value); |
758 faddr->set_origin(origin); | 707 faddr->set_origin(origin); |
759 } | 708 } |
760 | 709 |
761 bool CommandLineFlags::ccstrAt(char* name, size_t len, ccstr* value) { | 710 bool CommandLineFlags::ccstrAt(char* name, size_t len, ccstr* value) { |
764 if (!result->is_ccstr()) return false; | 713 if (!result->is_ccstr()) return false; |
765 *value = result->get_ccstr(); | 714 *value = result->get_ccstr(); |
766 return true; | 715 return true; |
767 } | 716 } |
768 | 717 |
718 // Contract: Flag will make private copy of the incoming value. | |
719 // Outgoing value is always malloc-ed, and caller MUST call free. | |
769 bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin) { | 720 bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin) { |
770 Flag* result = Flag::find_flag(name, len); | 721 Flag* result = Flag::find_flag(name, len); |
771 if (result == NULL) return false; | 722 if (result == NULL) return false; |
772 if (!result->is_ccstr()) return false; | 723 if (!result->is_ccstr()) return false; |
773 ccstr old_value = result->get_ccstr(); | 724 ccstr old_value = result->get_ccstr(); |
774 trace_flag_changed<EventStringFlagChanged, const char*>(name, old_value, *value, origin); | |
775 char* new_value = NULL; | 725 char* new_value = NULL; |
776 if (*value != NULL) { | 726 if (*value != NULL) { |
777 new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1, mtInternal); | 727 new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1, mtInternal); |
778 strcpy(new_value, *value); | 728 strcpy(new_value, *value); |
779 } | 729 } |
787 *value = old_value; | 737 *value = old_value; |
788 result->set_origin(origin); | 738 result->set_origin(origin); |
789 return true; | 739 return true; |
790 } | 740 } |
791 | 741 |
742 // Contract: Flag will make private copy of the incoming value. | |
792 void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin) { | 743 void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin) { |
793 Flag* faddr = address_of_flag(flag); | 744 Flag* faddr = address_of_flag(flag); |
794 guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type"); | 745 guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type"); |
795 ccstr old_value = faddr->get_ccstr(); | 746 ccstr old_value = faddr->get_ccstr(); |
796 trace_flag_changed<EventStringFlagChanged, const char*>(faddr->_name, old_value, value, origin); | |
797 char* new_value = NEW_C_HEAP_ARRAY(char, strlen(value)+1, mtInternal); | 747 char* new_value = NEW_C_HEAP_ARRAY(char, strlen(value)+1, mtInternal); |
798 strcpy(new_value, value); | 748 strcpy(new_value, value); |
799 faddr->set_ccstr(new_value); | 749 faddr->set_ccstr(new_value); |
800 if (!faddr->is_default() && old_value != NULL) { | 750 if (!faddr->is_default() && old_value != NULL) { |
801 // Prior value is heap allocated so free it. | 751 // Prior value is heap allocated so free it. |