Mercurial > hg > truffle
comparison src/cpu/x86/vm/interp_masm_x86_32.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 | f95d63e2154a |
children | 38fea01eb669 |
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. |
817 | 817 |
818 | 818 |
819 // Set the method data pointer for the current bcp. | 819 // Set the method data pointer for the current bcp. |
820 void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() { | 820 void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() { |
821 assert(ProfileInterpreter, "must be profiling interpreter"); | 821 assert(ProfileInterpreter, "must be profiling interpreter"); |
822 Label zero_continue; | 822 Label set_mdp; |
823 push(rax); | 823 push(rax); |
824 push(rbx); | 824 push(rbx); |
825 | 825 |
826 get_method(rbx); | 826 get_method(rbx); |
827 // Test MDO to avoid the call if it is NULL. | 827 // Test MDO to avoid the call if it is NULL. |
828 movptr(rax, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); | 828 movptr(rax, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); |
829 testptr(rax, rax); | 829 testptr(rax, rax); |
830 jcc(Assembler::zero, zero_continue); | 830 jcc(Assembler::zero, set_mdp); |
831 | |
832 // rbx,: method | 831 // rbx,: method |
833 // rsi: bcp | 832 // rsi: bcp |
834 call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, rsi); | 833 call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, rsi); |
835 // rax,: mdi | 834 // rax,: mdi |
836 | 835 // mdo is guaranteed to be non-zero here, we checked for it before the call. |
837 movptr(rbx, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); | 836 movptr(rbx, Address(rbx, in_bytes(methodOopDesc::method_data_offset()))); |
838 testptr(rbx, rbx); | |
839 jcc(Assembler::zero, zero_continue); | |
840 addptr(rbx, in_bytes(methodDataOopDesc::data_offset())); | 837 addptr(rbx, in_bytes(methodDataOopDesc::data_offset())); |
841 addptr(rbx, rax); | 838 addptr(rax, rbx); |
842 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rbx); | 839 bind(set_mdp); |
843 | 840 movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rax); |
844 bind(zero_continue); | |
845 pop(rbx); | 841 pop(rbx); |
846 pop(rax); | 842 pop(rax); |
847 } | 843 } |
848 | 844 |
849 void InterpreterMacroAssembler::verify_method_data_pointer() { | 845 void InterpreterMacroAssembler::verify_method_data_pointer() { |