comparison src/share/vm/code/nmethod.cpp @ 1783:d5d065957597

6953144: Tiered compilation Summary: Infrastructure for tiered compilation support (interpreter + c1 + c2) for 32 and 64 bit. Simple tiered policy implementation. Reviewed-by: kvn, never, phh, twisti
author iveresov
date Fri, 03 Sep 2010 17:51:07 -0700
parents 0878d7bae69f
children ac4f710073ed
comparison
equal deleted inserted replaced
1782:f353275af40e 1783:d5d065957597
865 const char* nm_kind = compile_kind(); 865 const char* nm_kind = compile_kind();
866 if (nm_kind != NULL) log->print(" compile_kind='%s'", nm_kind); 866 if (nm_kind != NULL) log->print(" compile_kind='%s'", nm_kind);
867 if (compiler() != NULL) { 867 if (compiler() != NULL) {
868 log->print(" compiler='%s'", compiler()->name()); 868 log->print(" compiler='%s'", compiler()->name());
869 } 869 }
870 #ifdef TIERED 870 if (TieredCompilation) {
871 log->print(" level='%d'", comp_level()); 871 log->print(" level='%d'", comp_level());
872 #endif // TIERED 872 }
873 } 873 }
874 874
875 875
876 #define LOG_OFFSET(log, name) \ 876 #define LOG_OFFSET(log, name) \
877 if ((intptr_t)name##_end() - (intptr_t)name##_begin()) \ 877 if ((intptr_t)name##_end() - (intptr_t)name##_begin()) \
906 } 906 }
907 907
908 #undef LOG_OFFSET 908 #undef LOG_OFFSET
909 909
910 910
911 void nmethod::print_compilation(outputStream *st, const char *method_name, const char *title,
912 methodOop method, bool is_blocking, int compile_id, int bci, int comp_level) {
913 bool is_synchronized = false, has_xhandler = false, is_native = false;
914 int code_size = -1;
915 if (method != NULL) {
916 is_synchronized = method->is_synchronized();
917 has_xhandler = method->has_exception_handler();
918 is_native = method->is_native();
919 code_size = method->code_size();
920 }
921 // print compilation number
922 st->print("%7d %3d", (int)tty->time_stamp().milliseconds(), compile_id);
923
924 // print method attributes
925 const bool is_osr = bci != InvocationEntryBci;
926 const char blocking_char = is_blocking ? 'b' : ' ';
927 const char compile_type = is_osr ? '%' : ' ';
928 const char sync_char = is_synchronized ? 's' : ' ';
929 const char exception_char = has_xhandler ? '!' : ' ';
930 const char native_char = is_native ? 'n' : ' ';
931 st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char);
932 if (TieredCompilation) {
933 st->print("%d ", comp_level);
934 }
935
936 // print optional title
937 bool do_nl = false;
938 if (title != NULL) {
939 int tlen = (int) strlen(title);
940 bool do_nl = false;
941 if (tlen > 0 && title[tlen-1] == '\n') { tlen--; do_nl = true; }
942 st->print("%.*s", tlen, title);
943 } else {
944 do_nl = true;
945 }
946
947 // print method name string if given
948 if (method_name != NULL) {
949 st->print(method_name);
950 } else {
951 // otherwise as the method to print itself
952 if (method != NULL && !Universe::heap()->is_gc_active()) {
953 method->print_short_name(st);
954 } else {
955 st->print("(method)");
956 }
957 }
958
959 if (method != NULL) {
960 // print osr_bci if any
961 if (is_osr) st->print(" @ %d", bci);
962 // print method size
963 st->print(" (%d bytes)", code_size);
964 }
965 if (do_nl) st->cr();
966 }
967
911 // Print out more verbose output usually for a newly created nmethod. 968 // Print out more verbose output usually for a newly created nmethod.
912 void nmethod::print_on(outputStream* st, const char* title) const { 969 void nmethod::print_on(outputStream* st, const char* title) const {
913 if (st != NULL) { 970 if (st != NULL) {
914 ttyLocker ttyl; 971 ttyLocker ttyl;
915 // Print a little tag line that looks like +PrintCompilation output: 972 print_compilation(st, /*method_name*/NULL, title,
916 int tlen = (int) strlen(title); 973 method(), /*is_blocking*/false,
917 bool do_nl = false; 974 compile_id(), osr_entry_bci(), comp_level());
918 if (tlen > 0 && title[tlen-1] == '\n') { tlen--; do_nl = true; }
919 st->print("%3d%c %.*s",
920 compile_id(),
921 is_osr_method() ? '%' :
922 method() != NULL &&
923 is_native_method() ? 'n' : ' ',
924 tlen, title);
925 #ifdef TIERED
926 st->print(" (%d) ", comp_level());
927 #endif // TIERED
928 if (WizardMode) st->print(" (" INTPTR_FORMAT ")", this); 975 if (WizardMode) st->print(" (" INTPTR_FORMAT ")", this);
929 if (Universe::heap()->is_gc_active() && method() != NULL) {
930 st->print("(method)");
931 } else if (method() != NULL) {
932 method()->print_short_name(st);
933 if (is_osr_method())
934 st->print(" @ %d", osr_entry_bci());
935 if (method()->code_size() > 0)
936 st->print(" (%d bytes)", method()->code_size());
937 }
938
939 if (do_nl) st->cr();
940 } 976 }
941 } 977 }
942 978
943 979
944 void nmethod::print_nmethod(bool printmethod) { 980 void nmethod::print_nmethod(bool printmethod) {
1135 // nmethod for the second time. 1171 // nmethod for the second time.
1136 return stack_traversal_mark()+1 < NMethodSweeper::traversal_count(); 1172 return stack_traversal_mark()+1 < NMethodSweeper::traversal_count();
1137 } 1173 }
1138 1174
1139 void nmethod::inc_decompile_count() { 1175 void nmethod::inc_decompile_count() {
1176 if (!is_compiled_by_c2()) return;
1140 // Could be gated by ProfileTraps, but do not bother... 1177 // Could be gated by ProfileTraps, but do not bother...
1141 methodOop m = method(); 1178 methodOop m = method();
1142 if (m == NULL) return; 1179 if (m == NULL) return;
1143 methodDataOop mdo = m->method_data(); 1180 methodDataOop mdo = m->method_data();
1144 if (mdo == NULL) return; 1181 if (mdo == NULL) return;