comparison src/share/vm/interpreter/interpreterRuntime.cpp @ 2118:dd031b2226de

4930919: race condition in MDO creation at back branch locations Summary: Reuse set_method_data_for_bcp() to setup mdp after MDO creation. Reviewed-by: kvn, never
author iveresov
date Mon, 10 Jan 2011 18:46:29 -0800
parents 9bc798875b2a
children 633a44a9fc45
comparison
equal deleted inserted replaced
2117:70427f06ea47 2118:dd031b2226de
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
882 methodDataOop mdo = method->method_data(); 882 methodDataOop mdo = method->method_data();
883 if (mdo == NULL) return 0; 883 if (mdo == NULL) return 0;
884 return mdo->bci_to_di(bci); 884 return mdo->bci_to_di(bci);
885 IRT_END 885 IRT_END
886 886
887 IRT_ENTRY(jint, InterpreterRuntime::profile_method(JavaThread* thread, address cur_bcp)) 887 IRT_ENTRY(void, InterpreterRuntime::profile_method(JavaThread* thread))
888 // use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized 888 // use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized
889 // flag, in case this method triggers classloading which will call into Java. 889 // flag, in case this method triggers classloading which will call into Java.
890 UnlockFlagSaver fs(thread); 890 UnlockFlagSaver fs(thread);
891 891
892 assert(ProfileInterpreter, "must be profiling interpreter"); 892 assert(ProfileInterpreter, "must be profiling interpreter");
893 frame fr = thread->last_frame(); 893 frame fr = thread->last_frame();
894 assert(fr.is_interpreted_frame(), "must come from interpreter"); 894 assert(fr.is_interpreted_frame(), "must come from interpreter");
895 methodHandle method(thread, fr.interpreter_frame_method()); 895 methodHandle method(thread, fr.interpreter_frame_method());
896 int bci = method->bci_from(cur_bcp);
897 methodOopDesc::build_interpreter_method_data(method, THREAD); 896 methodOopDesc::build_interpreter_method_data(method, THREAD);
898 if (HAS_PENDING_EXCEPTION) { 897 if (HAS_PENDING_EXCEPTION) {
899 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); 898 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
900 CLEAR_PENDING_EXCEPTION; 899 CLEAR_PENDING_EXCEPTION;
901 // and fall through... 900 // and fall through...
902 } 901 }
903 methodDataOop mdo = method->method_data();
904 if (mdo == NULL) return 0;
905 return mdo->bci_to_di(bci);
906 IRT_END 902 IRT_END
907 903
908 904
909 #ifdef ASSERT 905 #ifdef ASSERT
910 IRT_LEAF(void, InterpreterRuntime::verify_mdp(methodOopDesc* method, address bcp, address mdp)) 906 IRT_LEAF(void, InterpreterRuntime::verify_mdp(methodOopDesc* method, address bcp, address mdp))