828 LOG_OFFSET(xtty, consts);
829 LOG_OFFSET(xtty, insts);
830 LOG_OFFSET(xtty, stub);
831 LOG_OFFSET(xtty, scopes_data);
832 LOG_OFFSET(xtty, scopes_pcs);
833 LOG_OFFSET(xtty, dependencies);
834 LOG_OFFSET(xtty, handler_table);
835 LOG_OFFSET(xtty, nul_chk_table);
836 LOG_OFFSET(xtty, oops);
837 LOG_OFFSET(xtty, metadata);
838
839 xtty->method(method());
840 xtty->stamp();
841 xtty->end_elem();
842 }
843 }
844
845 #undef LOG_OFFSET
846
847
848 // Print out more verbose output usually for a newly created nmethod.
849 void nmethod::print_on(outputStream* st, const char* msg) const {
850 if (st != NULL) {
851 ttyLocker ttyl;
852 if (WizardMode) {
853 CompileTask::print(st, this, msg, /*short_form:*/ true);
854 st->print_cr(" (" INTPTR_FORMAT ")", p2i(this));
855 } else {
856 CompileTask::print(st, this, msg, /*short_form:*/ false);
857 }
858 }
859 }
860
861 void nmethod::maybe_print_nmethod(DirectiveSet* directive) {
862 bool printnmethods = directive->PrintAssemblyOption || directive->PrintNMethodsOption;
863 if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers) {
864 print_nmethod(printnmethods);
865 }
866 }
867
|
828 LOG_OFFSET(xtty, consts);
829 LOG_OFFSET(xtty, insts);
830 LOG_OFFSET(xtty, stub);
831 LOG_OFFSET(xtty, scopes_data);
832 LOG_OFFSET(xtty, scopes_pcs);
833 LOG_OFFSET(xtty, dependencies);
834 LOG_OFFSET(xtty, handler_table);
835 LOG_OFFSET(xtty, nul_chk_table);
836 LOG_OFFSET(xtty, oops);
837 LOG_OFFSET(xtty, metadata);
838
839 xtty->method(method());
840 xtty->stamp();
841 xtty->end_elem();
842 }
843 }
844
845 #undef LOG_OFFSET
846
847
848 // Iterating over all nmethods, e.g. with the help of CodeCache::nmethods_do(fun) was found
849 // to not be inherently safe. There is a chance that fields are seen which are not properly
850 // initialized. This happens despite the fact that nmethods_do() asserts the CodeCache_lock
851 // to be held.
852 // To bundle knowledge about necessary checks in one place, this function was introduced.
853 // It is not claimed that these checks are sufficient, but they were found to be necessary.
854 bool nmethod::access_is_safe(nmethod* nm) {
855 Method* method = (nm == NULL) ? NULL : nm->method(); // nm->method() may be uninitialized, i.e. != NULL, but invalid
856 return (nm != NULL) && (method != NULL) &&
857 nm->is_alive() && !nm->is_not_installed() &&
858 os::is_readable_pointer(method) &&
859 os::is_readable_pointer(method->constMethod()) &&
860 os::is_readable_pointer(method->constants()) &&
861 (method->signature() != NULL) &&
862 os::is_readable_pointer(method->signature());
863 }
864
865
866 // Print out more verbose output usually for a newly created nmethod.
867 void nmethod::print_on(outputStream* st, const char* msg) const {
868 if (st != NULL) {
869 ttyLocker ttyl;
870 if (WizardMode) {
871 CompileTask::print(st, this, msg, /*short_form:*/ true);
872 st->print_cr(" (" INTPTR_FORMAT ")", p2i(this));
873 } else {
874 CompileTask::print(st, this, msg, /*short_form:*/ false);
875 }
876 }
877 }
878
879 void nmethod::maybe_print_nmethod(DirectiveSet* directive) {
880 bool printnmethods = directive->PrintAssemblyOption || directive->PrintNMethodsOption;
881 if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers) {
882 print_nmethod(printnmethods);
883 }
884 }
885
|